From 6552be7f745c5a8d506148c8af9d367c9d996d24 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Tue, 1 Jul 2008 15:42:36 +0000 Subject: xdvik 22.84.14 git-svn-id: svn://tug.org/texlive/trunk@9142 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/xdvik/CHANGES | 96 +- Build/source/texk/xdvik/ChangeLog.TL | 36 + Build/source/texk/xdvik/LESSTIF-BUGS | 6 +- Build/source/texk/xdvik/Makefile.in | 62 +- Build/source/texk/xdvik/Makefile.in.orig | 242 + Build/source/texk/xdvik/acconfig.h.orig | 386 ++ Build/source/texk/xdvik/acinclude.m4 | 75 +- Build/source/texk/xdvik/aclocal.m4 | 1 + Build/source/texk/xdvik/aclocal.m4.orig | 1052 ++++ Build/source/texk/xdvik/browser.c | 18 +- Build/source/texk/xdvik/c-auto.in | 10 +- Build/source/texk/xdvik/configure | 5437 ++++++++++++--------- Build/source/texk/xdvik/configure.in | 45 +- Build/source/texk/xdvik/configure.in.orig | 310 ++ Build/source/texk/xdvik/depend.mk | 1271 +++-- Build/source/texk/xdvik/depend.mk.orig | 565 +++ Build/source/texk/xdvik/dl_list.c | 164 + Build/source/texk/xdvik/dl_list.h | 28 + Build/source/texk/xdvik/dvi-draw.c | 702 +-- Build/source/texk/xdvik/dvi-init.c | 400 +- Build/source/texk/xdvik/dvi-init.h | 49 +- Build/source/texk/xdvik/dvisel.c | 43 +- Build/source/texk/xdvik/dvisel.h | 6 +- Build/source/texk/xdvik/encodings.c | 294 +- Build/source/texk/xdvik/encodings.h | 1 - Build/source/texk/xdvik/events.c | 1817 +++---- Build/source/texk/xdvik/events.h | 39 +- Build/source/texk/xdvik/exit-handlers.c | 71 + Build/source/texk/xdvik/exit-handlers.h | 33 + Build/source/texk/xdvik/filehist.c | 17 +- Build/source/texk/xdvik/font-open.c | 527 +- Build/source/texk/xdvik/font-open.h | 16 +- Build/source/texk/xdvik/gf.c | 6 +- Build/source/texk/xdvik/gui/Makefile.in | 7 +- Build/source/texk/xdvik/gui/Makefile.in.orig | 83 + Build/source/texk/xdvik/gui/Panner.c | 340 +- Build/source/texk/xdvik/gui/Tip.c | 106 +- Build/source/texk/xdvik/gui/depend.mk | 1380 ++++-- Build/source/texk/xdvik/gui/depend.mk.orig | 559 +++ Build/source/texk/xdvik/gui/help-window.c | 65 +- Build/source/texk/xdvik/gui/mag.c | 289 +- Build/source/texk/xdvik/gui/mag.h | 8 + Build/source/texk/xdvik/gui/menu.c | 67 +- Build/source/texk/xdvik/gui/message-window.c | 122 +- Build/source/texk/xdvik/gui/message-window.h | 20 - Build/source/texk/xdvik/gui/pagesel.c | 198 +- Build/source/texk/xdvik/gui/print-dialog.c | 3730 ++++++-------- Build/source/texk/xdvik/gui/print-dialog.h | 16 +- Build/source/texk/xdvik/gui/print-log.c | 841 ++-- Build/source/texk/xdvik/gui/print-log.h | 31 +- Build/source/texk/xdvik/gui/search-dialog.c | 492 +- Build/source/texk/xdvik/gui/search-dialog.h | 5 +- Build/source/texk/xdvik/gui/selection.c | 120 +- Build/source/texk/xdvik/gui/sfDraw.c | 16 +- Build/source/texk/xdvik/gui/sfPath.c | 18 +- Build/source/texk/xdvik/gui/sfSelFile.c | 441 +- Build/source/texk/xdvik/gui/sfSelFile.h | 7 +- Build/source/texk/xdvik/gui/sfinternal.h | 11 + Build/source/texk/xdvik/gui/statusline.c | 137 +- Build/source/texk/xdvik/gui/statusline.h | 6 +- Build/source/texk/xdvik/gui/topic-window.c | 2 +- Build/source/texk/xdvik/gui/xaw_bitmaps.c | 18 +- Build/source/texk/xdvik/gui/xaw_menu.c | 1008 +--- Build/source/texk/xdvik/gui/xaw_menu.h | 16 +- Build/source/texk/xdvik/gui/xlwradio.c | 342 +- Build/source/texk/xdvik/gui/xm_colorsel.c | 90 +- Build/source/texk/xdvik/gui/xm_filesel.c | 164 +- Build/source/texk/xdvik/gui/xm_menu.c | 8 +- Build/source/texk/xdvik/gui/xm_prefs.c | 30 +- Build/source/texk/xdvik/gui/xm_prefsP.h | 9 +- Build/source/texk/xdvik/gui/xm_prefs_appearance.c | 38 +- Build/source/texk/xdvik/gui/xm_prefs_fonts.c | 12 +- Build/source/texk/xdvik/gui/xm_prefs_helpers.c | 150 +- Build/source/texk/xdvik/gui/xm_prefs_page.c | 72 +- Build/source/texk/xdvik/gui/xm_prefs_scroll.c | 2 +- Build/source/texk/xdvik/gui/xm_toolbar.c | 7 +- Build/source/texk/xdvik/hypertex.c | 221 +- Build/source/texk/xdvik/image-magick.c | 172 +- Build/source/texk/xdvik/kpathsea.ac | 58 + Build/source/texk/xdvik/kpathsea.ac.orig | 58 + Build/source/texk/xdvik/main.c | 1274 +++++ Build/source/texk/xdvik/mime.c | 40 +- Build/source/texk/xdvik/my-snprintf.c | 12 +- Build/source/texk/xdvik/my-vsnprintf.c | 26 +- Build/source/texk/xdvik/my-vsnprintf.h | 2 +- Build/source/texk/xdvik/pagehist.c | 76 +- Build/source/texk/xdvik/pagehist.h | 1 + Build/source/texk/xdvik/pk.c | 4 +- Build/source/texk/xdvik/print-internal.c | 334 +- Build/source/texk/xdvik/print-internal.h | 75 +- Build/source/texk/xdvik/psdps.c | 157 +- Build/source/texk/xdvik/psgs.c | 77 +- Build/source/texk/xdvik/psnews.c | 128 +- Build/source/texk/xdvik/read-mapfile.c | 2 + Build/source/texk/xdvik/search-internal.c | 664 ++- Build/source/texk/xdvik/search-internal.h | 5 +- Build/source/texk/xdvik/special.c | 97 +- Build/source/texk/xdvik/squeeze.c | 8 +- Build/source/texk/xdvik/stamp-aclocal | 2 +- Build/source/texk/xdvik/stamp-auto.in | 2 +- Build/source/texk/xdvik/stamp-configure | 2 +- Build/source/texk/xdvik/string-utils.c | 90 +- Build/source/texk/xdvik/string-utils.h | 3 +- Build/source/texk/xdvik/string_list.c | 166 + Build/source/texk/xdvik/string_list.h | 8 + Build/source/texk/xdvik/tests/Makefile.in | 120 + Build/source/texk/xdvik/tests/Makefile.in.orig | 119 + Build/source/texk/xdvik/tests/README | 29 + Build/source/texk/xdvik/tests/depend.mk | 245 + Build/source/texk/xdvik/tests/depend.mk.orig | 93 + Build/source/texk/xdvik/tests/run_tests.c | 127 + Build/source/texk/xdvik/tests/run_tests.h | 34 + Build/source/texk/xdvik/tests/test1.c | 14 + Build/source/texk/xdvik/tests/test_dl_list.c | 96 + Build/source/texk/xdvik/tests/test_string_list.c | 75 + Build/source/texk/xdvik/tests/test_string_utils.c | 431 ++ Build/source/texk/xdvik/tests/test_util.c | 45 + Build/source/texk/xdvik/texmf/XDvi | 24 +- Build/source/texk/xdvik/texmf/xdvi.cfg | 4 + Build/source/texk/xdvik/tfmload.c | 14 +- Build/source/texk/xdvik/translations.h | 212 +- Build/source/texk/xdvik/util.c | 445 +- Build/source/texk/xdvik/util.h | 40 +- Build/source/texk/xdvik/version.h | 2 +- Build/source/texk/xdvik/vf.c | 13 +- Build/source/texk/xdvik/withenable.ac | 65 +- Build/source/texk/xdvik/withenable.ac.orig | 149 + Build/source/texk/xdvik/x_util.c | 116 +- Build/source/texk/xdvik/x_util.h | 5 +- Build/source/texk/xdvik/xdvi-search.el | 196 +- Build/source/texk/xdvik/xdvi-sh.in | 17 +- Build/source/texk/xdvik/xdvi.1.in | 421 +- Build/source/texk/xdvik/xdvi.c | 2167 ++------ Build/source/texk/xdvik/xdvi.h | 466 +- Build/source/texk/xdvik/xdvizilla | 47 +- Build/source/texk/xdvik/xserver-info.c | 40 +- 136 files changed, 21577 insertions(+), 12966 deletions(-) create mode 100644 Build/source/texk/xdvik/Makefile.in.orig create mode 100644 Build/source/texk/xdvik/acconfig.h.orig create mode 100644 Build/source/texk/xdvik/aclocal.m4.orig create mode 100644 Build/source/texk/xdvik/configure.in.orig create mode 100644 Build/source/texk/xdvik/depend.mk.orig create mode 100644 Build/source/texk/xdvik/dl_list.c create mode 100644 Build/source/texk/xdvik/dl_list.h create mode 100644 Build/source/texk/xdvik/exit-handlers.c create mode 100644 Build/source/texk/xdvik/exit-handlers.h create mode 100644 Build/source/texk/xdvik/gui/Makefile.in.orig create mode 100644 Build/source/texk/xdvik/gui/depend.mk.orig create mode 100644 Build/source/texk/xdvik/kpathsea.ac create mode 100644 Build/source/texk/xdvik/kpathsea.ac.orig create mode 100644 Build/source/texk/xdvik/main.c create mode 100644 Build/source/texk/xdvik/string_list.c create mode 100644 Build/source/texk/xdvik/string_list.h create mode 100644 Build/source/texk/xdvik/tests/Makefile.in create mode 100644 Build/source/texk/xdvik/tests/Makefile.in.orig create mode 100644 Build/source/texk/xdvik/tests/README create mode 100644 Build/source/texk/xdvik/tests/depend.mk create mode 100644 Build/source/texk/xdvik/tests/depend.mk.orig create mode 100644 Build/source/texk/xdvik/tests/run_tests.c create mode 100644 Build/source/texk/xdvik/tests/run_tests.h create mode 100644 Build/source/texk/xdvik/tests/test1.c create mode 100644 Build/source/texk/xdvik/tests/test_dl_list.c create mode 100644 Build/source/texk/xdvik/tests/test_string_list.c create mode 100644 Build/source/texk/xdvik/tests/test_string_utils.c create mode 100644 Build/source/texk/xdvik/tests/test_util.c create mode 100644 Build/source/texk/xdvik/withenable.ac.orig mode change 100755 => 100644 Build/source/texk/xdvik/xdvi-sh.in (limited to 'Build/source/texk/xdvik') diff --git a/Build/source/texk/xdvik/CHANGES b/Build/source/texk/xdvik/CHANGES index 17c4edc5d3c..1a9ef8c3464 100644 --- a/Build/source/texk/xdvik/CHANGES +++ b/Build/source/texk/xdvik/CHANGES @@ -9,6 +9,100 @@ Versions containing major changes are marked as `beta'; these may contain undetected bugs. Such versions shouldn't be used by distributors. + * 22.84.14: + + Added action "mouse-modes()" to allow customization of + mode specific mouse bindings. + + Fixed #1953028 (typo in events.c that broke fullscreen mode) + + Fixed #1953023 (unsigned char vs. signed char problem in + window ID computation that broke -unique and -sourceposition + on 64bit systems) + + Fixed #1953026 (security issue with temp file naming in xdvizilla) + + Don't distribute xdvizilla as binary since it's no longer needed + for current browsers (see discussion here: + http://www.tug.org/pipermail/tex-live/2008-April/015697.html) + The source is kept for compatibility. + + Updated to kpathsea version 3.4.5 (same as in texlive 2007) + + Fixed #1875314 (--with-system-t1lib still used headers from + distribution's t1lib subdir) + + Fixed #1888187 (Typo in help window) + + Fixed #1875311 (Space and backspace now keep horizontal position + when -keep is specified) + + Fixed #1875321 (Numlock key is not properly handled by translations) + + Fixed #1875309: Added xdg-open to browser commands + + Improved fix for #1819017 + + Implemented feature request #1577926 (make mouse pointer invisible + in magnifier window) + + Merged STABLE with main branch by #ifdef'ing experimental + DELAYED_MKTEXPK code + + * 22.84.13: + + Fixed #1819017 (uint32_t conflicts with XeTeX configure) + + Fixed #1044891 (xdvi -unique didn't insert page into page history) + + Fixed #1586240 (memory corruption with full TMPDIR) + + Fixed #1143508/#1283438 (wrong window sizes at startup) + + Fixed margin flags (didn't work for the first page of a document) + + Fixed #1553432 (failed assertion with hyperref and html: specials) + + Fixed #1796818 (don't use 'empty' argument for %c when no column number + info is available) + + Fixed 1815476 (use = instead of == in shell wrapper) + + + * 22.84.12: + + Fixed a segfault bug if the default replacement font (cmr10) + had fewer characters than the font being replaced. + + Fixed a segfault with strcmp() when the statusline was disabled. + + * 22.84.11: + + IMPORTANT: The binary is now called xdvi- instead of + xdvi-.bin, e.g. 'xdvi-motif' instead of 'xdvi-motif.bin'. + For more information on the reasons for this change, please see: + http://sourceforge.net/tracker/index.php?func=detail&aid=1222202&group_id=23164&atid=377580 + + Implemented a search term history for the search window. + + Install signal handler for SIGUSR1 early (#1094615). + + Fixed a crash in htex_prescan_carry_over() (#1344956, #1188866). + + Fixed a crash when printing a DVI file that was read from a FIFO, as + was the case with Debian's xdvi.pl wrapper script (#1466262). + + Added more font encodings (missing encodings reported by several people). + + Fixed issue with translations not being installed on main window on Motif + (problem reported by Joost Kremers to xdvi-core). + + Fix for bug 1611508 (segfault with -nogrey/grey). + + Fix for bug 1526447 (searching for EPS files in included subdirectories). + + Fix for bug 1376354 (make -hush also trigger -hushstdout, add -hushbell). + + Fix bug with whitespace chars in Chinese fonts reported as .notdef + (see http://tug.org/mail-archives/tex-k/2006-October/001608.html). + + Fix for #1572806 (xdvi-search.el: cd into directory of .tex file + before invoking xdvi). + + Bugfix for #1530667 (hyperlinks containing parentheses don't work + correctly with 'hdvips' driver) contributed by Matthias Habl. + + Fixed xdvizilla bug #1508963 (Solaris "file" utility doesn't + recognize DVI files). + + Fixed bug #1499566 (force focus for text input field in search + dialog for Xaw). + + Fixed bugs #1475921 and #1484561 (type errors and a case of + uninitialized memory); thanks to Nobuyuki Tsuchimura for + reporting them and providing a patch. + + Fix for bug #1454648: restore old behaviour of '-s 0' option + which was accidentally lost in rev. 1.249.2.80 + + Resurrected 'grid mode' which had been removed in 22.73-beta1 + (toggled via 'D'; feature request #1375576) + + Fixed bug #1428583 (problems with GS_DPS, reported by Ben Stern) + + Fixed bug #1428482 (problem with building on sparcv9, also found + by Ben Stern) + + Added Ctrl/Shift bindings to the mouse wheel for zooming and + scrolling horizontally + + Fixed a bug with PK fonts not being used after loading a Type1 + font had failed, reported by Ralf Stubner (#1363644) + + Fixed a crash on Solaris 10 (SPARC and AMD64) with WORD64/LONG64 + reported by Peter Bray. + + Fixed a bug with reencoding reported by Staszek Wawrykiewicz + (#1295829): If plr10 is missing from ps2pk.map, xdvik will use + plr10.pfb without reencoding it instead of calling mktexpk for + plr10.mf which would yield the correct encoding. + + Replaced a failed assertion with a warning when a graphics file + included by a PS special isn't readable by user. + + Fix for library inclusion order problem contributed by K. Berry + (see http://tug.org/mailman/htdig/tex-live/2005-August/008609.html) + * 22.84.10 (2005/04/28): + Fixed zero termination bug in t1lib version number check (t1lib.ac). + Render an empty character instead of terminating with failed assertion @@ -521,7 +615,7 @@ by distributors. + Added resources `dvipsHangTime' and `dvipsFailHangTime' for customizing the time the dvips print log remains open (#684620). - + Implemented simple but hopefully efficient `ruler mode' + + Implemented simple but hopefully effective `ruler mode' (feature request #525129). + Removed the old `grid' mode, which didn't have any real purpose at all. diff --git a/Build/source/texk/xdvik/ChangeLog.TL b/Build/source/texk/xdvik/ChangeLog.TL index add649178e4..ce86fcb7146 100644 --- a/Build/source/texk/xdvik/ChangeLog.TL +++ b/Build/source/texk/xdvik/ChangeLog.TL @@ -1,6 +1,42 @@ ChangeLog: Changes for xdvik (teTeX / TeX live) =============================================== +2008-07-01 + Imported ftp://tug.org/tex/xdvik-22.84.14.tar.gz and + adapted to new TeX live build system (autoconf-2.59+). + + * Makefile.in.orig, acconfig.h.orig, aclocal.m4.orig, + configure.in.orig, depend.mk.orig, gui/Makefile.in.orig, + gui/depend.mk.orig, kpathsea.ac.orig, tests/Makefile.in.orig, + tests/depend.mk.orig, withenable.ac.orig (all new): + Original files from xdvik-22.84.14. + + * Makefile.in, gui/Makefile.in, tests/Makefile.in: + Added '@configure_input@' line and replace ac_include by + kpse_include. + + * acinclude.m4 (new): Renamed from aclocal.m4. + Renamed cache variables (must contain '_cv_'). + + * acinclude.m4, configure.in, withenable.ac: + Added lots of m4 quoting and third args of AC_DEFINE. + + * acconfig.h (removed): Use AC_DEFINE with three args to + provide templates. + + * configure.in: + Replaced AC_OUTPUT with arguments by KPSE_CONFIG_FILES, + AC_CONFIG_FILES and AC_OUTPUT without arg. + + * kpathsea.ac (LIBKPATHSEACPPFLAGS): Set to '-I$(kpathsea_parent)' + instead of '-I$(kpathsea_dir)' to avoid confusion between + and . + + * depend.mk, gui/depend.mk, tests/depend.mk: Regenerated and + cleaned by hand ('make depend' didn't quite do that). + + * aclocal.m4, c-auto.in, configure: Regenerated. + 2008-02-29 Peter Breitenlohner * acinclude.m4: added quotes to DEFUN's first args, added AC_DEFINES's third arg to provide autoheader templates ... diff --git a/Build/source/texk/xdvik/LESSTIF-BUGS b/Build/source/texk/xdvik/LESSTIF-BUGS index 288421cc6de..52a117ec20a 100644 --- a/Build/source/texk/xdvik/LESSTIF-BUGS +++ b/Build/source/texk/xdvik/LESSTIF-BUGS @@ -7,13 +7,15 @@ lesstif-0.93.18 (in decreasing severity). Some of them may be bugs in xdvik, others bugs with LessTif. Currently I don't have time and/or deeper knowledge of X to look into them. -People who want a working verion should use either OpenMotif, or +People who are annoyed by these bugs should use either OpenMotif, or the Xaw version of xdvik instead. Ideas and tips are welcome ... -- S.U. - Page list: Toggling expert mode or the page list produces strange results when page list is switched on again: List appears too wide - (hides part of horizontal scrollbar) and too short. + (hides part of horizontal scrollbar) and too short. When the page + list preference is set to 'Off', the pagelist is displayed + nevertheless (#1493853). - Main window layout: window is too narrow when starting in expert mode (e.g. 80x900) and too wide (entire screen) in non-expert mode. diff --git a/Build/source/texk/xdvik/Makefile.in b/Build/source/texk/xdvik/Makefile.in index c52394ea2f1..96f0b6014ee 100644 --- a/Build/source/texk/xdvik/Makefile.in +++ b/Build/source/texk/xdvik/Makefile.in @@ -1,16 +1,15 @@ # @configure_input@ # Makefile for xdvik # -# - 1999/05/08: janl: Removed submakes for libwww and kpathsea. That's what -# the top makefile is for! -# kpse_include ../make/paths.mk kpse_include ../make/common.mk +### hack to prevent linking with kpathsea by default +kpathsea= kpse_include ../make/programs.mk kpse_include ../make/cross.mk -all_subdirs = gui +all_subdirs = gui tests CPP = @CPP@ @@ -26,20 +25,28 @@ x_xpm_libs=@x_xpm_libs@ # -lXp and -lXext x_ext_lib=@x_ext_lib@ +LDLIBT1=@LDLIBT1@ +LIBT1CPPFLAGS=@LIBT1CPPFLAGS@ +LIBT1DEP=@LIBT1DEP@ +LIBT1DIR=../../libs/t1lib +LIBTYPE1DIR=$(LIBT1DIR)/../type1 +LIBT1SRCDIR=$(srcdir)/$(LIBT1DIR) + +# additional flags for kpathsea +LDLIBKPATHSEA=@LDLIBKPATHSEA@ +LIBKPATHSEACPPFLAGS=@LIBKPATHSEACPPFLAGS@ +LIBKPATHSEADEP=@LIBKPATHSEADEP@ + # Follow the library order used in X11R6 itself. # It seems that on Cygwin, libXaw needs _XpmReadFileToPixmap, so we put # x_xpm_libs after the tool_libs -- but before -lX11, since on MacOSX it # uses XGrabServer and XUngrabServer, which would otherwise be # unresolved with static libraries. # Xmu needs to come before Xt and after the toolkit libs. -x_link = $(LDLIBT1) $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt $(x_pre_libs) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs) +x_link = $(LDLIBT1) $(LDLIBKPATHSEA) $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt $(x_pre_libs) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs) -LDLIBT1=@LDLIBT1@ -LIBT1CPPFLAGS=@LIBT1CPPFLAGS@ -LIBT1DEP=@LIBT1DEP@ -LIBT1DIR = ../../libs/t1lib -LIBTYPE1DIR = $(LIBT1DIR)/../type1 -LIBT1SRCDIR = $(srcdir)/$(LIBT1DIR) +TESTS=./tests/run_tests +TESTS_DEP=$(TESTS) # various xdvik GUI elements LIBGUI=./gui/libgui.a @@ -50,8 +57,8 @@ LIBGUIDEP=$(LIBGUI) # ps_def = @PS_DEF@ -DXSERVER_INFO -DNEW_MENU_CREATION # ps_def = @PS_DEF@ -DRGB_ANTI_ALIASING ps_def = @PS_DEF@ -prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBT1CPPFLAGS) $(ps_def) \ --I$(srcdir)/gui -I../../libs/t1lib/lib/t1lib -I../kpathsea $(x_cppflags) +prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBT1CPPFLAGS) $(LIBKPATHSEACPPFLAGS) $(ps_def) \ +-I$(srcdir)/gui $(x_cppflags) # Note: to be able to use one depend.mk file for both Motif/Xaw (which # is needed since only maintainers are supposed to invoke `make depend') @@ -59,16 +66,20 @@ prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBT1CPPFLAGS) $(ps_def) \ # the files. objects = \ browser.o \ + dl_list.o \ dvi-draw.o \ dvi-init.o \ dvisel.o \ encodings.o \ events.o \ + exit-handlers.o \ filehist.o \ font-open.o \ gf.o \ + string_list.o \ hypertex.o \ image-magick.o \ + main.o \ mime.o \ my-snprintf.o \ my-vsnprintf.o \ @@ -100,11 +111,20 @@ default all: libguibuild @final_exec_name@ $(manpage).1 $(LIBGUI): cd gui; $(MAKE) $(makeargs) libgui.a +$(TESTS): + cd tests; $(MAKE) $(makeargs) + ### we need this additional target so that libgui is always checked to be up-to-date ... libguibuild: cd gui; $(MAKE) $(makeargs) libgui.a -@final_exec_name@: $(kpathsea) $(objects) $(LIBT1DEP) $(LIBGUIDEP) +test: + cd tests; $(MAKE) $(makeargs) test + +test_verbose: + cd tests; $(MAKE) $(makeargs) test_verbose + +@final_exec_name@: $(LIBKPATHSEADEP) $(objects) $(LIBT1DEP) $(LIBGUIDEP) $(kpathsea_link) $(objects) $(LIBGUI) $(x_link) $(LOADLIBES) squeeze.o: squeeze.c @@ -184,30 +204,30 @@ info dvi check: kpse_include ../make/clean.mk mostlyclean:: - test ! -r gui/Makefile \ + test ! -r gui/Makefile || test ! -r tests/Makefile \ || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done clean:: - test ! -r gui/Makefile \ + test ! -r gui/Makefile || test ! -r tests/Makefile \ || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done distclean:: - test ! -r gui/Makefile \ + test ! -r gui/Makefile || test ! -r tests/Makefile \ || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done extraclean:: - test ! -r gui/Makefile \ + test ! -r gui/Makefile || test ! -r tests/Makefile \ || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done maintainer-clean:: - test ! -r gui/Makefile \ + test ! -r gui/Makefile || test ! -r tests/Makefile \ || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done depend:: - test ! -r gui/Makefile \ + test ! -r gui/Makefile || test ! -r tests/Makefile \ || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done clean:: rm -f $(manpage).1 *.flc @final_exec_name@ distclean:: - rm -f psheader.c krheader.h sedscript $(manpage).1 *.flc *~ @final_exec_name@ xdvi-sh + rm -f psheader.c sedscript $(manpage).1 *.flc *~ @final_exec_name@ xdvi-sh test -f $(LIBTYPE1DIR)/Makefile && { cd $(LIBTYPE1DIR); $(MAKE) distclean; } || true test -f $(LIBT1DIR)/Makefile && { cd $(LIBT1DIR); $(MAKE) distclean; } || true diff --git a/Build/source/texk/xdvik/Makefile.in.orig b/Build/source/texk/xdvik/Makefile.in.orig new file mode 100644 index 00000000000..d42f762b255 --- /dev/null +++ b/Build/source/texk/xdvik/Makefile.in.orig @@ -0,0 +1,242 @@ +# Makefile for xdvik +# + +ac_include ../make/paths.mk +ac_include ../make/common.mk +### hack to prevent linking with kpathsea by default +kpathsea= +ac_include ../make/programs.mk +ac_include ../make/cross.mk + +all_subdirs = gui tests + +CPP = @CPP@ + +# Make `#include ' and `-lX...' work. +# This matches web2c (needed only for Metafont). +x_cppflags=@X_CFLAGS@ @iconv_includes@ +x_ldflags=@X_LIBS@ @x_linker_options@ @iconv_libpath@ +x_pre_libs=@X_PRE_LIBS@ +x_extra_libs=@X_EXTRA_LIBS@ @iconv_libs@ +x_tool_libs=@x_tool_libs@ +x_xmu_lib=@x_xmu_lib@ +x_xpm_libs=@x_xpm_libs@ +# -lXp and -lXext +x_ext_lib=@x_ext_lib@ + +LDLIBT1=@LDLIBT1@ +LIBT1CPPFLAGS=@LIBT1CPPFLAGS@ +LIBT1DEP=@LIBT1DEP@ +LIBT1DIR=../../libs/t1lib +LIBTYPE1DIR=$(LIBT1DIR)/../type1 +LIBT1SRCDIR=$(srcdir)/$(LIBT1DIR) + +# additional flags for kpathsea +LDLIBKPATHSEA=@LDLIBKPATHSEA@ +LIBKPATHSEACPPFLAGS=@LIBKPATHSEACPPFLAGS@ +LIBKPATHSEADEP=@LIBKPATHSEADEP@ + +# Follow the library order used in X11R6 itself. +# It seems that on Cygwin, libXaw needs _XpmReadFileToPixmap, so we put +# x_xpm_libs after the tool_libs -- but before -lX11, since on MacOSX it +# uses XGrabServer and XUngrabServer, which would otherwise be +# unresolved with static libraries. +# Xmu needs to come before Xt and after the toolkit libs. +x_link = $(LDLIBT1) $(LDLIBKPATHSEA) $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt $(x_pre_libs) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs) + +TESTS=./tests/run_tests +TESTS_DEP=$(TESTS) + +# various xdvik GUI elements +LIBGUI=./gui/libgui.a +LIBGUIDEP=$(LIBGUI) + + +# Extra xdvi-specific compiler options. +# ps_def = @PS_DEF@ -DXSERVER_INFO -DNEW_MENU_CREATION +# ps_def = @PS_DEF@ -DRGB_ANTI_ALIASING +ps_def = @PS_DEF@ +prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBT1CPPFLAGS) $(LIBKPATHSEACPPFLAGS) $(ps_def) \ +-I$(srcdir)/gui $(x_cppflags) + +# Note: to be able to use one depend.mk file for both Motif/Xaw (which +# is needed since only maintainers are supposed to invoke `make depend') +# we include *all* object files and have tests for #ifdef MOTIF/XAW inside +# the files. +objects = \ + browser.o \ + dl_list.o \ + dvi-draw.o \ + dvi-init.o \ + dvisel.o \ + encodings.o \ + events.o \ + exit-handlers.o \ + filehist.o \ + font-open.o \ + gf.o \ + string_list.o \ + hypertex.o \ + image-magick.o \ + main.o \ + mime.o \ + my-snprintf.o \ + my-vsnprintf.o \ + pagehist.o \ + pk.o \ + print-internal.o \ + psdps.o \ + psgs.o \ + psheader.o \ + psnews.o \ + read-mapfile.o \ + search-internal.o \ + special.o \ + string-utils.o \ + tfmload.o \ + util.o \ + vf.o \ + xdvi.o \ + xserver-info.o \ + x_util.o + +# t1mapper or its man page are currently not being installed, since they +# aren't needed on most current (teTeX) systems +perlprog = t1mapper +manpage = xdvi + +default all: libguibuild @final_exec_name@ $(manpage).1 + +$(LIBGUI): + cd gui; $(MAKE) $(makeargs) libgui.a + +$(TESTS): + cd tests; $(MAKE) $(makeargs) + +### we need this additional target so that libgui is always checked to be up-to-date ... +libguibuild: + cd gui; $(MAKE) $(makeargs) libgui.a + +test: + cd tests; $(MAKE) $(makeargs) test + +test_verbose: + cd tests; $(MAKE) $(makeargs) test_verbose + +@final_exec_name@: $(LIBKPATHSEADEP) $(objects) $(LIBT1DEP) $(LIBGUIDEP) + $(kpathsea_link) $(objects) $(LIBGUI) $(x_link) $(LOADLIBES) + +squeeze.o: squeeze.c + $(build_compile) -c $< +squeeze: squeeze.o + $(build_link_command) squeeze.o + +psheader.c: psheader.txt squeeze + ./squeeze $(srcdir)/psheader.txt $@ + +$(manpage).1: xdvi.1.in sedscript + sed -f sedscript <$(srcdir)/xdvi.1.in >$@ + +sedscript: mksedscript c-auto.h + $(SHELL) $(srcdir)/mksedscript $(srcdir) pkpath sizes vfpath \ + figpath headerpath $(DEFS) $(prog_cflags) >$@ + +install: install-exec install-data +uninstall: uninstall-exec uninstall-data + +install-exec: @final_exec_name@ + $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) + $(INSTALL_LIBTOOL_PROG) @final_exec_name@ $(bindir) + $(INSTALL_SCRIPT) xdvi-sh $(scriptdir)/@wrapper_script@ + rm -f $(scriptdir)/o@wrapper_script@ + ln -s @wrapper_script@ $(scriptdir)/o@wrapper_script@ + +uninstall-exec: + for p in @final_exec_name@; do rm -f $(bindir)/$$p; done + for p in @wrapper_script@ o@wrapper_script@; do rm -f $(scriptdir)/$$p; done + +install-data: $(manpage).1 pixmaps/toolbar.xpm pixmaps/toolbar2.xpm + $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir) + $(SHELL) $(top_srcdir)/../mkinstalldirs $(texmf)/xdvi/pixmaps + $(INSTALL_DATA) $(manpage).1 $(man1dir)/$(manpage).$(manext) + rm -f $(man1dir)/o$(manpage).$(manext) + ln -s $(manpage).$(manext) $(man1dir)/o$(manpage).$(manext) + $(INSTALL_DATA) $(srcdir)/texmf/XDvi $(texmf)/xdvi/XDvi + $(INSTALL_DATA) $(srcdir)/pixmaps/toolbar.xpm $(srcdir)/pixmaps/toolbar2.xpm $(texmf)/xdvi/pixmaps + if \ + grep 'original xdvi.cfg --' $(texmf)/xdvi/xdvi.cfg >/dev/null 2>&1 \ + || test ! -r $(texmf)/xdvi/xdvi.cfg; \ + then \ + $(INSTALL_DATA) $(srcdir)/texmf/xdvi.cfg $(texmf)/xdvi/xdvi.cfg; \ + else \ + true; \ + fi + +uninstall-data: + rm -f $(man1dir)/$(manpage).$(manext) \ + $(texmf)/xdvi/pixmaps/toolbar.xpm $(texmf)/xdvi/pixmaps/toolbar2.xpm \ + $(texmf)/xdvi/XDvi + if \ + head -n 1 $(texmf)/xdvi/xdvi.cfg | grep 'original xdvi.cfg --' >/dev/null 2>&1 \ + || test ! -r $(texmf)/xdvi/xdvi.cfg; \ + then \ + rm -f $(texmf)/xdvi/xdvi.cfg; \ + else \ + true; \ + fi + rmdir $(texmf)/xdvi/pixmaps + +distname = xdvik +program_files = *.1.in *.ac xdvi.icon xdvi.FAQ psheader.txt mksedscript \ + MOTIF +version_files = xdvi.c + +pre-dist-$(distname): +post-dist-$(distname): + cd $(top_distdir); rm -f xdvik/psheader.c + +ac_include ../make/dist.mk +ac_include ../make/config.mk + +info dvi check: + +ac_include ../make/clean.mk + +mostlyclean:: + test ! -r gui/Makefile || test ! -r tests/Makefile \ + || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done +clean:: + test ! -r gui/Makefile || test ! -r tests/Makefile \ + || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done +distclean:: + test ! -r gui/Makefile || test ! -r tests/Makefile \ + || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done +extraclean:: + test ! -r gui/Makefile || test ! -r tests/Makefile \ + || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done +maintainer-clean:: + test ! -r gui/Makefile || test ! -r tests/Makefile \ + || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done + +depend:: + test ! -r gui/Makefile || test ! -r tests/Makefile \ + || for d in $(all_subdirs); do (cd $$d && $(MAKE) $@); done + +clean:: + rm -f $(manpage).1 *.flc @final_exec_name@ + +distclean:: + rm -f psheader.c sedscript $(manpage).1 *.flc *~ @final_exec_name@ xdvi-sh + test -f $(LIBTYPE1DIR)/Makefile && { cd $(LIBTYPE1DIR); $(MAKE) distclean; } || true + test -f $(LIBT1DIR)/Makefile && { cd $(LIBT1DIR); $(MAKE) distclean; } || true + +$(LIBT1DIR)/libt1.a: + cd $(LIBT1DIR); $(MAKE) $(makeargs) libt1.a + +$(LIBTYPE1DIR)/libtype1.a: + cd $(LIBTYPE1DIR); $(MAKE) $(makeargs) libtype1.a + + +ac_include ../make/tkpathsea.mk +ac_include ../make/rdepend.mk +ac_include depend.mk diff --git a/Build/source/texk/xdvik/acconfig.h.orig b/Build/source/texk/xdvik/acconfig.h.orig new file mode 100644 index 00000000000..91db58ec0cf --- /dev/null +++ b/Build/source/texk/xdvik/acconfig.h.orig @@ -0,0 +1,386 @@ +/* regenerate c-auto.in from acconfig.h with: + /usr/bin/autoheader -m ../etc/autoconf + then run: + /usr/bin/autoconf -m ../etc/autoconf +*/ +/* c-auto.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + +/* Define if you have the ANSI # stringizing operator in cpp. */ +#undef HAVE_STRINGIZE + +/* Define if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if you have . */ +#undef HAVE_VFORK_H + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define to `int' if doesn't define. */ +#undef pid_t + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define vfork as fork if vfork does not work. */ +#undef vfork + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + +/* Define if you have the ANSI # stringizing operator in cpp. */ +#undef HAVE_STRINGIZE + +/* Define if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if you have . */ +#undef HAVE_VFORK_H + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define to `int' if doesn't define. */ +#undef pid_t + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define vfork as fork if vfork does not work. */ +#undef vfork + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* c-auto.in. Generated from configure.in by autoheader. */ +/* Define to determine the integer type to be used in bitmaps. The type used + will be "unsigned BMTYPE". */ +#define BMTYPE int + +/* Define to the length (in bytes) of the above type. */ +#define BMBYTES 4 + +/* Define if your system has STREAMS (and if X uses it). */ +#undef HAVE_STREAMS + +/* Define if you are using SunOS 4.x. */ +#undef SUNOS4 + +/* Define if you are using Linux 2.1.xxx -- 2.2.8, + or if you find it necessary. */ +#undef FLAKY_SIGPOLL + +/* Define if your system has and poll(). */ +#undef HAVE_POLL + +/* Define to use the Xaw toolkit. */ +#undef XAW + +/* Define to use the Motif toolkit. */ +#undef MOTIF + +/* Define to enable greyscale anti-aliasing for shrunken bitmaps. */ +#undef GREY + +/* Define to enable support for color specials. */ +#undef COLOR + +/* Define to enable gf format files (in addition to pk format). */ +#undef USE_GF + +/* Define to use A4 as the default paper size. */ +#undef A4 + +/* Define to use hypertex */ +#undef HTEX + +/* Define to use ImageMagick */ +#undef MAGICK + +/* ??? */ +#undef LDT1LIB + +/* Define to compile in t1lib */ +#undef T1LIB + +/* Define to compile in t1lib */ +#undef T1LIB + +/* Define if your C compiler can do string concatenation */ +#undef HAVE_CC_CONCAT + +/* Define if the memicmp() function is in */ +#undef HAVE_MEMICMP + +/* Define to point to the default command to use for printing (optional). */ +#undef DEFAULT_DVIPS_PATH + +/* Define to point to the default command to use for printing (optional). */ +#undef DEFAULT_PS2PDF_PATH + +/* Define if you have an old version of the Xaw library */ +#undef HAVE_OLD_XAW + +/* Define if you want to use the Xpm library */ +#undef USE_XPM + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Define to 1 if cpp supports the ANSI # stringizing operator. */ +#undef HAVE_STRINGIZE + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define to 1 if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork + +/* Define if you have the uint32_t type. */ +#undef HAVE_UINT32_T + +/* Define if you have the fchdir function. */ +#undef HAVE_FCHDIR + +/* Define if you have the ftruncate function. */ +#undef HAVE_FTRUNCATE + +/* Define if you have the getcwd function. */ +#undef HAVE_GETCWD + +/* Define if you have the getpwnam function. */ +#undef HAVE_GETPWNAM + +/* Define if you have the getpwuid function. */ +#undef HAVE_GETPWUID + +/* Define if you have the getuid function. */ +#undef HAVE_GETUID + +/* Define if you have the isinf function. */ +#undef HAVE_ISINF + +/* Define if you have the lstat function. */ +#undef HAVE_LSTAT + +/* Define if you have the memcpy function. */ +#undef HAVE_MEMCPY + +/* Define if you have the mkstemp function. */ +#undef HAVE_MKSTEMP + +/* Define if you have the realpath function. */ +#undef HAVE_REALPATH + +/* Define if you have the setenv function. */ +#undef HAVE_SETENV + +/* Define if you have the sigaction function. */ +#undef HAVE_SIGACTION + +/* Define if you have the snprintf function. */ +#undef HAVE_SNPRINTF + +/* Define if you have the strchr function. */ +#undef HAVE_STRCHR + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the ulltostr function. */ +#undef HAVE_ULLTOSTR + +/* Define if you have the vsnprintf function. */ +#undef HAVE_VSNPRINTF + +/* Define if the vsnprintf function works. */ +#undef HAVE_GOOD_VSNPRINTF + +/* Define if your system allows setsid() within vfork(). */ +#undef HAVE_GOOD_SETSID_VFORK + +/* Define if your system allows multiple definitions of functions. */ +#undef LD_ALLOWS_MULTIPLE_DEFINITIONS + +/* Define if you have the waitpid function. */ +#undef HAVE_WAITPID + +/* Define if you have the header file. */ +#undef HAVE_X11_XMU_EDITRES_H + +/* Define if you have the header file. */ +#undef HAVE_X11_XOSDEFS_H + +/* Define if you have the header file. */ +#undef HAVE_X11_XPM_H + +/* Define if you have the header file. */ +#undef HAVE_XM_XPMP_H + +/* Define if you have the header file (not in X11, e.g. Solaris 5.8). */ +#undef HAVE_XPM_H + +/* Define if you have the header file. */ +#undef HAVE_ICONV_H + +/* Define if you have the iconv function. */ +#undef HAVE_ICONV + +/* Define the type of the iconv input string (char ** or const char **) */ +#undef ICONV_CHAR_PPTR_TYPE + +/* Define if you have the header file. */ +#undef HAVE_IEEEFP_H + +/* Define if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define if you have the header file. */ +#undef HAVE_REGEX_H + +/* Define if you have the header file. */ +#undef HAVE_SELECT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_BSDTYPES_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_FCNTL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if the CODESET argument to nl_langinfo works. */ +#undef HAVE_WORKING_NL_LANGINFO_CODESET + +/* Define to use Xaw panner. */ +#undef USE_XAW_PANNER + +/* Define to use libXp. */ +#undef HAVE_LIB_XP + diff --git a/Build/source/texk/xdvik/acinclude.m4 b/Build/source/texk/xdvik/acinclude.m4 index be8459aa1fd..23aeb56e60c 100644 --- a/Build/source/texk/xdvik/acinclude.m4 +++ b/Build/source/texk/xdvik/acinclude.m4 @@ -1,5 +1,5 @@ dnl ### Check whether iconv takes a 'const char **' or a 'char **' input argument. -dnl ### According to EEE 1003.1, `char **' is correct, but e.g. librecode +dnl ### According to IEEE 1003.1, `char **' is correct, but e.g. librecode dnl ### uses `const char **'. dnl ### We use C++'s built-in function overloading to distinguish between the two. AC_DEFUN([XDVI_ICONV_CHAR_PPTR_TYPE], @@ -16,7 +16,7 @@ CXXFLAGS="$CXXFLAGS $iconv_includes" LDFLAGS="$LDFLAGS $iconv_libpath" # AC_MSG_CHECKING([for iconv input type]) -AC_CACHE_VAL(xdvi_iconv_char_pptr_type, +AC_CACHE_VAL(xdvi_cv_iconv_char_pptr_type, [AC_TRY_RUN( [ /* iconv() definitions may differ depending on following macros ... */ @@ -76,16 +76,16 @@ AC_CACHE_VAL(xdvi_iconv_char_pptr_type, (char**)&ptr2, &len2); } ], -xdvi_iconv_char_pptr_type="char_pptr", -xdvi_iconv_char_pptr_type="const_char_pptr", +[xdvi_cv_iconv_char_pptr_type="char_pptr"], +[xdvi_cv_iconv_char_pptr_type="const_char_pptr"], # `correct' default for cross-compiling ... -xdvi_iconv_char_pptr_type="char_pptr")]) +[xdvi_cv_iconv_char_pptr_type="char_pptr"])]) # LIBS="$xdvi_iconv_save_libs" CXXFLAGS="$xdvi_iconv_save_cxxflags" LDFLAGS="$xdvi_iconv_save_ldflags" # -if test $xdvi_iconv_char_pptr_type = "const_char_pptr"; then +if test $xdvi_cv_iconv_char_pptr_type = "const_char_pptr"; then AC_DEFINE([ICONV_CHAR_PPTR_TYPE], [const char **], [Define the type of the iconv input string (char ** or const char **)]) AC_MSG_RESULT([const char **]) @@ -158,7 +158,7 @@ dnl ### and if it doesn't, don't define LD_ALLOWS_MULTIPLE_DEFINITIONS. AC_DEFUN([XDVI_LINKER_MULTIPLE_DEFNS], [AC_CACHE_CHECK([whether linker supports the --allow-multiple-definition flag], -xdvi_linker_multiple_defns, +xdvi_cv_linker_multiple_defns, xdvi_save_LDFLAGS="$LDFLAGS" LDFLAGS="-Xlinker --allow-multiple-definition" x_linker_options="" @@ -167,10 +167,10 @@ x_linker_options="" ], [void foo(void); ], - xdvi_linker_multiple_defns=yes, xdvi_linker_multiple_defns=no + [xdvi_cv_linker_multiple_defns=yes], [xdvi_cv_linker_multiple_defns=no] )] ) -if test $xdvi_linker_multiple_defns = yes; then +if test $xdvi_cv_linker_multiple_defns = yes; then x_linker_options="-Xlinker --allow-multiple-definition" LDFLAGS="$xdvi_save_LDFLAGS" AC_DEFINE([LD_ALLOWS_MULTIPLE_DEFINITIONS], 1, @@ -205,12 +205,12 @@ else XtIntervalId i = 0; XtRemoveTimeOut(i); ], - xdvi_linker_multiple_defns=yes, xdvi_linker_multiple_defns=no + [xdvi_cv_linker_multiple_defns=yes], [xdvi_cv_linker_multiple_defns=no] ) - if test $xdvi_linker_multiple_defns = yes; then + if test $xdvi_cv_linker_multiple_defns = yes; then AC_MSG_RESULT(yes) - AC_DEFINE([LD_ALLOWS_MULTIPLE_DEFINITIONS]) + AC_DEFINE([LD_ALLOWS_MULTIPLE_DEFINITIONS], 1) else AC_MSG_RESULT(no) AC_MSG_WARN([Linker does not allow multiple definitions. @@ -264,12 +264,12 @@ AC_MSG_RESULT([unsigned $BMTYPE, size = $BMBYTES])]) dnl ### Check for whether the C compiler does string concatenation AC_DEFUN([XDVI_CC_CONCAT], -[AC_CACHE_CHECK([whether C compiler supports string concatenation], xdvi_cc_concat, +[AC_CACHE_CHECK([whether C compiler supports string concatenation], xdvi_cv_cc_concat, [AC_TRY_COMPILE( [#include ], [puts("Testing" " string" " concatenation"); -], xdvi_cc_concat=yes, xdvi_cc_concat=no)]) -if test $xdvi_cc_concat = yes; then +], [xdvi_cv_cc_concat=yes], [xdvi_cv_cc_concat=no])]) +if test $xdvi_cv_cc_concat = yes; then AC_DEFINE([HAVE_CC_CONCAT], 1, [Define if your C compiler can do string concatenation]) fi]) @@ -349,7 +349,7 @@ dnl [#include dnl ], [(void)vsnprintf((char *)NULL, 0, (char *)NULL, NULL);], dnl xdvi_cv_vsnprintf=yes, xdvi_cv_vsnprintf=no)]) dnl if test $xdvi_cv_vsnprintf = yes; then -dnl AC_DEFINE(HAVE_VSNPRINTF) +dnl AC_DEFINE([HAVE_VSNPRINTF], 1, [Define if you have the vsnprintf() function.]) dnl fi]) dnl ### Check for a working implementation of (v)snprintf() @@ -399,7 +399,7 @@ dnl [#include dnl ], [(void)realpath((const char *)NULL, NULL);], dnl xdvi_cv_realpath=yes, xdvi_cv_realpath=no)]) dnl if test $xdvi_cv_realpath = yes; then -dnl AC_DEFINE(HAVE_REALPATH) +dnl AC_DEFINE([HAVE_REALPATH], 1 [Define if you have the realpath() function.]) dnl fi]) @@ -413,7 +413,7 @@ AC_DEFUN([XDVI_FIND_XPM], AC_REQUIRE([AC_PATH_XTRA]) xpm_includes= xpm_libraries= -AC_ARG_WITH(xpm, +AC_ARG_WITH([xpm], [ --without-xpm Do not use the Xpm library (will disable the toolbar)]) dnl Treat --without-xpm like dnl --without-xpm-includes --without-xpm-libraries. @@ -422,14 +422,14 @@ then xpm_includes=no xpm_libraries=no fi -AC_ARG_WITH(xpm-includes, +AC_ARG_WITH([xpm-includes], [ --with-xpm-include=DIR Specify the location of Xpm include files], -xpm_includes="$withval") -AC_ARG_WITH(xpm-libraries, +[xpm_includes="$withval"]) +AC_ARG_WITH([xpm-libraries], [ --with-xpm-libdir=DIR Specify the location of Xpm libraries], -xpm_libraries="$withval") +[xpm_libraries="$withval"]) AC_MSG_CHECKING(for Xpm) # # @@ -602,7 +602,7 @@ if test "x$xpm_libraries_result" = "xdefault" ; then xpm_libraries_result="in default path" elif test "$xpm_libraries_result" = no || test "x$xpm_libraries_result" = "x"; then xpm_libraries_result="(none)" - AC_DEFINE(USE_XPM, 0) + AC_DEFINE([USE_XPM], 0) x_xpm_libs="" fi @@ -790,8 +790,35 @@ fi if test "$motif_include_result" != "" && test "$motif_libdir_result" != ""; then AC_MSG_RESULT([libraries $motif_libdir_result, headers $motif_include_result]) prog_extension="motif" - AC_DEFINE(MOTIF) + AC_DEFINE([MOTIF], 1) x_tool_libs="-lXm" + # now warn if we're using LessTif (see LESSTIF-BUGS for why ...) + AC_MSG_CHECKING(for LessTif) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_TRY_COMPILE([ + #include + #include + #include + #include + #include + #include ],[const char *p = LesstifVERSION_STRING; + ],[ + # yes, we're running LessTif + AC_MSG_RESULT(yes) + AC_MSG_WARN([LessTif header detected. + ***************************************************************** + * Warning: You are using LessTif instead of OpenMotif. * + * Some GUI elements might be broken; please see the file * + * * + * texk/xdvik/LESSTIF-BUGS * + * * + * for more information. * + *****************************************************************]) + ],[ + # no, not running LessTif + AC_MSG_RESULT([no]) + ]) else AC_MSG_RESULT([not found, using Xaw]) prog_extension="xaw" diff --git a/Build/source/texk/xdvik/aclocal.m4 b/Build/source/texk/xdvik/aclocal.m4 index 97ac02835e7..dc4510bfb9c 100644 --- a/Build/source/texk/xdvik/aclocal.m4 +++ b/Build/source/texk/xdvik/aclocal.m4 @@ -14,4 +14,5 @@ m4_include([../m4/kpse_cross.m4]) m4_include([../m4/kpse_inc.m4]) m4_include([../m4/kpse_maint.m4]) +m4_include([../m4/kpse_subdirs.m4]) m4_include([acinclude.m4]) diff --git a/Build/source/texk/xdvik/aclocal.m4.orig b/Build/source/texk/xdvik/aclocal.m4.orig new file mode 100644 index 00000000000..82b6dbe8dde --- /dev/null +++ b/Build/source/texk/xdvik/aclocal.m4.orig @@ -0,0 +1,1052 @@ +dnl ### Check whether iconv takes a 'const char **' or a 'char **' input argument. +dnl ### According to IEEE 1003.1, `char **' is correct, but e.g. librecode +dnl ### uses `const char **'. +dnl ### We use C++'s built-in function overloading to distinguish between the two. +AC_DEFUN(XDVI_ICONV_CHAR_PPTR_TYPE, +[ +AC_LANG_SAVE AC_LANG_CPLUSPLUS +# AC_LANG_PUSH(C++) # in newer autoconf +# +xdvi_iconv_save_libs="$LIBS" +xdvi_iconv_save_cxxflags="$CXXFLAGS" +xdvi_iconv_save_ldflags="$LDFLAGS" +# +LIBS="$LIBS $iconv_libs" +CXXFLAGS="$CXXFLAGS $iconv_includes" +LDFLAGS="$LDFLAGS $iconv_libpath" +# +AC_MSG_CHECKING([for iconv input type]) +AC_CACHE_VAL(xdvi_iconv_char_pptr_type, +[AC_TRY_RUN( +[ +/* iconv() definitions may differ depending on following macros ... */ +#ifdef __hpux +/* On HP-UX 10.10 B and 20.10, compiling with _XOPEN_SOURCE + ..._EXTENDED + * leads to poll() not realizing that a file descriptor is writable in psgs.c. + */ +# define _HPUX_SOURCE 1 +#else +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 600 +# endif +# define _XOPEN_SOURCE_EXTENDED 1 +# define __EXTENSIONS__ 1 /* needed to get struct timeval on SunOS 5.5 */ +# define _SVID_SOURCE 1 /* needed to get S_IFLNK in glibc */ +# define _BSD_SOURCE 1 /* needed to get F_SETOWN in glibc-2.1.3 */ +#endif + +#include + + // Define two iconv_adapter() functions, one with a const char **, the other with + // a char ** argument. The compiler will figure out which one to use, and we can + // check the exit value to see which it was. + // Idea taken from http://gcc.gnu.org/ml/libstdc++/2000-11/msg00127.html + + typedef const char ** ConstCharPtrT; + typedef char ** CharPtrT; + + inline int + iconv_adapter(size_t(*iconv_func)(iconv_t, ConstCharPtrT, size_t *, char**, size_t*), + iconv_t cd, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) + { + return 1; // 1 = false = const char ** + } + + + inline int + iconv_adapter(size_t(*iconv_func)(iconv_t, CharPtrT, size_t *, char**, size_t*), + iconv_t cd, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) + { + return 0; // 0 = true = char ** + } + + + int main(void) + { + iconv_t testconv = (iconv_t)-1; + char *ptr1 = 0; + char *ptr2 = 0; + size_t len1 = 0; + size_t len2 = 0; + + return iconv_adapter(iconv, testconv, + (char**)&ptr1, &len1, + (char**)&ptr2, &len2); + } +], +xdvi_iconv_char_pptr_type="char_pptr", +xdvi_iconv_char_pptr_type="const_char_pptr", +# `correct' default for cross-compiling ... +xdvi_iconv_char_pptr_type="char_pptr")]) +# +LIBS="$xdvi_iconv_save_libs" +CXXFLAGS="$xdvi_iconv_save_cxxflags" +LDFLAGS="$xdvi_iconv_save_ldflags" +# +if test $xdvi_iconv_char_pptr_type = "const_char_pptr"; then + AC_DEFINE(ICONV_CHAR_PPTR_TYPE, const char **) + AC_MSG_RESULT([const char **]) +else + AC_DEFINE(ICONV_CHAR_PPTR_TYPE, char **) + AC_MSG_RESULT([char **]) +fi +AC_LANG_RESTORE] +#AC_LANG_POP(C++) # in newer autoconf +) + +dnl ### Check for whether setsid() is allowed within vfork() +dnl (Mac OS X 10.3 (Panther, 11/2003) is one O/S which does not allow this.) + +AC_DEFUN(XDVI_FUNC_SETSID_IN_VFORK, +[if test $ac_cv_func_vfork_works = yes; then +AC_CACHE_CHECK([for whether setsid() is allowed within vfork()], +xdvi_cv_setsid_in_vfork, +[AC_TRY_RUN( +[/* Test adapted from Gnu autoconf */ +/* Thanks to Paul Eggert for this test. */ +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_VFORK_H +#include +#endif +int +main() { + pid_t parent = getpid (); + pid_t child; + + child = vfork (); + + if (child == 0) { + if (setsid () == -1) + _exit(1); + _exit(0); + } else { + int status; + + while (wait(&status) != child) + ; + exit( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + ); + } +}], +xdvi_cv_setsid_in_vfork=yes, +xdvi_cv_setsid_in_vfork=no, +# safe value for cross-compiling +xdvi_cv_setsid_in_vfork=no)]) +if test $xdvi_cv_setsid_in_vfork = yes; then + AC_DEFINE(HAVE_GOOD_SETSID_VFORK) +fi] +fi) + +dnl ### Check if the --allow-multiple-definition linker flag is +dnl ### available (assuming that we need to use it if it is). +dnl ### If it isn't, check if the linker accepts multiple definitions, +dnl ### and if it doesn't, don't define LD_ALLOWS_MULTIPLE_DEFINITIONS. + +AC_DEFUN(XDVI_LINKER_MULTIPLE_DEFNS, +[AC_CACHE_CHECK([whether linker supports the --allow-multiple-definition flag], +xdvi_linker_multiple_defns, +xdvi_save_LDFLAGS="$LDFLAGS" +LDFLAGS="-Xlinker --allow-multiple-definition" +x_linker_options="" +[AC_TRY_LINK( + [#include + ], + [void foo(void); + ], + xdvi_linker_multiple_defns=yes, xdvi_linker_multiple_defns=no +)] +) +if test $xdvi_linker_multiple_defns = yes; then + x_linker_options="-Xlinker --allow-multiple-definition" + LDFLAGS="$xdvi_save_LDFLAGS" + AC_DEFINE(LD_ALLOWS_MULTIPLE_DEFINITIONS) +else + LDFLAGS="$xdvi_save_LDFLAGS" + + xdvi_ld_save_LIBS="$LIBS" + xdvi_ld_save_CFLAGS="$CFLAGS" + xdvi_ld_save_CPPFLAGS="$CPPFLAGS" + xdvi_ld_save_LDFLAGS="$LDFLAGS" + + LIBS="$X_PRE_LIBS -lXt -lX11 $X_EXTRA_LIBS $LIBS" + CFLAGS="$X_CFLAGS $CFLAGS" + CPPFLAGS="$X_CFLAGS $CPPFLAGS" + LDFLAGS="$X_LIBS $LDFLAGS" + + AC_MSG_CHECKING([whether linker supports multiple definitions by default]) + + AC_TRY_LINK( + [#include + + XtIntervalId XtAppAddTimeOut(XtAppContext app, + unsigned long interval, + XtTimerCallbackProc proc, + XtPointer closure) + { + (void)app; (void)interval; (void)proc; (void)closure; + return (XtIntervalId)0; + } + ],[ + XtIntervalId i = 0; + XtRemoveTimeOut(i); + ], + xdvi_linker_multiple_defns=yes, xdvi_linker_multiple_defns=no + ) + + if test $xdvi_linker_multiple_defns = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(LD_ALLOWS_MULTIPLE_DEFINITIONS) + else + AC_MSG_RESULT(no) + AC_MSG_WARN([Linker does not allow multiple definitions. + ***************************************************************** + * Warning: Your linker does not allow multiple definitions. * + * This does not make xdvik unusable, but it will cause problems * + * with event handling: Some widgets, e.g. the print log window, * + * tooltips, statusline messages and hyperlink location markers * + * will not be updated until the mouse is moved. * + *****************************************************************]) + fi + LIBS="$xdvi_ld_save_LIBS" + CFLAGS="$xdvi_ld_save_CFLAGS" + CPPFLAGS="$xdvi_ld_save_CPPFLAGS" + LDFLAGS="$xdvi_ld_save_LDFLAGS" +fi +AC_SUBST(x_linker_options)]) + + +dnl ### Determine integer type to use for bitmaps + +AC_DEFUN(XDVI_C_BITMAP_TYPE, +[AC_MSG_CHECKING(for integer type to use in bitmaps) +AC_CACHE_VAL(xdvi_cv_bitmap_type, +[AC_TRY_RUN( +[#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + if ((sizeof(unsigned long) == 4 || sizeof(unsigned long) == 2) + && sizeof(unsigned long) != sizeof(unsigned int)) + fprintf(f, "BMTYPE=long BMBYTES=%d\n", sizeof(unsigned long)); + if (sizeof(unsigned int) == 4 || sizeof(unsigned int) == 2) + fprintf(f, "BMTYPE=int BMBYTES=%d\n", sizeof(unsigned int)); + else if (sizeof(unsigned short) == 4 || sizeof(unsigned short) == 2) + fprintf(f, "BMTYPE=short BMBYTES=%d\n", sizeof(unsigned short)); + else fprintf(f, "BMTYPE=char BMBYTES=%d\n", sizeof(unsigned char)); + exit(0); +}], +xdvi_cv_bitmap_type="`cat conftestval`", +AC_MSG_ERROR(could not determine integer type for bitmap))]) +eval "$xdvi_cv_bitmap_type" +AC_DEFINE_UNQUOTED(BMTYPE, $BMTYPE) +AC_DEFINE_UNQUOTED(BMBYTES, $BMBYTES) +AC_MSG_RESULT([unsigned $BMTYPE, size = $BMBYTES])]) + + +dnl ### Check for whether the C compiler does string concatenation + +AC_DEFUN(XDVI_CC_CONCAT, +[AC_CACHE_CHECK([whether C compiler supports string concatenation], xdvi_cc_concat, +[AC_TRY_COMPILE( +[#include +], [puts("Testing" " string" " concatenation"); +], xdvi_cc_concat=yes, xdvi_cc_concat=no)]) +if test $xdvi_cc_concat = yes; then + AC_DEFINE(HAVE_CC_CONCAT) +fi]) + + +dnl ### Check for at-least-pretend Streams capability + +AC_DEFUN(XDVI_SYS_STREAMS, +[AC_CACHE_CHECK([for stropts.h and isastream()], xdvi_cv_sys_streams, +[AC_TRY_LINK( +[#include +], [#ifndef I_SETSIG +choke me +#else +isastream(0); +#endif], xdvi_cv_sys_streams=yes, xdvi_cv_sys_streams=no)]) +if test $xdvi_cv_sys_streams = yes; then + AC_DEFINE(HAVE_STREAMS) +fi]) + + +dnl ### Check for poll() + +AC_DEFUN(XDVI_FUNC_POLL, +[AC_CACHE_CHECK([for poll.h and poll()], xdvi_cv_func_poll, +[AC_TRY_LINK( +[#include +], [poll((struct pollfd *) 0, 0, 0);], +xdvi_cv_func_poll=yes, xdvi_cv_func_poll=no)]) +if test $xdvi_cv_func_poll = yes; then + AC_DEFINE(HAVE_POLL) +else + AC_CHECK_HEADERS(sys/select.h select.h) +fi]) + + +dnl ### Check for SunOS 4 + +AC_DEFUN(XDVI_SYS_SUNOS_4, +[AC_CACHE_CHECK([for SunOS 4], xdvi_cv_sys_sunos_4, +[case "`(uname -sr) 2>/dev/null`" in +"SunOS 4."*) + xdvi_cv_sys_sunos_4=yes ;; +*) xdvi_cv_sys_sunos_4=no ;; +esac]) +if test $xdvi_cv_sys_sunos_4 = yes; then + AC_DEFINE(SUNOS4) +fi]) + +dnl ### Check for certain broken versions of Linux + +AC_DEFUN(XDVI_SYS_OLD_LINUX, +[AC_CACHE_CHECK([for certain old versions of Linux], xdvi_cv_sys_old_linux, +[case "`(uname -sr) 2>/dev/null`" in +"Linux 2."[[01]].* | "Linux 2.2."[[0-8]] | "Linux 2.2."[[0-8]]-*) + xdvi_cv_sys_old_linux=yes ;; +*) xdvi_cv_sys_old_linux=no ;; +esac]) +if test $xdvi_cv_sys_old_linux = yes; then + AC_DEFINE(FLAKY_SIGPOLL) +fi]) + +dnl ### Process a string argument + +dnl XDVI_ARG_STRING(PACKAGE, HELP-STRING, VARIABLE, DEFAULT_VALUE) +AC_DEFUN(XDVI_ARG_STRING, +[AC_ARG_WITH($1, [$2], [AC_DEFINE_UNQUOTED($3, "$withval") +], [AC_DEFINE($3, [$4]) +])]) + + +dnl dnl ### Check for vsnprintf() added by SU 2000/03/07 +dnl AC_DEFUN(AC_FUNC_VSNPRINTF, +dnl [AC_CACHE_CHECK([for vsnprintf], xdvi_cv_vsnprintf, +dnl [AC_TRY_LINK( +dnl [#include +dnl ], [(void)vsnprintf((char *)NULL, 0, (char *)NULL, NULL);], +dnl xdvi_cv_vsnprintf=yes, xdvi_cv_vsnprintf=no)]) +dnl if test $xdvi_cv_vsnprintf = yes; then +dnl AC_DEFINE(HAVE_VSNPRINTF) +dnl fi]) + +dnl ### Check for a working implementation of (v)snprintf() +dnl ### which should either return a negative result or the size actually needed +dnl ### (latter is C99 standard). +AC_DEFUN(XDVI_FUNC_WORKING_VSNPRINTF, +[AC_CACHE_CHECK([for a working implementation of (v)snprintf()], +xdvi_cv_func_good_vsnprintf, +[AC_TRY_RUN( +[ +#ifdef IRIX +#define _XOPEN_SOURCE 500 +#endif +#include +int main() +{ + char s[2]; + int retval = snprintf(s, 2, "test"); + if (retval > -1 && retval != 4) /* neither negative nor desired size, not OK */ + return 1; + return 0; +}], +xdvi_cv_func_good_vsnprintf=yes, +xdvi_cv_func_good_vsnprintf=no, +# safe value for cross-compiling +xdvi_cv_func_good_vsnprintf=no)]) +if test $xdvi_cv_func_good_vsnprintf = yes; then + AC_DEFINE(HAVE_GOOD_VSNPRINTF) +fi]) + +dnl ### Check for memicmp(), which some installations have in string.h +AC_DEFUN(AC_FUNC_MEMICMP, +[AC_CACHE_CHECK([for memicmp], xdvi_cv_memicmp, +[AC_TRY_LINK( +[#include +], [(void)memicmp((char *)NULL, (char *)NULL, 0);], +xdvi_cv_memicmp=yes, xdvi_cv_memicmp=no)]) +if test $xdvi_cv_memicmp = yes; then + AC_DEFINE(HAVE_MEMICMP) +fi]) + +dnl dnl ### Check for realpath() added by SU 2002/04/10 +dnl AC_DEFUN(AC_FUNC_REALPATH, +dnl [AC_CACHE_CHECK([for realpath], xdvi_cv_realpath, +dnl [AC_TRY_LINK( +dnl [#include +dnl ], [(void)realpath((const char *)NULL, NULL);], +dnl xdvi_cv_realpath=yes, xdvi_cv_realpath=no)]) +dnl if test $xdvi_cv_realpath = yes; then +dnl AC_DEFINE(HAVE_REALPATH) +dnl fi]) + + +dnl ### for Xpm libraries and headers. +dnl Put Xpm include directory in xpm_includes, +dnl put Xpm library directory in xpm_libraries, +dnl and add appropriate flags to X_CFLAGS and X_LIBS. +dnl +AC_DEFUN(XDVI_FIND_XPM, +[ +AC_REQUIRE([AC_PATH_XTRA]) +xpm_includes= +xpm_libraries= +AC_ARG_WITH(xpm, +[ --without-xpm Do not use the Xpm library (will disable the toolbar)]) +dnl Treat --without-xpm like +dnl --without-xpm-includes --without-xpm-libraries. +if test "$with_xpm" = "no" +then +xpm_includes=no +xpm_libraries=no +fi +AC_ARG_WITH(xpm-includes, +[ --with-xpm-include=DIR + Specify the location of Xpm include files], +xpm_includes="$withval") +AC_ARG_WITH(xpm-libraries, +[ --with-xpm-libdir=DIR + Specify the location of Xpm libraries], +xpm_libraries="$withval") +AC_MSG_CHECKING(for Xpm) +# +# +# Search the include files. XPM can either be in (as in X11R6), +# which is dealt with by AC_CHECK_HEADERS(X11/xpm.h), or in if installed locally; +# this is what this test is for. +# +if test "$xpm_includes" = ""; then +AC_CACHE_VAL(xdvi_cv_xpm_includes, +[ +xdvi_xpm_save_LIBS="$LIBS" +xdvi_xpm_save_CFLAGS="$CFLAGS" +xdvi_xpm_save_CPPFLAGS="$CPPFLAGS" +xdvi_xpm_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +AC_TRY_COMPILE([ +#include +],[int a;], +[ +# X11/xpm.h is in the standard search path. +xdvi_cv_xpm_includes="default" +], +[ +# X11/xpm.h is not in the standard search path. +# Locate it and put its directory in `xpm_includes' +# +# /usr/include/Motif* are used on HP-UX (Motif). +# /usr/include/X11* are used on HP-UX (X and Xaw). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Xaw). +# Other directories are just guesses. +for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ + /usr/X11/include /usr/X11R5/include /usr/X11R6/include \ + /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ + /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ + /usr/dt/include /usr/openwin/include \ + /usr/dt/*/include /opt/*/include /usr/include/Motif* \ + "${prefix}"/*/include /usr/*/include /usr/local/*/include \ + "${prefix}"/include/* /usr/include/* /usr/local/include/* +do + if test -f "$dir/X11/xpm.h"; then + xdvi_cv_xpm_includes="$dir" + AC_DEFINE(HAVE_X11_XPM_H, 1) + break + elif test -f "$dir/xpm.h"; then + xdvi_cv_xpm_includes="$dir" + AC_DEFINE(HAVE_XPM_H, 1) + break + fi +done +]) +# +LIBS="$xdvi_xpm_save_LIBS" +CFLAGS="$xdvi_xpm_save_CFLAGS" +CPPFLAGS="$xdvi_xpm_save_CPPFLAGS" +LDFLAGS="$xdvi_xpm_save_LDFLAGS" +]) +xpm_includes="$xdvi_cv_xpm_includes" +fi + +# +# +# Now for the libraries. +# +if test "$xpm_libraries" = ""; then +AC_CACHE_VAL(xdvi_cv_xpm_libraries, +[ +xdvi_xpm_save_LIBS="$LIBS" +xdvi_xpm_save_CFLAGS="$CFLAGS" +xdvi_xpm_save_CPPFLAGS="$CPPFLAGS" +xdvi_xpm_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +xdvi_cv_xpm_libraries= +# +# +# We use XtToolkitInitialize() here since it takes no arguments +# and thus also works with a C++ compiler. +AC_TRY_LINK([ +#include +#include +],[XtToolkitInitialize();], +[ +# libxpm.a is in the standard search path. +xdvi_cv_xpm_libraries="default" +], +[ +# libXpm.a is not in the standard search path. +# Locate it and put its directory in `xpm_libraries' +# +# +# /usr/lib/Motif* are used on HP-UX (Motif). +# /usr/lib/X11* are used on HP-UX (X and Xpm). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Xpm). +# Other directories are just guesses. +for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ + /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ + /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ + /usr/dt/lib /usr/openwin/lib \ + /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ + "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ + "${prefix}"/lib/* /usr/lib/* /usr/local/lib/* +do + if test -d "$dir" && test "`ls $dir/libXpm.* 2> /dev/null`" != ""; then + xdvi_cv_xpm_libraries="$dir" + break + fi +done +]) +# +LIBS="$xdvi_xpm_save_LIBS" +CFLAGS="$xdvi_xpm_save_CFLAGS" +CPPFLAGS="$xdvi_xpm_save_CPPFLAGS" +LDFLAGS="$xdvi_xpm_save_LDFLAGS" +]) +# +xpm_libraries="$xdvi_cv_xpm_libraries" +fi +# +# Add Xpm definitions to X flags +# +if test "x$xpm_includes" != "xdefault" && test "$xpm_includes" != "" \ + && test "$xpm_includes" != "$x_includes" && test "$xpm_includes" != "no" +then + X_CFLAGS="-I$xpm_includes $X_CFLAGS" +fi + +if test "x$xpm_libraries" != "xdefault" && test "$xpm_libraries" != "" \ + && test "$xpm_libraries" != "$x_libraries" && test "$xpm_libraries" != "no" +then +case "$X_LIBS" in + *-R\ *) X_LIBS="-L$xpm_libraries -R $xpm_libraries $X_LIBS";; + *-R*) X_LIBS="-L$xpm_libraries -R$xpm_libraries $X_LIBS";; + *) X_LIBS="-L$xpm_libraries $X_LIBS";; +esac +fi + +# +# +x_xpm_libs="-lXpm" +# +# Now check the results of headers and libraries and set USE_XPM to 0 +# if one of them hadn't been found. +# +AC_DEFINE(USE_XPM, 1) +xpm_libraries_result="$xpm_libraries" +xpm_includes_result="$xpm_includes" +if test "x$xpm_libraries_result" = "xdefault" ; then + xpm_libraries_result="in default path" +elif test "$xpm_libraries_result" = no || test "x$xpm_libraries_result" = "x"; then + xpm_libraries_result="(none)" + AC_DEFINE(USE_XPM, 0) + x_xpm_libs="" +fi + +if test "x$xpm_includes_result" = "xdefault"; then + xpm_includes_result="in default path" +elif test "$xpm_includes_result" = no || test "x$xpm_includes_result" = "x"; then + AC_DEFINE(USE_XPM, 0) + xpm_includes_result="(none)" +fi + +AC_SUBST(x_xpm_libs) +AC_MSG_RESULT( + [libraries $xpm_libraries_result, headers $xpm_includes_result]) +])dnl + + + +dnl ### Check for Motif libraries and headers +dnl Put Motif include directory in motif_include, +dnl put Motif library directory in motif_libdir, +dnl and add appropriate flags to X_CFLAGS and X_LIBS. +dnl If $1 is not `none', use Xaw as default toolkit if Motif isn't found. +AC_DEFUN(XDVI_FIND_MOTIF, +[ +default_toolkit="$1" +motif_include="$2" +motif_libdir="$3" +AC_REQUIRE([AC_PATH_XTRA]) +AC_MSG_CHECKING(for Motif) +# +# +# Search the include files. +# +if test "$motif_include" = ""; then +AC_CACHE_VAL(xdvi_cv_motif_include, +[ +xdvi_motif_save_LIBS="$LIBS" +xdvi_motif_save_CFLAGS="$CFLAGS" +xdvi_motif_save_CPPFLAGS="$CPPFLAGS" +xdvi_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +AC_TRY_COMPILE([#include ],[int a;], +[ +# Xm/Xm.h is in the standard search path. +xdvi_cv_motif_include= +], +[ +# Xm/Xm.h is not in the standard search path. +# Locate it and put its directory in `motif_include' +# +# /usr/include/Motif* are used on HP-UX (Motif). +# /usr/include/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ + /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ + /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ + /usr/dt/include /usr/openwin/include \ + /usr/dt/*/include /opt/*/include /usr/include/Motif* \ + "${prefix}"/*/include /usr/*/include /usr/local/*/include \ + "${prefix}"/include/* /usr/include/* /usr/local/include/*; do + if test -f "$dir/Xm/Xm.h"; then + xdvi_cv_motif_include="$dir" + break + fi +done +if test "$xdvi_cv_motif_include" = ""; then +xdvi_cv_motif_include=no +fi +]) +# +LIBS="$xdvi_motif_save_LIBS" +CFLAGS="$xdvi_motif_save_CFLAGS" +CPPFLAGS="$xdvi_motif_save_CPPFLAGS" +LDFLAGS="$xdvi_motif_save_LDFLAGS" +]) +motif_include="$xdvi_cv_motif_include" +fi +# +# +# Now for the libraries. +# +if test "$motif_libdir" = ""; then +AC_CACHE_VAL(xdvi_cv_motif_libdir, +[ +xdvi_motif_save_LIBS="$LIBS" +xdvi_motif_save_CFLAGS="$CFLAGS" +xdvi_motif_save_CPPFLAGS="$CPPFLAGS" +xdvi_motif_save_LDFLAGS="$LDFLAGS" +# +LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" +CFLAGS="$X_CFLAGS $CFLAGS" +CPPFLAGS="$X_CFLAGS $CPPFLAGS" +LDFLAGS="$X_LIBS $LDFLAGS" +# +# We use XtToolkitInitialize() here since it takes no arguments +# and thus also works with a C++ compiler. +AC_TRY_LINK( +[#include +#include +],[XtToolkitInitialize();], +[ +# libXm.a is in the standard search path. +xdvi_cv_motif_libdir= +], +[ +# libXm.a is not in the standard search path. +# Locate it and put its directory in `motif_libdir' +# +# /usr/lib/Motif* are used on HP-UX (Motif). +# /usr/lib/X11* are used on HP-UX (X and Athena). +# /usr/dt is used on Solaris (Motif). +# /usr/lesstif is used on Linux (Lesstif). +# /usr/openwin is used on Solaris (X and Athena). +# Other directories are just guesses. +for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ + /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ + /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ + /usr/dt/lib /usr/openwin/lib \ + /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ + /usr/lesstif*/lib /usr/lib/Lesstif* \ + "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ + "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do + if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then + xdvi_cv_motif_libdir="$dir" + break + fi +done +if test "$xdvi_cv_motif_libdir" = ""; then +xdvi_cv_motif_libdir=no +fi +]) +# +LIBS="$xdvi_motif_save_LIBS" +CFLAGS="$xdvi_motif_save_CFLAGS" +CPPFLAGS="$xdvi_motif_save_CPPFLAGS" +LDFLAGS="$xdvi_motif_save_LDFLAGS" +]) +# +motif_libdir="$xdvi_cv_motif_libdir" +fi +# Add Motif definitions to X flags +# +if test "$motif_include" != "" && test "$motif_include" != "$x_includes" && test "$motif_include" != "no" +then +X_CFLAGS="-I$motif_include $X_CFLAGS" +fi +if test "$motif_libdir" != "" && test "$motif_libdir" != "$x_libraries" && test "$motif_libdir" != "no" +then +case "$X_LIBS" in + *-R\ *) X_LIBS="-L$motif_libdir -R $motif_libdir $X_LIBS";; + *-R*) X_LIBS="-L$motif_libdir -R$motif_libdir $X_LIBS";; + *) X_LIBS="-L$motif_libdir $X_LIBS";; +esac +fi +# +# +motif_libdir_result="$motif_libdir" +motif_include_result="$motif_include" +test "$motif_libdir_result" = "" && + motif_libdir_result="in default path" && AC_DEFINE(MOTIF, 1) +test "$motif_include_result" = "" && + motif_include_result="in default path" && AC_DEFINE(MOTIF, 1) +if test "$motif_libdir_result" = "no"; then + if test "$default_toolkit" = "none"; then + motif_libdir_result="(none)" + else + motif_libdir_result="" + fi +fi +if test "$motif_include_result" = "no"; then + if test "$default_toolkit" = "none"; then + motif_include_result="(none)" + else + motif_include_result="" + fi +fi + +if test "$motif_include_result" != "" && test "$motif_libdir_result" != ""; then + AC_MSG_RESULT([libraries $motif_libdir_result, headers $motif_include_result]) + prog_extension="motif" + AC_DEFINE(MOTIF) + x_tool_libs="-lXm" + # now warn if we're using LessTif (see LESSTIF-BUGS for why ...) + AC_MSG_CHECKING(for LessTif) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_TRY_COMPILE([ + #include + #include + #include + #include + #include + #include ],[const char *p = LesstifVERSION_STRING; + ],[ + # yes, we're running LessTif + AC_MSG_RESULT(yes) + AC_MSG_WARN([LessTif header detected. + ***************************************************************** + * Warning: You are using LessTif instead of OpenMotif. * + * Some GUI elements might be broken; please see the file * + * * + * texk/xdvik/LESSTIF-BUGS * + * * + * for more information. * + *****************************************************************]) + ],[ + # no, not running LessTif + AC_MSG_RESULT([no]) + ]) +else + AC_MSG_RESULT([not found, using Xaw]) + prog_extension="xaw" + AC_DEFINE(XAW) + x_tool_libs="-lXaw" +fi + +# +AC_MSG_CHECKING(whether to compile in panner (requires Xaw)) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $X_CFLAGS" +AC_TRY_COMPILE([ +#include +#include +#include +#include + +#include +#include + +#include +],[ +], +xdvi_use_xaw_panner=yes, xdvi_use_xaw_panner=no +) +CPPFLAGS=$save_CPPFLAGS +if test $xdvi_use_xaw_panner = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(USE_XAW_PANNER) +else + AC_MSG_RESULT(no) +fi +])dnl + +dnl SU: the following is copied from gnome/compiler-flags.m4: turn on warnings for gcc +dnl +dnl COMPILER_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([COMPILER_WARNINGS],[ + AC_ARG_ENABLE(compiler-warnings, + [ --enable-compiler-warnings=[no/minimum/yes/maximum] + Turn on compiler warnings],,enable_compiler_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compiler_warnings=no + fi + + if test "x$enable_compiler_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCFLAGS="-W -Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compiler_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -pedantic -Wmissing-prototypes -Wmissing-declarations" + elif test "x$enable_compiler_warnings" = "xmaximum"; then + ## just turn on about everything: + warnCFLAGS="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wimplicit -Wparentheses -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" + fi + fi + fi + AC_MSG_RESULT($warnCFLAGS) + + ### FIXME: if we restrict setting the flags to this case only, they will get overridden + ### somehwere else further up in the configure process. + if test "x$cflags_set" != "xyes"; then + XTRA_WARN_CFLAGS=$warnCFLAGS + AC_SUBST(XTRA_WARN_CFLAGS) +# CFLAGS="$CFLAGS $warnCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) + fi +]) + +dnl ### Check for Xaw version +AC_DEFUN(XDVI_OLD_XAW,[ +if test "${with_xdvi_x_toolkit}" = xaw; then + AC_MSG_CHECKING(for Xaw library) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_TRY_COMPILE([ +#include +#include +#include +#include + +#include +#include +#include + ],[ + ], + xdvi_have_xaw=yes, xdvi_have_xaw=no + ) + CPPFLAGS=$save_CPPFLAGS + if test $xdvi_have_xaw = yes; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(not found) + AC_MSG_ERROR([Sorry, you will need at least the Xaw header/library files to compile xdvik.]) + fi + + AC_MSG_CHECKING(version of Xaw library) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_TRY_COMPILE([ +#include +#include +#include +#include +#include +#include +#include +#include + typedef void (*XawDiamondProc) (Widget); + + /* New fields for the Radio widget class record */ + typedef struct _RadioClass { + Dimension dsize; /* diamond size */ + XawDiamondProc drawDiamond; + /* pixmaps for the button */ + Pixmap sel_radio; /* selected state */ + Pixmap unsel_radio; /* unselected state */ + Pixmap sel_menu; /* selected state */ + Pixmap unsel_menu; /* unselected state */ + /* TODO: 3-d and xaw-xpm features? */ + XtPointer extension; + } RadioClassPart; + + /* Full class record declaration */ + typedef struct _RadioClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + LabelClassPart label_class; + CommandClassPart command_class; + ToggleClassPart toggle_class; + RadioClassPart radio_class; + } RadioClassRec; + /* New fields for the Radio widget record */ + typedef struct { + /* resources */ + Boolean isRadio; /* radio if True, checkbox else */ + /* TODO: 3-d and xaw-xpm features? */ + + /* private data */ + XtPointer extension; + } RadioPart; + + /* Full widget declaration */ + typedef struct _RadioRec { + CorePart core; + SimplePart simple; +#ifdef _ThreeDP_h + ThreeDPart threeD; +#endif + LabelPart label; + CommandPart command; + TogglePart toggle; + RadioPart radio; + } RadioRec; + + + /* The actions table from Toggle is almost perfect, but we need + * to override Highlight, Set, and Unset. + */ + +#define SuperClass ((ToggleWidgetClass)&toggleClassRec) + +#define BOX_SIZE 16 +#define PIXMAP_OFFSET 2 /* additional space between pixmap and label */ + ],[ + RadioClassRec radioClassRec = { + { + (WidgetClass) SuperClass, /* superclass */ + "Radio", /* class_name */ + sizeof(RadioRec), /* size */ + NULL, /* class_initialize */ + NULL, /* class_part_initialize */ + FALSE, /* class_inited */ + NULL, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + NULL, /* actions */ + 0, /* num_actions */ + NULL, /* resources */ + 0, /* resource_count */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + NULL, /* destroy */ + NULL, /* resize */ + NULL, /* expose */ + NULL, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + XtInheritTranslations, /* tm_table */ + NULL, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + }, /* CoreClass fields initialization */ + { + XtInheritChangeSensitive, /* change_sensitive */ + NULL + }, /* SimpleClass fields initialization */ + { + 0 /* field not used */ + }, /* LabelClass fields initialization */ + { + 0 /* field not used */ + }, /* CommandClass fields initialization */ + { + NULL, /* Set Procedure. */ + NULL, /* Unset Procedure. */ + NULL /* extension. */ + }, /* ToggleClass fields initialization */ + { + BOX_SIZE, + NULL, /* draw procedure */ + None, /* selected radiobutton */ + None, /* unselected radiobutton */ + None, /* selected menubutton */ + None, /* unselected menubutton */ + NULL /* extension. */ + } /* RadioClass fields initialization */ + }; + (void)radioClassRec; + ], + xdvi_old_xaw=no, xdvi_old_xaw=yes + ) + CPPFLAGS=$save_CPPFLAGS +if test $xdvi_old_xaw = yes; then + AC_MSG_RESULT(old) + AC_DEFINE(HAVE_OLD_XAW) +else + AC_MSG_RESULT(current) +fi +fi +]) diff --git a/Build/source/texk/xdvik/browser.c b/Build/source/texk/xdvik/browser.c index 4fbbe342c1d..59a1d227377 100644 --- a/Build/source/texk/xdvik/browser.c +++ b/Build/source/texk/xdvik/browser.c @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ #include "xdvi-config.h" #include "xdvi.h" @@ -39,9 +39,14 @@ #include "statusline.h" static const char *const default_browser_cmd = - "netscape -raise -remote \"openURL(%s,new-window)\"" - ":xterm -e lynx %s" - ":xterm -e wget %s"; +"xdg-open %s" +":htmlview %s" +":firefox -remote \"openURL(%s,new-window)\"" +":mozilla -remote \"openURL(%s,new-window)\"" +":netscape -remote \"openURL(%s,new-window)\"" +":xterm -e w3m %s" +":xterm -e lynx %s" +":xterm -e wget %s"; static Boolean do_fork_browser(char *argv[]) @@ -191,7 +196,7 @@ launch_browser(const char *filename) it would be better to have this in one function. */ my_child = xmalloc(sizeof *my_child); my_io = xmalloc(sizeof *my_io); - statusline_print(STATUS_MEDIUM, "Trying to launch browser ..."); + statusline_info(STATUS_MEDIUM, "Trying to launch browser ..."); /* flush output buffers to avoid double buffering (i.e. data waiting in the output buffer being written twice, by the parent and the child) */ @@ -257,6 +262,7 @@ launch_browser(const char *filename) #endif my_io->read_proc = read_child_error; my_io->write_proc = NULL; + my_io->data = NULL; my_child->next = NULL; my_child->pid = pid; @@ -266,7 +272,7 @@ launch_browser(const char *filename) my_child->io = my_io; set_chld(my_child); - statusline_print(STATUS_MEDIUM, "Trying to launch browser ... done."); + statusline_info(STATUS_MEDIUM, "Trying to launch browser ... done."); } } diff --git a/Build/source/texk/xdvik/c-auto.in b/Build/source/texk/xdvik/c-auto.in index cf4595ea96a..c2f32e21a9a 100644 --- a/Build/source/texk/xdvik/c-auto.in +++ b/Build/source/texk/xdvik/c-auto.in @@ -296,9 +296,13 @@ /* Define if you want to use the Xpm library */ #undef USE_XPM -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +#elif ! defined __LITTLE_ENDIAN__ +# undef WORDS_BIGENDIAN +#endif /* Define to use the Xaw toolkit. */ #undef XAW diff --git a/Build/source/texk/xdvik/configure b/Build/source/texk/xdvik/configure index 3e89b7f8cd1..9a89108d799 100755 --- a/Build/source/texk/xdvik/configure +++ b/Build/source/texk/xdvik/configure @@ -1,9 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61. +# Generated by GNU Autoconf 2.62. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -15,7 +15,7 @@ DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -37,17 +37,45 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi # Support unset when possible. @@ -63,8 +91,6 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -87,7 +113,7 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi @@ -100,17 +126,10 @@ PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && @@ -132,7 +151,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -158,7 +177,7 @@ else as_have_required=no fi - if test $as_have_required = yes && (eval ": + if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } @@ -240,7 +259,7 @@ IFS=$as_save_IFS if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -261,7 +280,7 @@ _ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -341,10 +360,10 @@ fi if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi @@ -413,9 +432,10 @@ fi test \$exitcode = 0") || { echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. } @@ -451,7 +471,7 @@ test \$exitcode = 0") || { s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems @@ -479,7 +499,6 @@ case `echo -n x` in *) ECHO_N='-n';; esac - if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -492,19 +511,22 @@ if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + fi else as_ln_s='cp -p' fi @@ -529,10 +551,10 @@ else as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else case $1 in - -*)set "./$1";; + -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi @@ -668,6 +690,9 @@ LD AR ARFLAGS texmfmain +LIBKPATHSEACPPFLAGS +LDLIBKPATHSEA +LIBKPATHSEADEP CPP GREP EGREP @@ -706,6 +731,50 @@ BUILDLDFLAGS BUILDCCLD LTLIBOBJS' ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +with_mktexmf_default +with_mktexpk_default +with_mktextfm_default +with_mkocp_default +with_mkofm_default +with_mktexfmt_default +with_mktextex_default +enable_multiplatform +with_dialog +with_pdfopen +with_ps2eps +with_psutils +with_t1utils +with_texinfo +with_tpic2pdftex +with_vlna +with_xindy +with_x +enable_compiler_warnings +with_x_toolkit +with_xdvi_x_toolkit +with_ps +enable_grey +enable_color +enable_t1lib +enable_gf +enable_a4 +enable_magick +with_system_t1lib +with_t1lib_libdir +with_t1lib_include +with_xpm +with_xpm_includes +with_xpm_libraries +with_motif_include +with_motif_libdir +with_iconv_libdir +with_iconv_include +with_default_dvips_path +with_default_ps2pdf_path +' ac_precious_vars='build_alias host_alias target_alias @@ -724,6 +793,8 @@ CCC' # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -822,13 +893,21 @@ do datarootdir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; @@ -841,13 +920,21 @@ do dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -1038,22 +1125,38 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -1073,7 +1176,7 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; @@ -1082,16 +1185,16 @@ Try \`$0 --help' for more information." >&2 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; @@ -1100,22 +1203,38 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi -# Be sure to have absolute directory names. +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; + *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done @@ -1130,7 +1249,7 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes @@ -1146,10 +1265,10 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 + { $as_echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } @@ -1157,12 +1276,12 @@ test "X$ac_ls_di" = "X$ac_pwd_ls_di" || if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1189,12 +1308,12 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. @@ -1243,9 +1362,9 @@ Configuration: Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1255,25 +1374,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -1294,10 +1413,13 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer + --enable-multiplatform put executables into bin/PLATFORM and libraries into + lib/PLATFORM --enable-compiler-warnings=no/minimum/yes/maximum Turn on compiler warnings --disable-grey Disable greyscale anti-aliasing for shrunken bitmaps @@ -1319,14 +1441,23 @@ Optional Packages: --without-mkofm-default do not run mkofm if OFM file missing --with-mktexfmt-default run mktexfmt if format file missing --with-mktextex-default run mktextex if TeX source missing + --without-dialog do not build the dialog package + --without-pdfopen do not build the pdfopen package + --without-ps2eps do not build the ps2eps package + --without-psutils do not build the psutils package + --without-t1utils do not build the t1utils package + --without-texinfo do not build the texinfo package + --without-tpic2pdftex do not build the tpic2pdftex package + --without-vlna do not build the vlna package + --without-xindy do not build the xindy package --with-x use the X Window System --with-x-toolkit=KIT OBSOLETE: use --with-mf-x-toolkit and/or --with-xdvi-x-toolkit instead. - --with-ps=PS Use PostScript (PS=no/yes/gs/dps/news, default gs) --with-xdvi-x-toolkit=KIT Use toolkit KIT for xdvi (KIT=motif/xaw/xaw3d/neXtaw). If no --with-xdvi-x-toolkit option is used, use Motif if available, else Xaw. + --with-ps=PS Use PostScript (PS=no/yes/gs/dps/news, default gs) --with-system-t1lib Use installed T1lib --with-t1lib-libdir=DIR Specify the location of T1lib library files (libt1.a) @@ -1373,15 +1504,17 @@ fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1417,7 +1550,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1427,10 +1560,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.61 +generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1441,7 +1574,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was +generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -1477,7 +1610,7 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" + $as_echo "PATH: $as_dir" done IFS=$as_save_IFS @@ -1512,7 +1645,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; @@ -1564,11 +1697,12 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac @@ -1598,9 +1732,9 @@ _ASBOX do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo @@ -1615,9 +1749,9 @@ _ASBOX do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1633,8 +1767,8 @@ _ASBOX echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -1676,21 +1810,24 @@ _ACEOF # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" + ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -shift -for ac_site_file +for ac_site_file in "$ac_site_file1" "$ac_site_file2" do + test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi @@ -1700,16 +1837,16 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1723,29 +1860,38 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1755,10 +1901,10 @@ echo "$as_me: current value: $ac_new_val" >&2;} fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -1798,10 +1944,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1814,7 +1960,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -1825,11 +1971,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1838,10 +1984,10 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1854,7 +2000,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -1865,11 +2011,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -1877,10 +2023,10 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; @@ -1895,10 +2041,10 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1911,7 +2057,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -1922,11 +2068,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1935,10 +2081,10 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1956,7 +2102,7 @@ do continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -1979,11 +2125,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1994,10 +2140,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2010,7 +2156,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2021,11 +2167,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2038,10 +2184,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2054,7 +2200,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2065,11 +2211,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2081,10 +2227,10 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; @@ -2096,44 +2242,48 @@ fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF @@ -2152,27 +2302,22 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. +{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + ac_rmfiles= for ac_file in $ac_files do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done @@ -2183,10 +2328,11 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' @@ -2197,7 +2343,7 @@ for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most @@ -2224,15 +2370,15 @@ else ac_file='' fi -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables +$as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi @@ -2241,8 +2387,8 @@ ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then @@ -2251,49 +2397,51 @@ if test "$cross_compiling" != yes; then *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. + { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. +$as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -2302,31 +2450,31 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link + { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2349,40 +2497,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2408,20 +2557,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no @@ -2431,15 +2581,19 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes @@ -2466,20 +2620,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" @@ -2504,20 +2659,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag @@ -2543,20 +2699,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -2571,8 +2728,8 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2588,10 +2745,10 @@ else CFLAGS= fi fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC @@ -2662,20 +2819,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -2691,15 +2849,15 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac @@ -2726,8 +2884,8 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi @@ -2753,11 +2911,12 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2786,17 +2945,29 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi done done ;; esac + done IFS=$as_save_IFS +rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then @@ -2809,8 +2980,8 @@ fi INSTALL=$ac_install_sh fi fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2820,11 +2991,12 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } -set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh @@ -2841,33 +3013,33 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi -{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } else - { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6; } + { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -2880,7 +3052,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2891,11 +3063,11 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6; } + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2904,10 +3076,10 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. @@ -2920,7 +3092,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2931,11 +3103,11 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6; } + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -2943,10 +3115,10 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; @@ -2963,18 +3135,15 @@ test "$program_prefix" != NONE && # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. +# Double any \ or $. # By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm -f conftest.sed +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 -echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval @@ -2982,8 +3151,8 @@ else USE_MAINTAINER_MODE=no fi - { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 -echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } + { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } if test "x$USE_MAINTAINER_MODE" = xyes; then MAINT= else @@ -2992,10 +3161,10 @@ echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } -{ echo "$as_me:$LINENO: checking for loader (symbol LD)" >&5 -echo $ECHO_N "checking for loader (symbol LD)... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for loader (symbol LD)" >&5 +$as_echo_n "checking for loader (symbol LD)... " >&6; } if test "${cf_cv_subst_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else test -z "$LD" && LD=ld @@ -3003,14 +3172,14 @@ cf_cv_subst_LD=$LD fi LD=${cf_cv_subst_LD} -{ echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6; } +{ $as_echo "$as_me:$LINENO: result: $LD" >&5 +$as_echo "$LD" >&6; } -{ echo "$as_me:$LINENO: checking for archiver (symbol AR)" >&5 -echo $ECHO_N "checking for archiver (symbol AR)... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for archiver (symbol AR)" >&5 +$as_echo_n "checking for archiver (symbol AR)... " >&6; } if test "${cf_cv_subst_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else test -z "$AR" && AR=ar @@ -3018,14 +3187,14 @@ cf_cv_subst_AR=$AR fi AR=${cf_cv_subst_AR} -{ echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6; } +{ $as_echo "$as_me:$LINENO: result: $AR" >&5 +$as_echo "$AR" >&6; } -{ echo "$as_me:$LINENO: checking for archiver options (symbol ARFLAGS)" >&5 -echo $ECHO_N "checking for archiver options (symbol ARFLAGS)... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for archiver options (symbol ARFLAGS)" >&5 +$as_echo_n "checking for archiver options (symbol ARFLAGS)... " >&6; } if test "${cf_cv_subst_ARFLAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else test -z "$ARFLAGS" && ARFLAGS=rc @@ -3033,8 +3202,8 @@ cf_cv_subst_ARFLAGS=$ARFLAGS fi ARFLAGS=${cf_cv_subst_ARFLAGS} -{ echo "$as_me:$LINENO: result: $ARFLAGS" >&5 -echo "${ECHO_T}$ARFLAGS" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ARFLAGS" >&5 +$as_echo "$ARFLAGS" >&6; } @@ -3093,8 +3262,8 @@ else fi -{ echo "$as_me:$LINENO: checking where the main texmf tree is located" >&5 -echo $ECHO_N "checking where the main texmf tree is located... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking where the main texmf tree is located" >&5 +$as_echo_n "checking where the main texmf tree is located... " >&6; } case $prefix in */) prefix=`echo "$prefix" | sed 's@/*$@@'`;; esac @@ -3106,12 +3275,12 @@ if test "x$datadir" != 'x${prefix}/share'; then texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` # ... do complain if it wasn't found. if test -d "$texmfmain"; then - { echo "$as_me:$LINENO: result: \"$texmfmain\"" >&5 -echo "${ECHO_T}\"$texmfmain\"" >&6; } + { $as_echo "$as_me:$LINENO: result: \"$texmfmain\"" >&5 +$as_echo "\"$texmfmain\"" >&6; } else - { echo "$as_me:$LINENO: result: not found" >&5 -echo "${ECHO_T}not found" >&6; } - { echo "$as_me:$LINENO: WARNING: No texmf tree found at $texmfmain. + { $as_echo "$as_me:$LINENO: result: not found" >&5 +$as_echo "not found" >&6; } + { $as_echo "$as_me:$LINENO: WARNING: No texmf tree found at $texmfmain. ***************************************************************** * Error: The main texmf tree was not found. * * If you do not have the files, you should be able to them from * @@ -3119,7 +3288,7 @@ echo "${ECHO_T}not found" >&6; } * CTAN hosts. * ***************************************************************** Winging it." >&5 -echo "$as_me: WARNING: No texmf tree found at $texmfmain. +$as_echo "$as_me: WARNING: No texmf tree found at $texmfmain. ***************************************************************** * Error: The main texmf tree was not found. * * If you do not have the files, you should be able to them from * @@ -3148,13 +3317,13 @@ else fi texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` if test -n "$texmfmain"; then - { echo "$as_me:$LINENO: result: \"$texmfmain\"" >&5 -echo "${ECHO_T}\"$texmfmain\"" >&6; } + { $as_echo "$as_me:$LINENO: result: \"$texmfmain\"" >&5 +$as_echo "\"$texmfmain\"" >&6; } else eval texmfmain="$datadir/texmf" - { echo "$as_me:$LINENO: result: not found" >&5 -echo "${ECHO_T}not found" >&6; } - { echo "$as_me:$LINENO: WARNING: The main texmf tree was not found at $texmfmain. + { $as_echo "$as_me:$LINENO: result: not found" >&5 +$as_echo "not found" >&6; } + { $as_echo "$as_me:$LINENO: WARNING: The main texmf tree was not found at $texmfmain. ***************************************************************** * Error: The main texmf tree was not found. * * Use the --datadir option to specify its parent directory. * @@ -3163,7 +3332,7 @@ echo "${ECHO_T}not found" >&6; } * CTAN hosts. * ***************************************************************** Winging it by pretending $texmfmain is correct." >&5 -echo "$as_me: WARNING: The main texmf tree was not found at $texmfmain. +$as_echo "$as_me: WARNING: The main texmf tree was not found at $texmfmain. ***************************************************************** * Error: The main texmf tree was not found. * * Use the --datadir option to specify its parent directory. * @@ -3176,22 +3345,212 @@ echo "$as_me: WARNING: The main texmf tree was not found at $texmfmain. fi +# withenable.ac - Written long ago by Thomas Esser and Sebastian Rahtz. +# $Id: withenable.ac 9056 2008-06-26 10:30:34Z peter $ + +# Public domain. + +# Check whether --enable-multiplatform was given. +if test "${enable_multiplatform+set}" = set; then + enableval=$enable_multiplatform; +fi + + + +# Options to avoid/include the packages in utils/. +# + +# Check whether --with-dialog was given. +if test "${with_dialog+set}" = set; then + withval=$with_dialog; +fi + +# Check whether --with-pdfopen was given. +if test "${with_pdfopen+set}" = set; then + withval=$with_pdfopen; +fi + +# Check whether --with-ps2eps was given. +if test "${with_ps2eps+set}" = set; then + withval=$with_ps2eps; +fi + +# Check whether --with-psutils was given. +if test "${with_psutils+set}" = set; then + withval=$with_psutils; +fi + +# Check whether --with-t1utils was given. +if test "${with_t1utils+set}" = set; then + withval=$with_t1utils; +fi + +# Check whether --with-texinfo was given. +if test "${with_texinfo+set}" = set; then + withval=$with_texinfo; +fi + +# Check whether --with-tpic2pdftex was given. +if test "${with_tpic2pdftex+set}" = set; then + withval=$with_tpic2pdftex; +fi + +# Check whether --with-vlna was given. +if test "${with_vlna+set}" = set; then + withval=$with_vlna; +fi + +# Check whether --with-xindy was given. +if test "${with_xindy+set}" = set; then + withval=$with_xindy; +fi + + + + +EXTRA_LIBKPATHSEA_INCLUDE= +EXTRA_LIBKPATHSEA_LIBDIR= + +if test "$with_system_kpathsea" = yes; then + if test "x$with_kpathsea_libdir" != x; then + EXTRA_LIBKPATHSEA_LIBDIR="-L$with_kpathsea_libdir" + fi + if test "x$with_kpathsea_include" != x; then + EXTRA_LIBKPATHSEA_INCLUDE="-I$with_kpathsea_include" + fi +fi + +if test "$with_system_kpathsea" = yes; then + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_CPPFLAGS=$CPPFLAGS + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBKPATHSEA_LIBDIR" + CPP="$CPP $EXTRA_LIBKPATHSEA_INCLUDE" + CPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE" + + { $as_echo "$as_me:$LINENO: checking whether kpathsea defines kpse_enc_format" >&5 +$as_echo_n "checking whether kpathsea defines kpse_enc_format... " >&6; } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "kpathsea/kpathsea.h" + +int +main () +{ +kpse_file_format_type mytype = kpse_enc_format; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + have_good_kpathsea=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + have_good_kpathsea=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $have_good_kpathsea = no; then + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:$LINENO: WARNING: kpathsea library is not recent enough; will compile my own" >&5 +$as_echo "$as_me: WARNING: kpathsea library is not recent enough; will compile my own" >&2;} + with_system_kpathsea=no + else + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + CPPFLAGS=$OLD_CPPFLAGS + LIBS=$OLD_LIBS +fi + +if test "$with_system_kpathsea" = yes; then + LIBKPATHSEACPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE" + LDLIBKPATHSEA="$EXTRA_LIBKPATHSEA_LIBDIR -lkpathsea" + LIBKPATHSEADEP= + using_system_kpathsea=yes +else + LIBKPATHSEACPPFLAGS='-I$(kpathsea_parent)' + LDLIBKPATHSEA='$(kpathsea_dir)/libkpathsea.la' + LIBKPATHSEADEP='$(kpathsea_dir)/libkpathsea.la' + using_system_kpathsea=no +fi + + + + + + + +if test "x$with_mktexpk_default" = "xno"; then + { $as_echo "$as_me:$LINENO: WARNING: Xdvik doesn't implement the --without-mktexpk-default option!" >&5 +$as_echo "$as_me: WARNING: Xdvik doesn't implement the --without-mktexpk-default option!" >&2;} +fi + +if test "x$with_mktexmf_default" = "xno"; then + { $as_echo "$as_me:$LINENO: WARNING: Xdvik doesn't implement the --without-mktexmf-default option!" >&5 +$as_echo "$as_me: WARNING: Xdvik doesn't implement the --without-mktexmf-default option!" >&2;} +fi + +if test "x$with_mktextfm_default" = "xno"; then + { $as_echo "$as_me:$LINENO: WARNING: Xdvik doesn't implement the --without-mktextfm-default option!" >&5 +$as_echo "$as_me: WARNING: Xdvik doesn't implement the --without-mktextfm-default option!" >&2;} +fi + +if test "x$with_mkocp_default" = "xno"; then + { $as_echo "$as_me:$LINENO: WARNING: Xdvik doesn't implement the --without-mkocp-default option!" >&5 +$as_echo "$as_me: WARNING: Xdvik doesn't implement the --without-mkocp-default option!" >&2;} +fi +if test "x$with_mkofm_default" = "xno"; then + { $as_echo "$as_me:$LINENO: WARNING: Xdvik doesn't implement the --without-mkofm-default option!" >&5 +$as_echo "$as_me: WARNING: Xdvik doesn't implement the --without-mkofm-default option!" >&2;} +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -3223,20 +3582,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. @@ -3260,13 +3620,14 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err @@ -3274,7 +3635,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. @@ -3299,8 +3660,8 @@ fi else ac_cv_prog_CPP=$CPP fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -3328,20 +3689,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. @@ -3365,13 +3727,14 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err @@ -3379,7 +3742,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. @@ -3395,9 +3758,9 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check + { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -3409,42 +3772,37 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 +{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else + if test -z "$GREP"; then ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` @@ -3459,74 +3817,60 @@ case `"$ac_path_GREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_GREP_found && break 3 + $ac_path_GREP_found && break 3 + done done done - -done IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + if test -z "$ac_cv_path_GREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } -fi - + fi else ac_cv_path_GREP=$GREP fi - fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + if test -z "$EGREP"; then ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` @@ -3541,40 +3885,31 @@ case `"$ac_path_EGREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_EGREP_found && break 3 + $ac_path_EGREP_found && break 3 + done done done - -done IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + if test -z "$ac_cv_path_EGREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } -fi - + fi else ac_cv_path_EGREP=$EGREP fi - fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -3601,20 +3936,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no @@ -3706,37 +4042,40 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF @@ -3758,11 +4097,11 @@ fi for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -3780,20 +4119,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -3801,12 +4141,14 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -3814,26 +4156,58 @@ fi done -{ echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5 +$as_echo_n "checking for pid_t... " >&6; } if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_type_pid_t=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef pid_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) +if (sizeof (pid_t)) + return 0; + ; return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((pid_t))) + return 0; ; return 0; } @@ -3844,29 +4218,38 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_pid_t=yes + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_pid_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_pid_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +$as_echo "$ac_cv_type_pid_t" >&6; } if test $ac_cv_type_pid_t = yes; then : else @@ -3880,20 +4263,21 @@ fi for ac_header in vfork.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } else # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3909,32 +4293,33 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } # Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3948,69 +4333,72 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -4021,11 +4409,11 @@ done for ac_func in fork vfork do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4078,45 +4466,51 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then eval "$as_ac_var=yes" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then - { echo "$as_me:$LINENO: checking for working fork" >&5 -echo $ECHO_N "checking for working fork... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } if test "${ac_cv_func_fork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_fork_works=cross @@ -4145,36 +4539,39 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_fork_works=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_fork_works=no fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 -echo "${ECHO_T}$ac_cv_func_fork_works" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork @@ -4189,15 +4586,15 @@ if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_fork_works=yes ;; esac - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then - { echo "$as_me:$LINENO: checking for working vfork" >&5 -echo $ECHO_N "checking for working vfork... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } if test "${ac_cv_func_vfork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_vfork_works=cross @@ -4304,42 +4701,45 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_vfork_works=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_vfork_works=no fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 -echo "${ECHO_T}$ac_cv_func_vfork_works" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then @@ -4366,11 +4766,11 @@ fi for ac_func in vprintf do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4423,41 +4823,47 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then eval "$as_ac_var=yes" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -{ echo "$as_me:$LINENO: checking for _doprnt" >&5 -echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for _doprnt" >&5 +$as_echo_n "checking for _doprnt... " >&6; } if test "${ac_cv_func__doprnt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4510,31 +4916,35 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_func__doprnt=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -echo "${ECHO_T}$ac_cv_func__doprnt" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +$as_echo "$ac_cv_func__doprnt" >&6; } if test $ac_cv_func__doprnt = yes; then cat >>confdefs.h <<\_ACEOF @@ -4547,10 +4957,10 @@ fi done -{ echo "$as_me:$LINENO: checking for a working implementation of (v)snprintf()" >&5 -echo $ECHO_N "checking for a working implementation of (v)snprintf()... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for a working implementation of (v)snprintf()" >&5 +$as_echo_n "checking for a working implementation of (v)snprintf()... " >&6; } if test "${xdvi_cv_func_good_vsnprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # safe value for cross-compiling @@ -4582,36 +4992,39 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then xdvi_cv_func_good_vsnprintf=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) xdvi_cv_func_good_vsnprintf=no fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ echo "$as_me:$LINENO: result: $xdvi_cv_func_good_vsnprintf" >&5 -echo "${ECHO_T}$xdvi_cv_func_good_vsnprintf" >&6; } +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_func_good_vsnprintf" >&5 +$as_echo "$xdvi_cv_func_good_vsnprintf" >&6; } if test $xdvi_cv_func_good_vsnprintf = yes; then cat >>confdefs.h <<\_ACEOF @@ -4619,10 +5032,10 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi -{ echo "$as_me:$LINENO: checking for memicmp" >&5 -echo $ECHO_N "checking for memicmp... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for memicmp" >&5 +$as_echo_n "checking for memicmp... " >&6; } if test "${xdvi_cv_memicmp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4646,31 +5059,35 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then xdvi_cv_memicmp=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 xdvi_cv_memicmp=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $xdvi_cv_memicmp" >&5 -echo "${ECHO_T}$xdvi_cv_memicmp" >&6; } +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_memicmp" >&5 +$as_echo "$xdvi_cv_memicmp" >&6; } if test $xdvi_cv_memicmp = yes; then cat >>confdefs.h <<\_ACEOF @@ -4680,10 +5097,10 @@ _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -{ echo "$as_me:$LINENO: checking for working alloca.h" >&5 -echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } if test "${ac_cv_working_alloca_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4707,31 +5124,35 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_working_alloca_h=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 -echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then cat >>confdefs.h <<\_ACEOF @@ -4740,10 +5161,10 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for alloca" >&5 -echo $ECHO_N "checking for alloca... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } if test "${ac_cv_func_alloca_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4787,31 +5208,35 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_func_alloca_works=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 -echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then @@ -4832,10 +5257,10 @@ cat >>confdefs.h <<\_ACEOF _ACEOF -{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 -echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if test "${ac_cv_os_cray+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4859,15 +5284,15 @@ fi rm -f conftest* fi -{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 -echo "${ECHO_T}$ac_cv_os_cray" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do - as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4920,33 +5345,39 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then eval "$as_ac_var=yes" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func @@ -4958,10 +5389,10 @@ fi done fi -{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 -echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } if test "${ac_cv_c_stack_direction+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 @@ -4999,36 +5430,39 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_stack_direction=-1 fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 -echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction @@ -5037,10 +5471,10 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5 -echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5 +$as_echo_n "checking for preprocessor stringizing operator... " >&6; } if test "${ac_cv_c_stringize+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -5061,8 +5495,8 @@ fi rm -f conftest* fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5 -echo "${ECHO_T}$ac_cv_c_stringize" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5 +$as_echo "$ac_cv_c_stringize" >&6; } if test $ac_cv_c_stringize = yes; then cat >>confdefs.h <<\_ACEOF @@ -5071,10 +5505,10 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for working memcmp" >&5 -echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for working memcmp" >&5 +$as_echo_n "checking for working memcmp... " >&6; } if test "${ac_cv_func_memcmp_working+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_working=no @@ -5124,36 +5558,39 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memcmp_working=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 -echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +$as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" @@ -5161,10 +5598,10 @@ test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in esac -{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 -echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -5197,20 +5634,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_sys_wait_h=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no @@ -5218,8 +5656,8 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +$as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF @@ -5228,10 +5666,10 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } if test "${ac_cv_type_signal+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -5256,20 +5694,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void @@ -5277,40 +5716,33 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF -{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } + + { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_bigendian=unknown + # See if __BIG_ENDIAN__ or __LITTLE_ENDIAN__ is defined. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ - && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) - bogus endian macros -#endif +#if ! (defined __BIG_ENDIAN__ || defined __LITTLE_ENDIAN__) + neither is defined; + #endif + typedef int dummy; - ; - return 0; -} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -5318,33 +5750,46 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_bigendian=universal +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include -#include + #include int main () { -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif ; return 0; @@ -5356,50 +5801,130 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_c_bigendian=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_bigendian=no -fi + # It does; now see whether it defined to BIG_ENDIAN or not. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_bigendian=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_bigendian=no +fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +#include + int main () { - _ascii (); _ebcdic (); +#ifndef _BIG_ENDIAN + not big endian + #endif + ; return 0; } @@ -5410,30 +5935,101 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_bigendian=no fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi -fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then + # Try to guess by grepping values from an object file. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -5452,14 +6048,14 @@ int main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; ; return 0; @@ -5471,58 +6067,60 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } -case $ac_cv_c_bigendian in - yes) - -cat >>confdefs.h <<\_ACEOF +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF - ;; - no) - ;; - *) - { { echo "$as_me:$LINENO: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} +;; #( + no) + ;; #( + universal) + ;; #( + *) + { { $as_echo "$as_me:$LINENO: error: unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +$as_echo "$as_me: error: unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; -esac + esac -{ echo "$as_me:$LINENO: checking for X" >&5 -echo $ECHO_N "checking for X... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } # Check whether --with-x was given. @@ -5536,11 +6134,11 @@ if test "x$with_x" = xno; then have_x=disabled else case $x_includes,$x_libraries in #( - *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 -echo "$as_me: error: Cannot use X directory names containing '" >&2;} + *\'*) { { $as_echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 +$as_echo "$as_me: error: Cannot use X directory names containing '" >&2;} { (exit 1); exit 1; }; };; #( *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no @@ -5561,7 +6159,7 @@ _ACEOF eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. - for ac_extension in a so sl; do + for ac_extension in a so sl dylib la dll; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break @@ -5636,13 +6234,14 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err @@ -5650,7 +6249,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 # We can compile using X headers with no special include directory. ac_x_includes= else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do @@ -5691,30 +6290,33 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS -for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! - for ac_extension in a so sl; do + for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 @@ -5723,6 +6325,7 @@ do done fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no @@ -5745,8 +6348,8 @@ fi fi # $with_x != no if test "$have_x" != yes; then - { echo "$as_me:$LINENO: result: $have_x" >&5 -echo "${ECHO_T}$have_x" >&6; } + { $as_echo "$as_me:$LINENO: result: $have_x" >&5 +$as_echo "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. @@ -5756,8 +6359,8 @@ else ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" - { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 -echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6; } + { $as_echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then @@ -5778,8 +6381,8 @@ else X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . - { echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 -echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 +$as_echo_n "checking whether -R must be followed by a space... " >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes @@ -5804,23 +6407,26 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$ac_xsave_LIBS -R $x_libraries" @@ -5845,33 +6451,38 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { echo "$as_me:$LINENO: result: neither works" >&5 -echo "${ECHO_T}neither works" >&6; } + { $as_echo "$as_me:$LINENO: result: neither works" >&5 +$as_echo "neither works" >&6; } fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_c_werror_flag=$ac_xsave_c_werror_flag @@ -5917,27 +6528,30 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 -echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" @@ -5969,41 +6583,45 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_dnet_dnet_ntoa=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 -echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then - { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 -echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" @@ -6035,32 +6653,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 -echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi @@ -6068,6 +6690,7 @@ fi fi fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" @@ -6080,10 +6703,10 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. - { echo "$as_me:$LINENO: checking for gethostbyname" >&5 -echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for gethostbyname" >&5 +$as_echo_n "checking for gethostbyname... " >&6; } if test "${ac_cv_func_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6136,37 +6759,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_func_gethostbyname=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +$as_echo "$ac_cv_func_gethostbyname" >&6; } if test $ac_cv_func_gethostbyname = no; then - { echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 -echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" @@ -6198,41 +6825,45 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_nsl_gethostbyname=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then - { echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 -echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 +$as_echo_n "checking for gethostbyname in -lbsd... " >&6; } if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" @@ -6264,32 +6895,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_bsd_gethostbyname=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 +$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi @@ -6304,10 +6939,10 @@ fi # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. - { echo "$as_me:$LINENO: checking for connect" >&5 -echo $ECHO_N "checking for connect... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for connect" >&5 +$as_echo_n "checking for connect... " >&6; } if test "${ac_cv_func_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6360,37 +6995,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_func_connect=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 -echo "${ECHO_T}$ac_cv_func_connect" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +$as_echo "$ac_cv_func_connect" >&6; } if test $ac_cv_func_connect = no; then - { echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 -echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 +$as_echo_n "checking for connect in -lsocket... " >&6; } if test "${ac_cv_lib_socket_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" @@ -6422,32 +7061,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_socket_connect=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 +$as_echo "$ac_cv_lib_socket_connect" >&6; } if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi @@ -6455,10 +7098,10 @@ fi fi # Guillermo Gomez says -lposix is necessary on A/UX. - { echo "$as_me:$LINENO: checking for remove" >&5 -echo $ECHO_N "checking for remove... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for remove" >&5 +$as_echo_n "checking for remove... " >&6; } if test "${ac_cv_func_remove+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6511,37 +7154,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_func_remove=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 -echo "${ECHO_T}$ac_cv_func_remove" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 +$as_echo "$ac_cv_func_remove" >&6; } if test $ac_cv_func_remove = no; then - { echo "$as_me:$LINENO: checking for remove in -lposix" >&5 -echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for remove in -lposix" >&5 +$as_echo_n "checking for remove in -lposix... " >&6; } if test "${ac_cv_lib_posix_remove+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" @@ -6573,32 +7220,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_posix_remove=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 -echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 +$as_echo "$ac_cv_lib_posix_remove" >&6; } if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi @@ -6606,10 +7257,10 @@ fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. - { echo "$as_me:$LINENO: checking for shmat" >&5 -echo $ECHO_N "checking for shmat... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for shmat" >&5 +$as_echo_n "checking for shmat... " >&6; } if test "${ac_cv_func_shmat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6662,37 +7313,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_func_shmat=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 -echo "${ECHO_T}$ac_cv_func_shmat" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 +$as_echo "$ac_cv_func_shmat" >&6; } if test $ac_cv_func_shmat = no; then - { echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 -echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 +$as_echo_n "checking for shmat in -lipc... " >&6; } if test "${ac_cv_lib_ipc_shmat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" @@ -6724,32 +7379,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_ipc_shmat=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 -echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 +$as_echo "$ac_cv_lib_ipc_shmat" >&6; } if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi @@ -6766,10 +7425,10 @@ fi # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry - { echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 -echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 +$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" @@ -6801,32 +7460,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_ICE_IceConnectionNumber=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 -echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi @@ -6835,26 +7498,58 @@ fi fi -{ echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 +$as_echo_n "checking for size_t... " >&6; } if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_type_size_t=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef size_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) +if (sizeof (size_t)) + return 0; + ; return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((size_t))) + return 0; ; return 0; } @@ -6865,29 +7560,38 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_size_t=yes + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_size_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +$as_echo "$ac_cv_type_size_t" >&6; } if test $ac_cv_type_size_t = yes; then : else @@ -6900,10 +7604,10 @@ fi if test $ac_cv_func_vfork_works = yes; then -{ echo "$as_me:$LINENO: checking for whether setsid() is allowed within vfork()" >&5 -echo $ECHO_N "checking for whether setsid() is allowed within vfork()... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for whether setsid() is allowed within vfork()" >&5 +$as_echo_n "checking for whether setsid() is allowed within vfork()... " >&6; } if test "${xdvi_cv_setsid_in_vfork+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # safe value for cross-compiling @@ -6958,36 +7662,39 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then xdvi_cv_setsid_in_vfork=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) xdvi_cv_setsid_in_vfork=no fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ echo "$as_me:$LINENO: result: $xdvi_cv_setsid_in_vfork" >&5 -echo "${ECHO_T}$xdvi_cv_setsid_in_vfork" >&6; } +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_setsid_in_vfork" >&5 +$as_echo "$xdvi_cv_setsid_in_vfork" >&6; } if test $xdvi_cv_setsid_in_vfork = yes; then cat >>confdefs.h <<\_ACEOF @@ -6996,10 +7703,10 @@ _ACEOF fi fi -{ echo "$as_me:$LINENO: checking whether C compiler supports string concatenation" >&5 -echo $ECHO_N "checking whether C compiler supports string concatenation... $ECHO_C" >&6; } -if test "${xdvi_cc_concat+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking whether C compiler supports string concatenation" >&5 +$as_echo_n "checking whether C compiler supports string concatenation... " >&6; } +if test "${xdvi_cv_cc_concat+set}" = set; then + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7024,45 +7731,46 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - xdvi_cc_concat=yes + xdvi_cv_cc_concat=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - xdvi_cc_concat=no + xdvi_cv_cc_concat=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $xdvi_cc_concat" >&5 -echo "${ECHO_T}$xdvi_cc_concat" >&6; } -if test $xdvi_cc_concat = yes; then +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_cc_concat" >&5 +$as_echo "$xdvi_cv_cc_concat" >&6; } +if test $xdvi_cv_cc_concat = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CC_CONCAT 1 _ACEOF fi -{ echo "$as_me:$LINENO: checking for integer type to use in bitmaps" >&5 -echo $ECHO_N "checking for integer type to use in bitmaps... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for integer type to use in bitmaps" >&5 +$as_echo_n "checking for integer type to use in bitmaps... " >&6; } if test "${xdvi_cv_bitmap_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling +$as_echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else @@ -7094,31 +7802,34 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then xdvi_cv_bitmap_type="`cat conftestval`" else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: could not determine integer type for bitmap" >&5 -echo "$as_me: error: could not determine integer type for bitmap" >&2;} +{ { $as_echo "$as_me:$LINENO: error: could not determine integer type for bitmap" >&5 +$as_echo "$as_me: error: could not determine integer type for bitmap" >&2;} { (exit 1); exit 1; }; } fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -7136,12 +7847,12 @@ cat >>confdefs.h <<_ACEOF #define BMBYTES $BMBYTES _ACEOF -{ echo "$as_me:$LINENO: result: unsigned $BMTYPE, size = $BMBYTES" >&5 -echo "${ECHO_T}unsigned $BMTYPE, size = $BMBYTES" >&6; } -{ echo "$as_me:$LINENO: checking for stropts.h and isastream()" >&5 -echo $ECHO_N "checking for stropts.h and isastream()... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: result: unsigned $BMTYPE, size = $BMBYTES" >&5 +$as_echo "unsigned $BMTYPE, size = $BMBYTES" >&6; } +{ $as_echo "$as_me:$LINENO: checking for stropts.h and isastream()" >&5 +$as_echo_n "checking for stropts.h and isastream()... " >&6; } if test "${xdvi_cv_sys_streams+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7169,31 +7880,35 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then xdvi_cv_sys_streams=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 xdvi_cv_sys_streams=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $xdvi_cv_sys_streams" >&5 -echo "${ECHO_T}$xdvi_cv_sys_streams" >&6; } +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_sys_streams" >&5 +$as_echo "$xdvi_cv_sys_streams" >&6; } if test $xdvi_cv_sys_streams = yes; then cat >>confdefs.h <<\_ACEOF @@ -7201,10 +7916,10 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi -{ echo "$as_me:$LINENO: checking for SunOS 4" >&5 -echo $ECHO_N "checking for SunOS 4... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for SunOS 4" >&5 +$as_echo_n "checking for SunOS 4... " >&6; } if test "${xdvi_cv_sys_sunos_4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else case "`(uname -sr) 2>/dev/null`" in "SunOS 4."*) @@ -7212,8 +7927,8 @@ else *) xdvi_cv_sys_sunos_4=no ;; esac fi -{ echo "$as_me:$LINENO: result: $xdvi_cv_sys_sunos_4" >&5 -echo "${ECHO_T}$xdvi_cv_sys_sunos_4" >&6; } +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_sys_sunos_4" >&5 +$as_echo "$xdvi_cv_sys_sunos_4" >&6; } if test $xdvi_cv_sys_sunos_4 = yes; then cat >>confdefs.h <<\_ACEOF @@ -7221,10 +7936,10 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi -{ echo "$as_me:$LINENO: checking for certain old versions of Linux" >&5 -echo $ECHO_N "checking for certain old versions of Linux... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for certain old versions of Linux" >&5 +$as_echo_n "checking for certain old versions of Linux... " >&6; } if test "${xdvi_cv_sys_old_linux+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else case "`(uname -sr) 2>/dev/null`" in "Linux 2."[01].* | "Linux 2.2."[0-8] | "Linux 2.2."[0-8]-*) @@ -7232,8 +7947,8 @@ else *) xdvi_cv_sys_old_linux=no ;; esac fi -{ echo "$as_me:$LINENO: result: $xdvi_cv_sys_old_linux" >&5 -echo "${ECHO_T}$xdvi_cv_sys_old_linux" >&6; } +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_sys_old_linux" >&5 +$as_echo "$xdvi_cv_sys_old_linux" >&6; } if test $xdvi_cv_sys_old_linux = yes; then cat >>confdefs.h <<\_ACEOF @@ -7241,10 +7956,10 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi -{ echo "$as_me:$LINENO: checking for poll.h and poll()" >&5 -echo $ECHO_N "checking for poll.h and poll()... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for poll.h and poll()" >&5 +$as_echo_n "checking for poll.h and poll()... " >&6; } if test "${xdvi_cv_func_poll+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7268,31 +7983,35 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then xdvi_cv_func_poll=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 xdvi_cv_func_poll=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $xdvi_cv_func_poll" >&5 -echo "${ECHO_T}$xdvi_cv_func_poll" >&6; } +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_func_poll" >&5 +$as_echo "$xdvi_cv_func_poll" >&6; } if test $xdvi_cv_func_poll = yes; then cat >>confdefs.h <<\_ACEOF @@ -7304,20 +8023,21 @@ else for ac_header in sys/select.h select.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } else # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7333,32 +8053,33 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } # Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7372,69 +8093,72 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -7452,8 +8176,8 @@ else fi - { echo "$as_me:$LINENO: checking what warning flags to pass to the C compiler" >&5 -echo $ECHO_N "checking what warning flags to pass to the C compiler... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking what warning flags to pass to the C compiler" >&5 +$as_echo_n "checking what warning flags to pass to the C compiler... " >&6; } warnCFLAGS= if test "x$GCC" != xyes; then enable_compiler_warnings=no @@ -7476,8 +8200,8 @@ echo $ECHO_N "checking what warning flags to pass to the C compiler... $ECHO_C" fi fi fi - { echo "$as_me:$LINENO: result: $warnCFLAGS" >&5 -echo "${ECHO_T}$warnCFLAGS" >&6; } + { $as_echo "$as_me:$LINENO: result: $warnCFLAGS" >&5 +$as_echo "$warnCFLAGS" >&6; } ### FIXME: if we restrict setting the flags to this case only, they will get overridden ### somehwere else further up in the configure process. @@ -7490,10 +8214,10 @@ echo "${ECHO_T}$warnCFLAGS" >&6; } fi -{ echo "$as_me:$LINENO: checking whether linker supports the --allow-multiple-definition flag" >&5 -echo $ECHO_N "checking whether linker supports the --allow-multiple-definition flag... $ECHO_C" >&6; } -if test "${xdvi_linker_multiple_defns+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking whether linker supports the --allow-multiple-definition flag" >&5 +$as_echo_n "checking whether linker supports the --allow-multiple-definition flag... " >&6; } +if test "${xdvi_cv_linker_multiple_defns+set}" = set; then + $as_echo_n "(cached) " >&6 else xdvi_save_LDFLAGS="$LDFLAGS" LDFLAGS="-Xlinker --allow-multiple-definition" @@ -7521,34 +8245,38 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - xdvi_linker_multiple_defns=yes + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + xdvi_cv_linker_multiple_defns=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - xdvi_linker_multiple_defns=no + xdvi_cv_linker_multiple_defns=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $xdvi_linker_multiple_defns" >&5 -echo "${ECHO_T}$xdvi_linker_multiple_defns" >&6; } -if test $xdvi_linker_multiple_defns = yes; then +{ $as_echo "$as_me:$LINENO: result: $xdvi_cv_linker_multiple_defns" >&5 +$as_echo "$xdvi_cv_linker_multiple_defns" >&6; } +if test $xdvi_cv_linker_multiple_defns = yes; then x_linker_options="-Xlinker --allow-multiple-definition" LDFLAGS="$xdvi_save_LDFLAGS" @@ -7569,8 +8297,8 @@ else CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" - { echo "$as_me:$LINENO: checking whether linker supports multiple definitions by default" >&5 -echo $ECHO_N "checking whether linker supports multiple definitions by default... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking whether linker supports multiple definitions by default" >&5 +$as_echo_n "checking whether linker supports multiple definitions by default... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7606,41 +8334,45 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - xdvi_linker_multiple_defns=yes + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + xdvi_cv_linker_multiple_defns=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - xdvi_linker_multiple_defns=no + xdvi_cv_linker_multiple_defns=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext - if test $xdvi_linker_multiple_defns = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + if test $xdvi_cv_linker_multiple_defns = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF #define LD_ALLOWS_MULTIPLE_DEFINITIONS 1 _ACEOF else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - { echo "$as_me:$LINENO: WARNING: Linker does not allow multiple definitions. + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:$LINENO: WARNING: Linker does not allow multiple definitions. ***************************************************************** * Warning: Your linker does not allow multiple definitions. * * This does not make xdvik unusable, but it will cause problems * @@ -7648,7 +8380,7 @@ echo "${ECHO_T}no" >&6; } * tooltips, statusline messages and hyperlink location markers * * will not be updated until the mouse is moved. * *****************************************************************" >&5 -echo "$as_me: WARNING: Linker does not allow multiple definitions. +$as_echo "$as_me: WARNING: Linker does not allow multiple definitions. ***************************************************************** * Warning: Your linker does not allow multiple definitions. * * This does not make xdvik unusable, but it will cause problems * @@ -7665,22 +8397,24 @@ fi -for ac_header in stdint.h + +for ac_header in stdint.h inttypes.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } else # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7696,32 +8430,33 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } # Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7735,96 +8470,130 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done - -{ echo "$as_me:$LINENO: checking for uint32_t" >&5 -echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for uint32_t" >&5 +$as_echo_n "checking for uint32_t... " >&6; } if test "${ac_cv_type_uint32_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_cv_type_uint32_t=no +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef uint32_t ac__type_new_; int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) +if (sizeof (uint32_t)) + return 0; + ; return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((uint32_t))) + return 0; ; return 0; } @@ -7835,29 +8604,38 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_uint32_t=yes + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_uint32_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_uint32_t=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 -echo "${ECHO_T}$ac_cv_type_uint32_t" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 +$as_echo "$ac_cv_type_uint32_t" >&6; } if test $ac_cv_type_uint32_t = yes; then : else @@ -7895,11 +8673,11 @@ for ac_func in mkstemp memcpy strerror waitpid sigaction strchr setenv ulltostr iconv nl_langinfo \ lstat ftruncate snprintf vsnprintf realpath do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7952,35 +8730,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then eval "$as_ac_var=yes" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -7997,20 +8781,21 @@ done for ac_header in netdb.h sys/bsdtypes.h sys/param.h unistd.h sys/fcntl.h regex.h iconv.h langinfo.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } else # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8026,32 +8811,33 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } # Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8065,69 +8851,72 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -8140,22 +8929,24 @@ CPPFLAGS="$CPPFLAGS $X_CFLAGS" -for ac_header in X11/Xosdefs.h X11/xpm.h Xm/XpmP.h + +for ac_header in X11/Intrinsic.h X11/Xosdefs.h X11/xpm.h Xm/XpmP.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } else # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8171,32 +8962,33 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } # Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8210,69 +9002,72 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -8284,154 +9079,14 @@ CPPFLAGS=$cppflags_save cppflags_save=$CPPFLAGS CPPFLAGS="$CPPFLAGS $X_CFLAGS" -for ac_header in X11/Intrinsic.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - for ac_header in X11/Xmu/Editres.h X11/Xmu/Xmu.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -8439,6 +9094,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #ifdef HAVE_X11_INTRINSIC_H # include #endif @@ -8452,20 +9108,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -8473,12 +9130,14 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF x_xmu_lib=-lXmu else @@ -8496,9 +9155,9 @@ CPPFLAGS=$cppflags_save # Check whether --with-x-toolkit was given. if test "${with_x_toolkit+set}" = set; then withval=$with_x_toolkit; - { echo "$as_me:$LINENO: WARNING: the --with-x-toolkit option is obsolete; please use --with-mf-x-toolkit + { $as_echo "$as_me:$LINENO: WARNING: the --with-x-toolkit option is obsolete; please use --with-mf-x-toolkit and/or --with-xdvi-x-toolkit instead. (Assuming default toolkit.)" >&5 -echo "$as_me: WARNING: the --with-x-toolkit option is obsolete; please use --with-mf-x-toolkit +$as_echo "$as_me: WARNING: the --with-x-toolkit option is obsolete; please use --with-mf-x-toolkit and/or --with-xdvi-x-toolkit instead. (Assuming default toolkit.)" >&2;} with_xdvi_x_toolkit=yes with_mf_x_toolkit=yes @@ -8507,6 +9166,30 @@ fi +# Check for toolkit options. This used to be --with-x-toolkit, but was changed +# to remove clashes with metafont which accepts different values. +# We allow `yes' as synonym for the default toolkit, for easier communication +# with ../kpathsea/xt.ac. + +# Check whether --with-xdvi-x-toolkit was given. +if test "${with_xdvi_x_toolkit+set}" = set; then + withval=$with_xdvi_x_toolkit; case "${withval}" in + next | nextaw | neXtaw ) val=neXtaw ;; + xaw3d ) val=xaw3d ;; + x | xa | xaw ) val=xaw ;; + y | ye | yes ) val=yes ;; + m | mo | mot | moti | motif ) val=motif ;; + * ) +{ $as_echo "$as_me:$LINENO: WARNING: unknown --with-xdvi-x-toolkit argument \`$withval'; using xaw." >&5 +$as_echo "$as_me: WARNING: unknown --with-xdvi-x-toolkit argument \`$withval'; using xaw." >&2;} + val=xaw;; + esac + with_xdvi_x_toolkit=$val + +fi + + + # Check if the user wants to use Ghostscript, DPS or NeWS to # display PostScript. @@ -8517,8 +9200,8 @@ if test "${with_ps+set}" = set; then no) PS_DEF=no;; dps) PS_DEF="$PS_DEF -DPS_DPS";; news) PS_DEF="$PS_DEF -DPS_NEWS";; - *) { echo "$as_me:$LINENO: WARNING: Unknown --with-ps argument \`$withval'; using gs." >&5 -echo "$as_me: WARNING: Unknown --with-ps argument \`$withval'; using gs." >&2;};; + *) { $as_echo "$as_me:$LINENO: WARNING: Unknown --with-ps argument \`$withval'; using gs." >&5 +$as_echo "$as_me: WARNING: Unknown --with-ps argument \`$withval'; using gs." >&2;};; esac fi @@ -8669,32 +9352,12 @@ _ACEOF echo "ImageMagick version too old - ImageMagick support disabled" fi else - echo "Can't run 'Magick-config' - ImageMagick support disabled" - fi -fi -fi - - - - - - - -# Check whether --with-xdvi-x-toolkit was given. -if test "${with_xdvi_x_toolkit+set}" = set; then - withval=$with_xdvi_x_toolkit; case "${withval}" in - next | nextaw | neXtaw ) val=neXtaw ;; - xaw3d ) val=xaw3d ;; - x | xa | xaw ) val=xaw ;; - m | mo | mot | moti | motif ) val=motif ;; - * ) -{ echo "$as_me:$LINENO: WARNING: unknown --with-xdvi-x-toolkit argument \`$withval'; using xaw." >&5 -echo "$as_me: WARNING: unknown --with-xdvi-x-toolkit argument \`$withval'; using xaw." >&2;} - val=xaw;; - esac - with_xdvi_x_toolkit=$val - + echo "Can't run 'Magick-config' - ImageMagick support disabled" + fi fi +fi + + @@ -8745,10 +9408,10 @@ else CPPFLAGS="$CPPFLAGS $EXTRA_LIBT1_INCLUDE" if test "$with_system_t1lib" = yes; then - { echo "$as_me:$LINENO: checking for T1_AddFont in -lt1" >&5 -echo $ECHO_N "checking for T1_AddFont in -lt1... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for T1_AddFont in -lt1" >&5 +$as_echo_n "checking for T1_AddFont in -lt1... " >&6; } if test "${ac_cv_lib_t1_T1_AddFont+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lt1 -lz -lm $LIBS" @@ -8780,37 +9443,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_t1_T1_AddFont=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_t1_T1_AddFont=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_t1_T1_AddFont" >&5 -echo "${ECHO_T}$ac_cv_lib_t1_T1_AddFont" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_t1_T1_AddFont" >&5 +$as_echo "$ac_cv_lib_t1_T1_AddFont" >&6; } if test $ac_cv_lib_t1_T1_AddFont = yes; then t1lib=-lt1 else - { echo "$as_me:$LINENO: WARNING: Standard T1 library not found. Compiling my own." >&5 -echo "$as_me: WARNING: Standard T1 library not found. Compiling my own." >&2;} + { $as_echo "$as_me:$LINENO: WARNING: Standard T1 library not found. Compiling my own." >&5 +$as_echo "$as_me: WARNING: Standard T1 library not found. Compiling my own." >&2;} with_system_t1lib=no fi @@ -8818,8 +9485,8 @@ fi LIBS="-lt1 -lm $LIBS" if test "$with_system_t1lib" = yes; then - { echo "$as_me:$LINENO: checking whether installed T1 lib is >= v 5.0.0 " >&5 -echo $ECHO_N "checking whether installed T1 lib is >= v 5.0.0 ... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking whether installed T1 lib is >= v 5.0.0 " >&5 +$as_echo_n "checking whether installed T1 lib is >= v 5.0.0 ... " >&6; } if test "$cross_compiling" = yes; then ac_compile_t1lib=1 @@ -8866,39 +9533,42 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compile_t1lib=0 else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_compile_t1lib=1 fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test $ac_compile_t1lib = 0; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } else - { echo "$as_me:$LINENO: result: no, will compile my own version" >&5 -echo "${ECHO_T}no, will compile my own version" >&6; } + { $as_echo "$as_me:$LINENO: result: no, will compile my own version" >&5 +$as_echo "no, will compile my own version" >&6; } with_system_t1lib=no fi fi @@ -8928,8 +9598,8 @@ fi if test "${with_xdvi_x_toolkit}" = xaw; then - { echo "$as_me:$LINENO: checking for Xaw library" >&5 -echo $ECHO_N "checking for Xaw library... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for Xaw library" >&5 +$as_echo_n "checking for Xaw library... " >&6; } save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat >conftest.$ac_ext <<_ACEOF @@ -8963,20 +9633,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then xdvi_have_xaw=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 xdvi_have_xaw=no @@ -8986,18 +9657,18 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS=$save_CPPFLAGS if test $xdvi_have_xaw = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } else - { echo "$as_me:$LINENO: result: not found" >&5 -echo "${ECHO_T}not found" >&6; } - { { echo "$as_me:$LINENO: error: Sorry, you will need at least the Xaw header/library files to compile xdvik." >&5 -echo "$as_me: error: Sorry, you will need at least the Xaw header/library files to compile xdvik." >&2;} + { $as_echo "$as_me:$LINENO: result: not found" >&5 +$as_echo "not found" >&6; } + { { $as_echo "$as_me:$LINENO: error: Sorry, you will need at least the Xaw header/library files to compile xdvik." >&5 +$as_echo "$as_me: error: Sorry, you will need at least the Xaw header/library files to compile xdvik." >&2;} { (exit 1); exit 1; }; } fi - { echo "$as_me:$LINENO: checking version of Xaw library" >&5 -echo $ECHO_N "checking version of Xaw library... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking version of Xaw library" >&5 +$as_echo_n "checking version of Xaw library... " >&6; } save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat >conftest.$ac_ext <<_ACEOF @@ -9148,20 +9819,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then xdvi_old_xaw=no else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 xdvi_old_xaw=yes @@ -9171,22 +9843,22 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS=$save_CPPFLAGS if test $xdvi_old_xaw = yes; then - { echo "$as_me:$LINENO: result: old" >&5 -echo "${ECHO_T}old" >&6; } + { $as_echo "$as_me:$LINENO: result: old" >&5 +$as_echo "old" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_OLD_XAW 1 _ACEOF else - { echo "$as_me:$LINENO: result: current" >&5 -echo "${ECHO_T}current" >&6; } + { $as_echo "$as_me:$LINENO: result: current" >&5 +$as_echo "current" >&6; } fi fi -{ echo "$as_me:$LINENO: checking if nl_langinfo(CODESET) is working" >&5 -echo $ECHO_N "checking if nl_langinfo(CODESET) is working... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking if nl_langinfo(CODESET) is working" >&5 +$as_echo_n "checking if nl_langinfo(CODESET) is working... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9208,34 +9880,38 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_NL_LANGINFO_CODESET 1 _ACEOF - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext @@ -9245,10 +9921,10 @@ if test -z "$x_ext_lib"; then # allow envvar override else XLFLAG= fi - { echo "$as_me:$LINENO: checking for XpQueryVersion in -lXp" >&5 -echo $ECHO_N "checking for XpQueryVersion in -lXp... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for XpQueryVersion in -lXp" >&5 +$as_echo_n "checking for XpQueryVersion in -lXp... " >&6; } if test "${ac_cv_lib_Xp_XpQueryVersion+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXp -lXext -lX11 $X_EXTRA_LIBS $XLFLAG $LIBS" @@ -9280,32 +9956,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_Xp_XpQueryVersion=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xp_XpQueryVersion=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xp_XpQueryVersion" >&5 -echo "${ECHO_T}$ac_cv_lib_Xp_XpQueryVersion" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xp_XpQueryVersion" >&5 +$as_echo "$ac_cv_lib_Xp_XpQueryVersion" >&6; } if test $ac_cv_lib_Xp_XpQueryVersion = yes; then x_ext_lib="-lXp -lXext" else @@ -9319,10 +9999,10 @@ if test -z "$x_ext_lib"; then # previous test unsuccessful, or envvar override else XLFLAG= fi - { echo "$as_me:$LINENO: checking for XextCreateExtension in -lXext" >&5 -echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for XextCreateExtension in -lXext" >&5 +$as_echo_n "checking for XextCreateExtension in -lXext... " >&6; } if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXext -lX11 $X_EXTRA_LIBS $XLFLAG $LIBS" @@ -9354,32 +10034,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_Xext_XextCreateExtension=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xext_XextCreateExtension=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 -echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 +$as_echo "$ac_cv_lib_Xext_XextCreateExtension" >&6; } if test $ac_cv_lib_Xext_XextCreateExtension = yes; then x_ext_lib=-lXext else @@ -9417,8 +10101,8 @@ if test "${with_xpm_libraries+set}" = set; then withval=$with_xpm_libraries; xpm_libraries="$withval" fi -{ echo "$as_me:$LINENO: checking for Xpm" >&5 -echo $ECHO_N "checking for Xpm... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for Xpm" >&5 +$as_echo_n "checking for Xpm... " >&6; } # # # Search the include files. XPM can either be in (as in X11R6), @@ -9427,7 +10111,7 @@ echo $ECHO_N "checking for Xpm... $ECHO_C" >&6; } # if test "$xpm_includes" = ""; then if test "${xdvi_cv_xpm_includes+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else xdvi_xpm_save_LIBS="$LIBS" @@ -9463,13 +10147,14 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9479,7 +10164,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 xdvi_cv_xpm_includes="default" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -9550,7 +10235,7 @@ fi # if test "$xpm_libraries" = ""; then if test "${xdvi_cv_xpm_libraries+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else xdvi_xpm_save_LIBS="$LIBS" @@ -9591,24 +10276,27 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then # libxpm.a is in the standard search path. xdvi_cv_xpm_libraries="default" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -9637,6 +10325,7 @@ done fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # @@ -9705,8 +10394,8 @@ _ACEOF fi -{ echo "$as_me:$LINENO: result: libraries $xpm_libraries_result, headers $xpm_includes_result" >&5 -echo "${ECHO_T}libraries $xpm_libraries_result, headers $xpm_includes_result" >&6; } +{ $as_echo "$as_me:$LINENO: result: libraries $xpm_libraries_result, headers $xpm_includes_result" >&5 +$as_echo "libraries $xpm_libraries_result, headers $xpm_includes_result" >&6; } prog_extension="xaw" @@ -9737,15 +10426,15 @@ default_toolkit="none" motif_include=""$motif_include"" motif_libdir=""$motif_libdir"" -{ echo "$as_me:$LINENO: checking for Motif" >&5 -echo $ECHO_N "checking for Motif... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for Motif" >&5 +$as_echo_n "checking for Motif... " >&6; } # # # Search the include files. # if test "$motif_include" = ""; then if test "${xdvi_cv_motif_include+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else xdvi_motif_save_LIBS="$LIBS" @@ -9779,13 +10468,14 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9795,7 +10485,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 xdvi_cv_motif_include= else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -9842,7 +10532,7 @@ fi # if test "$motif_libdir" = ""; then if test "${xdvi_cv_motif_libdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else xdvi_motif_save_LIBS="$LIBS" @@ -9880,24 +10570,27 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then # libXm.a is in the standard search path. xdvi_cv_motif_libdir= else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -9929,6 +10622,7 @@ fi fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # @@ -9987,17 +10681,97 @@ if test "$motif_include_result" = "no"; then fi if test "$motif_include_result" != "" && test "$motif_libdir_result" != ""; then - { echo "$as_me:$LINENO: result: libraries $motif_libdir_result, headers $motif_include_result" >&5 -echo "${ECHO_T}libraries $motif_libdir_result, headers $motif_include_result" >&6; } + { $as_echo "$as_me:$LINENO: result: libraries $motif_libdir_result, headers $motif_include_result" >&5 +$as_echo "libraries $motif_libdir_result, headers $motif_include_result" >&6; } prog_extension="motif" cat >>confdefs.h <<\_ACEOF #define MOTIF 1 _ACEOF x_tool_libs="-lXm" + # now warn if we're using LessTif (see LESSTIF-BUGS for why ...) + { $as_echo "$as_me:$LINENO: checking for LessTif" >&5 +$as_echo_n "checking for LessTif... " >&6; } + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + #include + #include + #include + #include + #include +int +main () +{ +const char *p = LesstifVERSION_STRING; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + # yes, we're running LessTif + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:$LINENO: WARNING: LessTif header detected. + ***************************************************************** + * Warning: You are using LessTif instead of OpenMotif. * + * Some GUI elements might be broken; please see the file * + * * + * texk/xdvik/LESSTIF-BUGS * + * * + * for more information. * + *****************************************************************" >&5 +$as_echo "$as_me: WARNING: LessTif header detected. + ***************************************************************** + * Warning: You are using LessTif instead of OpenMotif. * + * Some GUI elements might be broken; please see the file * + * * + * texk/xdvik/LESSTIF-BUGS * + * * + * for more information. * + *****************************************************************" >&2;} + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + # no, not running LessTif + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - { echo "$as_me:$LINENO: result: not found, using Xaw" >&5 -echo "${ECHO_T}not found, using Xaw" >&6; } + { $as_echo "$as_me:$LINENO: result: not found, using Xaw" >&5 +$as_echo "not found, using Xaw" >&6; } prog_extension="xaw" cat >>confdefs.h <<\_ACEOF #define XAW 1 @@ -10007,8 +10781,8 @@ _ACEOF fi # -{ echo "$as_me:$LINENO: checking whether to compile in panner (requires Xaw)" >&5 -echo $ECHO_N "checking whether to compile in panner (requires Xaw)... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether to compile in panner (requires Xaw)" >&5 +$as_echo_n "checking whether to compile in panner (requires Xaw)... " >&6; } save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat >conftest.$ac_ext <<_ACEOF @@ -10043,20 +10817,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then xdvi_use_xaw_panner=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 xdvi_use_xaw_panner=no @@ -10066,16 +10841,16 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS=$save_CPPFLAGS if test $xdvi_use_xaw_panner = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF #define USE_XAW_PANNER 1 _ACEOF else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi elif test "x$with_xdvi_x_toolkit" = xxaw; then @@ -10092,15 +10867,15 @@ default_toolkit="Xaw" motif_include=""$motif_include"" motif_libdir=""$motif_libdir"" -{ echo "$as_me:$LINENO: checking for Motif" >&5 -echo $ECHO_N "checking for Motif... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for Motif" >&5 +$as_echo_n "checking for Motif... " >&6; } # # # Search the include files. # if test "$motif_include" = ""; then if test "${xdvi_cv_motif_include+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else xdvi_motif_save_LIBS="$LIBS" @@ -10134,13 +10909,14 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10150,7 +10926,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 xdvi_cv_motif_include= else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -10197,7 +10973,7 @@ fi # if test "$motif_libdir" = ""; then if test "${xdvi_cv_motif_libdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else xdvi_motif_save_LIBS="$LIBS" @@ -10235,24 +11011,27 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then # libXm.a is in the standard search path. xdvi_cv_motif_libdir= else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -10284,6 +11063,7 @@ fi fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # @@ -10342,17 +11122,97 @@ if test "$motif_include_result" = "no"; then fi if test "$motif_include_result" != "" && test "$motif_libdir_result" != ""; then - { echo "$as_me:$LINENO: result: libraries $motif_libdir_result, headers $motif_include_result" >&5 -echo "${ECHO_T}libraries $motif_libdir_result, headers $motif_include_result" >&6; } + { $as_echo "$as_me:$LINENO: result: libraries $motif_libdir_result, headers $motif_include_result" >&5 +$as_echo "libraries $motif_libdir_result, headers $motif_include_result" >&6; } prog_extension="motif" cat >>confdefs.h <<\_ACEOF #define MOTIF 1 _ACEOF x_tool_libs="-lXm" + # now warn if we're using LessTif (see LESSTIF-BUGS for why ...) + { $as_echo "$as_me:$LINENO: checking for LessTif" >&5 +$as_echo_n "checking for LessTif... " >&6; } + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + #include + #include + #include + #include + #include +int +main () +{ +const char *p = LesstifVERSION_STRING; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + # yes, we're running LessTif + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:$LINENO: WARNING: LessTif header detected. + ***************************************************************** + * Warning: You are using LessTif instead of OpenMotif. * + * Some GUI elements might be broken; please see the file * + * * + * texk/xdvik/LESSTIF-BUGS * + * * + * for more information. * + *****************************************************************" >&5 +$as_echo "$as_me: WARNING: LessTif header detected. + ***************************************************************** + * Warning: You are using LessTif instead of OpenMotif. * + * Some GUI elements might be broken; please see the file * + * * + * texk/xdvik/LESSTIF-BUGS * + * * + * for more information. * + *****************************************************************" >&2;} + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + # no, not running LessTif + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - { echo "$as_me:$LINENO: result: not found, using Xaw" >&5 -echo "${ECHO_T}not found, using Xaw" >&6; } + { $as_echo "$as_me:$LINENO: result: not found, using Xaw" >&5 +$as_echo "not found, using Xaw" >&6; } prog_extension="xaw" cat >>confdefs.h <<\_ACEOF #define XAW 1 @@ -10362,8 +11222,8 @@ _ACEOF fi # -{ echo "$as_me:$LINENO: checking whether to compile in panner (requires Xaw)" >&5 -echo $ECHO_N "checking whether to compile in panner (requires Xaw)... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether to compile in panner (requires Xaw)" >&5 +$as_echo_n "checking whether to compile in panner (requires Xaw)... " >&6; } save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat >conftest.$ac_ext <<_ACEOF @@ -10398,20 +11258,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then xdvi_use_xaw_panner=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 xdvi_use_xaw_panner=no @@ -10421,16 +11282,16 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS=$save_CPPFLAGS if test $xdvi_use_xaw_panner = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF #define USE_XAW_PANNER 1 _ACEOF else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi fi @@ -10450,10 +11311,10 @@ else iconv_libpath= iconv_libs= -{ echo "$as_me:$LINENO: checking for iconv_open in -liconv" >&5 -echo $ECHO_N "checking for iconv_open in -liconv... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for iconv_open in -liconv" >&5 +$as_echo_n "checking for iconv_open in -liconv... " >&6; } if test "${ac_cv_lib_iconv_iconv_open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liconv $LIBS" @@ -10485,39 +11346,43 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_iconv_iconv_open=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_iconv_iconv_open=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv_open" >&5 -echo "${ECHO_T}$ac_cv_lib_iconv_iconv_open" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv_open" >&5 +$as_echo "$ac_cv_lib_iconv_iconv_open" >&6; } if test $ac_cv_lib_iconv_iconv_open = yes; then iconv_libs=-liconv else - { echo "$as_me:$LINENO: checking for libiconv_open in -liconv" >&5 -echo $ECHO_N "checking for libiconv_open in -liconv... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for libiconv_open in -liconv" >&5 +$as_echo_n "checking for libiconv_open in -liconv... " >&6; } if test "${ac_cv_lib_iconv_libiconv_open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liconv $LIBS" @@ -10549,32 +11414,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_iconv_libiconv_open=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_iconv_libiconv_open=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv_open" >&5 -echo "${ECHO_T}$ac_cv_lib_iconv_libiconv_open" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv_open" >&5 +$as_echo "$ac_cv_lib_iconv_libiconv_open" >&6; } if test $ac_cv_lib_iconv_libiconv_open = yes; then iconv_libs=-liconv else @@ -10624,10 +11493,10 @@ if test -z "$CXX"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. @@ -10640,7 +11509,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10651,11 +11520,11 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6; } + { $as_echo "$as_me:$LINENO: result: $CXX" >&5 +$as_echo "$CXX" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -10668,10 +11537,10 @@ if test -z "$CXX"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. @@ -10684,7 +11553,7 @@ do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10695,11 +11564,11 @@ fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6; } + { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi @@ -10711,10 +11580,10 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; @@ -10726,43 +11595,47 @@ fi fi fi # Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` +$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10788,20 +11661,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no @@ -10811,15 +11685,19 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } -GXX=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS -{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes @@ -10846,20 +11724,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" @@ -10884,20 +11763,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag @@ -10923,20 +11803,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -10951,8 +11832,8 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then @@ -10992,14 +11873,14 @@ LIBS="$LIBS $iconv_libs" CXXFLAGS="$CXXFLAGS $iconv_includes" LDFLAGS="$LDFLAGS $iconv_libpath" # -{ echo "$as_me:$LINENO: checking for iconv input type" >&5 -echo $ECHO_N "checking for iconv input type... $ECHO_C" >&6; } -if test "${xdvi_iconv_char_pptr_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:$LINENO: checking for iconv input type" >&5 +$as_echo_n "checking for iconv input type... " >&6; } +if test "${xdvi_cv_iconv_char_pptr_type+set}" = set; then + $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # `correct' default for cross-compiling ... -xdvi_iconv_char_pptr_type="char_pptr" +xdvi_cv_iconv_char_pptr_type="char_pptr" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11072,29 +11953,32 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - xdvi_iconv_char_pptr_type="char_pptr" + xdvi_cv_iconv_char_pptr_type="char_pptr" else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -xdvi_iconv_char_pptr_type="const_char_pptr" +xdvi_cv_iconv_char_pptr_type="const_char_pptr" fi +rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -11106,21 +11990,21 @@ LIBS="$xdvi_iconv_save_libs" CXXFLAGS="$xdvi_iconv_save_cxxflags" LDFLAGS="$xdvi_iconv_save_ldflags" # -if test $xdvi_iconv_char_pptr_type = "const_char_pptr"; then +if test $xdvi_cv_iconv_char_pptr_type = "const_char_pptr"; then cat >>confdefs.h <<\_ACEOF #define ICONV_CHAR_PPTR_TYPE const char ** _ACEOF - { echo "$as_me:$LINENO: result: const char **" >&5 -echo "${ECHO_T}const char **" >&6; } + { $as_echo "$as_me:$LINENO: result: const char **" >&5 +$as_echo "const char **" >&6; } else cat >>confdefs.h <<\_ACEOF #define ICONV_CHAR_PPTR_TYPE char ** _ACEOF - { echo "$as_me:$LINENO: result: char **" >&5 -echo "${ECHO_T}char **" >&6; } + { $as_echo "$as_me:$LINENO: result: char **" >&5 +$as_echo "char **" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -11132,7 +12016,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu my_program_transform_name=`echo $program_transform_name | sed 's,\\$\\$,$,g' | sed 's,\\\\\\\\,\\\\,g'` -exec_name="xdvi-$prog_extension.bin" +exec_name="xdvi-$prog_extension" final_exec_name=`echo $exec_name | sed "$my_program_transform_name"` wrapper_script=`echo xdvi | sed "$my_program_transform_name"` @@ -11145,13 +12029,13 @@ test "$PS_DEF" = no && PS_DEF= if echo "$PS_DEF" | grep PS_DPS >/dev/null; then if test "`(uname) 2>/dev/null`" = SunOS \ && uname -r | grep '^5' >/dev/null; then - { echo "$as_me:$LINENO: result: adding DPS includes and libraries for Solaris" >&5 -echo "${ECHO_T}adding DPS includes and libraries for Solaris" >&6; } + { $as_echo "$as_me:$LINENO: result: adding DPS includes and libraries for Solaris" >&5 +$as_echo "adding DPS includes and libraries for Solaris" >&6; } X_CFLAGS="$X_CFLAGS -I/usr/openwin/include/X11" - { echo "$as_me:$LINENO: checking for isinf in -lsunmath" >&5 -echo $ECHO_N "checking for isinf in -lsunmath... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for isinf in -lsunmath" >&5 +$as_echo_n "checking for isinf in -lsunmath... " >&6; } if test "${ac_cv_lib_sunmath_isinf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsunmath $LIBS" @@ -11183,32 +12067,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_sunmath_isinf=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_sunmath_isinf=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_sunmath_isinf" >&5 -echo "${ECHO_T}$ac_cv_lib_sunmath_isinf" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_sunmath_isinf" >&5 +$as_echo "$ac_cv_lib_sunmath_isinf" >&6; } if test $ac_cv_lib_sunmath_isinf = yes; then ac_sunmath=-lsunmath else @@ -11219,11 +12107,11 @@ fi for ac_func in isinf do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11276,35 +12164,41 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then eval "$as_ac_var=yes" else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if test `eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -11313,20 +12207,21 @@ done for ac_header in ieeefp.h do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } else # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -11342,32 +12237,33 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } # Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -11381,69 +12277,72 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -11451,13 +12350,13 @@ fi done else - { echo "$as_me:$LINENO: result: adding DPS includes and libraries for SunOS 4.x" >&5 -echo "${ECHO_T}adding DPS includes and libraries for SunOS 4.x" >&6; } + { $as_echo "$as_me:$LINENO: result: adding DPS includes and libraries for SunOS 4.x" >&5 +$as_echo "adding DPS includes and libraries for SunOS 4.x" >&6; } X_LIBS="$X_LIBS -ldps" fi elif echo "$PS_DEF" | grep PS_NEWS >/dev/null; then - { echo "$as_me:$LINENO: result: adding NeWS libraries" >&5 -echo "${ECHO_T}adding NeWS libraries" >&6; } + { $as_echo "$as_me:$LINENO: result: adding NeWS libraries" >&5 +$as_echo "adding NeWS libraries" >&6; } X_LIBS="$X_LIBS -lxview -lcps -lolgx -lxvps" fi @@ -11499,17 +12398,17 @@ fi PS_DEF="$PS_DEF $MAGICK_DEF" if echo "$PS_DEF" | grep MAGICK >/dev/null; then - { echo "$as_me:$LINENO: result: adding ImageMagick libraries" >&5 -echo "${ECHO_T}adding ImageMagick libraries" >&6; } + { $as_echo "$as_me:$LINENO: result: adding ImageMagick libraries" >&5 +$as_echo "adding ImageMagick libraries" >&6; } X_EXTRA_LIBS="$X_EXTRA_LIBS `Magick-config --libs`" fi # needed for web2c later than 7.3.4: -{ echo "$as_me:$LINENO: checking for main in -lm" >&5 -echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for main in -lm" >&5 +$as_echo_n "checking for main in -lm... " >&6; } if test "${ac_cv_lib_m_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" @@ -11535,32 +12434,36 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_m_main=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_main=no fi +rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5 -echo "${ECHO_T}$ac_cv_lib_m_main" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5 +$as_echo "$ac_cv_lib_m_main" >&6; } if test $ac_cv_lib_m_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 @@ -11570,10 +12473,10 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } +{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11645,20 +12548,21 @@ case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no @@ -11666,12 +12570,12 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6; } +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF -#define const +#define const /**/ _ACEOF fi @@ -11684,12 +12588,12 @@ if test "$cross_compiling" = yes; then if test -z "${BUILDCC}"; then BUILDCC='cc' fi - { echo "$as_me:$LINENO: result: setting \$BUILDCC to ${BUILDCC}" >&5 -echo "${ECHO_T}setting \$BUILDCC to ${BUILDCC}" >&6; } + { $as_echo "$as_me:$LINENO: result: setting \$BUILDCC to ${BUILDCC}" >&5 +$as_echo "setting \$BUILDCC to ${BUILDCC}" >&6; } else if test -n "${BUILDCC}"; then - { echo "$as_me:$LINENO: WARNING: \$BUILDCC set but not cross-compiling." >&5 -echo "$as_me: WARNING: \$BUILDCC set but not cross-compiling." >&2;} + { $as_echo "$as_me:$LINENO: WARNING: \$BUILDCC set but not cross-compiling." >&5 +$as_echo "$as_me: WARNING: \$BUILDCC set but not cross-compiling." >&2;} fi BUILDCC='$(CC)' fi @@ -11699,12 +12603,12 @@ if test "$cross_compiling" = yes; then if test -z "${BUILDCFLAGS}"; then BUILDCFLAGS='$(BUILDXCFLAGS)' fi - { echo "$as_me:$LINENO: result: setting \$BUILDCFLAGS to ${BUILDCFLAGS}" >&5 -echo "${ECHO_T}setting \$BUILDCFLAGS to ${BUILDCFLAGS}" >&6; } + { $as_echo "$as_me:$LINENO: result: setting \$BUILDCFLAGS to ${BUILDCFLAGS}" >&5 +$as_echo "setting \$BUILDCFLAGS to ${BUILDCFLAGS}" >&6; } else if test -n "${BUILDCFLAGS}"; then - { echo "$as_me:$LINENO: WARNING: \$BUILDCFLAGS set but not cross-compiling." >&5 -echo "$as_me: WARNING: \$BUILDCFLAGS set but not cross-compiling." >&2;} + { $as_echo "$as_me:$LINENO: WARNING: \$BUILDCFLAGS set but not cross-compiling." >&5 +$as_echo "$as_me: WARNING: \$BUILDCFLAGS set but not cross-compiling." >&2;} fi BUILDCFLAGS='$(CFLAGS)' fi @@ -11714,12 +12618,12 @@ if test "$cross_compiling" = yes; then if test -z "${BUILDCPPFLAGS}"; then BUILDCPPFLAGS='$(BUILDXCPPFLAGS)' fi - { echo "$as_me:$LINENO: result: setting \$BUILDCPPFLAGS to ${BUILDCPPFLAGS}" >&5 -echo "${ECHO_T}setting \$BUILDCPPFLAGS to ${BUILDCPPFLAGS}" >&6; } + { $as_echo "$as_me:$LINENO: result: setting \$BUILDCPPFLAGS to ${BUILDCPPFLAGS}" >&5 +$as_echo "setting \$BUILDCPPFLAGS to ${BUILDCPPFLAGS}" >&6; } else if test -n "${BUILDCPPFLAGS}"; then - { echo "$as_me:$LINENO: WARNING: \$BUILDCPPFLAGS set but not cross-compiling." >&5 -echo "$as_me: WARNING: \$BUILDCPPFLAGS set but not cross-compiling." >&2;} + { $as_echo "$as_me:$LINENO: WARNING: \$BUILDCPPFLAGS set but not cross-compiling." >&5 +$as_echo "$as_me: WARNING: \$BUILDCPPFLAGS set but not cross-compiling." >&2;} fi BUILDCPPFLAGS='$(CPPFLAGS)' fi @@ -11729,12 +12633,12 @@ if test "$cross_compiling" = yes; then if test -z "${BUILDLDFLAGS}"; then BUILDLDFLAGS='$(BUILDXLDFLAGS)' fi - { echo "$as_me:$LINENO: result: setting \$BUILDLDFLAGS to ${BUILDLDFLAGS}" >&5 -echo "${ECHO_T}setting \$BUILDLDFLAGS to ${BUILDLDFLAGS}" >&6; } + { $as_echo "$as_me:$LINENO: result: setting \$BUILDLDFLAGS to ${BUILDLDFLAGS}" >&5 +$as_echo "setting \$BUILDLDFLAGS to ${BUILDLDFLAGS}" >&6; } else if test -n "${BUILDLDFLAGS}"; then - { echo "$as_me:$LINENO: WARNING: \$BUILDLDFLAGS set but not cross-compiling." >&5 -echo "$as_me: WARNING: \$BUILDLDFLAGS set but not cross-compiling." >&2;} + { $as_echo "$as_me:$LINENO: WARNING: \$BUILDLDFLAGS set but not cross-compiling." >&5 +$as_echo "$as_me: WARNING: \$BUILDLDFLAGS set but not cross-compiling." >&2;} fi BUILDLDFLAGS='$(LDFLAGS)' fi @@ -11744,12 +12648,12 @@ if test "$cross_compiling" = yes; then if test -z "${BUILDCCLD}"; then BUILDCCLD='$(BUILDCC)' fi - { echo "$as_me:$LINENO: result: setting \$BUILDCCLD to ${BUILDCCLD}" >&5 -echo "${ECHO_T}setting \$BUILDCCLD to ${BUILDCCLD}" >&6; } + { $as_echo "$as_me:$LINENO: result: setting \$BUILDCCLD to ${BUILDCCLD}" >&5 +$as_echo "setting \$BUILDCCLD to ${BUILDCCLD}" >&6; } else if test -n "${BUILDCCLD}"; then - { echo "$as_me:$LINENO: WARNING: \$BUILDCCLD set but not cross-compiling." >&5 -echo "$as_me: WARNING: \$BUILDCCLD set but not cross-compiling." >&2;} + { $as_echo "$as_me:$LINENO: WARNING: \$BUILDCCLD set but not cross-compiling." >&5 +$as_echo "$as_me: WARNING: \$BUILDCCLD set but not cross-compiling." >&2;} fi BUILDCCLD='$(CCLD)' fi @@ -11760,6 +12664,8 @@ ac_config_files="$ac_config_files Makefile.aux:Makefile.in" ac_config_files="$ac_config_files Makefile:Makefile.aux" ac_config_files="$ac_config_files gui/Makefile.aux:gui/Makefile.in" ac_config_files="$ac_config_files gui/Makefile:gui/Makefile.aux" +ac_config_files="$ac_config_files tests/Makefile.aux:tests/Makefile.in" +ac_config_files="$ac_config_files tests/Makefile:tests/Makefile.aux" ac_config_files="$ac_config_files xdvi-sh" @@ -11790,11 +12696,12 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac @@ -11827,12 +12734,12 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -11848,7 +12755,7 @@ ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -11861,11 +12768,12 @@ LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -11878,7 +12786,7 @@ ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -11888,7 +12796,7 @@ DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -11910,17 +12818,45 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi # Support unset when possible. @@ -11936,8 +12872,6 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -11960,7 +12894,7 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi @@ -11973,17 +12907,10 @@ PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && @@ -12005,7 +12932,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -12056,7 +12983,7 @@ $as_unset CDPATH s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems @@ -12084,7 +13011,6 @@ case `echo -n x` in *) ECHO_N='-n';; esac - if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -12097,19 +13023,22 @@ if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + fi else as_ln_s='cp -p' fi @@ -12134,10 +13063,10 @@ else as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else case $1 in - -*)set "./$1";; + -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi @@ -12160,7 +13089,7 @@ exec 6>&1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was +generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -12173,14 +13102,14 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. @@ -12193,9 +13122,9 @@ Usage: $0 [OPTIONS] [FILE]... -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -12206,24 +13135,24 @@ $config_headers Report bugs to ." _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.62, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2006 Free Software Foundation, Inc. +Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do @@ -12245,30 +13174,36 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - { echo "$as_me: error: ambiguous option: $1 + { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 + -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; @@ -12287,30 +13222,32 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + exec "\$@" fi _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - echo "$ac_log" + $as_echo "$ac_log" } >&5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets @@ -12321,10 +13258,12 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.aux" ;; "gui/Makefile.aux") CONFIG_FILES="$CONFIG_FILES gui/Makefile.aux:gui/Makefile.in" ;; "gui/Makefile") CONFIG_FILES="$CONFIG_FILES gui/Makefile:gui/Makefile.aux" ;; + "tests/Makefile.aux") CONFIG_FILES="$CONFIG_FILES tests/Makefile.aux:tests/Makefile.in" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile:tests/Makefile.aux" ;; "xdvi-sh") CONFIG_FILES="$CONFIG_FILES xdvi-sh" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done @@ -12364,157 +13303,143 @@ $debug || (umask 077 && mkdir "$tmp") } || { - echo "$me: cannot create a temporary directory in ." >&2 + $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then -_ACEOF +ac_cr=' ' +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -SET_MAKE!$SET_MAKE$ac_delim -LN_S!$LN_S$ac_delim -RANLIB!$RANLIB$ac_delim -MAINT!$MAINT$ac_delim -LD!$LD$ac_delim -AR!$AR$ac_delim -ARFLAGS!$ARFLAGS$ac_delim -texmfmain!$texmfmain$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -ALLOCA!$ALLOCA$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -XMKMF!$XMKMF$ac_delim -X_CFLAGS!$X_CFLAGS$ac_delim -X_PRE_LIBS!$X_PRE_LIBS$ac_delim -X_LIBS!$X_LIBS$ac_delim -X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim -XTRA_WARN_CFLAGS!$XTRA_WARN_CFLAGS$ac_delim -cflags_set!$cflags_set$ac_delim -x_linker_options!$x_linker_options$ac_delim -x_xmu_lib!$x_xmu_lib$ac_delim -LDT1LIB!$LDT1LIB$ac_delim -LIBT1CPPFLAGS!$LIBT1CPPFLAGS$ac_delim -LDLIBT1!$LDLIBT1$ac_delim -LIBT1DEP!$LIBT1DEP$ac_delim -x_ext_lib!$x_ext_lib$ac_delim -x_xpm_libs!$x_xpm_libs$ac_delim -x_tool_libs!$x_tool_libs$ac_delim -iconv_libpath!$iconv_libpath$ac_delim -iconv_libs!$iconv_libs$ac_delim -iconv_includes!$iconv_includes$ac_delim -CXX!$CXX$ac_delim -CXXFLAGS!$CXXFLAGS$ac_delim -ac_ct_CXX!$ac_ct_CXX$ac_delim -exec_name!$exec_name$ac_delim -final_exec_name!$final_exec_name$ac_delim -wrapper_script!$wrapper_script$ac_delim -PS_DEF!$PS_DEF$ac_delim -BUILDCC!$BUILDCC$ac_delim -BUILDCFLAGS!$BUILDCFLAGS$ac_delim -BUILDCPPFLAGS!$BUILDCPPFLAGS$ac_delim -BUILDLDFLAGS!$BUILDLDFLAGS$ac_delim -BUILDCCLD!$BUILDCCLD$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then + . ./conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then break elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\).*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACAWK _ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } _ACEOF - # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty @@ -12530,19 +13455,133 @@ s/^[^=]*=[ ]*$// }' fi -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + prefix = substr(line, 1, index(line, defundef) - 1) + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", line, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } +fi # test -n "$CONFIG_HEADERS" + -for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; @@ -12571,26 +13610,38 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac - ac_file_inputs="$ac_file_inputs $ac_f" + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; + *:-:* | *:-) cat >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; esac ;; esac @@ -12600,7 +13651,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -12626,7 +13677,7 @@ echo X"$ac_file" | as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -12635,7 +13686,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | +$as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -12656,17 +13707,17 @@ echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -12706,12 +13757,13 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix esac _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= -case `sed -n '/datarootdir/ { +ac_sed_dataroot=' +/datarootdir/ { p q } @@ -12720,13 +13772,14 @@ case `sed -n '/datarootdir/ { /@infodir@/p /@localedir@/p /@mandir@/p -' $ac_file_inputs` in +' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g @@ -12740,15 +13793,16 @@ _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t +s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t @@ -12758,119 +13812,58 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # -_ACEOF - -# Transform confdefs.h into a sed script `conftest.defines', that -# substitutes the proper values into config.h.in to produce config.h. -rm -f conftest.defines conftest.tail -# First, append a space to every undef/define line, to ease matching. -echo 's/$/ /' >conftest.defines -# Then, protect against being on the right side of a sed subst, or in -# an unquoted here document, in config.status. If some macros were -# called several times there might be several #defines for the same -# symbol, which is useless. But do not sort them, since the last -# AC_DEFINE must be honored. -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where -# NAME is the cpp macro being defined, VALUE is the value it is being given. -# PARAMS is the parameter list in the macro definition--in most cases, it's -# just an empty string. -ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' -ac_dB='\\)[ (].*,\\1define\\2' -ac_dC=' ' -ac_dD=' ,' - -uniq confdefs.h | - sed -n ' - t rset - :rset - s/^[ ]*#[ ]*define[ ][ ]*// - t ok - d - :ok - s/[\\&,]/\\&/g - s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p - s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p - ' >>conftest.defines - -# Remove the space that was appended to ease matching. -# Then replace #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -# (The regexp can be short, since the line contains either #define or #undef.) -echo 's/ $// -s,^[ #]*u.*,/* & */,' >>conftest.defines - -# Break up conftest.defines: -ac_max_sed_lines=50 - -# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" -# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" -# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" -# et cetera. -ac_in='$ac_file_inputs' -ac_out='"$tmp/out1"' -ac_nxt='"$tmp/out2"' - -while : -do - # Write a here document: - cat >>$CONFIG_STATUS <<_ACEOF - # First, check the format of the line: - cat >"\$tmp/defines.sed" <<\\CEOF -/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def -/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def -b -:def -_ACEOF - sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS - ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in - sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail - grep . conftest.tail >/dev/null || break - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines conftest.tail - -echo "ac_result=$ac_in" >>$CONFIG_STATUS -cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then - echo "/* $configure_input */" >"$tmp/config.h" - cat "$ac_result" >>"$tmp/config.h" - if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} else - rm -f $ac_file - mv "$tmp/config.h" $ac_file + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } fi else - echo "/* $configure_input */" - cat "$ac_result" + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } fi - rm -f "$tmp/out12" ;; @@ -12878,12 +13871,11 @@ echo "$as_me: $ac_file is unchanged" >&6;} case $ac_file$ac_mode in - "c-auto.h":H) date >stamp-auto ;; "Makefile.aux":F) # Discard the file just generated and first resolve kpse_include's kpse_input=`case Makefile.in in [\\/$]*) # Absolute - test -f "Makefile.in" || { { echo "$as_me:$LINENO: error: cannot find input file: Makefile.in" >&5 -echo "$as_me: error: cannot find input file: Makefile.in" >&2;} + test -f "Makefile.in" || { { $as_echo "$as_me:$LINENO: error: cannot find input file: Makefile.in" >&5 +$as_echo "$as_me: error: cannot find input file: Makefile.in" >&2;} { (exit 1); exit 1; }; } echo "Makefile.in";; *) # Relative @@ -12895,8 +13887,8 @@ echo "$as_me: error: cannot find input file: Makefile.in" >&2;} echo "$srcdir/Makefile.in" else # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: Makefile.in" >&5 -echo "$as_me: error: cannot find input file: Makefile.in" >&2;} + { { $as_echo "$as_me:$LINENO: error: cannot find input file: Makefile.in" >&5 +$as_echo "$as_me: error: cannot find input file: Makefile.in" >&2;} { (exit 1); exit 1; }; } fi;; esac` || { (exit 1); exit 1; } @@ -12913,9 +13905,9 @@ echo "$as_me: error: cannot find input file: Makefile.in" >&2;} # Be careful with whitespace; we need to use echo. kpse_file_substs=`sed -n '/^kpse_include/s%[ ]*\(.*\)%\1%p' "$kpse_input"` if test x"$kpse_file_substs" = x; then - { echo "$as_me:$LINENO: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`Makefile.in' + { $as_echo "$as_me:$LINENO: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`Makefile.in' without any \`kpse_include' directives" >&5 -echo "$as_me: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`Makefile.in' +$as_echo "$as_me: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`Makefile.in' without any \`kpse_include' directives" >&2;} fi # Create the sed command line ... @@ -12952,8 +13944,8 @@ kpse_substs=`echo "$kpse_substs" | sed -e 's,%,\\\/,g' \ "gui/Makefile.aux":F) # Discard the file just generated and first resolve kpse_include's kpse_input=`case gui/Makefile.in in [\\/$]*) # Absolute - test -f "gui/Makefile.in" || { { echo "$as_me:$LINENO: error: cannot find input file: gui/Makefile.in" >&5 -echo "$as_me: error: cannot find input file: gui/Makefile.in" >&2;} + test -f "gui/Makefile.in" || { { $as_echo "$as_me:$LINENO: error: cannot find input file: gui/Makefile.in" >&5 +$as_echo "$as_me: error: cannot find input file: gui/Makefile.in" >&2;} { (exit 1); exit 1; }; } echo "gui/Makefile.in";; *) # Relative @@ -12965,8 +13957,8 @@ echo "$as_me: error: cannot find input file: gui/Makefile.in" >&2;} echo "$srcdir/gui/Makefile.in" else # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: gui/Makefile.in" >&5 -echo "$as_me: error: cannot find input file: gui/Makefile.in" >&2;} + { { $as_echo "$as_me:$LINENO: error: cannot find input file: gui/Makefile.in" >&5 +$as_echo "$as_me: error: cannot find input file: gui/Makefile.in" >&2;} { (exit 1); exit 1; }; } fi;; esac` || { (exit 1); exit 1; } @@ -12983,9 +13975,9 @@ echo "$as_me: error: cannot find input file: gui/Makefile.in" >&2;} # Be careful with whitespace; we need to use echo. kpse_file_substs=`sed -n '/^kpse_include/s%[ ]*\(.*\)%\1%p' "$kpse_input"` if test x"$kpse_file_substs" = x; then - { echo "$as_me:$LINENO: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`gui/Makefile.in' + { $as_echo "$as_me:$LINENO: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`gui/Makefile.in' without any \`kpse_include' directives" >&5 -echo "$as_me: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`gui/Makefile.in' +$as_echo "$as_me: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`gui/Makefile.in' without any \`kpse_include' directives" >&2;} fi # Create the sed command line ... @@ -13018,6 +14010,76 @@ done kpse_substs=`echo "$kpse_substs" | sed -e 's,%,\\\/,g' \ -e 's/kpse_include /kpse_include[ ]*/g'` (eval $kpse_substs -e '/^kpse_include/d' "$kpse_input") > gui/Makefile.aux + ;; + "tests/Makefile.aux":F) # Discard the file just generated and first resolve kpse_include's + kpse_input=`case tests/Makefile.in in + [\\/$]*) # Absolute + test -f "tests/Makefile.in" || { { $as_echo "$as_me:$LINENO: error: cannot find input file: tests/Makefile.in" >&5 +$as_echo "$as_me: error: cannot find input file: tests/Makefile.in" >&2;} + { (exit 1); exit 1; }; } + echo "tests/Makefile.in";; + *) # Relative + if test -f "tests/Makefile.in"; then + # Build tree + echo "tests/Makefile.in" + elif test -f "$srcdir/tests/Makefile.in"; then + # Source tree + echo "$srcdir/tests/Makefile.in" + else + # /dev/null tree + { { $as_echo "$as_me:$LINENO: error: cannot find input file: tests/Makefile.in" >&5 +$as_echo "$as_me: error: cannot find input file: tests/Makefile.in" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac` || { (exit 1); exit 1; } +# Replace lines of the form "kpse_include foo" with the contents of foo: +# first, from the kpse_include lines construct a list of file names. +# From that list, we construct a second list of those files that exist. +# Then we construct a list of sed commands for including those files, +# and a sed command that removes the kpse_include lines. We don't attempt +# to read non-existent files because some (buggy) versions of sed choke +# on this. Have to use sed because old (Ultrix, SunOs) awk does not support +# getline or system. (Anyway, configure scripts aren't supposed to use awk.) +# Can't use only one -e and commands {dr foo} because foo has to be last. +# Be careful, because the filename may contain /. +# Be careful with whitespace; we need to use echo. +kpse_file_substs=`sed -n '/^kpse_include/s%[ ]*\(.*\)%\1%p' "$kpse_input"` +if test x"$kpse_file_substs" = x; then + { $as_echo "$as_me:$LINENO: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`tests/Makefile.in' + without any \`kpse_include' directives" >&5 +$as_echo "$as_me: WARNING: No need to use \`KPSE_CONFIG_FILES' for input \`tests/Makefile.in' + without any \`kpse_include' directives" >&2;} +fi +# Create the sed command line ... +# Input lines containing "@configure_input@" are output twice, +# first with our modifications and then unmodified. +kpse_substs="sed -e '/@configure_input@/ { h; \ + s,@configure_input@,tests/Makefile.aux. Generated from `echo tests/Makefile.in | + sed 's,.*/,,'` by configure.,; G; }'" +for kpse_inc in $kpse_file_substs; do + kpse_read=`case $kpse_inc in + [\\/$]*) # Absolute + if test -f "$kpse_inc"; then + echo "$kpse_inc" + fi;; + *) # Relative + if test -f "$kpse_inc"; then + # Build tree + echo "$kpse_inc" + elif test -f "$srcdir/$kpse_inc"; then + # Source tree + echo "$srcdir/$kpse_inc" + fi;; + esac` + if test -n "$kpse_read"; then + kpse_mung=`echo $kpse_inc | sed 's,/,%,g'` + kpse_substs="$kpse_substs -e '/^kpse_include $kpse_mung$/r $kpse_read'" + fi +done +# ... and fix the whitespace and escaped slashes. +kpse_substs=`echo "$kpse_substs" | sed -e 's,%,\\\/,g' \ + -e 's/kpse_include /kpse_include[ ]*/g'` +(eval $kpse_substs -e '/^kpse_include/d' "$kpse_input") > tests/Makefile.aux ;; esac @@ -13029,6 +14091,11 @@ _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -13050,4 +14117,8 @@ if test "$no_create" != yes; then # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;} +fi diff --git a/Build/source/texk/xdvik/configure.in b/Build/source/texk/xdvik/configure.in index d17c977cb9f..4925e9c1f30 100644 --- a/Build/source/texk/xdvik/configure.in +++ b/Build/source/texk/xdvik/configure.in @@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(xdvi.c) AC_PREREQ(2.59) -AC_CONFIG_HEADERS([c-auto.h:c-auto.in], [date >stamp-auto]) +AC_CONFIG_HEADER([c-auto.h:c-auto.in], [date >stamp-auto]) AC_PROG_CC AC_PROG_INSTALL @@ -15,6 +15,28 @@ dnl allow for --program-suffix AC_ARG_PROGRAM sinclude(../kpathsea/withenable.ac) +sinclude(../../withenable.ac) +sinclude(kpathsea.ac) + +if test "x$with_mktexpk_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mktexpk-default option!) +fi + +if test "x$with_mktexmf_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mktexmf-default option!) +fi + +if test "x$with_mktextfm_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mktextfm-default option!) +fi + +if test "x$with_mkocp_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mkocp-default option!) +fi + +if test "x$with_mkofm_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mkofm-default option!) +fi AC_FUNC_VFORK AC_FUNC_VPRINTF @@ -50,8 +72,7 @@ COMPILER_WARNINGS dnl SU: for `--allow-multiple-definition' linker flag on Cygwin XDVI_LINKER_MULTIPLE_DEFNS -AC_CHECK_HEADERS(stdint.h) - +AC_CHECK_HEADERS(stdint.h inttypes.h) AC_CHECK_TYPE(uint32_t, unsigned long) dnl These were probably missing from the test-set? @@ -70,17 +91,15 @@ AC_CHECK_HEADERS(netdb.h sys/bsdtypes.h sys/param.h unistd.h sys/fcntl.h regex.h cppflags_save=$CPPFLAGS CPPFLAGS="$CPPFLAGS $X_CFLAGS" -AC_CHECK_HEADERS(X11/Xosdefs.h X11/xpm.h Xm/XpmP.h) +AC_CHECK_HEADERS(X11/Intrinsic.h X11/Xosdefs.h X11/xpm.h Xm/XpmP.h) CPPFLAGS=$cppflags_save dnl For editres, we need to check both the header and define a linker option. cppflags_save=$CPPFLAGS CPPFLAGS="$CPPFLAGS $X_CFLAGS" -dnl The fourth argument below is ignored by autoconf-2.13, -dnl but is required by autoconf-2.59 -AC_CHECK_HEADERS(X11/Intrinsic.h) AC_CHECK_HEADERS(X11/Xmu/Editres.h X11/Xmu/Xmu.h, x_xmu_lib=-lXmu, x_xmu_lib=, -[#ifdef HAVE_X11_INTRINSIC_H +[ +#ifdef HAVE_X11_INTRINSIC_H # include #endif ]) @@ -214,11 +233,13 @@ dnl backtick magic inside other commands. dnl dnl For some reason, the doubling of $$ and \\ must be reverted here: my_program_transform_name=`echo $program_transform_name | sed 's,\\$\\$,$,g' | sed 's,\\\\\\\\,\\\\,g'` -exec_name="xdvi-$prog_extension.bin" +exec_name="xdvi-$prog_extension" final_exec_name=`echo $exec_name | sed "$my_program_transform_name"` +dnl OBSOLETE?? exec_link=`echo xdvi.bin | sed "$my_program_transform_name"` wrapper_script=`echo xdvi | sed "$my_program_transform_name"` AC_SUBST(exec_name) AC_SUBST(final_exec_name) +dnl OBSOLETE?? AC_SUBST(exec_link) AC_SUBST(wrapper_script) dnl @@ -253,13 +274,13 @@ elif echo "$PS_DEF" | grep PS_NEWS >/dev/null; then X_LIBS="$X_LIBS -lxview -lcps -lolgx -lxvps" fi -XDVI_ARG_STRING(default-dvips-path, +XDVI_ARG_STRING([default-dvips-path], [ --with-default-dvips-path=CMD Use CMD as default DVI to PS converter], [DEFAULT_DVIPS_PATH], ["dvips"], [Define to point to the default command to use for printing (optional).]) -XDVI_ARG_STRING(default-ps2pdf-path, +XDVI_ARG_STRING([default-ps2pdf-path], [ --with-default-ps2pdf-path=CMD Use CMD as default PS to PDF converter], [DEFAULT_PS2PDF_PATH], ["ps2pdf"], @@ -285,6 +306,6 @@ KPSE_CROSS_BUILD_VAR(CPPFLAGS, $(BUILDXCPPFLAGS)) KPSE_CROSS_BUILD_VAR(LDFLAGS, $(BUILDXLDFLAGS)) KPSE_CROSS_BUILD_VAR(CCLD, $(BUILDCC)) -KPSE_CONFIG_FILES([Makefile gui/Makefile]) +KPSE_CONFIG_FILES([Makefile gui/Makefile tests/Makefile]) AC_CONFIG_FILES([xdvi-sh]) AC_OUTPUT diff --git a/Build/source/texk/xdvik/configure.in.orig b/Build/source/texk/xdvik/configure.in.orig new file mode 100644 index 00000000000..692422c9c74 --- /dev/null +++ b/Build/source/texk/xdvik/configure.in.orig @@ -0,0 +1,310 @@ +dnl Process this file with autoconf to produce a configure script. +dnl e.g.: +dnl /usr/bin/autoconf --macrodir=../etc/autoconf configure.in > configure +dnl the macrodir argument is neccessary to make the non-standard `ac_include' +dnl extension (acsite.m4) available to autoconf. +AC_INIT(xdvi.c) +AC_PREREQ(2.13) + +AC_CONFIG_HEADER(c-auto.h:c-auto.in) +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_LN_S +AC_PROG_RANLIB + +dnl allow for --program-suffix +AC_ARG_PROGRAM + +sinclude(../kpathsea/withenable.ac) +sinclude(../../withenable.ac) +sinclude(kpathsea.ac) + +if test "x$with_mktexpk_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mktexpk-default option!) +fi + +if test "x$with_mktexmf_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mktexmf-default option!) +fi + +if test "x$with_mktextfm_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mktextfm-default option!) +fi + +if test "x$with_mkocp_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mkocp-default option!) +fi + +if test "x$with_mkofm_default" = "xno"; then + AC_MSG_WARN(Xdvik doesn't implement the --without-mkofm-default option!) +fi + +AC_FUNC_VFORK +AC_FUNC_VPRINTF +dnl begin additions SU, 2000/03/07 +dnl AC_FUNC_VSNPRINTF +XDVI_FUNC_WORKING_VSNPRINTF +AC_FUNC_MEMICMP +dnl AC_FUNC_REALPATH +AC_FUNC_ALLOCA +AC_C_STRINGIZE +dnl end additions SU +AC_FUNC_MEMCMP +AC_HEADER_SYS_WAIT +AC_TYPE_SIGNAL +AC_C_BIGENDIAN +dnl Put here by Thomas Esser for teTeX. This causes some tests to be run +dnl twice by the kps version. +AC_PATH_XTRA +AC_TYPE_SIZE_T + +dnl XDVI checks by Paul Vojta +XDVI_FUNC_SETSID_IN_VFORK +XDVI_CC_CONCAT +XDVI_C_BITMAP_TYPE +XDVI_SYS_STREAMS +XDVI_SYS_SUNOS_4 +XDVI_SYS_OLD_LINUX +XDVI_FUNC_POLL + +dnl SU: added flags to turn on gcc warnings, taken from gnome/compiler-flags.m4 and put into aclocal.m4 +COMPILER_WARNINGS + +dnl SU: for `--allow-multiple-definition' linker flag on Cygwin +XDVI_LINKER_MULTIPLE_DEFNS + +AC_CHECK_HEADERS(stdint.h inttypes.h) +AC_CHECK_TYPE(uint32_t, unsigned long) + +dnl These were probably missing from the test-set? +dnl On the other hand, they are not used already, why start now? -janl +dnl AC_TYPE_OFF_T +dnl AC_HEADER_TIME + +AC_CHECK_FUNCS(mkstemp memcpy strerror waitpid sigaction strchr setenv ulltostr \ + fchdir getcwd getpwnam getuid getpwuid \ + iconv nl_langinfo \ + lstat ftruncate snprintf vsnprintf realpath) + +dnl is for ISC 4.0, to define fd_set in psgs.c. +dnl regex.h is needed for regexp support in DVI search. +AC_CHECK_HEADERS(netdb.h sys/bsdtypes.h sys/param.h unistd.h sys/fcntl.h regex.h iconv.h langinfo.h) + +cppflags_save=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $X_CFLAGS" +AC_CHECK_HEADERS(X11/Intrinsic.h X11/Xosdefs.h X11/xpm.h Xm/XpmP.h) +CPPFLAGS=$cppflags_save + +dnl For editres, we need to check both the header and define a linker option. +cppflags_save=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $X_CFLAGS" +AC_CHECK_HEADERS(X11/Xmu/Editres.h X11/Xmu/Xmu.h, x_xmu_lib=-lXmu, x_xmu_lib=, +[[ +#ifdef HAVE_X11_INTRINSIC_H +# include +#endif +]]) +AC_SUBST(x_xmu_lib) +CPPFLAGS=$cppflags_save + +dnl For the bitmap size. -- I think this is in XDVI_C_BITMAP_TYPE now -janl +dnl AC_CHECK_SIZEOF(long) + +sinclude(../kpathsea/xt.ac) +sinclude(withenable.ac) +sinclude(../../libs/t1lib/withenable.ac) +sinclude(../../libs/t1lib/t1lib.ac) + +dnl check for Xaw version +XDVI_OLD_XAW + +dnl nl_langinfo checks +AC_MSG_CHECKING(if nl_langinfo(CODESET) is working) +AC_TRY_LINK([#include ], [char* cs = nl_langinfo(CODESET);], + AC_DEFINE(HAVE_WORKING_NL_LANGINFO_CODESET) AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) +) + +dnl First, check for libXp and libXext: +if test -z "$x_ext_lib"; then # allow envvar override + if test -n "$x_libraries"; then + XLFLAG="-L$x_libraries" + else + XLFLAG= + fi + AC_CHECK_LIB(Xp, XpQueryVersion, + x_ext_lib="-lXp -lXext", :, -lXext -lX11 $X_EXTRA_LIBS $XLFLAG) +fi +dnl +dnl If libXp not found, try libXext only: +dnl +if test -z "$x_ext_lib"; then # previous test unsuccessful, or envvar override + if test -n "$x_libraries"; then + XLFLAG="-L$x_libraries" + else + XLFLAG= + fi + AC_CHECK_LIB(Xext, XextCreateExtension, + x_ext_lib=-lXext, :, -lX11 $X_EXTRA_LIBS $XLFLAG) +fi +AC_SUBST(x_ext_lib) + +dnl For --with-x-toolkit. Must be Xaw at least. If no --with-x-toolkit is given, +dnl we try to check if Motif is available, and if yes, use it; else, +dnl we use Xaw (--with-x-toolkit=xaw can be used to override this default). + +dnl Check whether -lXpm can be used +XDVI_FIND_XPM + +dnl Check which X toolkit to use +prog_extension="xaw" +motif_include= +motif_libdir= +AC_ARG_WITH(motif-include, +[ --with-motif-include=DIR + Specify the location of Motif include files], +motif_include="$withval") +AC_ARG_WITH(motif-libdir, +[ --with-motif-libdir=DIR + Specify the location of Motif libraries], +motif_libdir="$withval") + +if test "x$with_xdvi_x_toolkit" = xxaw3d; then + prog_extension="xaw3d" + x_tool_libs="-lXaw3d" +elif test "x$with_xdvi_x_toolkit" = xneXtaw; then + prog_extension="nextaw" + x_tool_libs="-lneXtaw" +elif test "x$with_xdvi_x_toolkit" = xmotif; then +dnl Motif with no fallback +dnl XDVI_FIND_MOTIF also defines $prog_extension, AC_DEFINE(toolkit) and $x_tool_libs + XDVI_FIND_MOTIF(none, "$motif_include", "$motif_libdir") +elif test "x$with_xdvi_x_toolkit" = xxaw; then + prog_extension="xaw" + AC_DEFINE(XAW) + x_tool_libs="-lXaw" +else +dnl Motif with xaw as fallback +dnl XDVI_FIND_MOTIF also defines $prog_extension, AC_DEFINE(toolkit) and $x_tool_libs + XDVI_FIND_MOTIF(Xaw, "$motif_include", "$motif_libdir") +fi +AC_SUBST(x_tool_libs) + +AC_ARG_WITH(iconv-libdir, +[ --with-iconv-libdir=DIR + Specify the location of iconv library (librecode.so)], +[if test XXX"$withval" != "XXX"; then + iconv_libpath="-L$withval" + iconv_libs="-lrecode" +else + iconv_libpath= + iconv_libs= +fi], [ +dnl On non-Linux systems, -liconv is needed. Check for both iconv_open and libiconv_open. +iconv_libpath= +iconv_libs= +AC_CHECK_LIB(iconv, iconv_open, iconv_libs=-liconv, + AC_CHECK_LIB(iconv, libiconv_open, iconv_libs=-liconv,iconv_libs=,) + ,) +]) +if test XXX"$iconv_libs" != "XXX"; then + AC_DEFINE(HAVE_ICONV) +fi +AC_SUBST(iconv_libpath) +AC_SUBST(iconv_libs) + +AC_ARG_WITH(iconv-include, +[ --with-iconv-include=DIR + Specify the location of iconv header (iconv.h)], +[if test XXX"$withval" != "XXX"; then + iconv_includes="-I$withval" +fi],[ +iconv_includes= +]) +AC_SUBST(iconv_includes) + +XDVI_ICONV_CHAR_PPTR_TYPE + +dnl We try to perform the $program_transform_name replacement already +dnl here, and AC_SUBST the final names into the Makefile; this makes +dnl the compilation commands more readable and causes less problems with +dnl backtick magic inside other commands. +dnl +dnl For some reason, the doubling of $$ and \\ must be reverted here: +my_program_transform_name=`echo $program_transform_name | sed 's,\\$\\$,$,g' | sed 's,\\\\\\\\,\\\\,g'` +exec_name="xdvi-$prog_extension" +final_exec_name=`echo $exec_name | sed "$my_program_transform_name"` +dnl OBSOLETE?? exec_link=`echo xdvi.bin | sed "$my_program_transform_name"` +wrapper_script=`echo xdvi | sed "$my_program_transform_name"` +AC_SUBST(exec_name) +AC_SUBST(final_exec_name) +AC_SUBST(exec_link) +AC_SUBST(wrapper_script) + +dnl +dnl Tests for different application setup features follow. +dnl + +dnl For --with-ps. +test -z "$PS_DEF" && PS_DEF=-DPS_GS +test "$PS_DEF" = no && PS_DEF= +AC_SUBST(PS_DEF)dnl +dnl +dnl If we're on Solaris and we want DPS, then add the extra compilation stuff +dnl to get it. +if echo "$PS_DEF" | grep PS_DPS >/dev/null; then + if test "`(uname) 2>/dev/null`" = SunOS \ + && uname -r | grep '^5' >/dev/null; then + AC_MSG_RESULT(adding DPS includes and libraries for Solaris) + X_CFLAGS="$X_CFLAGS -I/usr/openwin/include/X11" + AC_CHECK_LIB(sunmath, isinf, ac_sunmath=-lsunmath, ac_sunmath="") + X_LIBS="$X_LIBS -R/usr/openwin/lib /usr/openwin/lib/libdps.so $ac_sunmath" + dnl We only need isinf and ieeefp.h to work around a Solaris bug in + dnl -ldps; see psdps.c. isinf is in -lsunmath. + AC_CHECK_FUNCS(isinf) + AC_CHECK_HEADERS(ieeefp.h) + else + dnl SunOS 4.x is simpler. + AC_MSG_RESULT(adding DPS includes and libraries for SunOS 4.x) + X_LIBS="$X_LIBS -ldps" + fi +elif echo "$PS_DEF" | grep PS_NEWS >/dev/null; then + AC_MSG_RESULT(adding NeWS libraries) + X_LIBS="$X_LIBS -lxview -lcps -lolgx -lxvps" +fi + +XDVI_ARG_STRING(default-dvips-path, +[ --with-default-dvips-path=CMD + Use CMD as default DVI to PS converter], +DEFAULT_DVIPS_PATH, "dvips") + +XDVI_ARG_STRING(default-ps2pdf-path, +[ --with-default-ps2pdf-path=CMD + Use CMD as default PS to PDF converter], +DEFAULT_PS2PDF_PATH, "ps2pdf") + +dnl ImageMagick support +PS_DEF="$PS_DEF $MAGICK_DEF" +if echo "$PS_DEF" | grep MAGICK >/dev/null; then + AC_MSG_RESULT(adding ImageMagick libraries) + X_EXTRA_LIBS="$X_EXTRA_LIBS `Magick-config --libs`" +fi + +# needed for web2c later than 7.3.4: +AC_CHECK_LIB(m, main) +AC_C_CONST() + +# If you're cross-compiling, these macros set up the variables in +# ../make/cross.mk: BUILDCC, BUILDCFLAGS, BUILDCCLD etc. These are +# near the end so people have some chance of seeing them. +KPSE_CROSS_BUILD_VAR(CC, cc) +KPSE_CROSS_BUILD_VAR(CFLAGS, $(BUILDXCFLAGS)) +KPSE_CROSS_BUILD_VAR(CPPFLAGS, $(BUILDXCPPFLAGS)) +KPSE_CROSS_BUILD_VAR(LDFLAGS, $(BUILDXLDFLAGS)) +KPSE_CROSS_BUILD_VAR(CCLD, $(BUILDCC)) + +AC_OUTPUT(Makefile gui/Makefile tests/Makefile xdvi-sh) + +dnl update `stamp-auto' since we just remade `c-auto.h' +date >stamp-auto diff --git a/Build/source/texk/xdvik/depend.mk b/Build/source/texk/xdvik/depend.mk index 7733bcee015..9a26e7e8167 100644 --- a/Build/source/texk/xdvik/depend.mk +++ b/Build/source/texk/xdvik/depend.mk @@ -1,536 +1,1219 @@ -browser.o: browser.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ +browser.o: browser.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ $(kpathsea_srcdir)/c-fopen.h \ $(kpathsea_srcdir)/c-stat.h \ - util.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + util.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ events.h \ + gui/message-window.h \ browser.h \ - string-utils.h my-vsnprintf.h -dvi-draw.o: dvi-draw.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + string-utils.h \ + my-vsnprintf.h \ + gui/statusline.h +dl_list.o: dl_list.c \ + dl_list.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ $(kpathsea_srcdir)/c-fopen.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/tex-file.h dvi.h string-utils.h \ - my-vsnprintf.h util.h $(kpathsea_srcdir)/hash.h \ - events.h x_util.h \ - dvi-init.h hypertex.h \ - special.h tfmload.h read-mapfile.h my-snprintf.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h +dvi-draw.o: dvi-draw.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/magstep.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + dvi.h \ + string-utils.h \ + my-vsnprintf.h \ + util.h \ + $(kpathsea_srcdir)/hash.h \ + events.h \ + x_util.h \ + dvi-init.h \ + gui/statusline.h \ + hypertex.h \ + special.h \ + tfmload.h \ + read-mapfile.h \ + my-snprintf.h \ + gui/mag.h \ + gui/message-window.h \ dvi-draw.h \ search-internal.h \ - dvisel.h print-internal.h \ + gui/search-dialog.h \ + xdvi-config.h \ + xdvi.h \ + dvisel.h \ + print-internal.h \ encodings.h \ - pagehist.h psgs.h -dvi-init.o: dvi-init.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + gui/pagesel.h \ + pagehist.h \ + psgs.h +dvi-init.o: dvi-init.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvi-init.h dvi-draw.h util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + dvi-draw.h \ + util.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - events.h x_util.h \ - mime.h special.h hypertex.h \ - $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/tex-glyph.h \ - dvi.h string-utils.h my-vsnprintf.h browser.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + x_util.h \ + exit-handlers.h \ + mime.h \ + gui/pagesel.h \ + xdvi.h \ + special.h \ + hypertex.h \ + $(kpathsea_srcdir)/magstep.h \ + $(kpathsea_srcdir)/tex-glyph.h \ + $(kpathsea_srcdir)/tex-file.h \ + dvi.h \ + string-utils.h \ + my-vsnprintf.h \ + browser.h \ + gui/sfSelFile.h \ + gui/xm_toolbar.h \ pagehist.h \ + gui/message-window.h \ search-internal.h \ + gui/search-dialog.h \ + xdvi-config.h \ dvisel.h \ print-internal.h \ + gui/statusline.h \ font-open.h dvisel.o: dvisel.c \ dvi.h \ - xdvi.h xdvi-config.h c-auto.h \ - xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + gui/pagesel.h \ + xdvi.h \ + xdvi-config.h c-auto.h \ + xdvi-debug.h \ + xdvi.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvisel.h dvi-init.h print-internal.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvisel.h \ + dvi-init.h \ + print-internal.h \ util.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - events.h dvi-draw.h -encodings.o: encodings.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + dvi-draw.h \ + gui/message-window.h \ + gui/statusline.h \ + gui/print-dialog.h \ + print-internal.h +encodings.o: encodings.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - util.h $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - events.h encodings.h my-snprintf.h -events.o: events.c xdvi-config.h c-auto.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + encodings.h \ + my-snprintf.h \ + gui/message-window.h \ + exit-handlers.h +events.o: events.c \ + xdvi-config.h c-auto.h \ xdvi.h \ - xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - filehist.h special.h events.h \ - psgs.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + gui/pagesel.h \ + xdvi.h \ + filehist.h \ + special.h \ + events.h \ + psgs.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - x_util.h string-utils.h my-vsnprintf.h \ + $(kpathsea_srcdir)/c-vararg.h \ + x_util.h \ + string-utils.h \ + my-vsnprintf.h \ + gui/print-dialog.h \ + print-internal.h \ + dvi-init.h \ + gui/search-dialog.h \ + xdvi-config.h \ + gui/sfSelFile.h \ + gui/mag.h \ + gui/help-window.h \ + gui/message-window.h \ dvi-draw.h \ - hypertex.h dvi-init.h \ - browser.h search-internal.h \ - dvisel.h print-internal.h my-snprintf.h \ - encodings.h pagehist.h + gui/statusline.h \ + hypertex.h \ + gui/Tip.h \ + browser.h \ + search-internal.h \ + dvisel.h \ + print-internal.h \ + my-snprintf.h \ + gui/selection.h \ + encodings.h \ + pagehist.h \ + gui/xm_colorsel.h \ + gui/xm_toolbar.h \ + gui/xaw_menu.h \ + gui/menu.h \ + events.h \ + gui/xm_menu.h \ + gui/xaw_menu.h \ + gui/xm_menu.h \ + gui/xm_prefs.h \ + gui/xm_prefs_appearance.h \ + gui/xm_prefs_fonts.h \ + gui/xm_prefs_page.h +exit-handlers.o: exit-handlers.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + exit-handlers.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h filehist.o: filehist.c \ - xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - events.h my-snprintf.h string-utils.h \ - my-vsnprintf.h dvi-init.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + dl_list.h \ + my-snprintf.h \ + string-utils.h \ + my-vsnprintf.h \ + dvi-init.h \ + gui/message-window.h \ + gui/xm_menu.h \ + gui/menu.h \ + xdvi-config.h \ + events.h \ + xdvi.h \ + gui/xm_menu.h \ + gui/xaw_menu.h \ + gui/xaw_menu.h \ filehist.h -font-open.o: font-open.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ +font-open.o: font-open.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvi-draw.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvi-draw.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - events.h my-snprintf.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + dvi-init.h \ + my-snprintf.h \ + gui/print-log.h \ + gui/statusline.h \ font-open.h \ - $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/tex-glyph.h -gf.o: gf.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/tex-glyph.h \ + $(kpathsea_srcdir)/tex-file.h +gf.o: gf.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvi-init.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ events.h -hypertex.o: hypertex.c alloc-debug.h \ +hypertex.o: hypertex.c \ + alloc-debug.h \ xdvi-config.h c-auto.h \ - xdvi.h xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ $(kpathsea_srcdir)/c-fopen.h \ $(kpathsea_srcdir)/c-stat.h \ - events.h dvi-init.h \ - util.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - x_util.h mime.h \ + events.h \ + dvi-init.h \ + gui/message-window.h \ + util.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + dl_list.h \ + x_util.h \ + mime.h \ + gui/mag.h \ dvi-draw.h \ - browser.h hypertex.h \ - special.h string-utils.h my-vsnprintf.h \ - my-snprintf.h pagehist.h + gui/statusline.h \ + browser.h \ + hypertex.h \ + special.h \ + string-utils.h \ + my-vsnprintf.h \ + gui/xm_toolbar.h \ + my-snprintf.h \ + pagehist.h image-magick.o: image-magick.c \ - xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvi-init.h events.h dvi-draw.h util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + events.h \ + dvi-draw.h \ + util.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ special.h \ image-magick.h -mime.o: mime.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ +main.o: main.c \ + xdvi-config.h c-auto.h \ + $(kpathsea_srcdir)/proginit.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/expand.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + x_util.h \ + gui/sfSelFile.h \ + my-snprintf.h \ + dvi-init.h \ + filehist.h \ + gui/mag.h \ + gui/message-window.h +mime.o: mime.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - hypertex.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + hypertex.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - events.h string-utils.h my-vsnprintf.h mime.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + string-utils.h \ + my-vsnprintf.h \ + mime.h \ browser.h \ - $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/variable.h + gui/message-window.h \ + $(kpathsea_srcdir)/variable.h my-snprintf.o: my-snprintf.c \ - xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ - $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - my-vsnprintf.h my-snprintf.h + $(kpathsea_srcdir)/c-fopen.h \ + my-vsnprintf.h \ + my-snprintf.h my-vsnprintf.o: my-vsnprintf.c \ - xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ - $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ my-vsnprintf.h -pagehist.o: pagehist.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ +pagehist.o: pagehist.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - events.h string-utils.h my-vsnprintf.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + dl_list.h \ + string-utils.h \ + my-vsnprintf.h \ dvi-init.h \ + gui/statusline.h \ + gui/message-window.h \ + gui/xm_toolbar.h \ pagehist.h -pk.o: pk.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ +pk.o: pk.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvi-init.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ events.h -print-internal.o: print-internal.c xdvi-config.h c-auto.h xdvi.h \ - xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ +print-internal.o: print-internal.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvisel.h dvi-init.h print-internal.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvisel.h \ + dvi-init.h \ + print-internal.h \ + gui/print-log.h \ search-internal.h \ + gui/search-dialog.h \ + xdvi-config.h \ + xdvi.h \ events.h \ + gui/message-window.h \ util.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ x_util.h \ - string-utils.h my-vsnprintf.h my-snprintf.h + string-utils.h \ + my-vsnprintf.h \ + my-snprintf.h psdps.o: psdps.c psgs.o: psgs.c \ - xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ - $(kpathsea_srcdir)/c-errno.h $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - psgs.h dvi-init.h dvi-draw.h events.h \ - special.h util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + psgs.h \ + dvi-init.h \ + dvi-draw.h \ + events.h \ + gui/statusline.h \ + special.h \ + util.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h -psheader.o: psheader.c + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h psnews.o: psnews.c -read-mapfile.o: read-mapfile.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ +read-mapfile.o: read-mapfile.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - events.h read-mapfile.h dvi-draw.h -search-internal.o: search-internal.c xdvi-config.h c-auto.h xdvi.h \ - xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + read-mapfile.h \ + dvi-draw.h +search-internal.o: search-internal.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - dvi-init.h dvi-draw.h search-internal.h \ + $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + dvi-draw.h \ + search-internal.h \ + gui/search-dialog.h \ + xdvi-config.h \ + xdvi.h \ dvisel.h \ print-internal.h \ - events.h encodings.h \ - util.h $(kpathsea_srcdir)/c-stat.h \ + gui/message-window.h \ + gui/statusline.h \ + events.h \ + encodings.h \ + gui/pagesel.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - x_util.h string-utils.h my-vsnprintf.h \ - pagehist.h + $(kpathsea_srcdir)/c-vararg.h \ + x_util.h \ + string-utils.h \ + my-vsnprintf.h \ + gui/mag.h \ + pagehist.h \ + translations.h special.o: special.c \ - xdvi-config.h \ - c-auto.h xdvi.h xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ $(kpathsea_srcdir)/c-fopen.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/line.h $(kpathsea_srcdir)/tex-file.h special.h events.h hypertex.h \ - dvi.h dvi-init.h \ - dvi-draw.h util.h \ + $(kpathsea_srcdir)/line.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + special.h \ + events.h \ + hypertex.h \ + dvi.h \ + gui/message-window.h \ + dvi-init.h \ + dvi-draw.h \ + gui/statusline.h \ + util.h \ $(kpathsea_srcdir)/hash.h \ image-magick.h \ - my-snprintf.h string-utils.h \ - my-vsnprintf.h psgs.h + gui/pagesel.h \ + xdvi.h \ + my-snprintf.h \ + string-utils.h \ + my-vsnprintf.h \ + psgs.h squeeze.o: squeeze.c \ $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/c-memstr.h + $(kpathsea_srcdir)/c-memstr.h string-utils.o: string-utils.c \ xdvi-config.h c-auto.h \ - xdvi.h xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - string-utils.h my-vsnprintf.h util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + string-utils.h \ + my-vsnprintf.h \ + util.h \ $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ events.h +string_list.o: string_list.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + string_list.h tfmload.o: tfmload.c \ - xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - events.h tfmload.h -util.o: util.c xdvi-config.h c-auto.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + tfmload.h +util.o: util.c \ + xdvi-config.h c-auto.h \ xdvi.h \ - xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - hypertex.h dvi-init.h special.h events.h \ - string-utils.h my-vsnprintf.h $(kpathsea_srcdir)/tex-file.h util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + hypertex.h \ + dvi-init.h \ + special.h \ + events.h \ + string-utils.h \ + my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ x_util.h \ + gui/message-window.h \ search-internal.h \ + gui/search-dialog.h \ + xdvi-config.h \ + xdvi.h \ dvisel.h \ print-internal.h \ - encodings.h filehist.h -vf.o: vf.c xdvi-config.h c-auto.h dvi.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + encodings.h \ + filehist.h \ + exit-handlers.h \ + gui/xm_prefs.h +vf.o: vf.c \ + xdvi-config.h c-auto.h \ + dvi.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + dvi-init.h \ + dvi-draw.h +x_util.o: x_util.c \ + xdvi-config.h c-auto.h \ + x_util.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + string-utils.h \ + my-vsnprintf.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - events.h dvi-init.h dvi-draw.h -xdvi.o: xdvi.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-vararg.h \ + events.h \ + gui/statusline.h \ + gui/message-window.h +xdvi.o: xdvi.c \ + xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + gui/xm_menu.h \ + gui/menu.h \ + xdvi-config.h \ events.h \ - xserver-info.h $(kpathsea_srcdir)/c-fopen.h \ - $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/proginit.h \ - $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-hush.h $(kpathsea_srcdir)/tex-make.h \ - string-utils.h my-vsnprintf.h $(kpathsea_srcdir)/expand.h translations.h \ - dvi-init.h c-openmx.h x_util.h \ + xdvi.h \ + gui/xm_menu.h \ + gui/xaw_menu.h \ + gui/xaw_menu.h \ + gui/xm_toolbar.h \ + xserver-info.h \ + $(kpathsea_srcdir)/c-pathch.h \ + $(kpathsea_srcdir)/c-ctype.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/tex-hush.h \ + $(kpathsea_srcdir)/tex-make.h \ + $(kpathsea_srcdir)/tex-file.h \ + string-utils.h \ + my-vsnprintf.h \ + translations.h \ + dvi-init.h \ + c-openmx.h \ + gui/xicon.h \ + x_util.h \ + gui/message-window.h \ + events.h \ + gui/mag.h \ + gui/pagesel.h \ dvi-draw.h \ - util.h $(kpathsea_srcdir)/hash.h \ - my-snprintf.h hypertex.h pagehist.h filehist.h \ + gui/statusline.h \ + util.h \ + $(kpathsea_srcdir)/hash.h \ + hypertex.h \ + pagehist.h \ + filehist.h \ print-internal.h \ - pixmaps/time16.xbm \ - pixmaps/time16_mask.xbm pixmaps/magglass.xbm pixmaps/magglass_mask.xbm \ - pixmaps/drag_vert.xbm pixmaps/drag_vert_mask.xbm pixmaps/drag_horiz.xbm \ - pixmaps/drag_horiz_mask.xbm pixmaps/drag_omni.xbm \ - pixmaps/drag_omni_mask.xbm -xserver-info.o: xserver-info.c xdvi.h xdvi-config.h c-auto.h xdvi-debug.h \ - version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ + exit-handlers.h \ + gui/xm_prefsP.h \ + pixmaps/magglass.xbm \ + pixmaps/magglass_mask.xbm +xserver-info.o: xserver-info.c \ + xdvi.h \ + xdvi-config.h c-auto.h \ + xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ xserver-info.h -x_util.o: x_util.c xdvi-config.h c-auto.h \ - x_util.h xdvi.h xdvi-debug.h version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/getopt.h \ - $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ - $(kpathsea_srcdir)/c-pathmx.h \ - $(kpathsea_srcdir)/c-dir.h \ - $(kpathsea_srcdir)/c-vararg.h \ - string-utils.h my-vsnprintf.h util.h $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/hash.h \ - $(kpathsea_srcdir)/tex-file.h \ - events.h diff --git a/Build/source/texk/xdvik/depend.mk.orig b/Build/source/texk/xdvik/depend.mk.orig new file mode 100644 index 00000000000..dba5ea585d0 --- /dev/null +++ b/Build/source/texk/xdvik/depend.mk.orig @@ -0,0 +1,565 @@ +browser.o: browser.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/c-stat.h \ + util.h $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + events.h gui/message-window.h browser.h \ + string-utils.h my-vsnprintf.h gui/statusline.h +dl_list.o: dl_list.c dl_list.h \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h +dvi-draw.o: dvi-draw.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/tex-file.h \ + dvi.h string-utils.h my-vsnprintf.h util.h $(kpathsea_srcdir)/hash.h \ + events.h x_util.h dvi-init.h gui/statusline.h hypertex.h special.h \ + tfmload.h read-mapfile.h my-snprintf.h gui/mag.h gui/message-window.h \ + dvi-draw.h search-internal.h gui/search-dialog.h dvisel.h \ + print-internal.h encodings.h gui/pagesel.h pagehist.h psgs.h +dvi-init.o: dvi-init.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + dvi-draw.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h x_util.h exit-handlers.h mime.h gui/pagesel.h special.h \ + hypertex.h $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/tex-glyph.h dvi.h \ + string-utils.h my-vsnprintf.h browser.h gui/sfSelFile.h \ + gui/xm_toolbar.h pagehist.h \ + gui/message-window.h search-internal.h gui/search-dialog.h dvisel.h \ + print-internal.h gui/statusline.h font-open.h +dvisel.o: dvisel.c \ + dvi.h gui/pagesel.h \ + xdvi.h xdvi-config.h c-auto.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvisel.h \ + dvi-init.h print-internal.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + events.h dvi-draw.h gui/message-window.h \ + gui/statusline.h gui/print-dialog.h +encodings.o: encodings.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + events.h encodings.h my-snprintf.h \ + gui/message-window.h exit-handlers.h +events.o: events.c xdvi-config.h c-auto.h \ + $(kpathsea_srcdir)/getopt.h \ + xdvi.h \ + xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + gui/pagesel.h filehist.h special.h events.h psgs.h \ + util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + x_util.h string-utils.h my-vsnprintf.h gui/print-dialog.h \ + print-internal.h dvi-init.h gui/search-dialog.h gui/sfSelFile.h \ + gui/mag.h gui/help-window.h gui/message-window.h dvi-draw.h \ + gui/statusline.h hypertex.h gui/Tip.h browser.h search-internal.h \ + dvisel.h my-snprintf.h gui/selection.h encodings.h pagehist.h \ + gui/xm_colorsel.h gui/xm_toolbar.h gui/xaw_menu.h gui/menu.h \ + gui/xm_menu.h gui/xm_prefs.h gui/xm_prefsP.h gui/xm_prefs_appearance.h \ + gui/xm_prefs_fonts.h gui/xm_prefs_page.h +exit-handlers.o: exit-handlers.c xdvi-config.h c-auto.h xdvi.h \ + xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + exit-handlers.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h +filehist.o: filehist.c \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h dl_list.h \ + my-snprintf.h string-utils.h my-vsnprintf.h dvi-init.h \ + gui/message-window.h gui/xm_menu.h gui/menu.h gui/xaw_menu.h filehist.h +font-open.o: font-open.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvi-draw.h \ + util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h dvi-init.h my-snprintf.h gui/print-log.h gui/statusline.h \ + font-open.h $(kpathsea_srcdir)/tex-glyph.h +gf.o: gf.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h +hypertex.o: hypertex.c alloc-debug.h \ + xdvi-config.h c-auto.h \ + xdvi.h xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/c-stat.h \ + events.h dvi-init.h gui/message-window.h \ + util.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + dl_list.h x_util.h \ + mime.h gui/mag.h dvi-draw.h gui/statusline.h browser.h hypertex.h \ + special.h string-utils.h my-vsnprintf.h gui/xm_toolbar.h my-snprintf.h \ + pagehist.h +image-magick.o: image-magick.c \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + events.h dvi-draw.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + special.h image-magick.h +main.o: main.c xdvi-config.h c-auto.h \ + $(kpathsea_srcdir)/proginit.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/expand.h xdvi.h \ + xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h x_util.h \ + gui/sfSelFile.h my-snprintf.h dvi-init.h filehist.h gui/mag.h \ + gui/message-window.h +mime.o: mime.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + hypertex.h \ + util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h string-utils.h my-vsnprintf.h mime.h browser.h \ + gui/message-window.h $(kpathsea_srcdir)/variable.h +my-snprintf.o: my-snprintf.c \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + my-vsnprintf.h my-snprintf.h +my-vsnprintf.o: my-vsnprintf.c \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + my-vsnprintf.h +pagehist.o: pagehist.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h dl_list.h \ + string-utils.h my-vsnprintf.h dvi-init.h gui/statusline.h \ + gui/message-window.h gui/xm_toolbar.h pagehist.h +pk.o: pk.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h \ + util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h +print-internal.o: print-internal.c xdvi-config.h c-auto.h xdvi.h \ + xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvisel.h \ + dvi-init.h print-internal.h gui/print-log.h search-internal.h \ + gui/search-dialog.h events.h gui/message-window.h util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + x_util.h \ + string-utils.h my-vsnprintf.h my-snprintf.h +psdps.o: psdps.c +psgs.o: psgs.c \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + psgs.h \ + dvi-init.h dvi-draw.h events.h gui/statusline.h special.h util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h +psheader.o: psheader.c +psnews.o: psnews.c +read-mapfile.o: read-mapfile.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h \ + read-mapfile.h dvi-draw.h +search-internal.o: search-internal.c xdvi-config.h c-auto.h xdvi.h \ + xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + dvi-init.h dvi-draw.h search-internal.h gui/search-dialog.h dvisel.h \ + print-internal.h gui/message-window.h gui/statusline.h events.h \ + encodings.h gui/pagesel.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + x_util.h string-utils.h my-vsnprintf.h \ + gui/mag.h pagehist.h translations.h +special.o: special.c \ + xdvi-config.h \ + c-auto.h xdvi.h xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/line.h $(kpathsea_srcdir)/tex-file.h \ + special.h events.h hypertex.h dvi.h gui/message-window.h dvi-init.h \ + dvi-draw.h gui/statusline.h util.h $(kpathsea_srcdir)/hash.h \ + image-magick.h gui/pagesel.h my-snprintf.h string-utils.h \ + my-vsnprintf.h psgs.h +squeeze.o: squeeze.c \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-memstr.h +string-utils.o: string-utils.c \ + xdvi-config.h c-auto.h \ + xdvi.h xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + string-utils.h my-vsnprintf.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + events.h +string_list.o: string_list.c \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h string_list.h +tfmload.o: tfmload.c \ + xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h tfmload.h +util.o: util.c xdvi-config.h c-auto.h \ + xdvi.h \ + xdvi-debug.h version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + hypertex.h \ + dvi-init.h special.h events.h string-utils.h my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + x_util.h gui/message-window.h search-internal.h gui/search-dialog.h \ + dvisel.h print-internal.h encodings.h filehist.h exit-handlers.h \ + gui/xm_prefs.h gui/xm_prefsP.h +vf.o: vf.c xdvi-config.h c-auto.h dvi.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h dvi-init.h \ + dvi-draw.h +x_util.o: x_util.c xdvi-config.h c-auto.h \ + x_util.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + string-utils.h my-vsnprintf.h util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ + events.h \ + gui/statusline.h gui/message-window.h +xdvi.o: xdvi.c xdvi-config.h c-auto.h xdvi.h xdvi-debug.h version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + gui/menu.h events.h gui/xm_menu.h gui/xaw_menu.h gui/xm_toolbar.h \ + xserver-info.h \ + $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/tex-hush.h $(kpathsea_srcdir)/tex-make.h string-utils.h \ + my-vsnprintf.h translations.h dvi-init.h c-openmx.h gui/xicon.h \ + x_util.h gui/message-window.h gui/mag.h gui/pagesel.h dvi-draw.h \ + gui/statusline.h util.h $(kpathsea_srcdir)/hash.h \ + hypertex.h pagehist.h \ + filehist.h print-internal.h exit-handlers.h gui/xm_prefsP.h \ + pixmaps/magglass.xbm pixmaps/magglass_mask.xbm \ + gui/Panner.h +xserver-info.o: xserver-info.c xdvi.h xdvi-config.h c-auto.h xdvi-debug.h \ + version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/getopt.h \ + $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + xserver-info.h diff --git a/Build/source/texk/xdvik/dl_list.c b/Build/source/texk/xdvik/dl_list.c new file mode 100644 index 00000000000..76eeabc1297 --- /dev/null +++ b/Build/source/texk/xdvik/dl_list.c @@ -0,0 +1,164 @@ +#include "dl_list.h" + +size_t dl_list_len(struct dl_list *list) +{ + size_t len = 0; + struct dl_list *ptr; + for (ptr = list; ptr != NULL; ptr = ptr->next, len++) { ; } + return len; +} + +/* + Insert item to the list and return the result. +*/ +struct dl_list * +dl_list_insert(struct dl_list *list, void *item) +{ + struct dl_list *new_elem = xmalloc(sizeof *new_elem); + new_elem->item = item; + new_elem->next = NULL; + new_elem->prev = NULL; + + if (list == NULL) { + list = new_elem; + } + else { + /* append after current position */ + struct dl_list *ptr = list; + + new_elem->next = ptr->next; + new_elem->prev = ptr; + + if (ptr->next != NULL) + ptr->next->prev = new_elem; + + ptr->next = new_elem; + } + return new_elem; +} + +/* + Return head of the list. +*/ +struct dl_list * +dl_list_head(struct dl_list *list) +{ + for (; list != NULL && list->prev != NULL; list = list->prev) { ; } + return list; +} + +/* + Put a new item at the front of the list (current front is passed in first argument) + and return its position. +*/ +struct dl_list * +dl_list_push_front(struct dl_list *list, void *item) +{ + struct dl_list *new_elem = xmalloc(sizeof *new_elem); + new_elem->item = item; + new_elem->next = NULL; + new_elem->prev = NULL; + + if (list != NULL) { /* prepend to current position */ + new_elem->next = list; + list->prev = new_elem; + } + return new_elem; +} + +/* + Truncate list so that current pointer is the last element. +*/ +struct dl_list * +dl_list_truncate(struct dl_list *list) +{ + struct dl_list *ptr = list->next; + struct dl_list *save; + + list->next = NULL; + + while (ptr != NULL) { + save = ptr->next; + free(ptr); + ptr = save; + } + return list; +} + +/* + Truncate list at the head (i.e. remove the first element from it - head must be passed to this list), + and return the result. +*/ +struct dl_list * +dl_list_truncate_head(struct dl_list *list) +{ + struct dl_list *ptr = list->next; + if (list->next != NULL) + list->next->prev = NULL; + free(list); + return ptr; +} + +/* + If the item pointed to by *list isn't the head of the list, remove it, + set *list to the previous item, and return True. Else return False. +*/ +Boolean +dl_list_remove_item(struct dl_list **list) +{ + struct dl_list *ptr = *list; /* item to remove */ + if (ptr->prev == NULL) + return False; + ptr->prev->next = ptr->next; + if (ptr->next != NULL) + ptr->next->prev = ptr->prev; + /* update list */ + *list = (*list)->prev; + /* remove item */ + free(ptr); + + return True; +} + +void +dl_list_apply(struct dl_list *list, void (*func)(const void *item)) +{ + struct dl_list *ptr; + for (ptr = list; ptr != NULL; ptr = ptr->next) { + func(ptr->item); + } +} + +/* + Remove all items matching compare_func() from list. Must be called + with a pointer to the head of the list, which is also returned. + Returns the number of removed items in `count'. +*/ +struct dl_list * +dl_list_remove(struct dl_list *list, const void *item, + int *count, + void **removed_item, + Boolean (*compare_func)(const void *item1, const void *item2)) +{ + struct dl_list *ptr = list; + while (ptr != NULL) { + struct dl_list *next = ptr->next; + if (compare_func(ptr->item, item)) { /* match */ + *removed_item = ptr->item; + (*count)++; + if (ptr->prev != NULL) { + ptr->prev->next = ptr->next; + } + else { /* removed first element */ + list = list->next; + } + + if (ptr->next != NULL) + ptr->next->prev = ptr->prev; + free(ptr); + ptr = NULL; + } + ptr = next; + } + return list; +} diff --git a/Build/source/texk/xdvik/dl_list.h b/Build/source/texk/xdvik/dl_list.h new file mode 100644 index 00000000000..50ef7deee0c --- /dev/null +++ b/Build/source/texk/xdvik/dl_list.h @@ -0,0 +1,28 @@ +#include +#include "xdvi-config.h" +#include "xdvi.h" +#include "version.h" +#include "kpathsea/c-stat.h" +#include "kpathsea/hash.h" +#include "kpathsea/tex-file.h" + +/* double linked list */ +struct dl_list { + void *item; + struct dl_list *prev; + struct dl_list *next; +}; + +void dl_list_apply(struct dl_list *list, void (*func)(const void *item)); +size_t dl_list_len(struct dl_list *list); +struct dl_list *dl_list_head(struct dl_list *list); +struct dl_list *dl_list_push_front(struct dl_list *list, void *item); +struct dl_list *dl_list_insert(struct dl_list *list, void *item); +struct dl_list *dl_list_truncate(struct dl_list *list); +struct dl_list *dl_list_truncate_head(struct dl_list *list); +struct dl_list *dl_list_remove(struct dl_list *list, + const void *elem, + int *count, + void **item, + Boolean (*compare_func)(const void *item1, const void *item2)); +Boolean dl_list_remove_item(struct dl_list **list); diff --git a/Build/source/texk/xdvik/dvi-draw.c b/Build/source/texk/xdvik/dvi-draw.c index 12e4cabca73..a9a17a9f36d 100644 --- a/Build/source/texk/xdvik/dvi-draw.c +++ b/Build/source/texk/xdvik/dvi-draw.c @@ -21,8 +21,8 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTE: - xdvi is based on prior work, as noted in the modification history - in xdvi.c. +xdvi is based on prior work, as noted in the modification history +in xdvi.c. \*========================================================================*/ @@ -79,7 +79,7 @@ NOTE: #define TRACE_AA3 0 #endif -#define MY_DEBUG 1 +#define MY_DEBUG 0 #if MY_DEBUG # define TRACE_FIND_VERBOSE(x) TRACE_FIND(x) @@ -117,7 +117,7 @@ NOTE: static hashTableT t1fonts_hash; static hashTableT tfminfo_hash; static hashTableT fontmaps_hash; -static hashTableT font_warn_hash; +/* static hashTableT font_warn_hash; */ typedef enum { FAILURE_BLANK = -2, FAILURE_PK = -1, SUCCESS = 0 } t1FontLoadStatusT; #endif @@ -144,11 +144,11 @@ Boolean drawing_mag = False; /* Datastructures: - encodings[n]: Loaded from map file - [0] = 8r, - [1] = 8c, +encodings[n]: Loaded from map file +[0] = 8r, +[1] = 8c, - The vectors are demand-loaded in 'load_encoded_font' +The vectors are demand-loaded in 'load_encoded_font' */ struct encoding { @@ -162,30 +162,29 @@ static struct encoding *encodings = NULL; /* Dynamic array = realloc when it get static size_t enclidx = 0; /* global, for communication with find_T1_font */ /* - - t1fonts[n]: Built as xdvi loads t1 fonts - idx file short t1id loaded - [0] = /path/cmr10.pfb, cmr10 0 1 - [1] = /path/prmr.pfa, prmr 1 0 - [2] = /path/pcrr8a.pfa, pcrr8a 2 0 - - This array enumerates the loaded t1 fonts by full path name. - The integer `t1id' is the t1lib font id. The font will not be - extended/slanted/encoded. The `loaded' field indicates if - T1_LoadFont has been called for the font yet. Texfonts that need a - modified version of the t1 font must use T1_CopyFont to copy the - raw font and obtain the id of a new t1 font which can then be - modified. As described in the t1 docs a font must be loaded before - it can be copied. - - Fonts that are copies of other fonts have NULL filenames. If any - font files are to be reused based on the file name, the raw font - must be reused, not a copy. - - The `short' field contains the font as it was identified in the - fontmap. This is used to save searching; if two fonts are - identified the same way in the fontmap, they are the same font. - + t1fonts[n]: Built as xdvi loads t1 fonts + idx file short t1id loaded + [0] = /path/cmr10.pfb, cmr10 0 1 + [1] = /path/prmr.pfa, prmr 1 0 + [2] = /path/pcrr8a.pfa, pcrr8a 2 0 + + This array enumerates the loaded t1 fonts by full path name. + The integer `t1id' is the t1lib font id. The font will not be + extended/slanted/encoded. The `loaded' field indicates if + T1_LoadFont has been called for the font yet. Texfonts that need a + modified version of the t1 font must use T1_CopyFont to copy the + raw font and obtain the id of a new t1 font which can then be + modified. As described in the t1 docs a font must be loaded before + it can be copied. + + Fonts that are copies of other fonts have NULL filenames. If any + font files are to be reused based on the file name, the raw font + must be reused, not a copy. + + The `short' field contains the font as it was identified in the + fontmap. This is used to save searching; if two fonts are + identified the same way in the fontmap, they are the same font. + */ struct t1font_info { @@ -198,30 +197,30 @@ struct t1font_info { static struct t1font_info *t1fonts = NULL; /* Dynamic array */ /* - fontmaps[n]: Loaded from map file, and extended with 'implied' - fonts as needed. - idx texname enc exten. slant filena. t1libid pathn. tfmidx - [0] = pcrr8rn 0 750 0 pcrr8a 2 ... 2 - [1] = putro8r 0 0 0 putro8r 3 ... 3 - - The first 5 fields of this table are loaded from the font map - files, or filled out with default values when implied fonts are - set-up. The t1libid is -1 until the font is loaded or copied as - described under t1fonts. Once the dvi file reveals that the font - is needed, it is located on disk to ensure it exists, and the - pathname field is filled out. The t1 font is not loaded or - copied before it's needed because set_t1_char has been called to - draw a glyph from the font. The late loading is necessiated by the - high cost of loading fonts. If the font loading is concentrated at - startup of the program the startup-time becomes ecessively high due - to the high number of fonts used by the average LaTeX document. - - A value of 0 for `extension'/`slant' means no extension/slant. If - the input values are decimal (less than 10) they're multiplied by - 1000 and 10000 respectively to obtain fixed-point integer values. - (This means that xdvi will translate entries like `0.81' to 810.) - Integer values have the advantage that they can be tested for - exact equality on all architectures. + fontmaps[n]: Loaded from map file, and extended with 'implied' + fonts as needed. + idx texname enc exten. slant filena. t1libid pathn. tfmidx + [0] = pcrr8rn 0 750 0 pcrr8a 2 ... 2 + [1] = putro8r 0 0 0 putro8r 3 ... 3 + + The first 5 fields of this table are loaded from the font map + files, or filled out with default values when implied fonts are + set-up. The t1libid is -1 until the font is loaded or copied as + described under t1fonts. Once the dvi file reveals that the font + is needed, it is located on disk to ensure it exists, and the + pathname field is filled out. The t1 font is not loaded or + copied before it's needed because set_t1_char has been called to + draw a glyph from the font. The late loading is necessiated by the + high cost of loading fonts. If the font loading is concentrated at + startup of the program the startup-time becomes ecessively high due + to the high number of fonts used by the average LaTeX document. + + A value of 0 for `extension'/`slant' means no extension/slant. If + the input values are decimal (less than 10) they're multiplied by + 1000 and 10000 respectively to obtain fixed-point integer values. + (This means that xdvi will translate entries like `0.81' to 810.) + Integer values have the advantage that they can be tested for + exact equality on all architectures. */ struct fontmap { @@ -253,19 +252,19 @@ static struct fontmap *fontmaps = NULL; static size_t g_maplidx = 0; /* global, for communication with find_texfont */ /* - widthinfo[n]: TFM width info, loaded on demand as the fonts are used. - idx texname widths - [0] = cmr10 ... - [1] = ptmr8r ... - [2] = pcrr8rn ... - [3] = putro8r ... + widthinfo[n]: TFM width info, loaded on demand as the fonts are used. + idx texname widths + [0] = cmr10 ... + [1] = ptmr8r ... + [2] = pcrr8rn ... + [3] = putro8r ... - The widthinfo is loaded from the font tfm file because the type1 - width information isn't precise enough to avoid accumulating - rounding errors that make things visibly misaligned. This is - esp. noticeable in tables (for the lines separating the columns). + The widthinfo is loaded from the font tfm file because the type1 + width information isn't precise enough to avoid accumulating + rounding errors that make things visibly misaligned. This is + esp. noticeable in tables (for the lines separating the columns). - For other than "design" sizes the widths are scaled up or down. + For other than "design" sizes the widths are scaled up or down. */ @@ -667,7 +666,7 @@ put_rule(int x, int y, unsigned int w, unsigned int h) if (x < globals.win_expose.max_x && x + (int)w >= globals.win_expose.min_x && y < globals.win_expose.max_y && y + (int)h >= globals.win_expose.min_y) { if (--globals.ev.ctr == 0) { if (read_events(EV_NOWAIT) & EV_GE_MAG_GONE) { -/* fprintf(stderr, "longjmp1!\n"); */ + /* fprintf(stderr, "longjmp1!\n"); */ longjmp(globals.ev.canit, 1); } } @@ -695,7 +694,7 @@ put_bitmap(struct bitmap *bitmap, int x, int y) y < globals.win_expose.max_y && y + (int)bitmap->h >= globals.win_expose.min_y) { if (--globals.ev.ctr == 0) if (read_events(EV_NOWAIT) & EV_GE_MAG_GONE) { -/* fprintf(stderr, "longjmp2!\n"); */ + /* fprintf(stderr, "longjmp2!\n"); */ longjmp(globals.ev.canit, 1); } #if COLOR @@ -751,7 +750,7 @@ put_image(struct glyph *g, int x, int y) y < globals.win_expose.max_y && y + img->height >= globals.win_expose.min_y) { if (--globals.ev.ctr == 0) if (read_events(EV_NOWAIT) & EV_GE_MAG_GONE) { -/* fprintf(stderr, "longjmp3!\n"); */ + /* fprintf(stderr, "longjmp3!\n"); */ longjmp(globals.ev.canit, 1); } @@ -763,11 +762,11 @@ put_image(struct glyph *g, int x, int y) #endif /* TODO: Can we increase gamma locally to make the inverted text more readable? - and to draw the background, so something like this: - XFillRectangle(DISP, currwin.win, globals.gc.fore, x - currwin.base_x, y - currwin.base_y, - (unsigned int)img->width * 2, (unsigned int)img->height * 2); + and to draw the background, so something like this: + XFillRectangle(DISP, currwin.win, globals.gc.fore, x - currwin.base_x, y - currwin.base_y, + (unsigned int)img->width * 2, (unsigned int)img->height * 2); - test this with color changes!! + test this with color changes!! */ /*TEST_DELAY("check point 1 ...")*/ XPutImage(DISP, currwin.win, globals.gc.fore, img, @@ -802,6 +801,53 @@ draw_border(int x, int y, unsigned int width, unsigned int height, GC ourGC) XDrawRectangle(DISP, currwin.win, ourGC, x, y, width, height); } +/* draw the grid */ +static void +put_grid(int x, int y, + unsigned int width, unsigned int height, unsigned int unit, + GC gc) +{ + int i; + float sep; + unsigned int tmp; + + --width; + --height; + + + /* draw vertial grid */ +#define DRAWGRID_VER(gc) for (i = 1; \ + (tmp = x + (int)(i * sep)) < x + width; \ + i++) \ + XFillRectangle(DISP, currwin.win, (gc), \ + tmp, y, 1, height) + /* draw horizontal grid */ +#define DRAWGRID_HOR(gc) for (i = 1; \ + (tmp = y + (int)(i * sep)) < y + height; \ + i++) \ + XFillRectangle(DISP, currwin.win, (gc), \ + x, tmp, width, 1) + + if (resource.grid_mode > 2) { /* third level grid */ + sep = (float)unit / 4.0; + DRAWGRID_VER(gc); + DRAWGRID_HOR(gc); + } + + if (resource.grid_mode > 1) { /* second level grid */ + sep = (float)unit / 2.0; + DRAWGRID_VER(gc); + DRAWGRID_HOR(gc); + } + + if (resource.grid_mode > 0) { /* first level grid */ + sep = (float)unit; + DRAWGRID_VER(gc); + DRAWGRID_HOR(gc); + } +} +#undef DRAWGRID_VER +#undef DRAWGRID_HOR /* * Byte reading routines for dvi file. @@ -1140,8 +1186,8 @@ shrink_glyph(struct glyph *g) } shrunk_ptr += shrunk_bytes_wide / sizeof(bmUnitT); unshrunk_ptr += rows * g->bitmap.bytes_wide / sizeof(bmUnitT); -/* *((char **)&shrunk_ptr) += shrunk_bytes_wide; */ -/* *((char **)&unshrunk_ptr) += rows * g->bitmap.bytes_wide; */ + /* *((char **)&shrunk_ptr) += shrunk_bytes_wide; */ + /* *((char **)&unshrunk_ptr) += rows * g->bitmap.bytes_wide; */ rows_left -= rows; rows = currwin.shrinkfactor; } @@ -1243,7 +1289,7 @@ shrink_glyph_grey(struct glyph *g) int cols; int x, y; long thesample; -/* int min_sample = currwin.shrinkfactor * currwin.shrinkfactor * resource.density / 100; */ + /* int min_sample = currwin.shrinkfactor * currwin.shrinkfactor * resource.density / 100; */ Pixel onoff, onoff2; bmUnitT *unshrunk_ptr; unsigned int size; @@ -1255,26 +1301,29 @@ shrink_glyph_grey(struct glyph *g) do_color_change(); } #endif + if (pixeltbl == NULL) { /* fix #1611508 (segfault when starting with -nogrey) */ + do_color_change(); + } /* TODO: rounding errors causing color fringing (see HACK comment below): - \documentclass{article} - \pagestyle{empty} + \documentclass{article} + \pagestyle{empty} - \begin{document} - l - \end{document} + \begin{document} + l + \end{document} - With ./xdvi-xaw.bin -name xdvi -subpixel rgb -s 4 ./test.dvi: + With ./xdvi-xaw.bin -name xdvi -subpixel rgb -s 4 ./test.dvi: - subpixel order: rgb = 1 - g->x2: 0, init_cols: -2 - AFTER: g->x2: 0, init_cols: 2 + subpixel order: rgb = 1 + g->x2: 0, init_cols: -2 + AFTER: g->x2: 0, init_cols: 2 - but with ./xdvi-xaw.bin -name xdvi -s 4 ./test.dvi: + but with ./xdvi-xaw.bin -name xdvi -s 4 ./test.dvi: - g->x2: 0, init_cols: -3 - AFTER: g->x2: 0, init_cols: 1 + g->x2: 0, init_cols: -3 + AFTER: g->x2: 0, init_cols: 1 */ /* These machinations ensure that the character is shrunk according to @@ -1314,13 +1363,13 @@ shrink_glyph_grey(struct glyph *g) g->bitmap2.w = g->x2 + ROUNDUP((int)g->bitmap.w - g->x, currwin.shrinkfactor); else { fprintf(stderr, "AFTER: g->x2: %d, init_cols: %d\n", g->x2, init_cols); -/* fprintf(stderr, "g->bitmap.w / 3.0 + 0.5: %d; g->x / 3.0: %d; all: %d, %d\n", */ -/* (int)(g->bitmap.w / 3.0 + 0.5), */ -/* (int)(g->x / 3.0), */ -/* (int)((g->bitmap.w / 3.0 + 0.5) - g->x / 3.0), */ -/* g->x2 + (int)((((g->bitmap.w / 3.0 + 0.5) - g->x / 3.0) + currwin.shrinkfactor - 1) / currwin.shrinkfactor)); */ + /* fprintf(stderr, "g->bitmap.w / 3.0 + 0.5: %d; g->x / 3.0: %d; all: %d, %d\n", */ + /* (int)(g->bitmap.w / 3.0 + 0.5), */ + /* (int)(g->x / 3.0), */ + /* (int)((g->bitmap.w / 3.0 + 0.5) - g->x / 3.0), */ + /* g->x2 + (int)((((g->bitmap.w / 3.0 + 0.5) - g->x / 3.0) + currwin.shrinkfactor - 1) / currwin.shrinkfactor)); */ g->bitmap2.w = g->x2 + ROUNDUP((int)((g->bitmap.w / 3.0 + 0.5) - g->x / 3.0), currwin.shrinkfactor); -/* fprintf(stderr, "g->bitmap.w: %d\n", g->bitmap2.w); */ + /* fprintf(stderr, "g->bitmap.w: %d\n", g->bitmap2.w); */ } #else g->bitmap2.w = g->x2 + ROUNDUP((int)g->bitmap.w - g->x, currwin.shrinkfactor); @@ -1389,7 +1438,7 @@ shrink_glyph_grey(struct glyph *g) if (rows > rows_left) /* why - extra safety? */ rows = rows_left; cols_left = g->bitmap.w; -/* fprintf(stderr, "init_cols: %d\n", init_cols); */ + /* fprintf(stderr, "init_cols: %d\n", init_cols); */ cols = init_cols; while (cols_left) { if (cols > cols_left) /* why - extra safety? */ @@ -1398,15 +1447,15 @@ shrink_glyph_grey(struct glyph *g) thesample = sample(unshrunk_ptr, g->bitmap.bytes_wide, (int)g->bitmap.w - cols_left, cols, rows); -/* if (resource.subpixel_order != SUBPIXEL_NONE && resource.subpixel_energy[2] != 0) */ -/* onoff = thesample >= min_sample ? 0xffffff : 0; */ -/* else */ + /* if (resource.subpixel_order != SUBPIXEL_NONE && resource.subpixel_energy[2] != 0) */ + /* onoff = thesample >= min_sample ? 0xffffff : 0; */ + /* else */ onoff = pixeltbl[thesample]; #ifdef XSERVER_INFO if (globals.debug & DBG_PK) { int c; -/* fprintf(stderr, "onoff: %d\n", onoff); */ + /* fprintf(stderr, "onoff: %d\n", onoff); */ if (onoff > 65536) c = onoff / 65536; else if (onoff > 256) @@ -1478,7 +1527,7 @@ shrink_glyph_grey(struct glyph *g) else if (rest == 1) pixel2 |= onoff2 & G_visual->green_mask; else - pixel2 |= onoff2 & G_visual->blue_mask; + pixel2 |= onoff2 & G_visual->blue_mask; } else { /* SUBPIXEL_BGR */ if (rest == 0) @@ -1515,9 +1564,9 @@ shrink_glyph_grey(struct glyph *g) x++; } /* advance pointer by the number of rows covered */ -/* fprintf(stderr, "++: %d; %d, %d\n", rows * g->bitmap.bytes_wide, g->bitmap.bytes_wide, sizeof(bmUnitT)); */ + /* fprintf(stderr, "++: %d; %d, %d\n", rows * g->bitmap.bytes_wide, g->bitmap.bytes_wide, sizeof(bmUnitT)); */ unshrunk_ptr += rows * g->bitmap.bytes_wide / sizeof(bmUnitT); -/* *((char **)&unshrunk_ptr) += rows * g->bitmap.bytes_wide; */ + /* *((char **)&unshrunk_ptr) += rows * g->bitmap.bytes_wide; */ rows_left -= rows; rows = currwin.shrinkfactor; y++; @@ -1538,15 +1587,15 @@ shrink_glyph_grey(struct glyph *g) /* fill remaining rows not covered before (how?) */ while (y < (int)g->bitmap2.h) { for (x = 0; x < (int)g->bitmap2.w; x++) { -/* int c = *pixeltbl; */ + /* int c = *pixeltbl; */ #if TRACE_AA1 fprintf(stderr, "Remaining at %d, %d: 0x%.6lx\n", x, y, *pixeltbl); #endif XPutPixel(g->image2, x, y, *pixeltbl); -/* if (c == 0) */ -/* fprintf(stdout, ",.."); */ -/* else */ -/* fprintf(stdout, ",%.2x", c); */ + /* if (c == 0) */ + /* fprintf(stdout, ",.."); */ + /* else */ + /* fprintf(stdout, ",%.2x", c); */ if (globals.gc.fore2 != NULL) { g->image2->data = g->pixmap2_gc2; #if TRACE_AA1 @@ -1705,7 +1754,7 @@ spcl_scan(Boolean (*spcl_proc)(char *str, int str_len, void *data), void *data, for (;;) { ch = xone(fp); -/* print_dvi(ch); */ + /* print_dvi(ch); */ n = scantable[ch]; if (n < MM) while (n-- != 0) @@ -1910,7 +1959,7 @@ set_char( #ifdef DBG_AA fprintf(stderr, "shinking the bitmap!\n"); #endif /* DBG_AA */ -/* print_bitmap(&g->bitmap); */ + /* print_bitmap(&g->bitmap); */ shrink_glyph_grey(g); } put_image(g, PXL_H - g->x2, PXL_V - g->y2); @@ -1969,7 +2018,11 @@ load_n_set_char( #endif wide_ubyte ch) { - if (!load_font(currinf.fontp, resource.t1lib)) { /* if not found */ + if (!load_font(currinf.fontp, resource.t1lib +#if DELAYED_MKTEXPK + , True +#endif + )) { /* if not found */ if (globals.ev.flags & EV_GE_NEWDOC) { /* if abort */ longjmp(globals.ev.canit, 1); } @@ -2111,7 +2164,7 @@ draw_part(FILE *fp, struct frame *minframe, double current_dimconv) ubyte ch = 0; #ifdef TEXXET struct drawinf oldinfo; - ubyte oldmaxchar = 0; + wide_ubyte oldmaxchar = 0; off_t file_pos = 0; int refl_count = 0; #endif @@ -2427,7 +2480,7 @@ warn_raw_postscript(void) } /* too likely to overdraw important information */ - /* statusline_print(STATUS_MEDIUM, */ + /* statusline_info(STATUS_MEDIUM, */ /* "Warning: Postscript commands on this page may not display correctly."); */ } #endif /* PS */ @@ -2472,6 +2525,16 @@ draw_page(void) ROUNDUP(pageinfo_get_page_height(current_page), currwin.shrinkfactor) + 2, globals.gc.high); #endif /* MOTIF */ + if (resource.grid_mode > 0) { /* grid is wanted */ + put_grid(-currwin.base_x, -currwin.base_y, + /* ROUNDUP(globals.page.unshrunk_w, currwin.shrinkfactor) + 2, */ + /* ROUNDUP(globals.page.unshrunk_h, currwin.shrinkfactor) + 2, */ + ROUNDUP(pageinfo_get_page_width(current_page), currwin.shrinkfactor) + 2, + ROUNDUP(pageinfo_get_page_height(current_page), currwin.shrinkfactor) + 2, + ROUNDUP(globals.grid_paper_unit, currwin.shrinkfactor), + globals.gc.high); + } + (void) lseek(fileno(globals.dvi_file.bak_fp), pageinfo_get_offset(current_page), SEEK_SET); memset((char *)&currinf.data, '\0', sizeof currinf.data); @@ -2492,11 +2555,11 @@ draw_page(void) rect.y = globals.win_expose.min_y; rect.width = globals.win_expose.max_x - globals.win_expose.min_x; rect.height = globals.win_expose.max_y - globals.win_expose.min_y; -/* fprintf(stderr, "clip: %d, %d, %d, %d\n", */ -/* globals.win_expose.min_x, */ -/* globals.win_expose.min_y, */ -/* globals.win_expose.max_x - globals.win_expose.min_x, */ -/* globals.win_expose.max_y - globals.win_expose.min_y); */ + /* fprintf(stderr, "clip: %d, %d, %d, %d\n", */ + /* globals.win_expose.min_x, */ + /* globals.win_expose.min_y, */ + /* globals.win_expose.max_x - globals.win_expose.min_x, */ + /* globals.win_expose.max_y - globals.win_expose.min_y); */ #define SET_CLIP(gc) if (gc != NULL) XSetClipRectangles(DISP, gc, 0, 0, &rect, 1, Unsorted) #define CLEAR_CLIP(gc) if (gc != NULL) XSetClipMask(DISP, gc, None) /* Set clip masks for all GC's */ @@ -2513,22 +2576,22 @@ draw_page(void) if (!setjmp(globals.ev.canit)) { /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BUG ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ALL GLYPH DRAWING/RULE SETTING COMMANDS THAT MIGHT INVOKE - longjmp(globals.ev.canit) - MUST GO INSIDE THIS IF CASE, AND MUST NOT BE INVOKED FROM - SOMEWHERE ELSE! + ALL GLYPH DRAWING/RULE SETTING COMMANDS THAT MIGHT INVOKE + longjmp(globals.ev.canit) + MUST GO INSIDE THIS IF CASE, AND MUST NOT BE INVOKED FROM + SOMEWHERE ELSE! - Failure to check whether a command could (indirectly) invoke - such a drawing routine (like e.g. put_rule()) will result - in *really* strange bugs (see e.g. #616920, and probably also #471021). + Failure to check whether a command could (indirectly) invoke + such a drawing routine (like e.g. put_rule()) will result + in *really* strange bugs (see e.g. #616920, and probably also #471021). - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BUG ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BUG ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* generate an expose event */ if (search_have_match(current_page)) { search_erase_highlighting(False); } - if (resource.mouse_mode == MOUSE_TEXT_MODE) { + if (globals.curr_mode == TEXT_MODE_ACTIVE) { text_change_region(TEXT_SEL_ERASE, NULL); } draw_part(globals.dvi_file.bak_fp, current_frame = &frame0, dimconv); @@ -2550,9 +2613,9 @@ draw_page(void) #ifdef PS psp.interrupt(); /* reset this flag too, just to make sure ... */ -#if GS_PIXMAP_CLEARING_HACK +# if defined(PS_GS) && GS_PIXMAP_CLEARING_HACK had_ps_specials = False; -#endif +# endif #endif globals.ev.flags &= ~EV_MAG_GONE; #if 0 @@ -2582,11 +2645,11 @@ draw_page(void) /* highlight search match */ search_draw_inverted_regions(); } - if (currwin.win == mane.win && resource.mouse_mode == MOUSE_TEXT_MODE) { + if (currwin.win == mane.win && (globals.curr_mode == TEXT_MODE_ACTIVE)) { /* highlight selection */ text_change_region(TEXT_SEL_REDRAW, NULL); } - if (resource.mouse_mode == MOUSE_RULER_MODE) { + if (globals.curr_mode == RULER_MODE_ACTIVE) { redraw_ruler(); } @@ -2611,7 +2674,7 @@ draw_page(void) /* this sets the file-scope htex_anchor_type to the type of the anchor just scanned, which is used by the drawing routines to determine whether current position is inside an anchor. Called from special.c. - */ +*/ void htex_do_special(const char *str, size_t len) { @@ -2712,8 +2775,8 @@ delete_last_bbox(struct word_info *info) static void finish_bbox(struct word_info *info) { -/* if (info->bboxes_idx == 0) /\* nothing to do *\/ */ -/* return; */ + /* if (info->bboxes_idx == 0) /\* nothing to do *\/ */ + /* return; */ info->bboxes_idx++; while (info->bboxes_idx + 1 > info->bboxes_size) { @@ -2919,7 +2982,7 @@ do_char(wide_ubyte ch, /* default min space between words, in DVI units */ /* TODO: for T1 fonts, should we look at fontdimen2 / fontdimen4? (e.g. tfminfo[fontmaps[currinf.fontp->t1id].tfmidx].fontdimen2) - */ + */ long min_delta = (int)(1.5 * fsize + 0.5) << 16; size_t buf_offset = w_info->buffer_offset; @@ -2958,13 +3021,13 @@ do_char(wide_ubyte ch, last_u_glyph = 0; w_info->bboxes_idx = 0; reset_bboxes(w_info); -/* w_info->curr_buf_idx = 0; */ + /* w_info->curr_buf_idx = 0; */ reinit_scan = False; had_newline = False; had_chars_in_line = False; } -/* TRACE_FIND((stderr, "\n--------- POSITIONS: %ld, %ld, %ld, %ld", x1, pxl_v2, x2, y2)); */ + /* TRACE_FIND((stderr, "\n--------- POSITIONS: %ld, %ld, %ld, %ld", x1, pxl_v2, x2, y2)); */ if ((u_glyph = get_unicode_char(ch, currinf, retbuf)) == 0) { if (retbuf[0] == '\0') { @@ -2990,7 +3053,7 @@ do_char(wide_ubyte ch, if we have more text, this '\0' will be overwritten in the next call. */ /* apply accent/linebreak heuristics */ -/* fprintf(stderr, "Checking: %ld > 0, %ld > 0\n", last_dvi_h1, last_pxl_v); */ + /* fprintf(stderr, "Checking: %ld > 0, %ld > 0\n", last_dvi_h1, last_pxl_v); */ if (last_dvi_h1 > 0 && last_pxl_v > 0) { /* had at least 1 character */ TRACE_FIND_VERBOSE((stderr, "++++ dvi_h: %ld, last_dvi_h1: %ld, w_info->curr_buf_idx: %ld", DVI_H, last_dvi_h1, (unsigned long)w_info->curr_buf_idx)); @@ -3118,7 +3181,7 @@ do_char(wide_ubyte ch, || (w_info->text_selection_pass && inside_bbox(x1, pxl_v2, x2 - x1, g->bitmap.h, w_info->bboxes))) { -/* fprintf(stderr, "inserting1 %s\n", expanded_lig); */ + /* fprintf(stderr, "inserting1 %s\n", expanded_lig); */ if (had_newline) { w_info->txt_buf[w_info->curr_buf_idx++] = '\n'; had_newline = False; @@ -3127,7 +3190,7 @@ do_char(wide_ubyte ch, had_chars_in_line = True; for (i = 0; i < len; i++) { w_info->curr_buf_idx++; -/* fprintf(stderr, "setting index to: %d\n", w_info->curr_buf_idx); */ + /* fprintf(stderr, "setting index to: %d\n", w_info->curr_buf_idx); */ if (w_info->bbox_pass) { int from, to; map_index_positions(settings->searchinfo, page_mapping, &from, &to); @@ -3140,13 +3203,13 @@ do_char(wide_ubyte ch, } } else if (!w_info->text_selection_pass - || (w_info->text_selection_pass && inside_bbox(x1, pxl_v2, x2 - x1, g->bitmap.h, w_info->bboxes))) { + || (w_info->text_selection_pass && inside_bbox(x1, pxl_v2, x2 - x1, g->bitmap.h, w_info->bboxes))) { /* convert to utf8 */ char utf8_buf[MAX_CHARS]; /* ample ... */ size_t len; /* convert to utf8, eventually lowercasing */ ucs4_to_utf8(u_glyph, utf8_buf, &len, convert_to_lowercase); -/* fprintf(stderr, "inserting2 %lu\n", u_glyph); */ + /* fprintf(stderr, "inserting2 %lu\n", u_glyph); */ if (had_newline) { w_info->txt_buf[w_info->curr_buf_idx++] = '\n'; had_newline = False; @@ -3155,7 +3218,7 @@ do_char(wide_ubyte ch, had_chars_in_line = True; for (i = 0; i < len; i++) { w_info->curr_buf_idx++; -/* fprintf(stderr, "setting index2 to: %d\n", w_info->curr_buf_idx); */ + /* fprintf(stderr, "setting index2 to: %d\n", w_info->curr_buf_idx); */ if (w_info->bbox_pass) { int from, to; #if 0 @@ -3165,7 +3228,7 @@ do_char(wide_ubyte ch, fprintf(stderr, "%d: %d\n", j, page_mapping[j]); } #endif /* 0 */ -/* fprintf(stderr, "mapping!\n"); */ + /* fprintf(stderr, "mapping!\n"); */ map_index_positions(settings->searchinfo, page_mapping, &from, &to); if (inside_text_match((int)w_info->curr_buf_idx, from, to)) { create_bbox(w_info, x1, pxl_v2, x2 - x1, g->bitmap.h); @@ -3200,7 +3263,11 @@ text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch) if (currinf.set_char_p == load_n_set_char) { if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */ return 0; - if (!load_font(currinf.fontp, resource.t1lib)) { /* if not found */ + if (!load_font(currinf.fontp, resource.t1lib +#if DELAYED_MKTEXPK + , True +#endif + )) { /* if not found */ if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */ return 0; @@ -3249,7 +3316,7 @@ text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch) else if (currinf.set_char_p == set_vf_char) { struct macro *m; struct drawinf oldinfo; - ubyte oldmaxchar; + wide_ubyte oldmaxchar; #ifdef TEXXET long dvi_h_sav; #endif @@ -3342,7 +3409,11 @@ geom_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch) if (currinf.set_char_p == load_n_set_char) { if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */ return 0; - if (!load_font(currinf.fontp, resource.t1lib)) { /* if not found */ + if (!load_font(currinf.fontp, resource.t1lib +#if DELAYED_MKTEXPK + , True +#endif + )) { /* if not found */ if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */ return 0; @@ -3393,7 +3464,7 @@ geom_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch) else if (currinf.set_char_p == set_vf_char) { struct macro *m; struct drawinf oldinfo; - ubyte oldmaxchar; + wide_ubyte oldmaxchar; #ifdef TEXXET long dvi_h_sav; #endif @@ -3503,7 +3574,7 @@ geom_scan_part(long(*char_proc)(FILE *, struct scan_info *, wide_ubyte), ubyte ch; #ifdef TEXXET struct drawinf oldinfo; - ubyte oldmaxchar = 0; + wide_ubyte oldmaxchar = 0; off_t file_pos = 0; int refl_count = 0; #endif @@ -4006,96 +4077,6 @@ scan_last_src_spcl(char *str, int str_len, void *data) } -/* Replace (pseudo-)format arguments in NULL-terminated argv list as follows: - * %f -> filename, %l -> linenumber, %c -> column number. - * If %f or %l are not specified, they are appended as %f and +%l. - * If colno == 0, no %c argument is provided. - */ -static char ** -src_format_arguments(char **argv, const char *filename, int lineno, int colno) -{ - size_t i; - Boolean found_filename = False; - Boolean found_lineno = False; - /* index of argv elem that contained a deleted column number specifier */ - int colno_deleted = -1; - - for (i = 0; argv[i] != NULL; i++) { - char *ptr, *curr = argv[i]; - while ((ptr = strchr(curr, '%')) != NULL) { - char *p1; - if ((p1 = strchr("flc", ptr[1])) != NULL) { /* we have a formatting char */ - char digit_arg[LENGTH_OF_INT]; - const char *new_elem = NULL; - /* remember offsets and lengths */ - size_t l_init = ptr - argv[i]; - size_t l_rest = strlen(ptr + 2) + 1; - size_t l_mid; - - if (*p1 == 'f') { - found_filename = True; - new_elem = filename; - } - else if (*p1 == 'l') { - found_lineno = True; - sprintf(digit_arg, "%d", lineno); - new_elem = digit_arg; - } - else if (*p1 == 'c') { - if (colno == 0) { /* if we have no column information, don't provide this argument */ - memmove(ptr, ptr + 2, l_rest); - curr = ptr; - colno_deleted = i; - continue; - } - sprintf(digit_arg, "%d", colno); - new_elem = digit_arg; - } - - l_mid = strlen(new_elem); - - argv[i] = xrealloc(argv[i], strlen(argv[i]) + l_mid + 1); - curr = argv[i] + l_init; /* need to reinitialize it because of realloc */ - memmove(curr + l_mid, curr + 2, l_rest); - memcpy(curr, new_elem, l_mid); - curr += l_mid; - } - else if (ptr[1] == '%') { /* escaped %, skip both */ - curr = ptr + 2; - } - else { - curr = ptr + 1; - } - } - } - - /* append line number and file name arguments if they were not specified */ - if (!found_lineno) { - i++; - argv = xrealloc(argv, (i + 1) * sizeof *argv); - argv[i - 1] = xmalloc(LENGTH_OF_INT + 2); - sprintf(argv[i - 1], "+%d", lineno); - argv[i] = NULL; - } - - if (!found_filename) { - i++; - argv = xrealloc(argv, (i + 1) * sizeof *argv); - argv[i - 1] = xstrdup(filename); - argv[i] = NULL; - } - - /* if we deleted %c, remove from argv if it's empty now */ - if (colno_deleted > -1 && strlen(argv[colno_deleted]) == 0) { - for (i = colno_deleted; argv[i] != NULL; i++) { - argv[i] = argv[i + 1]; - - } - } - return argv; -} - - static void src_spawn_editor(const struct src_parsed_special *parsed) { @@ -4149,7 +4130,7 @@ src_spawn_editor(const struct src_parsed_special *parsed) else { TRACE_SRC((stderr, "source file \"%s\" expanded to \"%s\"\n", parsed->filename, expanded_filename)); if (buf.st_mtime > globals.dvi_file.time) { - statusline_print(STATUS_FOREVER, + statusline_info(STATUS_FOREVER, "Warning: TeX file is newer than dvi file - " "source special information might be wrong."); } @@ -4271,12 +4252,12 @@ source_reverse_search(int x, int y, wide_bool call_editor) } if (found.filename_len != 0) - statusline_print(STATUS_MEDIUM, + statusline_info(STATUS_MEDIUM, "No source specials on this page - nearest on page %d", lower + globals.pageno_correct); else { /* nothing found at all; complain */ - XBell(DISP, 0); + xdvi_bell(); popup_message(globals.widgets.top_level, MSG_ERR, /* helptext */ @@ -4299,7 +4280,7 @@ source_reverse_search(int x, int y, wide_bool call_editor) src_spawn_editor(foundp); } else { - statusline_print(STATUS_MEDIUM, "nearest special at (%d,%d): \"%s:%d\"", + statusline_info(STATUS_MEDIUM, "nearest special at (%d,%d): \"%s:%d\"", x / currwin.shrinkfactor, y / currwin.shrinkfactor, foundp->filename, foundp->line); } free(foundp->filename); @@ -4990,12 +4971,14 @@ anchor_search(const char *str) /* Start search over pages */ for (test_page = 0; test_page < total_pages; test_page++) { if (spcl_scan(htex_scan_special, NULL, True, globals.dvi_file.bak_fp)) { + TRACE_HTEX((stderr, "Found anchor on page %d", test_page)); found_anchor = True; break; } } if (!found_anchor) { + TRACE_HTEX((stderr, "Anchor not found")); /* Restore file position. */ maxchar = maxchar_save; currinf = currinf_save; @@ -5004,8 +4987,8 @@ anchor_search(const char *str) (void)lseek(fileno(globals.dvi_file.bak_fp), pos_save, SEEK_SET); dvi_pointer_frame->pos = dvi_pointer_frame->end = dvi_buffer; } - XBell(DISP, 0); - statusline_print(STATUS_MEDIUM, "Error: Anchor \"%s\" not found.", str); + xdvi_bell(); + statusline_error(STATUS_MEDIUM, "Error: Anchor \"%s\" not found.", str); return; } @@ -5039,6 +5022,7 @@ anchor_search(const char *str) goto_page(test_page, resource.keep_flag ? NULL : home, False); page_history_insert(test_page); do_autoscroll = True; + TRACE_HTEX((stderr, "Found anchor on position %d", y_pos)); htex_set_anchormarker(y_pos); } /* reset info */ @@ -5281,38 +5265,38 @@ setup_encoded_T1_font(const char *mapfile, { /* xdvi T1 Font loading is done in two steps: - 1. At xdvi startup two things happen: + 1. At xdvi startup two things happen: - a. The fontmaps are read. + a. The fontmaps are read. - b. the dvi file is (partialy) scanned, and fonts are set up. - In the case of t1 fonts we only set up the data structures, - they are not actually loaded until they are used. + b. the dvi file is (partialy) scanned, and fonts are set up. + In the case of t1 fonts we only set up the data structures, + they are not actually loaded until they are used. - 2. At the time a T1 font is used it is loaded, encoded, extended - and slanted as prescribed. + 2. At the time a T1 font is used it is loaded, encoded, extended + and slanted as prescribed. - This procedure takes care of step 1a. It locates the font and - sets up the data-structures so it may be assumed, by xdvi, to be - loaded. Return the fontmaps array index. + This procedure takes care of step 1a. It locates the font and + sets up the data-structures so it may be assumed, by xdvi, to be + loaded. Return the fontmaps array index. - The 'texname' param should be the texname of the font, such as - ptmr8r or cmr10. + The 'texname' param should be the texname of the font, such as + ptmr8r or cmr10. - The 'alias' param should be the file name of the font if it is - different from the texname. This is often the case with fonts - defined in fontmaps. + The 'alias' param should be the file name of the font if it is + different from the texname. This is often the case with fonts + defined in fontmaps. - If, for some reason, the full filename of the font has already - been looked up before we get here it is passed in the filename - param so we don't have to look it up again. + If, for some reason, the full filename of the font has already + been looked up before we get here it is passed in the filename + param so we don't have to look it up again. - Implied encodings are not handled here. + Implied encodings are not handled here. - REMEMBER: THIS PROC IS CALLED FOR EACH FONT IN THE FONTMAPS, WE - CANNOT DO ANY EXPENSIVE OPERATIONS HERE!!! + REMEMBER: THIS PROC IS CALLED FOR EACH FONT IN THE FONTMAPS, WE + CANNOT DO ANY EXPENSIVE OPERATIONS HERE!!! - */ + */ int test_idx; size_t curr_idx; @@ -5391,7 +5375,11 @@ try_pk_fallback(int idx, struct font *fontp) { Boolean success; - success = load_font(fontp, False); /* loading non-t1 version of font */ + success = load_font(fontp, False +#if DELAYED_MKTEXPK + , True +#endif + ); /* loading non-t1 version of font */ fontmaps[idx].force_pk = True; TRACE_T1((stderr, "setting force_pk for %d to true; success for PK fallback: %d\n", @@ -5438,7 +5426,7 @@ load_font_now(int idx, struct font *fontp) int cid; /* The id of the copied font */ int enc, sl, ext; -/* statusline_print(STATUS_SHORT, "Loading T1 font %s", fontmaps[idx].filename); */ + /* statusline_info(STATUS_SHORT, "Loading T1 font %s", fontmaps[idx].filename); */ TRACE_T1((stderr, "adding %s %s", fontmaps[idx].filename, fontmaps[idx].pathname)); @@ -5559,6 +5547,11 @@ find_T1_font(const char *texname) } #if 0 + /* SU: Fix for #1295829: If eg. plr10 is missing from ps2pk.map, xdvi + will use plr10.pfb without reencoding it instead of calling mktexpk + for plr10.mf which will use the correct encoding. + */ + /* Second: the bare name */ filename = kpse_find_file(texname, kpse_type1_format, 0); @@ -5568,7 +5561,7 @@ find_T1_font(const char *texname) return idx; } #endif - + /* Third: Implied encoding? */ fl = strlen(texname); @@ -5741,7 +5734,7 @@ read_cfg_file(const char *file) filename = kpse_find_file(file, kpse_program_text_format, 1); if (filename == NULL) { - statusline_print(STATUS_MEDIUM, "Warning: Unable to find \"%s\"!", file); + statusline_error(STATUS_MEDIUM, "Warning: Unable to find \"%s\"!", file); return; } @@ -5909,6 +5902,12 @@ get_t1_glyph( size, currwin.shrinkfactor)); /* Check if the glyph already has been rendered */ + if (ch > currinf.fontp->maxchar) { + /* in this case, the replacement font is 'smaller' than the requested one. + This will later lead to a warning: "Character 9561 not defined in font cmr10". + */ + return NULL; + } if ((g = &currinf.fontp->glyph[ch])->bitmap.bits == NULL) { int bitmapbytes; int h; @@ -5931,7 +5930,7 @@ get_t1_glyph( /* This can happen e.g. if font is too small; example with plain TeX: \magnification=50 Hello, world!\end */ - statusline_print(STATUS_FOREVER, + statusline_info(STATUS_FOREVER, "Error rendering character 0x%x `%c' - replacing by whitespace", ch, isprint(ch) ? ch : '?'); @@ -5952,19 +5951,53 @@ get_t1_glyph( } if (G->bits == NULL) { +#if 0 + /* in this case the glyph can either be a whitespace or .notdef. + We would like to warn about the latter, but I haven't found a way + to distinguish between the two cases that works reliably. + + If the font has built-in encoding, we can't use the following + test to check for the name, since the index i doesn't correspond to "ch": + */ + char **glyph_names = T1_GetAllCharNames(t1libid); + for (i = 0; glyph_names[i] != NULL; i++) { + fprintf(stderr, "CHAR %d: %s\n", i, glyph_names[i]); + } + free(glyph_names); // not sure about this ... + + /* + For ~/projects/xdvik/bugs/cjk-notdef-problem, this prints: + + CHAR 0: .notdef + CHAR 1: uni3000 + + even though the character at point 0 is uni3000. + + For external encodings, it should be possible to look at the encoding + vector: + */ + + int enc = fontmaps[id].enc; + if (enc != -1) { + if (encodings[enc].vector == NULL) { + fprintf(stderr, "Unexpected: vector is NULL!\n"); + } + else { + fprintf(stderr, "GOT CHAR: %s\n", encodings[enc].vector[ch]); + } + } + + /* + Also checking for the font dimens doesn't help in this case - the + results are identical for .notdef and uni3000: + */ + + fprintf(stderr, "DIMENS: %d,%d,%d,%d\n", + G->metrics.rightSideBearing, G->metrics.leftSideBearing, + G->metrics.advanceX, G->metrics.advanceY); + + /* the following simple test for whitespace doesn't work for Chinese fonts either: */ if (ch != ' ') { - /* -- janl: - Blank glyph != .notdef (e.g., it could be a space char). - Drop message until I find out how .notdef can be detected. - -- SU 2003/02/24: - I changed this, since dropped characters is an important - thing to warn users about. We try to catch the space char - case by checking for space above (rather lame, since it won't - catch all fonts, but ...) - The only case in which TeX actually uses a space character seems - to be the output of `tex testfont', or in some CJK fonts - (e.g. gbksong25). - */ char index[128]; char *fontname = xstrdup(currinf.fontp->fontname); size_t dummy = 0; @@ -5987,7 +6020,7 @@ get_t1_glyph( if (!find_str_int_hash(&font_warn_hash, fontname, &dummy)) { if (!resource.hush_chars) XDVI_WARNING((stderr, "Character %d is mapped to .notdef in font %s (page %d), " - "replacing by whitespace.", + "replaced by whitespace.", ch, currinf.fontp->fontname, current_page + 1)); put_str_int_hash(&font_warn_hash, fontname, dummy); } @@ -5995,6 +6028,7 @@ get_t1_glyph( free(fontname); } } +#endif /* *flag = FAILURE_BLANK; */ /* g->addr = -1; */ /* return NULL; */ @@ -6003,7 +6037,7 @@ get_t1_glyph( set_empty_char(), and the former apparently needs a valid bitmap. Check how this is done without t1lib. */ - TRACE_T1((stderr, "replacing .notdef char 0x%02x by space.\n", ch)); + TRACE_T1((stderr, "replaced .notdef or whitespace char 0x%02x by space.\n", ch)); g->bitmap.w = 1; g->bitmap.h = 1; g->bitmap.bytes_wide = T1PAD(g->bitmap.w, archpad) / 8; @@ -6116,13 +6150,13 @@ void init_t1(void) void *success; /* Attempt to set needed padding. - FIXME: This is not really the required alignment/padding. On - ix86 the requirement for int * is 8 bits, on sparc on the other - hand it's 32 bits. Even so, some operations will be faster if - the bitmaps lines are alligned "better". But on the other hand - this requires a more complex glyph copying operation... + FIXME: This is not really the required alignment/padding. On + ix86 the requirement for int * is 8 bits, on sparc on the other + hand it's 32 bits. Even so, some operations will be faster if + the bitmaps lines are alligned "better". But on the other hand + this requires a more complex glyph copying operation... - - janl 16/5/2001 + - janl 16/5/2001 */ archpad = BMBYTES * 8; i = T1_SetBitmapPad(archpad); @@ -6361,12 +6395,12 @@ do_color_change(void) globals.gc.fore = set_or_make_gc(globals.gc.fore, GXor, fg_current->pixel & set_bits, 0); if (clr_bits) { globals.gc.fore2 = globals.gc.fore2_bak = set_or_make_gc(globals.gc.fore2_bak, GXandInverted, - ~fg_current->pixel & clr_bits, 0); + ~fg_current->pixel & clr_bits, 0); } } else { globals.gc.fore = set_or_make_gc(globals.gc.fore, GXandInverted, - ~fg_current->pixel & clr_bits, 0); + ~fg_current->pixel & clr_bits, 0); } } @@ -6409,7 +6443,7 @@ do_color_change(void) unsigned int red, green, blue; Pixel pixel; /* fprintf(stderr, "frac: %f\n", frac); */ -/* fprintf(stderr, "fg_current: %d, bg_current: %d\n", fg_current->color.r, bg_current->color.r); */ + /* fprintf(stderr, "fg_current: %d, bg_current: %d\n", fg_current->color.r, bg_current->color.r); */ red = frac * ((double) fg_current->color.r - bg_current->color.r) + bg_current->color.r; @@ -6497,7 +6531,7 @@ do_color_change(void) if (using_planes && bg_current->pixel != resource.back_Pixel) { bg_current->pixel = resource.back_Pixel; -/* XSetWindowBackground(DISP, mane.win, bg_current->pixel); */ + /* XSetWindowBackground(DISP, mane.win, bg_current->pixel); */ #if MOTIF fprintf(stderr, "setting window background!\n"); XSetWindowBackground(DISP, XtWindow(globals.widgets.main_window), bg_current->pixel); @@ -6517,15 +6551,15 @@ do_color_change(void) if (using_planes) { globals.gc.rule = set_or_make_gc(globals.gc.rule, GXor, fg_current->palette[15], - bg_current->pixel); + bg_current->pixel); globals.gc.fore = set_or_make_gc(globals.gc.fore, GXor, fg_current->palette[15], - bg_current->pixel); + bg_current->pixel); } else { globals.gc.rule = set_or_make_gc(globals.gc.rule, GXcopy, fg_current->palette[15], - bg_current->pixel); + bg_current->pixel); globals.gc.fore = set_or_make_gc(globals.gc.fore, GXcopy, fg_current->palette[15], - bg_current->pixel); + bg_current->pixel); } globals.gc.fore2 = NULL; @@ -6541,52 +6575,52 @@ do_color_change(void) for (i = 0; i <= mane.shrinkfactor * mane.shrinkfactor; ++i) { pixeltbl[i] = fg_current->palette[(i * 30 + mane.shrinkfactor * mane.shrinkfactor) - / (2 * mane.shrinkfactor * mane.shrinkfactor)]; + / (2 * mane.shrinkfactor * mane.shrinkfactor)]; } } } } /* end if resource.use_grey */ else #endif /* GREY */ - { - if (!fg_current->pixel_good) { - fg_current->pixel = alloc_color(&fg_current->color, - color_data[0].pixel); - fg_current->pixel_good = True; - } + { + if (!fg_current->pixel_good) { + fg_current->pixel = alloc_color(&fg_current->color, + color_data[0].pixel); + fg_current->pixel_good = True; + } - if (globals.debug & DBG_DVI) - printf("do_color_change: fg = %lx, bg = %lx\n", - fg_current->pixel, bg_current->pixel); + if (globals.debug & DBG_DVI) + printf("do_color_change: fg = %lx, bg = %lx\n", + fg_current->pixel, bg_current->pixel); - globals.gc.rule = set_or_make_gc(globals.gc.rule, GXcopy, fg_current->pixel, bg_current->pixel); + globals.gc.rule = set_or_make_gc(globals.gc.rule, GXcopy, fg_current->pixel, bg_current->pixel); - set_bits = (Pixel) (fg_current->pixel & ~bg_current->pixel); - clr_bits = (Pixel) (bg_current->pixel & ~fg_current->pixel); - globals.gc.fore2 = NULL; + set_bits = (Pixel) (fg_current->pixel & ~bg_current->pixel); + clr_bits = (Pixel) (bg_current->pixel & ~fg_current->pixel); + globals.gc.fore2 = NULL; - if (resource.copy - || (set_bits && clr_bits && !resource.thorough)) { - if (!resource.copy) { - /* I used to get a warning here which I didn't get for - xdvi-22.64/events.c, l.1330, but I can't reproduce - it any more ... - */ - warn_overstrike(); - } - globals.gc.fore = set_or_make_gc(globals.gc.fore, GXcopy, fg_current->pixel, bg_current->pixel); + if (resource.copy + || (set_bits && clr_bits && !resource.thorough)) { + if (!resource.copy) { + /* I used to get a warning here which I didn't get for + xdvi-22.64/events.c, l.1330, but I can't reproduce + it any more ... + */ + warn_overstrike(); } - else { - if (set_bits) { - globals.gc.fore = set_or_make_gc(globals.gc.fore, GXor, set_bits, 0); - if (clr_bits) { - globals.gc.fore2 = globals.gc.fore2_bak1 = set_or_make_gc(globals.gc.fore2_bak1, GXandInverted, clr_bits, 0); - } + globals.gc.fore = set_or_make_gc(globals.gc.fore, GXcopy, fg_current->pixel, bg_current->pixel); + } + else { + if (set_bits) { + globals.gc.fore = set_or_make_gc(globals.gc.fore, GXor, set_bits, 0); + if (clr_bits) { + globals.gc.fore2 = globals.gc.fore2_bak1 = set_or_make_gc(globals.gc.fore2_bak1, GXandInverted, clr_bits, 0); } - else - globals.gc.fore = set_or_make_gc(globals.gc.fore, GXandInverted, clr_bits, 0); } + else + globals.gc.fore = set_or_make_gc(globals.gc.fore, GXandInverted, clr_bits, 0); } + } fg_active = fg_current; } @@ -6652,7 +6686,7 @@ init_pix(void) globals.gc.fore = set_or_make_gc(NULL, GXor, set_bits & color_data[0].pixel, 0); } if (clr_bits || !set_bits) { -/* fprintf(stderr, "using GXandInverted!\n"); */ + /* fprintf(stderr, "using GXandInverted!\n"); */ *(globals.gc.fore ? &globals.gc.fore2 : &globals.gc.fore) = set_or_make_gc(NULL, GXandInverted, clr_bits & ~(color_data[0].pixel), 0); } @@ -6787,7 +6821,7 @@ init_pix(void) for (i = 0; i <= mane.shrinkfactor * mane.shrinkfactor; ++i) { pixeltbl[i] = palette[(i * 30 + mane.shrinkfactor * mane.shrinkfactor) - / (2 * mane.shrinkfactor * mane.shrinkfactor)]; + / (2 * mane.shrinkfactor * mane.shrinkfactor)]; } } diff --git a/Build/source/texk/xdvik/dvi-init.c b/Build/source/texk/xdvik/dvi-init.c index d62b170f620..411f8e3c72b 100644 --- a/Build/source/texk/xdvik/dvi-init.c +++ b/Build/source/texk/xdvik/dvi-init.c @@ -21,8 +21,8 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTE: - xdvi is based on prior work, as noted in the modification history - in xdvi.c. +xdvi is based on prior work, as noted in the modification history +in xdvi.c. \*========================================================================*/ @@ -33,6 +33,7 @@ NOTE: #include "dvi-draw.h" #include "util.h" #include "x_util.h" +#include "exit-handlers.h" #include "mime.h" #include "pagesel.h" #include "special.h" @@ -48,6 +49,12 @@ NOTE: #include "xm_toolbar.h" #include "pagehist.h" +#if DELAYED_MKTEXPK +#include "font-open.h" /* for reinit_missing_font_count() */ +#endif + + + #ifdef T1LIB #include "t1lib.h" #endif @@ -133,6 +140,21 @@ get_dvi_error(dviErrFlagT flag) { return dvi_err_list[flag]; } + +/* + * Extract the unit used in paper size specification. This information is used + * to decide the initial grid separation. + */ +static int +atopixunit(const char *arg) +{ + int len = strlen(arg); + + /* check if the unit 'mm' or 'cm' occurs in the arg string */ + return (len > 2 && (arg[len - 2] == 'c' || arg[len - 2] == 'm') && arg[len - 1] == 'm' ? + 1.0 / 2.54 : 1.0) * resource.pixels_per_inch + 0.5; +} + /* * free_vf_chain frees the vf_chain structure. */ @@ -222,7 +244,7 @@ free_unused_fonts(void) for (m = fontp->macro; m <= fontp->macro + fontp->maxchar; ++m) - if (m->free_me) free((char *)m->pos); + if (m->free_me) free((char *)m->pos); free((char *)fontp->macro); free((char *)fontp->vf_table); free_vf_chain(fontp->vf_chain); @@ -327,7 +349,7 @@ realloc_font(struct font *fontp, wide_ubyte newsize) (unsigned int)(newsize + 1) * sizeof(struct glyph)); if (newsize > fontp->maxchar) memset((char *)(glyph + fontp->maxchar + 1), 0, - (int)(newsize - fontp->maxchar) * sizeof(struct glyph)); + (int)(newsize - fontp->maxchar) * sizeof(struct glyph)); maxchar = fontp->maxchar = newsize; } @@ -345,7 +367,7 @@ realloc_virtual_font(struct font *fontp, wide_ubyte newsize) (unsigned int)(newsize + 1) * sizeof(struct macro)); if (newsize > fontp->maxchar) memset((char *)(macro + fontp->maxchar + 1), 0, - (int)(newsize - fontp->maxchar) * sizeof(struct macro)); + (int)(newsize - fontp->maxchar) * sizeof(struct macro)); maxchar = fontp->maxchar = newsize; } @@ -359,7 +381,11 @@ realloc_virtual_font(struct font *fontp, wide_ubyte newsize) */ Boolean -load_font(struct font *fontp, Boolean use_t1lib) +load_font(struct font *fontp, Boolean use_t1lib +#if DELAYED_MKTEXPK + , Boolean load_font_now +#endif + ) { double fsize = fontp->fsize; int dpi = fsize + 0.5; @@ -389,16 +415,23 @@ load_font(struct font *fontp, Boolean use_t1lib) * appear before the main window comes up ... */ + fontp->file = font_open( +#if DELAYED_MKTEXPK + load_font_now, +#endif + fontp, + &font_found, + &size_found, #ifdef T1LIB - fontp->file = font_open(fontp->fontname, &font_found, - fsize, &size_found, - &fontp->filename, &fontp->t1id); -#else - fontp->file = font_open(fontp->fontname, &font_found, - fsize, &size_found, - &fontp->filename); -#endif /* T1LIB */ + &fontp->t1id, +#endif + use_t1lib); +#if DELAYED_MKTEXPK + if (!load_font_now) + return True; +#endif + #ifdef T1LIB if (fontp->t1id >= 0 && use_t1lib) { /* It's a type1 font */ @@ -412,7 +445,7 @@ load_font(struct font *fontp, Boolean use_t1lib) memset((char *) fontp->glyph, 0, 256 * sizeof (struct glyph)); fontp->flags |= FONT_LOADED; if (font_found != NULL) { - statusline_print(STATUS_MEDIUM, + statusline_error(STATUS_MEDIUM, "Error: Can't find font %s; using %s instead. Expect ugly output.", fontp->fontname, font_found); force_statusline_update(); @@ -432,9 +465,9 @@ load_font(struct font *fontp, Boolean use_t1lib) } fontp->flags |= FONT_LOADED; - if (font_found != NULL && strcmp(fontp->fontname, font_found) != 0) { + if (font_found != NULL && strcmp(fontp->fontname, font_found) != 0) { /* some other font used - FIXME: is there a more efficient way than strcmp() for checking this? */ - statusline_print(STATUS_MEDIUM, + statusline_error(STATUS_MEDIUM, "Can't find pixel font %s; using %s instead at %d dpi.", fontp->fontname, font_found, dpi); force_statusline_update(); @@ -443,7 +476,7 @@ load_font(struct font *fontp, Boolean use_t1lib) hushcs = True; } else if (!kpse_bitmap_tolerance((double)size_found, fsize)) { /* a different size used */ - statusline_print(STATUS_MEDIUM, + statusline_error(STATUS_MEDIUM, "Can't find pixel font %s at %d dpi; using %d dpi instead.", fontp->fontname, dpi, size_found); force_statusline_update(); @@ -489,8 +522,9 @@ load_font(struct font *fontp, Boolean use_t1lib) else { while (maxchar > 0 && fontp->glyph[maxchar].addr == 0) --maxchar; - if (maxchar < 255) + if (maxchar < 255) { realloc_font(fontp, (wide_ubyte)maxchar); + } } return True; } @@ -571,8 +605,15 @@ reuse_font(struct font *fontp) * all of the fonts used in the job. */ struct font * -define_font(Boolean load_font_now, /* only scanning, or also loading the font? */ - FILE *file, wide_ubyte cmnd, +define_font( +#if DELAYED_MKTEXPK + Boolean read_fonts, /* reading font definitions */ + Boolean initialize_fonts, /* also initializing internal data structures for fonts */ +#else + Boolean load_font_now, /* only scanning, or also loading the font? */ +#endif + FILE *file, + wide_ubyte cmnd, struct font *vfparent, /* vf parent of this font, or NULL */ struct font **tntable, /* table for low TeXnumbers */ unsigned int tn_table_len, /* length of table for TeXnumbers */ @@ -598,12 +639,20 @@ define_font(Boolean load_font_now, /* only scanning, or also loading the font? * len = get_byte(file); len += get_byte(file); /* sequence point in the middle */ +#if DELAYED_MKTEXPK + if (!read_fonts) { + get_bytes(file, len); + return NULL; + } +#else if (!load_font_now) return NULL; +#endif fontname = xmalloc((unsigned)len + 1); - fread(fontname, sizeof(char), len, file); + (void)fread(fontname, sizeof(char), len, file); fontname[len] = '\0'; + if (globals.debug & DBG_PK) printf("xdvi: Define font \"%s\" scale=%d design=%d number=%d\n", fontname, scale, design, TeXnumber); @@ -645,7 +694,11 @@ define_font(Boolean load_font_now, /* only scanning, or also loading the font? * fontp->set_char_p = load_n_set_char; fontp->scale = scale; if (vfparent == NULL) - if (!load_font(fontp, resource.t1lib)) { + if (!load_font(fontp, resource.t1lib +#if DELAYED_MKTEXPK + , initialize_fonts +#endif + )) { if (globals.ev.flags & EV_GE_NEWDOC) { /* if aborting */ free(fontname); free(fontp); @@ -711,7 +764,7 @@ process_preamble(FILE *fp, dviErrFlagT *errflag) dimconv = dimconv * (((long)resource.pixels_per_inch) << 16) / 254000; tpic_conv = resource.pixels_per_inch * magnification / 1000000.0; k = get_byte(fp); - fread(job_id, sizeof(char), (int)k, fp); + (void)fread(job_id, sizeof(char), (int)k, fp); job_id[k] = '\0'; TRACE_FILES((stderr, "process_preamble: fp = %p, errflag = %d, returning True", (void *)fp, *errflag)); @@ -812,6 +865,8 @@ set_paper_type(const char *arg) m_paper_unshrunk_w = atopix(arg, False); m_paper_unshrunk_h = atopix(arg1 + 1, False); + globals.grid_paper_unit = atopixunit(arg); + return (m_paper_unshrunk_w != 0 && m_paper_unshrunk_h != 0); } @@ -825,12 +880,37 @@ set_paper_type(const char *arg) * and allow to open window on first page) if the font loading was done on-demand later! */ Boolean -read_postamble(FILE *fp, dviErrFlagT *errflag, Boolean load_fonts) +read_postamble(FILE *fp, dviErrFlagT *errflag, +#if DELAYED_MKTEXPK + Boolean read_fonts, Boolean initialize_fonts +#else + Boolean load_fonts +#endif + ) { ubyte cmnd; Boolean font_not_found = False; struct font *fontp; +#if DELAYED_MKTEXPK + int tmp_total_pages; + unsigned long tmp_numerator = numerator; + unsigned long tmp_denominator = denominator; + unsigned long tmp_magnification = magnification; + unsigned int tmp_dvi_unshrunk_page_w, tmp_dvi_unshrunk_page_h; + long tmp_last_page_offset; + + TRACE_FILES((stderr, "read_postamble: reading %p (%d, %d)", (void *)fp, read_fonts, initialize_fonts)); + + if (read_fonts && initialize_fonts) { + /* clear existing font table */ + memset((char *)tn_table, 0, (int)sizeof tn_table); + free_vf_chain(tn_head); + tn_head = NULL; + for (fontp = font_head; fontp != NULL; fontp = fontp->next) + fontp->flags &= ~FONT_IN_USE; + } +#else /* DELAYED_MKTEXPK */ TRACE_FILES((stderr, "read_postamble: reading %p (%d)", (void *)fp, load_fonts)); /* clear existing font table */ @@ -839,13 +919,47 @@ read_postamble(FILE *fp, dviErrFlagT *errflag, Boolean load_fonts) tn_head = NULL; for (fontp = font_head; fontp != NULL; fontp = fontp->next) fontp->flags &= ~FONT_IN_USE; - +#endif /* DELAYED_MKTEXPK */ if (get_byte(fp) != POST) { *errflag = POSTAMBLE_NO_POST; TRACE_FILES((stderr, "read_postamble: returning FALSE")); return False; } +#if DELAYED_MKTEXPK + tmp_last_page_offset = get_bytes(fp, 4); + if (read_fonts && initialize_fonts) + m_last_page_offset = tmp_last_page_offset; + + if (tmp_numerator != get_bytes(fp, 4) + || tmp_denominator != get_bytes(fp, 4) + || tmp_magnification != get_bytes(fp, 4)) { + *errflag = POSTAMBLE_NO_MATCH; + TRACE_FILES((stderr, "read_postamble: returning FALSE")); + return False; + } + else if (read_fonts && initialize_fonts) { + numerator = tmp_numerator; + denominator = tmp_denominator; + magnification = tmp_magnification; + } + + /* read largest box height and width */ + tmp_dvi_unshrunk_page_h = (spell_conv(get_lbytes(fp, 4)) >> 16) + resource.yoffset_int; + tmp_dvi_unshrunk_page_w = (spell_conv(get_lbytes(fp, 4)) >> 16) + resource.xoffset_int; + (void)get_bytes(fp, 2); /* max stack size */ + tmp_total_pages = get_bytes(fp, 2); + + if (read_fonts && initialize_fonts) { + dvi_unshrunk_page_h = tmp_dvi_unshrunk_page_h; + if (dvi_unshrunk_page_h < m_paper_unshrunk_h) + dvi_unshrunk_page_h = m_paper_unshrunk_h; + dvi_unshrunk_page_w = tmp_dvi_unshrunk_page_w; + if (dvi_unshrunk_page_w < m_paper_unshrunk_w) + dvi_unshrunk_page_w = m_paper_unshrunk_w; + total_pages = tmp_total_pages; + } +#else /* DELAYED_MKTEXPK */ m_last_page_offset = get_bytes(fp, 4); if (numerator != get_bytes(fp, 4) || denominator != get_bytes(fp, 4) @@ -864,31 +978,56 @@ read_postamble(FILE *fp, dviErrFlagT *errflag, Boolean load_fonts) dvi_unshrunk_page_w = m_paper_unshrunk_w; (void)get_bytes(fp, 2); /* max stack size */ total_pages = get_bytes(fp, 2); +#endif /* DELAYED_MKTEXPK */ /* read font definitions */ while ((cmnd = get_byte(fp)) >= FNTDEF1 && cmnd <= FNTDEF4) { - struct font *f = define_font(load_fonts, fp, cmnd, (struct font *)NULL, tn_table, + struct font *f = define_font( +#if DELAYED_MKTEXPK + read_fonts, initialize_fonts, +#else + load_fonts, +#endif + fp, cmnd, (struct font *)NULL, tn_table, TNTABLELEN, &tn_head, &font_not_found); - if (load_fonts && f == NULL) { + if ( +#if DELAYED_MKTEXPK + read_fonts && initialize_fonts +#else + load_fonts +#endif + && f == NULL) { TRACE_FILES((stderr, "read_postamble: returning FALSE")); return False; } +#if !DELAYED_MKTEXPK else if (!load_fonts) { /* return early */ TRACE_FILES((stderr, "read_postamble: returning TRUE")); return True; } +#endif } + if (cmnd != POSTPOST) { *errflag = POSTAMBLE_NON_FNTDEF; TRACE_FILES((stderr, "read_postamble: returning FALSE")); return False; } - if (font_not_found) { + if ( +#if DELAYED_MKTEXPK + read_fonts && initialize_fonts && +#endif + font_not_found) { *errflag = NOT_ALL_PIXEL_FILES_FOUND; TRACE_FILES((stderr, "read_postamble: returning FALSE")); return False; } +#if DELAYED_MKTEXPK + if (read_fonts && initialize_fonts) + free_unused_fonts(); +#else free_unused_fonts(); +#endif TRACE_FILES((stderr, "read_postamble: returning TRUE")); return True; @@ -960,18 +1099,22 @@ init_page(void) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif -static char *tmp_dvi_name = NULL; /* name of backup file for useTempFp */ +static char *m_tmp_dvi_name = NULL; /* name of backup file for useTempFp */ /* access function for backup file name */ char *get_tmp_dvi_name() { - return tmp_dvi_name; + return m_tmp_dvi_name; } -void -remove_tmp_dvi_file(void) +static void +remove_tmp_dvi_file(void *dummy) { - if (tmp_dvi_name != NULL) - unlink(tmp_dvi_name); + UNUSED(dummy); + if (m_tmp_dvi_name != NULL) { + unlink(m_tmp_dvi_name); + free(m_tmp_dvi_name); + } + m_tmp_dvi_name = NULL; } @@ -984,26 +1127,27 @@ make_backup_fp(FILE *source_fp, FILE *target_fp) #if !HAVE_FTRUNCATE /* in this case, we can't use ftruncate() on the existing temp file - just close the existing one, and set flag to open a new one */ - if (tmp_dvi_name != NULL) - unlink(tmp_dvi_name); + remove_tmp_dvi_file(NULL); if (target_fp != NULL) fclose(target_fp); /* make sure we use a new temp file, else we'd have a race condition after closing it */ - free(tmp_dvi_name); - tmp_dvi_name = NULL; first_time = True; #endif if (first_time) { /* doesn't exist yet, create it */ - if ((tmp_fd = xdvi_temp_fd(&tmp_dvi_name)) == -1) { + if ((tmp_fd = xdvi_temp_fd(&m_tmp_dvi_name)) == -1) { XDVI_ERROR((stderr, "error creating temporary file - disabling `useTempFp'.")); + resource.use_temp_fp = False; + remove_tmp_dvi_file(NULL); return NULL; } -/* fprintf(stderr, "temporary file name: |%s|, %d\n", tmp_dvi_name, tmp_fd); */ - TRACE_EVENTS((stderr, "Created temp file: |%s|\n", tmp_dvi_name)); + /* fprintf(stderr, "temporary file name: |%s|, %d\n", m_tmp_dvi_name, tmp_fd); */ + TRACE_EVENTS((stderr, "Created temp file: |%s|\n", m_tmp_dvi_name)); if ((target_fp = try_fdopen(tmp_fd, "wb+")) == NULL) { XDVI_ERROR((stderr, "error opening temporary file (%s) - disabling `useTempFp'.", strerror(errno))); + resource.use_temp_fp = False; + remove_tmp_dvi_file(NULL); return NULL; } first_time = False; @@ -1012,12 +1156,14 @@ make_backup_fp(FILE *source_fp, FILE *target_fp) and position both files at beginning */ ASSERT(target_fp != NULL, ""); ASSERT(source_fp != NULL, ""); - + #if HAVE_FTRUNCATE if (ftruncate(tmp_fd, 0) < 0) { - XDVI_ERROR((stderr, "Couldn't truncate file %s: %s - disabling `useTempFp'.", - tmp_dvi_name, strerror(errno))); - unlink(tmp_dvi_name); + + XDVI_ERROR((stderr, "Couldn't truncate file %s: %s - disabling `useTempFp'; target_fp: %p.", + m_tmp_dvi_name, strerror(errno), target_fp)); + resource.use_temp_fp = False; + remove_tmp_dvi_file(NULL); fclose(target_fp); return NULL; } @@ -1032,12 +1178,16 @@ make_backup_fp(FILE *source_fp, FILE *target_fp) "Error creating temporary file: %s\n" "- disabling `useTempFp'.", strerror(errno))); + remove_tmp_dvi_file(NULL); + resource.use_temp_fp = False; fclose(target_fp); target_fp = NULL; } /* rewind both files, else DVI parsing will fail! */ - fflush(target_fp); + if (target_fp != NULL) { + fflush(target_fp); + } fseek(source_fp, 0L, SEEK_SET); if (target_fp != NULL) { fseek(target_fp, 0L, SEEK_SET); @@ -1052,12 +1202,12 @@ file_exists_p(const char *path, dviErrFlagT *errflag) TRACE_FILES((stderr, "file_exists_p for |%s|", path)); *errflag = UNKNOWN_ERROR; if ((m_dvi_fp = XFOPEN(path, OPEN_MODE)) == NULL) { -/* fprintf(stderr, "after internal_open_dvi1: xfopen\n"); */ + /* fprintf(stderr, "after internal_open_dvi1: xfopen\n"); */ *errflag = FILE_DOESNT_EXIST; return False; } TRACE_FILES((stderr, "m_dvi_fp for |%s| = %p", path, (void *)m_dvi_fp)); -/* fprintf(stderr, "after internal_open_dvi2: xfopen\n"); */ + /* fprintf(stderr, "after internal_open_dvi2: xfopen\n"); */ /* shouldn't happen */ if (fstat(fileno(m_dvi_fp), &fstatbuf) != 0 || S_ISDIR(fstatbuf.st_mode)) { /* if it's a directory */ @@ -1089,7 +1239,13 @@ file_exists_p(const char *path, dviErrFlagT *errflag) */ static Boolean -internal_init_dvi(dviErrFlagT *errflag, Boolean load_fonts) +internal_init_dvi(dviErrFlagT *errflag, +#if DELAYED_MKTEXPK + Boolean read_fonts, Boolean initialize_fonts +#else + Boolean load_fonts +#endif + ) { char *icon_name = NULL, *title_name = NULL; @@ -1099,10 +1255,23 @@ internal_init_dvi(dviErrFlagT *errflag, Boolean load_fonts) if (!process_preamble(globals.dvi_file.bak_fp, errflag) || !find_postamble(globals.dvi_file.bak_fp, errflag) +#if DELAYED_MKTEXPK + || !read_postamble(globals.dvi_file.bak_fp, errflag, read_fonts, initialize_fonts) +#else || !read_postamble(globals.dvi_file.bak_fp, errflag, load_fonts) - || !prepare_pages(errflag)) + || !prepare_pages(errflag) +#endif + ) { return False; - + } +#if DELAYED_MKTEXPK + if (!read_fonts || !initialize_fonts) /* return early */ + return True; + + if (!prepare_pages(errflag)) + return False; +#endif + if (current_page >= total_pages) current_page = total_pages - 1; @@ -1141,13 +1310,23 @@ internal_init_dvi(dviErrFlagT *errflag, Boolean load_fonts) */ Boolean -internal_open_dvi(const char *path, dviErrFlagT *errflag, Boolean load_fonts) +internal_open_dvi(const char *path, dviErrFlagT *errflag, +#if DELAYED_MKTEXPK + Boolean read_fonts, Boolean initialize_fonts +#else + Boolean load_fonts +#endif + ) { -/* FILE *tmp_fp = NULL; */ -/* static FILE *bak_fp = NULL; /\* re-use the temporary backup fp *\/ */ -/* fprintf(stderr, "------------ opening: |%s|\n", path); */ + /* FILE *tmp_fp = NULL; */ + /* static FILE *bak_fp = NULL; /\* re-use the temporary backup fp *\/ */ + /* fprintf(stderr, "------------ opening: |%s|\n", path); */ +#if DELAYED_MKTEXPK + TRACE_FILES((stderr, "internal_open_dvi for |%s|; loading fonts: %d, %d", path, read_fonts, initialize_fonts)); +#else TRACE_FILES((stderr, "internal_open_dvi for |%s|", path)); +#endif close_old_filep(); if (!file_exists_p(path, errflag)) { /* this should set fstatbuf.st_mtime */ @@ -1157,9 +1336,18 @@ internal_open_dvi(const char *path, dviErrFlagT *errflag, Boolean load_fonts) if (!resource.use_temp_fp || (globals.dvi_file.bak_fp = make_backup_fp(m_dvi_fp, globals.dvi_file.bak_fp)) == NULL) { globals.dvi_file.bak_fp = m_dvi_fp; } - globals.dvi_file.time = fstatbuf.st_mtime; + + register_exit_handler(remove_tmp_dvi_file, NULL); - if (!internal_init_dvi(errflag, load_fonts)) { + globals.dvi_file.time = fstatbuf.st_mtime; + + if (!internal_init_dvi(errflag, +#if DELAYED_MKTEXPK + read_fonts, initialize_fonts +#else + load_fonts +#endif + )) { return False; } @@ -1346,7 +1534,7 @@ open_dvi_file_wrapper(const char *filename, people, who meant to launch *xdvi*). `find_dvi_file' tries to locate the file and does all error handling; on success, it returns a fully expanded filename. - */ + */ real_filename = find_dvi_file(filename, tried_dvi_ext, from_file_history); /* this allocates real_filename */ if (real_filename == NULL) return False; @@ -1363,7 +1551,7 @@ open_dvi_file_wrapper(const char *filename, if it's not from the command line (e.g. result of clicking Mouse-1 on a link); in this case we might fall back to using the browser. Check whether it's a local file: - */ + */ const char *filename_no_prefix; char *expanded_filename; TRACE_HTEX((stderr, "filename NOT from commandline")); @@ -1416,8 +1604,11 @@ open_dvi_file(const char *filename, Boolean open_new_instance) else { dviErrFlagT errflag = NO_ERROR; TRACE_HTEX((stderr, "internal_open_dvi: |%s|", filename)); - if (!internal_open_dvi(filename, &errflag, True)) { -/* || !internal_init_dvi(&errflag, True)) { */ + if (!internal_open_dvi(filename, &errflag, True +#if DELAYED_MKTEXPK + , TRUE +#endif + )) { report_open_error("Cannot open DVI file", filename, errflag); retval = False; } @@ -1478,28 +1669,37 @@ dvi_file_changed(void) { TRACE_FILES((stderr, "dvi_file_changed: fp = %p?", (void *)m_dvi_fp)); -/* fprintf(stderr, "m_dvi_fp3: %p (%s)\n", m_dvi_fp, globals.dvi_name); */ + /* fprintf(stderr, "m_dvi_fp3: %p (%s)\n", m_dvi_fp, globals.dvi_name); */ if (m_dvi_fp == NULL) { TRACE_FILES((stderr, "m_dvi_fp == NULL")); if (stat(globals.dvi_name, &fstatbuf) == 0 && fstatbuf.st_mtime != globals.dvi_file.time) { TRACE_FILES((stderr, "file changed")); if (resource.use_temp_fp) { dviErrFlagT errflag = NO_ERROR; - +#if !DELAYED_MKTEXPK if (resource.watch_file == 0.0) - statusline_print(STATUS_MEDIUM, "File changed ..."); + statusline_info(STATUS_MEDIUM, "File changed ..."); TRACE_FILES((stderr, "returning FALSE")); - +#endif if (file_exists_p(globals.dvi_name, &errflag) && process_preamble(m_dvi_fp, &errflag) && find_postamble(m_dvi_fp, &errflag) - && read_postamble(m_dvi_fp, &errflag, False)) { + && read_postamble(m_dvi_fp, &errflag, False +#if DELAYED_MKTEXPK + , False +#endif + )) { TRACE_FILES((stderr, "File OK, reloading ...")); globals.ev.flags |= EV_RELOAD; return True; } else { +#if DELAYED_MKTEXPK + if (resource.watch_file == 0.0) + statusline_info(STATUS_MEDIUM, "File corrupted (click on window to reload) ..."); + TRACE_FILES((stderr, "returning FALSE")); +#endif return False; } } @@ -1509,9 +1709,9 @@ dvi_file_changed(void) on the canvas. */ /* - else { - globals.ev.flags |= EV_RELOAD; - } + else { + globals.ev.flags |= EV_RELOAD; + } */ TRACE_FILES((stderr, "returning TRUE")); return True; @@ -1531,18 +1731,22 @@ dvi_file_changed(void) if (resource.use_temp_fp) { /* in this case, reload only if file has been written completely */ if (resource.watch_file == 0.0) { - statusline_print(STATUS_MEDIUM, "File corrupted (click on window to reload) ..."); + statusline_info(STATUS_MEDIUM, "File corrupted (click on window to reload) ..."); globals.cursor.flags |= CURSOR_CORRUPTED; globals.ev.flags |= EV_CURSOR; } else { - statusline_print(STATUS_MEDIUM, "File corrupted (will try to reload) ..."); + statusline_info(STATUS_MEDIUM, "File corrupted (will try to reload) ..."); } close_old_filep(); if (file_exists_p(globals.dvi_name, &errflag) && process_preamble(m_dvi_fp, &errflag) && find_postamble(m_dvi_fp, &errflag) - && read_postamble(m_dvi_fp, &errflag, False)) { + && read_postamble(m_dvi_fp, &errflag, False +#if DELAYED_MKTEXPK + , False +#endif + )) { TRACE_FILES((stderr, "File OK, reloading ...")); globals.ev.flags |= EV_RELOAD; @@ -1550,7 +1754,7 @@ dvi_file_changed(void) } else { TRACE_FILES((stderr, "NO successful load: %s", get_dvi_error(errflag))); -/* fprintf(stderr, "=========== NO successful load: %s\n", get_dvi_error(errflag)); */ + /* fprintf(stderr, "=========== NO successful load: %s\n", get_dvi_error(errflag)); */ return False; } } @@ -1568,7 +1772,11 @@ dvi_file_changed(void) **/ Boolean -load_dvi_file(Boolean load_fonts, dviErrFlagT *errflag) +load_dvi_file( +#if !DELAYED_MKTEXPK + Boolean load_fonts, +#endif + dviErrFlagT *errflag) { unsigned int old_page_w, old_page_h; static ino_t dvi_inode = 0; @@ -1581,7 +1789,13 @@ load_dvi_file(Boolean load_fonts, dviErrFlagT *errflag) fseek(m_dvi_fp, 0L, SEEK_SET); if (!process_preamble(m_dvi_fp, errflag) || !find_postamble(m_dvi_fp, errflag) - || !read_postamble(m_dvi_fp, errflag, True)) { + || !read_postamble(m_dvi_fp, errflag, +#if DELAYED_MKTEXPK + False, False +#else + True +#endif + )) { TRACE_FILES((stderr, "reading of %p failed: %s!", (void *)m_dvi_fp, get_dvi_error(*errflag))); @@ -1593,16 +1807,42 @@ load_dvi_file(Boolean load_fonts, dviErrFlagT *errflag) old_page_h = globals.page.h; *errflag = NO_ERROR; - if (!internal_open_dvi(globals.dvi_name, errflag, load_fonts)) { -/* || !internal_init_dvi(errflag, load_fonts)) { */ + +#if DELAYED_MKTEXPK + /* use same trick with reading postamble twice to first find names of PK fonts + that need to be created. */ + reset_missing_font_count(); + kpse_set_program_enabled(kpse_any_glyph_format, False, kpse_src_compile); +#endif + + if (!internal_open_dvi(globals.dvi_name, errflag, +#if DELAYED_MKTEXPK + True, False +#else + load_fonts +#endif + )) { XClearWindow(DISP, mane.win); - XBell(DISP, 0); - statusline_print(STATUS_MEDIUM, "%s: %s%s", globals.dvi_name, get_dvi_error(*errflag), + xdvi_bell(); + statusline_info(STATUS_MEDIUM, "%s: %s%s", globals.dvi_name, get_dvi_error(*errflag), resource.watch_file > 0.0 ? "; will try to reload ..." : " (click on window to reload)"); close_old_filep(); return False; } +#if DELAYED_MKTEXPK + /* second time */ + kpse_set_program_enabled(kpse_any_glyph_format, True, kpse_src_compile); + + if (!internal_open_dvi(globals.dvi_name, errflag, True, True)) { + XClearWindow(DISP, mane.win); + xdvi_bell(); + statusline_info(STATUS_MEDIUM, "%s: %s%s", globals.dvi_name, get_dvi_error(*errflag), + resource.watch_file > 0.0 ? "; will try to reload ..." : " (click on window to reload)"); + close_old_filep(); + return False; + } +#endif else { /* success */ if (fstatbuf.st_ino != dvi_inode) { dvi_inode = fstatbuf.st_ino; diff --git a/Build/source/texk/xdvik/dvi-init.h b/Build/source/texk/xdvik/dvi-init.h index e5881e0f151..ca970d2f42a 100644 --- a/Build/source/texk/xdvik/dvi-init.h +++ b/Build/source/texk/xdvik/dvi-init.h @@ -47,7 +47,13 @@ typedef enum { extern const char *get_dvi_error(dviErrFlagT flag); -extern Boolean internal_open_dvi(const char *path, dviErrFlagT *errmsg, Boolean load_fonts); +extern Boolean internal_open_dvi(const char *path, dviErrFlagT *errmsg, +#if DELAYED_MKTEXPK + Boolean read_fonts, Boolean initialize_fonts +#else + Boolean load_fonts +#endif + ); extern char *open_dvi_file_wrapper(const char *filename, Boolean from_command_line, Boolean open_new_instance, @@ -167,16 +173,35 @@ extern void full_reset_colors(void); #endif extern void realloc_font(struct font *, wide_ubyte); extern void realloc_virtual_font(struct font *, wide_ubyte); -extern Boolean load_font(struct font *, Boolean use_t1lib); -extern struct font *define_font(Boolean load_font_now, - FILE *, wide_ubyte, - struct font *, struct font **, unsigned int, - struct tn **, Boolean *not_found_flag); +extern Boolean load_font(struct font *, + Boolean use_t1lib +#if DELAYED_MKTEXPK + , Boolean load_font_now +#endif + ); + +extern struct font *define_font( +#if DELAYED_MKTEXPK + Boolean read_fonts, + Boolean initialize_fonts, +#else + Boolean load_font_now, +#endif + FILE *, + wide_ubyte, + struct font *, + struct font **, + unsigned int, + struct tn **, + Boolean *not_found_flag); extern void init_page(void); extern void form_dvi_property(void); extern Boolean dvi_file_changed(void); -extern void remove_tmp_dvi_file(void); -extern Boolean load_dvi_file(Boolean load_fonts, dviErrFlagT *errflag); +extern Boolean load_dvi_file( +#if !DELAYED_MKTEXPK + Boolean load_fonts, +#endif + dviErrFlagT *errflag); extern void read_PK_index(struct font *, wide_bool); extern void read_GF_index(struct font *, wide_bool); extern unsigned long read_VF_index(struct font *, wide_bool); @@ -184,7 +209,13 @@ extern unsigned long read_VF_index(struct font *, wide_bool); extern Boolean set_paper_type(const char *arg); extern Boolean find_postamble(FILE *fp, dviErrFlagT *errflag); -extern Boolean read_postamble(FILE *fp, dviErrFlagT *errflag, Boolean load_fonts); +extern Boolean read_postamble(FILE *fp, dviErrFlagT *errflag, +#if DELAYED_MKTEXPK + Boolean read_fonts, Boolean initialize_fonts +#else + Boolean load_fonts +#endif + ); extern void close_old_filep(void); extern Boolean process_preamble(FILE *fp, dviErrFlagT *errflag); diff --git a/Build/source/texk/xdvik/dvisel.c b/Build/source/texk/xdvik/dvisel.c index d6b6b7f6793..e924b90c0c4 100644 --- a/Build/source/texk/xdvik/dvisel.c +++ b/Build/source/texk/xdvik/dvisel.c @@ -80,7 +80,7 @@ static struct specials_stack href_stack = { 0, NULL}; /* stacks saved from the previous page (i.e. active at the beginning of the page) - */ +*/ static struct specials_stack color_save_stack = { 0, NULL }; static struct specials_stack href_save_stack = { 0, NULL }; @@ -170,8 +170,8 @@ FontWrite(FILE *fout, struct fontinfo *fontp, long *fout_pos) putc(FNTDEF1, fout); } putc(fontp->TeXnumber & 0xff, fout); - fwrite(fontp->info, sizeof(char), 14, fout); - fwrite(fontp->fontname, sizeof(char), fontp->info[12] + fontp->info[13], fout); + (void)fwrite(fontp->info, sizeof(char), 14, fout); + (void)fwrite(fontp->fontname, sizeof(char), fontp->info[12] + fontp->info[13], fout); (*fout_pos) += 2 + 14 + fontp->info[12] + fontp->info[13]; } @@ -576,28 +576,29 @@ WriteDVI(FILE *fin, FILE *fout, long *fout_pos, int c) /* callback functions for selecting pages */ Boolean -check_pagerange(struct select_pages_info *info, int page) +check_pagerange(struct save_or_print_info *info, int page) { - return (page >= info->from && page <= info->to); + return (page >= info->pinfo->from && page <= info->pinfo->to); } Boolean -check_marked(struct select_pages_info *info, int page) +check_marked(struct save_or_print_info *info, int page) { UNUSED(info); return pageinfo_is_marked(page); } void -select_pages(struct select_pages_info *pinfo) +select_pages(struct save_or_print_info *info) { + struct select_pages_info *pinfo = info->pinfo; int c, n, page, pagecnt; long fout_pos = 0L; unsigned long curr_page_offset = 0xffffffff; /* pattern to be overwritten later */ unsigned long post_cmd_offset = 0xffffffff; /* pattern to be overwritten later */ struct fontinfo *fontp; - FILE *in_fp = pinfo->finfo->dvi_in.fp; - FILE *out_fp = pinfo->finfo->dvi_tmp.fp; + FILE *in_fp = info->finfo->in_fp; + FILE *out_fp = info->finfo->tmp_dvi_fp; Boolean headers_dumped = False; free(dvips_papersize_special); /* re-initialize */ @@ -618,10 +619,10 @@ select_pages(struct select_pages_info *pinfo) break; fontp = (struct fontinfo *) xmalloc(sizeof(struct fontinfo)); fontp->TeXnumber = get_bytes(in_fp, c - FNTDEF1 + 1); - fread(fontp->info, sizeof(char), 14, in_fp); + (void)fread(fontp->info, sizeof(char), 14, in_fp); n = fontp->info[12] + fontp->info[13]; fontp->fontname = xmalloc(n); - fread(fontp->fontname, sizeof(char), n, in_fp); + (void)fread(fontp->fontname, sizeof(char), n, in_fp); fontp->next = fontinfo_head; fontinfo_head = fontp; fontp->used = False; @@ -638,7 +639,7 @@ select_pages(struct select_pages_info *pinfo) scan_page_for_specials(in_fp, page, True, stack_save, NULL); /* should the current page be selected? */ - if (pinfo->callback == NULL || pinfo->callback(pinfo, page)) { + if (pinfo->callback == NULL || pinfo->callback(info, page)) { scan_page_for_specials(in_fp, page, False, scan_for_included_files, pinfo); /* read BOP except for p[4] */ @@ -659,8 +660,8 @@ select_pages(struct select_pages_info *pinfo) /* if (!written_pre_cmds) { */ stack_dump_open_commands(out_fp, &fout_pos); -/* written_pre_cmds = True; */ -/* } */ + /* written_pre_cmds = True; */ + /* } */ while ((c = getc(in_fp)) != EOF) { if ((c & 0x80) == 0) { /* ordinary character */ @@ -668,20 +669,20 @@ select_pages(struct select_pages_info *pinfo) fout_pos++; } else if (c == EOP) { /* End Of Page */ -/* fprintf(stderr, "EOP at %ld\n", ftell(fin)); */ + /* fprintf(stderr, "EOP at %ld\n", ftell(fin)); */ -/* if (page == to) { */ /* print close stack for last page */ + /* if (page == to) { */ /* print close stack for last page */ stack_dump_close_commands(out_fp, &fout_pos); -/* } */ + /* } */ putc(c, out_fp); fout_pos++; break; } else { -/* fprintf(stderr, "WRITE_DVI before: %ld, in_fp before: %ld\n", fout_pos, ftell(in_fp)); */ + /* fprintf(stderr, "WRITE_DVI before: %ld, in_fp before: %ld\n", fout_pos, ftell(in_fp)); */ WriteDVI(in_fp, out_fp, &fout_pos, c); -/* fprintf(stderr, "WRITE_DVI after: %ld; in_fp after: %ld\n", fout_pos, ftell(in_fp)); */ + /* fprintf(stderr, "WRITE_DVI after: %ld; in_fp after: %ld\n", fout_pos, ftell(in_fp)); */ } /* HACK alert: force synchronization - why is this neccessary? Seems to have something do with the fact that two FILE *'s on the same @@ -689,7 +690,7 @@ select_pages(struct select_pages_info *pinfo) `Interaction of File Descriptors and Standard I/O Streams' seems to say the seek()s on one of them also affect the other, but I'm not sure about this. - */ + */ fseek(in_fp, 0L, SEEK_CUR); } pagecnt++; @@ -753,7 +754,7 @@ select_pages(struct select_pages_info *pinfo) putc(TRAILER, out_fp); } -/* fclose(in_fp); */ + /* fclose(in_fp); */ fflush(out_fp); } diff --git a/Build/source/texk/xdvik/dvisel.h b/Build/source/texk/xdvik/dvisel.h index 6e395564466..bf726b04ee3 100644 --- a/Build/source/texk/xdvik/dvisel.h +++ b/Build/source/texk/xdvik/dvisel.h @@ -35,8 +35,8 @@ #include "print-internal.h" /* callbacks */ -Boolean check_pagerange(struct select_pages_info *pinfo, int pageno); -Boolean check_marked(struct select_pages_info *pinfo, int pageno); -void select_pages(struct select_pages_info *pinfo); +Boolean check_pagerange(struct save_or_print_info *info, int pageno); +Boolean check_marked(struct save_or_print_info *info, int pageno); +void select_pages(struct save_or_print_info *info); #endif /* DVISEL_H_ */ diff --git a/Build/source/texk/xdvik/encodings.c b/Build/source/texk/xdvik/encodings.c index 37cb883498c..84daa8d5c51 100644 --- a/Build/source/texk/xdvik/encodings.c +++ b/Build/source/texk/xdvik/encodings.c @@ -44,23 +44,23 @@ /* The rest of the file is Copyright (c) 2003-2004 the xdvik development team - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. */ #include "xdvi-config.h" @@ -77,9 +77,12 @@ static iconv_t m_iconv_gb_ucs4 = (iconv_t)(-1); #include "encodings.h" #include "my-snprintf.h" #include "message-window.h" +#include "exit-handlers.h" #define MY_DEBUG 0 +#define HAS_PREFIX(src,dst) (memcmp(src, dst, strlen(dst)) == 0) + #if MY_DEBUG # define TRACE_FIND_VERBOSE(x) TRACE_FIND(x) #else @@ -143,6 +146,57 @@ static uint32_t m_cm_symbol_encoding[256] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/* cbgreek, greek encoding */ +static uint32_t m_cb_greek_encoding[256] = { + 0x2013, 0x20032f, 0x10144, 0x10145, 0x10146, 0x10147, 0x03db, 0x03db, + 0x1fbe, 0x1fbc, 0x1fcc, 0x1ffc, 0x0391, 0x03ab, 0x03b1, 0x03cb, + /* 0x10 */ + 0x02cf, 0x02ce, 0x03df, 0x03d9, 0x20032e, 0x03d8, 0x03da, 0x03e0, + 0x20ac, 0x2030, 0x0259, 0x03e1, 0x2018, 0x2019, 0x02d8, 0x00af, + /* 0x20 */ + 0x1fc1, 0x0021, 0x00a8, 0x0385, 0x1fed, 0x0025, 0x00b7, 0x0384, + 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + /* 0x30 */ + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x0387, 0x1ffe, 0x003d, 0x1fbf, 0x003b, + /* 0x40 */ + 0x1fdf, 0x0391, 0x0392, 0x1fdd, 0x0394, 0x0395, 0x03a6, 0x0393, + 0x0397, 0x0399, 0x0398, 0x039a, 0x039b, 0x039c, 0x039d, 0x039f, + /* 0x50 */ + 0x03a0, 0x03a7, 0x03a1, 0x03a3, 0x03a4, 0x03d2, 0x1fde, 0x03a9, + 0x039e, 0x03a8, 0x0396, 0x005b, 0x1fcf, 0x005d, 0x1fce, 0x1fcd, + /* 0x60 */ + 0x1fef, 0x03b1, 0x03b2, 0x03c2, 0x03b4, 0x03b5, 0x03c6, 0x03b3, + 0x03b7, 0x03b9, 0x03b8, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03bf, + /* 0x70 */ + 0x03c0, 0x03c7, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0, 0x03c9, + 0x03be, 0x03c8, 0x03b6, 0x00ab, 0x037a, 0x00bb, 0x1fc0, 0x2014, + /* 0x80 */ + 0x1f70, 0x1f01, 0x1f00, 0x1f03, 0x1fb2, 0x1f81, 0x1f80, 0x1f83, + 0x03ac, 0x1f05, 0x1f04, 0x1f02, 0x1fb4, 0x1f85, 0x1f84, 0x1f82, + /* 0x90 */ + 0x1fb6, 0x1f07, 0x1f06, 0x03dd, 0x1fb7, 0x1f87, 0x1f86, 0, + 0x1f74, 0x1f21, 0x1f20, 0, 0x1fc2, 0x1f91, 0x1f90, 0, + /* 0xa0 */ + 0x03ae, 0x1f25, 0x1f24, 0x1f23, 0x1fc4, 0x1f95, 0x1f94, 0x1f93, + 0x1fc6, 0x1f27, 0x1f26, 0x1f22, 0x1fc7, 0x1f97, 0x1f96, 0x1f92, + /* 0b0 */ + 0x1f7c, 0x1f61, 0x1f60, 0x1f63, 0x1ff2, 0x1fa1, 0x1fa0, 0x1fa3, + 0x03ce, 0x1f65, 0x1f64, 0x1f62, 0x1ff4, 0x1fa5, 0x1fa4, 0x1fa2, + /* 0xc0 */ + 0x1ff6, 0x1f67, 0x1f66, 0x03dc, 0x1ff7, 0x1fa7, 0x1fa6, 0, + 0x1f76, 0x1f31, 0x1f30, 0x1f33, 0x1f7a, 0x1f51, 0x1f50, 0x1f53, + /* 0xd0 */ + 0x03af, 0x1f35, 0x1f34, 0x1f32, 0x03cd, 0x1f55, 0x1f54, 0x1f52, + 0x1fd6, 0x1f37, 0x1f36, 0x03aa, 0x1fe6, 0x1f57, 0x1f56, 0x03ab, + /* 0xe0 */ + 0x1f72, 0x1f11, 0x1f10, 0x1f13, 0x1f78, 0x1f41, 0x1f40, 0x1f43, + 0x03ad, 0x1f15, 0x1f14, 0x1f12, 0x03cc, 0x1f45, 0x1f44, 0x1f42, + /* 0xf0 */ + 0x03ca, 0x1fd2, 0x0390, 0x1fd7, 0x03cb, 0x1fe2, 0x03b0, 0x1fe7, + 0x1fb3, 0x1fc3, 0x1ff3, 0x1fe5, 0x1fe4, 0, 0x0374, 0x0375 +}; + /* from enc/texmital.h */ static uint32_t m_cm_math_italics_encoding[256] = { /* 0x00 */ @@ -195,6 +249,58 @@ static uint32_t m_cm_math_italics_encoding[256] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +static uint32_t m_bbold_encoding[256] = { + /* 0x00 */ + 0x0393, 0x0394, 0x0398, 0x039b, 0x039e, 0x03a0, 0x03a3, 0x03a5, + 0x03a6, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03f5, + /* 0x10 */ + 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, + 0x03be, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03d5, 0x03c7, + /* 0x20 */ + 0x03c8, 0x0021, 0x201c, 0x0023, 0x0024, 0x0025, 0x0026, 0x2019, + 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + /* 0x30 */ + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x003b, 0x00a1, 0x003d, 0x00bf, 0x003f, + /* 0x40 */ + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + /* 0x50 */ + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x0028, 0x0029, + /* 0x60 */ + 0x2018, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + /* 0x70 */ + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007a, 0x002d, 0x007c, 0x2013, 0x201d, 0x03c9, + /* 0x80 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x90 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xa0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xb0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xc0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xd0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xe0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xf0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + /* from enc/texmext.h */ static uint32_t m_cm_math_extended_encoding[256] = { /* 0x00 */ @@ -459,7 +565,7 @@ static uint32_t m_cork_encoding[256] = { This only gets the accents and stuff from iso-latin1 right; lots of the special characters aren't defined in the Adobe lookup list used by catdvi's `pse2unic'. - */ +*/ static uint32_t m_ts1_encoding[256] = { /* 0x00 */ 0x0060, 0x00b4, 0x02c6, 0x02dc, 0x00a8, 0x02dd, 0x02da, 0x02c7, @@ -1302,7 +1408,7 @@ static struct adobe2unicode adobe2unicode_table[] = { { "circle", 0x25CB }, /* WHITE CIRCLE */ { "circlemultiply", 0x2297 }, /* CIRCLED TIMES */ { "circleplus", 0x2295 }, /* CIRCLED PLUS */ -/* { "circumflex", 0x02C6 }, /\* MODIFIER LETTER CIRCUMFLEX ACCENT *\/ */ + /* { "circumflex", 0x02C6 }, /\* MODIFIER LETTER CIRCUMFLEX ACCENT *\/ */ { "circumflex", 0x005E }, /* MODIFIER LETTER CIRCUMFLEX ACCENT */ { "club", 0x2663 }, /* BLACK CLUB SUIT */ { "colon", 0x003A }, /* COLON */ @@ -1680,7 +1786,7 @@ static struct adobe2unicode adobe2unicode_table[] = { { "threequarters", 0x00BE }, /* VULGAR FRACTION THREE QUARTERS */ { "threequartersemdash", 0xF6DE }, /* THREE QUARTERS EM DASH */ { "threesuperior", 0x00B3 }, /* SUPERSCRIPT THREE */ -/* { "tilde", 0x02DC }, /\* SMALL TILDE *\/ */ + /* { "tilde", 0x02DC }, /\* SMALL TILDE *\/ */ { "tilde", 0x007E }, /* ASCII TILDE */ { "tildecomb", 0x0303 }, /* COMBINING TILDE */ { "tonos", 0x0384 }, /* GREEK TONOS */ @@ -2906,9 +3012,10 @@ unicode_id_cmp(const void *s1, const void *s2) } #endif /* 0 */ -void -close_iconv(void) +static void +close_iconv(void *dummy) { + UNUSED(dummy); #if HAVE_ICONV_H if (m_iconv_gb_ucs4 != (iconv_t)(-1)) { iconv_close(m_iconv_gb_ucs4); @@ -2945,6 +3052,9 @@ cjk2unicode(const unsigned char *cjk) XDVI_ERROR((stderr, "cjk2unicode: iconv_open() failed: %s", strerror(errno))); return 0; } + + register_exit_handler(close_iconv, NULL); + } if (iconv(m_iconv_gb_ucs4, (iconv_char_pptrT)&from_ptr, &from, &to_ptr, &to) == (size_t)(-1)) { XDVI_ERROR((stderr, "cjk2unicode: can't convert GBK to unicode: %s", strerror(errno))); @@ -2975,7 +3085,7 @@ adobe2unicode_name(const char *adobe_name) struct adobe2unicode search_item; struct adobe2unicode *match_item; - if (memcmp(adobe_name, "cjk", 3) == 0) { + if (HAS_PREFIX(adobe_name, "cjk")) { /* Special case for CJK fonts (Chinese) - ZLB: the Adobe names in * the Chinese T1 fonts are of the form 'cjkXXXX' where 'XXXX' are * the hex number of the GBK/GB18030 encoding */ @@ -3040,7 +3150,7 @@ ucs4_lowercase(uint32_t c) if [ -n "$res" ]; then echo "RES: $a $b -> $res"; fi; fi; done | grep 'RES' > uni2adobe-map And then, some Emacs keyboard macros. - */ + */ switch (c) { case 0x0041: /* A */ return 0x0061; /* a */ case 0x0042: /* B */ return 0x0062; /* b */ @@ -3473,9 +3583,10 @@ guess_encoding(wide_ubyte ch, const char *fontname, char *retbuf) return 0; } - if (memcmp(fontname, "gbk", 3) == 0 - && isdigit((int)fontname[(i=strlen(fontname))-1]) - && isdigit((int)fontname[i-2])) { + if (HAS_PREFIX(fontname, "gbk") + && isdigit((int)fontname[(i=strlen(fontname))-1]) + && isdigit((int)fontname[i-2])) + { unsigned char cjk[2]; TRACE_FIND_VERBOSE((stderr, "guess_encoding: CJK fonts (GBK encoding)")); i = atoi(fontname + i - 2); /* font no */ @@ -3487,57 +3598,66 @@ guess_encoding(wide_ubyte ch, const char *fontname, char *retbuf) return cjk2unicode(cjk); } - if (memcmp(fontname, "cmsy", 4) == 0) { + if (HAS_PREFIX(fontname, "cmsy") || + HAS_PREFIX(fontname, "xccsy") + ) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_cm_symbol", fontname)); return m_cm_symbol_encoding[ch]; } - if (memcmp(fontname, "cmmi", 4) == 0) { + if (HAS_PREFIX(fontname, "cmmi") || + HAS_PREFIX(fontname, "xccmi") + ) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_cm_math_italics", fontname)); return m_cm_math_italics_encoding[ch]; } - if (memcmp(fontname, "cmex", 4) == 0) { + if (HAS_PREFIX(fontname, "cmex") || + HAS_PREFIX(fontname, "xccex") + ) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_cm_math_extended", fontname)); return m_cm_math_extended_encoding[ch]; } - if (memcmp(fontname, "cmtt", 4) == 0) { + if (HAS_PREFIX(fontname, "cmtt")) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_cm_typewriter", fontname)); return m_cm_typewriter_encoding[ch]; } /* following to cover cmsl, cmb, cmbx, cmti, cmdunghill, whatever ... hope it doesn't overgenerate ;-) */ - if (memcmp(fontname, "cm", 2) == 0 - || memcmp(fontname, "lcmss", strlen("lcmss")) == 0 /* lcmss8 etc. */ - || memcmp(fontname, "ygoth", strlen("ygoth")) == 0 - || memcmp(fontname, "yinit", strlen("yinit")) == 0 - || memcmp(fontname, "logo", strlen("logo")) == 0 - || memcmp(fontname, "rsfs", strlen("rsfs")) == 0 + if (HAS_PREFIX(fontname, "cm") + || HAS_PREFIX(fontname, "ccr") + || HAS_PREFIX(fontname, "lcmss") /* lcmss8 etc. */ + || HAS_PREFIX(fontname, "ygoth") + || HAS_PREFIX(fontname, "yinit") + || HAS_PREFIX(fontname, "logo") + || HAS_PREFIX(fontname, "rsfs") + || HAS_PREFIX(fontname, "bbm") ) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_ot1", fontname)); return m_ot1_encoding[ch]; } /* cyrillic fonts */ - if (memcmp(fontname, "la", 2) == 0) { + if (HAS_PREFIX(fontname, "la")) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_t2", fontname)); return m_t2_encoding[ch]; } - if (memcmp(fontname, "ec", 2) == 0 - || memcmp(fontname, "eb", 2) == 0) { + if (HAS_PREFIX(fontname, "ec") + || HAS_PREFIX(fontname, "eo") + || HAS_PREFIX(fontname, "eb")) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_cork", fontname)); - /* FIXME: why cork and not EC? What font actually uses EC? + /* FIXME: why cork and not EC? Are there fonts that actually use EC? The only difference seems that dvips' EC.enc has `ldot' at 0xb8, whereas cork.enc has `ydieresis' there. A document with \usepackage[T1]{fontenc} also produces a ydieresis. - */ + */ return m_cork_encoding[ch]; } - if (memcmp(fontname, "tc", 2) == 0) { + if (HAS_PREFIX(fontname, "tc")) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_ts1", fontname)); return m_ts1_encoding[ch]; } /* blackletter fonts with funny encoding */ - if (memcmp(fontname, "ysmfrak", 7) == 0 - || memcmp(fontname, "yswab", 5) == 0) { + if (HAS_PREFIX(fontname, "ysmfrak") + || HAS_PREFIX(fontname, "yswab")) { TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_yfrak", fontname)); /* special cases for ligatures */ switch (ch) { @@ -3547,11 +3667,9 @@ guess_encoding(wide_ubyte ch, const char *fontname, char *retbuf) default: return m_yfrak_encoding[ch]; } } - /* euler mathematical */ - if (memcmp(fontname, "eufm", strlen("eufm")) == 0 - || memcmp(fontname, "eusm", strlen("eufm")) == 0 - ) { + if (HAS_PREFIX(fontname, "eufm") + || HAS_PREFIX(fontname, "eusm")) { switch (ch) { case 0x0: case 0x1: return 'd'; break; case 0x2: case 0x3: return 'f'; break; @@ -3562,21 +3680,55 @@ guess_encoding(wide_ubyte ch, const char *fontname, char *retbuf) default: return m_ot1_encoding[ch]; } } - - /* stuff that doesn't have a good ASCII representation */ - if (memcmp(fontname, "lcircle", strlen("lcircle")) == 0 - || memcmp(fontname, "line", strlen("line")) == 0 - || memcmp(fontname, "fmvr8x", strlen("fmvr8x")) == 0 - || memcmp(fontname, "feymr", strlen("feymr")) == 0 - || memcmp(fontname, "msbm", strlen("msbm")) == 0 - || memcmp(fontname, "msam", strlen("msam")) == 0 - || memcmp(fontname, "wasy", strlen("wasy")) == 0 - || memcmp(fontname, "txsy", strlen("txsy")) == 0 + if (HAS_PREFIX(fontname, "lcircle") + || HAS_PREFIX(fontname, "line") + || HAS_PREFIX(fontname, "fmvr8x") + || HAS_PREFIX(fontname, "feymr") + || HAS_PREFIX(fontname, "msbm") + || HAS_PREFIX(fontname, "msam") + || HAS_PREFIX(fontname, "wasy") + || HAS_PREFIX(fontname, "txsy") ) { return 0; } - + if (HAS_PREFIX(fontname, "bbold")) { + return m_bbold_encoding[ch]; + } + if (HAS_PREFIX(fontname, "gli") + || HAS_PREFIX(fontname, "glj") + || HAS_PREFIX(fontname, "glm") + || HAS_PREFIX(fontname, "glt") + || HAS_PREFIX(fontname, "glw") + || HAS_PREFIX(fontname, "glx") + || HAS_PREFIX(fontname, "gmm") + || HAS_PREFIX(fontname, "gmt") + || HAS_PREFIX(fontname, "gmx") + || HAS_PREFIX(fontname, "gom") + || HAS_PREFIX(fontname, "gox") + || HAS_PREFIX(fontname, "grb") + || HAS_PREFIX(fontname, "grm") + || HAS_PREFIX(fontname, "grx") + || HAS_PREFIX(fontname, "gsm") + || HAS_PREFIX(fontname, "gsx") + || HAS_PREFIX(fontname, "gtt") + ) { + TRACE_FIND_VERBOSE((stderr, "guess_encoding: %s => m_cb_greek_encoding", fontname)); + return m_cb_greek_encoding[ch]; + } + if (HAS_PREFIX(fontname, "wasy")) { + /* these are all special symbols */ + return 0; + } + if (HAS_PREFIX(fontname, "to")) { + if (ch >= '0' && ch <= '9') { + return ch; + } + else { /* special symbols */ + return 0; + } + } + /* TODO: txfonts */ @@ -3587,10 +3739,17 @@ guess_encoding(wide_ubyte ch, const char *fontname, char *retbuf) hash_initialized = True; } if (!find_str_int_hash(&unknown_font_hash, fontname, &dummy)) { - XDVI_WARNING((stderr, - "guess_encoding(): nothing suitable for \"%s\", assuming Cork encoding.\n" - "(Please tell us about this at " - "http://sourceforge.net/tracker/?group_id=23164&atid=377580)", fontname)); + if (resource.t1lib) { + XDVI_WARNING((stderr, + "guess_encoding(): nothing suitable for \"%s\", assuming Cork encoding.\n" + "(Please tell us about this at " + "http://sourceforge.net/tracker/?group_id=23164&atid=377580)", fontname)); + } + else { + XDVI_INFO((stderr, + "T1lib not enabled, assuming Cork encoding for font \"%s\".\n", + fontname)); + } put_str_int_hash(&unknown_font_hash, fontname, dummy); } return m_cork_encoding[ch]; @@ -3794,8 +3953,13 @@ utf8_to_ucs4(const char *utf8, uint32_t *ucs4, size_t len) void ucs4_to_utf8(uint32_t ucs4, char *utf8, size_t *len, Boolean do_lowercase) { - if (do_lowercase) + if (do_lowercase) { ucs4 = ucs4_lowercase(ucs4); + TRACE_FIND_VERBOSE((stderr, "Lowercasing of 0x%lx --> 0x%lx\n", ucs4_bak, ucs4)); + } + else { + TRACE_FIND_VERBOSE((stderr, "NOT lowercasing 0x%lx\n", ucs4)); + } if (ucs4 < 0x80) *len = 1; diff --git a/Build/source/texk/xdvik/encodings.h b/Build/source/texk/xdvik/encodings.h index 180692c6690..e4b3741a96d 100644 --- a/Build/source/texk/xdvik/encodings.h +++ b/Build/source/texk/xdvik/encodings.h @@ -52,7 +52,6 @@ extern void iso_8859_1_to_utf8(unsigned char iso_8859_1, char *utf8, size_t *len extern int str_iso_8859_1_to_utf8(const char *latin1, char *utf8, size_t len); extern Boolean is_hyphenchar(uint32_t unicode); extern Boolean is_ideograph(uint32_t unicode); -extern void close_iconv(void); #endif /* ENCODINGS_H_ */ diff --git a/Build/source/texk/xdvik/events.c b/Build/source/texk/xdvik/events.c index 417e09d4b18..77776de5699 100644 --- a/Build/source/texk/xdvik/events.c +++ b/Build/source/texk/xdvik/events.c @@ -21,8 +21,8 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTE: - xdvi is based on prior work, as noted in the modification history - in xdvi.c. +xdvi is based on prior work, as noted in the modification history +in xdvi.c. \*========================================================================*/ @@ -168,6 +168,11 @@ extern int errno; # define XIO_OUT 2 #endif /* HAVE_POLL */ +/* cannot be const since Stings in Action routines arent either */ +static char *Act_true_retval = "true"; +static char *Act_false_retval = "false"; + + static sigset_t all_signals; /* @@ -218,11 +223,11 @@ static void do_sigsegv(void); Example: flag := SF_TERM | SF_CHLD = 24 flags_to_sigproc[24] => - do_sigterm, which sets flag to 24 & ~SF_TERM == 8 + do_sigterm, which sets flag to 24 & ~SF_TERM == 8 then, in next check: flags_to_sigproc[8] => - do_sigchld, which sets flag 8 & ~SF_CHLD == 0. - */ + do_sigchld, which sets flag 8 & ~SF_CHLD == 0. +*/ #define SP0 do_sigusr #define SP1 do_sigalrm #define SP2 do_sigpoll @@ -290,36 +295,6 @@ Pixel *color_list; /* list of colors */ unsigned int color_list_len = 0; /* current len of list*/ unsigned int color_list_max = 0; /* allocated size */ Boolean color_warned = False; -/* - FIXME: the following file-static flag is used to control whether - a mouse-related Act_* should block further actions that have - been registered for the same event. - - It is used for the Act_href_* routines. - - This used to be a - longjmp(somewehre_in_the_event_loop); - but that was pretty dreadful as well. Surely there must - be some other (X(t)-specific?) way to do this?? (Apart from - de-registering the action and re-registering it again.) -*/ -static Boolean m_block_mouse_event = False; - -/* for calling it from mag.c */ -void -block_next_mouse_event(void) { - m_block_mouse_event = True; -} - -Boolean -block_this_mouse_event(void) { - if (m_block_mouse_event == True) { - m_block_mouse_event = False; - return True; - } - return False; -} - void null_mouse(XEvent *event) { @@ -331,6 +306,7 @@ mouse_proc mouse_release = null_mouse; static void Act_digit(Widget, XEvent *, String *, Cardinal *); static void Act_find(Widget, XEvent *, String *, Cardinal *); +static void Act_incremental_find(Widget, XEvent *, String *, Cardinal *); static void Act_find_next(Widget, XEvent *, String *, Cardinal *); static void Act_minus(Widget, XEvent *, String *, Cardinal *); static void Act_quit(Widget, XEvent *, String *, Cardinal *); @@ -372,12 +348,12 @@ static void Act_drag(Widget, XEvent *, String *, Cardinal *); static void Act_wheel(Widget, XEvent *, String *, Cardinal *); static void Act_motion(Widget, XEvent *, String *, Cardinal *); static void Act_release(Widget, XEvent *, String *, Cardinal *); +static void Act_toggle_grid_mode(Widget, XEvent *, String *, Cardinal *); static void Act_source_special(Widget, XEvent *, String *, Cardinal *); static void Act_show_source_specials(Widget, XEvent *, String *, Cardinal *); static void Act_source_what_special(Widget, XEvent *, String *, Cardinal *); static void Act_unpause_or_next(Widget, XEvent *, String *, Cardinal *); static void Act_ruler_snap_origin(Widget w, XEvent *event, String *params, Cardinal *num_params); -static void Act_text_mode(Widget w, XEvent *event, String *params, Cardinal *num_params); static void Act_load_url(Widget w, XEvent *event, String *params, Cardinal *num_params); #ifdef MOTIF static void Act_prefs_dialog(Widget w, XEvent *event, String *params, Cardinal *num_params); @@ -385,9 +361,8 @@ static void Act_prefs_dialog(Widget w, XEvent *event, String *params, Cardinal * static XtActionsRec m_actions[] = { {"digit", Act_digit}, + {"mouse-modes", Act_mouse_modes}, {"switch-mode", Act_switch_mode}, - {"ruler-mode", Act_ruler_mode}, - {"text-mode", Act_text_mode}, {"minus", Act_minus}, {"recent-files", Act_recent_files}, {"quit", Act_quit}, @@ -395,6 +370,7 @@ static XtActionsRec m_actions[] = { {"print", Act_print}, {"save", Act_save}, {"find", Act_find}, + {"incremental-find", Act_incremental_find}, {"find-next", Act_find_next}, {"help", Act_help}, {"goto-page", Act_goto_page}, @@ -408,7 +384,6 @@ static XtActionsRec m_actions[] = { {"end-or-bottom", Act_end_or_bottom}, {"center", Act_center}, {"set-keep-flag", Act_set_keep_flag}, - {"ruler-snap-origin", Act_ruler_snap_origin}, {"left", Act_left}, {"right", Act_right}, {"up", Act_up}, @@ -445,14 +420,15 @@ static XtActionsRec m_actions[] = { {"wheel", Act_wheel}, {"motion", Act_motion}, {"release", Act_release}, + {"toggle-grid-mode", Act_toggle_grid_mode}, {"source-special", Act_source_special}, {"show-source-specials", Act_show_source_specials}, {"source-what-special", Act_source_what_special}, {"unpause-or-next", Act_unpause_or_next}, -#if defined(NEW_MENU_CREATION) || defined(MOTIF) +#if 0 /* not implemented yet */ {"set-papersize", Act_set_papersize}, {"set-paper-landscape", Act_set_paper_landscape}, -#endif /* NEW_MENU_CREATION */ +#endif {"load-url", Act_load_url}, {"pagehistory-clear", Act_pagehistory_clear}, {"pagehistory-back", Act_pagehistory_back}, @@ -462,6 +438,13 @@ static XtActionsRec m_actions[] = { #ifdef MOTIF {"prefs-dialog", Act_prefs_dialog}, #endif + {"magnifier", Act_magnifier}, + {"ruler", Act_ruler}, + {"ruler-snap-origin", Act_ruler_snap_origin}, + {"text-selection", Act_text_selection}, + {"do-href", Act_href}, + {"do-href-newwindow", Act_href_newwindow}, + {"switch-magnifier-units", Act_switch_magnifier_units}, }; /* @@ -554,10 +537,10 @@ clearexpose(struct WindowRec *windowrec, * Routines for X11 toolkit. */ -static Position window_x, window_y; +static Position m_window_x, m_window_y; static Arg arg_xy[] = { - {XtNx, (XtArgVal) &window_x}, - {XtNy, (XtArgVal) &window_y}, + {XtNx, (XtArgVal) &m_window_x}, + {XtNy, (XtArgVal) &m_window_y}, }; #define get_xy() XtGetValues(globals.widgets.draw_widget, arg_xy, XtNumber(arg_xy)) @@ -576,7 +559,7 @@ warn_num_params(const char *act_name, String *params, int num_params, int max_pa struct xdvi_action * compile_action(const char *str) { - const char *p, *p1, *p2; + const char *p, *p1, *p2, *end_cmd; XtActionsRec *actp; struct xdvi_action *ap; @@ -591,7 +574,9 @@ compile_action(const char *str) /* find end of command name */ while (isalnum((int)*p) || *p == '-' || *p == '_') ++p; - + + end_cmd = p; + for (actp = m_actions; ; ++actp) { if (actp >= m_actions + XtNumber(m_actions)) { const char *tmp = strchr(str, '\0'); @@ -629,6 +614,8 @@ compile_action(const char *str) ap = xmalloc(sizeof *ap); ap->proc = actp->proc; + ap->command = xstrndup(str, end_cmd - str); + for (p2 = p1;; --p2) { if (p2 <= p) { /* if no args */ ap->num_params = 0; @@ -636,6 +623,7 @@ compile_action(const char *str) break; } else if (p2[-1] != ' ' && p2[-1] != '\t') { + /* we only deal with one arg here */ char *arg; arg = xmalloc(p2 - p + 1); @@ -646,7 +634,8 @@ compile_action(const char *str) break; } } - + + /* call recursivly; next will be either next parsed action, or NULL */ ap->next = compile_action(p1 + 1); return ap; @@ -663,7 +652,7 @@ handle_command(Widget widget, XtPointer client_data, XtPointer call_data) for (actp = (struct xdvi_action *)client_data; actp != NULL; actp = actp->next) { if (globals.debug & DBG_EVENT) fprintf(stderr, "calling action with param: %s\n", actp->param); - (actp->proc) (widget, NULL, &actp->param, &actp->num_params); + (actp->proc)(widget, NULL, &actp->param, &actp->num_params); } } @@ -696,10 +685,12 @@ home(wide_bool scrl) { int value; - value = (globals.page.w - mane.width) / 2; - if (value > resource.sidemargin_int / mane.shrinkfactor) - value = resource.sidemargin_int / mane.shrinkfactor; - (void)set_bar_value(globals.widgets.x_bar, value, (int)(globals.page.w - mane.width)); + if (!resource.keep_flag) { + value = (globals.page.w - mane.width) / 2; + if (value > resource.sidemargin_int / mane.shrinkfactor) + value = resource.sidemargin_int / mane.shrinkfactor; + (void)set_bar_value(globals.widgets.x_bar, value, (int)(globals.page.w - mane.width)); + } value = (globals.page.h - mane.height) / 2; if (value > resource.topmargin_int / mane.shrinkfactor) @@ -708,19 +699,19 @@ home(wide_bool scrl) } # else get_xy(); - if (globals.widgets.x_bar != NULL) { + if (!resource.keep_flag && globals.widgets.x_bar != NULL) { int coord = (globals.page.w - mane.width) / 2; if (coord > resource.sidemargin_int / mane.shrinkfactor) coord = resource.sidemargin_int / mane.shrinkfactor; - XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer) (window_x + coord)); + XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer) (m_window_x + coord)); } if (globals.widgets.y_bar != NULL) { int coord = (globals.page.h - mane.height) / 2; if (coord > resource.topmargin_int / mane.shrinkfactor) coord = resource.topmargin_int / mane.shrinkfactor; - XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer) (window_y + coord)); + XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer) (m_window_y + coord)); } # endif /* MOTIF */ if (!scrl) { @@ -728,8 +719,10 @@ home(wide_bool scrl) /* Wait for the server to catch up---this eliminates flicker. */ XSync(DISP, False); } +#ifdef USE_PANNER handle_x_scroll(NULL, NULL, NULL, NULL); handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } /* @@ -745,31 +738,35 @@ home_bottom(wide_bool scrl) { int value; - value = (globals.page.w - mane.width) / 2; - if (value > resource.sidemargin_int / mane.shrinkfactor) - value = resource.sidemargin_int / mane.shrinkfactor; - (void)set_bar_value(globals.widgets.x_bar, value, (int)(globals.page.w - mane.width)); + if (!resource.keep_flag) { + value = (globals.page.w - mane.width) / 2; + if (value > resource.sidemargin_int / mane.shrinkfactor) + value = resource.sidemargin_int / mane.shrinkfactor; + (void)set_bar_value(globals.widgets.x_bar, value, (int)(globals.page.w - mane.width)); + } (void)set_bar_value(globals.widgets.y_bar, (int)(globals.page.h - mane.height), (int)(globals.page.h - mane.height)); } #else /* MOTIF */ get_xy(); - if (globals.widgets.x_bar != NULL) { + if (!resource.keep_flag && globals.widgets.x_bar != NULL) { int coord = (globals.page.w - mane.width) / 2; if (coord > resource.sidemargin_int / mane.shrinkfactor) coord = resource.sidemargin_int / mane.shrinkfactor; - XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer) (window_x + coord)); + XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer) (m_window_x + coord)); } if (globals.widgets.y_bar != NULL) - XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer)(window_y + (globals.page.h - mane.height))); + XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer)(m_window_y + (globals.page.h - mane.height))); #endif /* MOTIF */ XMapWindow(DISP, mane.win); /* Wait for the server to catch up---this eliminates flicker. */ XSync(DISP, False); +#ifdef USE_PANNER handle_x_scroll(NULL, NULL, NULL, NULL); handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } @@ -817,8 +814,10 @@ get_geom(void) if (globals.widgets.x_bar != NULL) { XtAddCallback(globals.widgets.x_bar, XtNdestroyCallback, handle_destroy_bar, (XtPointer)&globals.widgets.x_bar); +#ifdef USE_PANNER XtAddEventHandler(globals.widgets.x_bar, ButtonMotionMask | ButtonPressMask | ButtonReleaseMask, False, handle_x_scroll, NULL); +#endif } } if (globals.widgets.y_bar == NULL) { @@ -826,8 +825,10 @@ get_geom(void) if (globals.widgets.y_bar != NULL) { XtAddCallback(globals.widgets.y_bar, XtNdestroyCallback, handle_destroy_bar, (XtPointer)&globals.widgets.y_bar); +#ifdef USE_PANNER XtAddEventHandler(globals.widgets.y_bar, ButtonMotionMask | ButtonPressMask | ButtonReleaseMask, False, handle_y_scroll, NULL); +#endif } } #endif @@ -858,7 +859,7 @@ get_geom(void) (void)set_bar_value(globals.widgets.x_bar, m_x_scroll, (int)(globals.page.w - mane.width)); #else XtVaGetValues(globals.widgets.clip_widget, XtNy, &d, NULL); - curr_scroll = d - window_x; + curr_scroll = d - m_window_x; if (m_x_scroll > curr_scroll) { TRACE_GUI((stderr, "======== diff: %d", m_x_scroll - curr_scroll)); XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer)(m_x_scroll - curr_scroll)); @@ -871,7 +872,7 @@ get_geom(void) (void)set_bar_value(globals.widgets.y_bar, m_y_scroll, (int)(globals.page.h - mane.height)); #else XtVaGetValues(globals.widgets.clip_widget, XtNy, &d, NULL); - curr_scroll = d - window_y; + curr_scroll = d - m_window_y; if (m_y_scroll > curr_scroll) { TRACE_GUI((stderr, "======== diff: %d", m_y_scroll - curr_scroll)); XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer)(m_y_scroll - curr_scroll)); @@ -905,7 +906,7 @@ handle_resize(Widget widget, XtPointer junk, XEvent *event, Boolean *cont) void reconfig(void) { -/* Dimension x, y; */ + /* Dimension x, y; */ if (globals.dvi_file.bak_fp == NULL) return; @@ -917,7 +918,7 @@ reconfig(void) XtVaSetValues(globals.widgets.draw_widget, XtNwidth, (XtArgVal)globals.page.w, XtNheight, (XtArgVal)globals.page.h, NULL); #ifdef TEST_SCROLLING -/* XtVaSetValues(globals.widgets.draw_background, XtNwidth, (XtArgVal)globals.page.w, XtNheight, (XtArgVal)globals.page.h, NULL); */ + /* XtVaSetValues(globals.widgets.draw_background, XtNwidth, (XtArgVal)globals.page.w, XtNheight, (XtArgVal)globals.page.h, NULL); */ #endif #ifndef MOTIF @@ -928,37 +929,39 @@ reconfig(void) get_geom(); -/* set_windowsize(&x, &y */ -/* #ifndef MOTIF */ -/* , get_panel_width() */ -/* #endif */ -/* ); */ -/* XResizeWindow(DISP, XtWindow(globals.widgets.top_level), x, y); */ -/* reconfigure_window(False, x, y, True); */ -/* reconfig_window(); */ + /* set_windowsize(&x, &y */ + /* #ifndef MOTIF */ + /* , get_panel_width() */ + /* #endif */ + /* ); */ + /* XResizeWindow(DISP, XtWindow(globals.widgets.top_level), x, y); */ + /* reconfigure_window(False, x, y, True); */ + /* reconfig_window(); */ } int -check_goto_page(int pageno) +check_goto_page(int pageno, Boolean insert_into_pagehist) { int retval; if (pageno < 0) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Can't go to page %d, going to first page instead", pageno + 1); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "Can't go to page %d, going to first page instead", pageno + 1); */ retval = 0; } else if (pageno >= total_pages) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, - "Can't go to page %d, going to last page (%d) instead", - pageno + 1, total_pages); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, */ +/* "Can't go to page %d, going to last page (%d) instead", */ +/* pageno + 1, total_pages); */ retval = total_pages - 1; } else retval = pageno; - page_history_insert(retval); + if (insert_into_pagehist) { + page_history_insert(retval); + } return retval; } @@ -977,23 +980,23 @@ check_goto_tex_page(int pageno) if (res >= 0) retval = res; else { - XBell(DISP, 0); + xdvi_bell(); if (pageno < 1) { - statusline_print(STATUS_SHORT, "Can't go to page %d, going to first page instead", pageno + 1); +/* statusline_info(STATUS_SHORT, "Can't go to page %d, going to first page instead", pageno + 1); */ retval = 0; } else { /* there is no quick way to determine the last page number in the TeX page index */ - statusline_print(STATUS_SHORT, - "Can't go to page %d, going to last page instead", - pageno + 1); +/* statusline_info(STATUS_SHORT, */ +/* "Can't go to page %d, going to last page instead", */ +/* pageno + 1); */ retval = total_pages - 1; } } page_history_insert(retval); } else { - retval = check_goto_page(pageno); + retval = check_goto_page(pageno, True); } return retval; } @@ -1061,7 +1064,6 @@ toggle_arg(int arg, String *param, Cardinal *num_params) return True; } -#if defined(NEW_MENU_CREATION) || defined(MOTIF) Boolean check_resource_expert(void *val, const char *param) { @@ -1106,8 +1108,199 @@ check_int(void *val, const char *param) int i = strtol(param, (char **)NULL, 10); return i == *(int *)val; } -#endif /* NEW_MENU_CREATION */ +void +Act_ruler(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + UNUSED(w); + UNUSED(params); + UNUSED(num_params); + + MYTRACE((stderr, "ruler!\n")); + + if (dvi_file_changed()) { + globals.ev.flags |= EV_RELOAD; + return; + } + +#ifdef MOTIF + /* see xm_menu.c for an explanation of this */ + if (event && pulldown_menu_active(event->xany.serial)) { + return; + } +#endif + + if (bg_current == NULL) { + /* + HACK ALERT: we can arrive here after loading a new file via the file selector + for which not all fonts have been generated. In that case, dereferencing + bg_current would bomb. Try to recover by simply returning here. + */ + return; + } + + show_ruler(event); + globals.curr_mode = RULER_MODE_ACTIVE; + globals.ev.flags |= EV_CURSOR; + XFlush(DISP); + show_distance_from_ruler(event, False); +} + +void +Act_text_selection(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + UNUSED(w); + UNUSED(params); + UNUSED(num_params); + + MYTRACE((stderr, "text selection!\n")); + + if (dvi_file_changed()) { + globals.ev.flags |= EV_RELOAD; + return; + } + +#ifdef MOTIF + /* see xm_menu.c for an explanation of this */ + if (pulldown_menu_active(event->xany.serial)) { + return; + } +#endif + + if (bg_current == NULL) { + /* + HACK ALERT: we can arrive here after loading a new file via the file selector + for which not all fonts have been generated. In that case, dereferencing + bg_current would bomb. Try to recover by simply returning here. + */ + return; + } + + globals.curr_mode = TEXT_MODE_ACTIVE; + globals.ev.flags |= EV_CURSOR; + XFlush(DISP); + text_selection_start(event); + text_motion(event); +} + +/**************************************************************************** + * Actions specific to the handling of the magnifier + */ + +void +Act_magnifier(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + UNUSED(w); + + MYTRACE((stderr, "magnifier!\n")); + + if (dvi_file_changed()) { + globals.ev.flags |= EV_RELOAD; + return; + } + +#ifdef MOTIF + /* see xm_menu.c for an explanation of this */ + if (pulldown_menu_active(event->xany.serial)) { + return; + } +#endif + + if (bg_current == NULL) { + /* + HACK ALERT: we can arrive here after loading a new file via the file selector + for which not all fonts have been generated. In that case, dereferencing + bg_current would bomb. Try to recover by simply returning here. + */ + return; + } + + if (event->type != ButtonPress || mouse_release != null_mouse + || MAGNIFIER_ACTIVE || mane.shrinkfactor == 1 || *num_params != 1) { + XBell(DISP, 0); + if (mane.shrinkfactor == 1) { + statusline_info(STATUS_SHORT, + "No magnification available at shrink factor 1"); + } + return; + } + + magnifier_move(*params, event); +} + +void +Act_switch_magnifier_units(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + size_t k = 0; + static char *TeX_units[] = { + "mm", "pt", "in", "sp", "bp", "cc", "dd", "pc", "px", + }; + + UNUSED(w); + UNUSED(event); + UNUSED(params); + UNUSED(num_params); + + for (k = 0; k < XtNumber(TeX_units); ++k) + if (strcmp(resource.tick_units, TeX_units[k]) == 0) + break; + k++; + if (k >= XtNumber(TeX_units)) + k = 0; + resource.tick_units = TeX_units[k]; + if (globals.curr_mode == RULER_MODE_ACTIVE) { + show_distance_from_ruler(event, False); + } + else { + statusline_info(STATUS_SHORT, "Ruler units: %s\n", resource.tick_units); + } +} + +void +Act_href(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + int x, y; + Window dummy; + + UNUSED(w); + UNUSED(num_params); + + (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, + event->xkey.x, event->xkey.y, &x, &y, &dummy); + + if (params) { + if (htex_handleref(x, y, False)) + *params = Act_true_retval; + else + *params = Act_false_retval; + } +} + +void +Act_href_newwindow(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + int x, y; + Window dummy; + + UNUSED(w); + UNUSED(num_params); + + (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, + event->xkey.x, event->xkey.y, &x, &y, &dummy); + + if (params) { + if (htex_handleref(x, y, True)) + *params = Act_true_retval; + else + *params = Act_false_retval; + } +} static void Act_digit(Widget w, XEvent *event, @@ -1123,7 +1316,7 @@ Act_digit(Widget w, XEvent *event, UNUSED(event); if (*num_params != 1 || (digit = **params - '0') > 9) { - XBell(DISP, 0); + xdvi_bell(); return; } m_have_arg = True; @@ -1132,11 +1325,11 @@ Act_digit(Widget w, XEvent *event, if (m_number < MAXINT_QUOT || (m_number == MAXINT_QUOT && digit <= MAXINT_MOD)) { m_number = m_number * 10 + digit; if (resource.expert_mode & XPRT_SHOW_STATUSLINE) /* too distracting for stdout */ - statusline_print(STATUS_SHORT, "numerical prefix: %s%d", m_sign < 0 ? "-" : "", m_number); + statusline_info(STATUS_SHORT, "numerical prefix: %s%d", m_sign < 0 ? "-" : "", m_number); } else { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "numerical prefix: %s%d: no larger value possible", m_sign < 0 ? "-" : "", m_number); + xdvi_bell(); + statusline_info(STATUS_SHORT, "numerical prefix: %s%d: no larger value possible", m_sign < 0 ? "-" : "", m_number); } } @@ -1153,11 +1346,11 @@ Act_minus(Widget w, XEvent *event, m_sign = -m_sign; if (m_number > 0) { if (resource.expert_mode & XPRT_SHOW_STATUSLINE) /* too distracting for stdout */ - statusline_print(STATUS_SHORT, "numerical prefix: %s%d", m_sign < 0 ? "-" : "", m_number); + statusline_info(STATUS_SHORT, "numerical prefix: %s%d", m_sign < 0 ? "-" : "", m_number); } else { if (resource.expert_mode & XPRT_SHOW_STATUSLINE) /* too distracting for stdout */ - statusline_print(STATUS_SHORT, "numerical prefix: %s", m_sign < 0 ? "-" : ""); + statusline_info(STATUS_SHORT, "numerical prefix: %s", m_sign < 0 ? "-" : ""); } } @@ -1165,9 +1358,6 @@ static void Act_quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); @@ -1188,9 +1378,6 @@ Act_quit_confirm(Widget w, XEvent *event, { static Widget dialog = 0; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); @@ -1209,7 +1396,7 @@ Act_quit_confirm(Widget w, XEvent *event, or XtIsMapped() don't work?? Grabbing the server apparently has problems with Xaw, and it's not a nice solution anyway ... */ if (kill_message_window(dialog)) - XBell(DISP, 0); + xdvi_bell(); } dialog = choice_dialog_sized(globals.widgets.top_level, @@ -1228,9 +1415,6 @@ Act_quit_confirm(Widget w, XEvent *event, static void Act_load_url(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(num_params); @@ -1240,45 +1424,68 @@ Act_load_url(Widget w, XEvent *event, String *params, Cardinal *num_params) static void Act_print(Widget w, XEvent *event, String *params, Cardinal *num_params) { + /* static so that we can pass them around to callbacks etc. */ static struct save_or_print_info info; + static struct select_pages_info pinfo = { + 0, 0, check_marked, { 0, NULL }, NO_ERROR + }; + static struct file_info finfo = { + NULL, NULL, + NULL, NULL, + NULL + }; + static Boolean first_time = True; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); UNUSED(num_params); - info.act = FILE_PRINT; - + if (first_time) { + info.shell = info.printlog = NULL; + info.act = FILE_PRINT; + info.pinfo = &pinfo; + info.finfo = &finfo; + info.callbacks = NULL; + first_time = False; + } save_or_print_callback(&info); } static void Act_save(Widget w, XEvent *event, String *params, Cardinal *num_params) { + /* static so that we can pass them around to callbacks etc. */ static struct save_or_print_info info; + static struct select_pages_info pinfo = { + 0, 0, check_marked, { 0, NULL }, NO_ERROR + }; + static struct file_info finfo = { + NULL, NULL, + NULL, NULL, + NULL + }; + static Boolean first_time = True; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); UNUSED(num_params); - info.act = FILE_SAVE; - + if (first_time) { + info.shell = info.printlog = NULL; + info.act = FILE_SAVE; + info.pinfo = &pinfo; + info.finfo = &finfo; + info.callbacks = NULL; + first_time = False; + } save_or_print_callback(&info); } static void Act_find(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); @@ -1286,12 +1493,19 @@ Act_find(Widget w, XEvent *event, String *params, Cardinal *num_params) dvi_find_string(NULL, False); } +static void +Act_incremental_find(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + UNUSED(w); + UNUSED(event); + UNUSED(params); + UNUSED(num_params); + isearch_start(); +} + static void Act_find_next(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); @@ -1305,9 +1519,6 @@ Act_help(Widget w, XEvent *event, { char *arg = NULL; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1322,9 +1533,9 @@ static home_proc home_action = NULL; void goto_page(int new_page, home_proc proc, Boolean force) { - /* SU: added clearing the window here, else old window content + /* SU: added clearing the window here, otherwise old window content will survive switching pages as long as globals.pausing.flag is active - (i.e. when inadvertedly changing page instead of unpausing) + (i.e. when accidentally changing page instead of unpausing) */ if (globals.pausing.flag) { XClearWindow(DISP, mane.win); @@ -1334,20 +1545,23 @@ goto_page(int new_page, home_proc proc, Boolean force) current_page = new_page; /* so that xdvi gets the page change */ return; } - - ASSERT(new_page >= 0 && new_page < total_pages, "new_page in goto_page() out of range"); + + xdvi_assert(XDVI_VERSION_INFO, __FILE__, __LINE__, + new_page >= 0 && new_page < total_pages, + "%d >= 0 && %d < %d", new_page, new_page, total_pages); + if (current_page != new_page || force) { globals.cursor.flags &= ~CURSOR_LINK; /* disable link cursor if needed */ current_page = new_page; home_action = proc; globals.warn_spec_now = resource.warn_spec; - /* this seems unneccessary */ -/* if (!resource.keep_flag) */ -/* home(False); */ + /* this seems unneccessary */ + /* if (!resource.keep_flag) */ + /* home(False); */ #if defined(MOTIF) && HAVE_XPM tb_check_navigation_sensitivity(current_page); -/* page_history_update_toolbar_navigation(); */ + /* page_history_update_toolbar_navigation(); */ #endif maybe_scroll_pagelist(current_page, False); @@ -1371,9 +1585,6 @@ Act_goto_page(Widget w, XEvent *event, int arg; Boolean clear_statusline = False; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1398,7 +1609,7 @@ Act_goto_page(Widget w, XEvent *event, if (arg == total_pages - 1) { /* with TeX numbers, total_pages - 1 might not be found in the page list, so don't use check_goto_tex_page() in this case */ - goto_page(check_goto_page(arg), resource.keep_flag ? NULL : home, False); + goto_page(check_goto_page(arg, True), resource.keep_flag ? NULL : home, False); } else { goto_page(check_goto_tex_page(arg), resource.keep_flag ? NULL : home, False); @@ -1406,6 +1617,7 @@ Act_goto_page(Widget w, XEvent *event, search_signal_page_changed(); if (clear_statusline) statusline_clear(); + statusline_erase("Page history:"); } void @@ -1425,8 +1637,6 @@ Act_use_tex_pages(Widget w, XEvent *event, UNUSED(w); UNUSED(event); - if (block_this_mouse_event()) - return; if (*num_params == 0) { if (m_have_arg) { @@ -1443,23 +1653,16 @@ Act_use_tex_pages(Widget w, XEvent *event, resource.use_tex_pages = (**params == 't' ? !resource.use_tex_pages : atoi(*params)); if (resource.use_tex_pages) { - statusline_print(STATUS_SHORT, "Using TeX page numbers for \"g\", goto-page()"); + statusline_info(STATUS_SHORT, "Using TeX page numbers for \"g\", goto-page()"); } else { - statusline_print(STATUS_SHORT, "Using physical page numbers for \"g\", goto-page()"); + statusline_info(STATUS_SHORT, "Using physical page numbers for \"g\", goto-page()"); } store_preference(NULL, "useTeXPages", "%s", resource.use_tex_pages ? "True" : "False"); -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.use_tex_pages, Act_use_tex_pages, check_toggle); -#else -#ifdef MOTIF - set_use_tex_option(); -#else - toggle_menu(resource.use_tex_pages, Act_use_tex_pages); -#endif -#endif /* NEW_MENU_CREATION */ + refresh_pagelist(total_pages, current_page); } @@ -1470,9 +1673,6 @@ Act_forward_page(Widget w, XEvent *event, int arg; Boolean clear_statusline = False; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1488,18 +1688,19 @@ Act_forward_page(Widget w, XEvent *event, search_reset_info(); globals.ev.flags |= EV_NEWPAGE; XFlush(DISP); - statusline_print(STATUS_SHORT, "Page redrawn."); + statusline_info(STATUS_SHORT, "Page redrawn."); return; } else if (current_page >= total_pages - 1) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Last page of DVI file"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "Last page of DVI file"); */ return; } - goto_page(check_goto_page(arg), resource.keep_flag ? NULL : home, False); + goto_page(check_goto_page(arg, True), resource.keep_flag ? NULL : home, False); if (clear_statusline) statusline_clear(); + statusline_erase("Page history:"); search_signal_page_changed(); } @@ -1510,9 +1711,6 @@ Act_back_page(Widget w, XEvent *event, int arg; Boolean clear_statusline = False; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1524,14 +1722,15 @@ Act_back_page(Widget w, XEvent *event, arg = current_page - arg; if (current_page == 0) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "First page of DVI file"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "First page of DVI file"); */ return; } - goto_page(check_goto_page(arg), resource.keep_flag ? NULL : home, False); + goto_page(check_goto_page(arg, True), resource.keep_flag ? NULL : home, False); if (clear_statusline) statusline_clear(); + statusline_erase("Page history:"); search_signal_page_changed(); } @@ -1541,13 +1740,10 @@ Act_declare_page_number(Widget w, XEvent *event, { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); - - if (resource.mouse_mode == MOUSE_RULER_MODE) { + + if (globals.curr_mode == RULER_MODE_ACTIVE) { show_distance_from_ruler(event, True); return; } @@ -1556,7 +1752,7 @@ Act_declare_page_number(Widget w, XEvent *event, arg = 0; } globals.pageno_correct = arg - current_page; - statusline_print(STATUS_SHORT, "Current page number set to %d", arg); + statusline_info(STATUS_SHORT, "Current page number set to %d", arg); } static void @@ -1565,9 +1761,6 @@ Act_toggle_mark(Widget w, XEvent *event, { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1580,14 +1773,18 @@ Act_toggle_mark(Widget w, XEvent *event, #else (resource.expert_mode & XPRT_SHOW_BUTTONS) == 0 #endif - ) + ) { + xdvi_bell(); + statusline_info(STATUS_SHORT, + "Expert mode: Page list not available."); return; + } if (*num_params > 0) { arg = atoi(*params); if (arg < -1 || arg > 2) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, + xdvi_bell(); + statusline_error(STATUS_SHORT, "Possible arguments: none (toggle current), " "-1 (mark all), 0 (unmark all), 1 (toggle odd), 2 (toggle even)"); } @@ -1612,9 +1809,6 @@ Act_home(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - home(True); } @@ -1627,9 +1821,6 @@ Act_home_or_top(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - if (resource.keep_flag) { String args[1]; args[0] = "10"; /* should be large enough ... */ @@ -1642,13 +1833,10 @@ Act_home_or_top(Widget w, XEvent *event, static void Act_end_or_bottom(Widget w, XEvent *event, - String *params, Cardinal *num_params) + String *params, Cardinal *num_params) { String args[1]; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); @@ -1672,9 +1860,6 @@ Act_center(Widget w, XEvent *event, { int x, y; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(params); UNUSED(num_params); @@ -1687,7 +1872,7 @@ Act_center(Widget w, XEvent *event, x = set_bar_value(globals.widgets.x_bar, x, (int)(globals.page.w - mane.width)); y = set_bar_value(globals.widgets.y_bar, y, (int)(globals.page.h - mane.height)); get_xy(); - XWarpPointer(DISP, None, None, 0, 0, 0, 0, -x - window_x, -y - window_y); + XWarpPointer(DISP, None, None, 0, 0, 0, 0, -x - m_window_x, -y - m_window_y); #else if (event == NULL) @@ -1702,33 +1887,29 @@ Act_center(Widget w, XEvent *event, XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer) y); XWarpPointer(DISP, None, None, 0, 0, 0, 0, -x, -y); #endif +#ifdef USE_PANNER handle_x_scroll(NULL, NULL, NULL, NULL); handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } void Act_ruler_snap_origin(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(params); UNUSED(num_params); - if (resource.mouse_mode == MOUSE_RULER_MODE) + if (globals.curr_mode == RULER_MODE_ACTIVE) ruler_snap_origin(event); } -#if defined(NEW_MENU_CREATION) || defined(MOTIF) +#if 0 void Act_set_papersize(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(num_params); @@ -1742,9 +1923,6 @@ void Act_set_paper_landscape(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(num_params); @@ -1754,15 +1932,13 @@ Act_set_paper_landscape(Widget w, XEvent *event, set_menu((char *)resource.paper, Act_set_paper_landscape, check_paper_landscape); } -#endif /* NEW_MENU_CREATION */ +#endif /* 0 */ + void Act_set_keep_flag(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(event); UNUSED(w); @@ -1781,29 +1957,22 @@ Act_set_keep_flag(Widget w, XEvent *event, resource.keep_flag = (**params == 't' ? !resource.keep_flag : atoi(*params)); if (resource.keep_flag) { - statusline_print(STATUS_SHORT, "Keeping position when switching pages"); + statusline_info(STATUS_SHORT, "Keeping position when switching pages"); } else { - statusline_print(STATUS_SHORT, + statusline_info(STATUS_SHORT, "Not keeping position when switching pages"); } store_preference(NULL, "keepPosition", "%s", resource.keep_flag ? "True" : "False"); -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.keep_flag, Act_set_keep_flag, check_toggle); -#else - toggle_menu(resource.keep_flag, Act_set_keep_flag); -#endif /* NEW_MENU_CREATION */ } static void Act_left(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1815,11 +1984,11 @@ Act_left(Widget w, XEvent *event, get_xy(); #ifdef TEST_SCROLLING fprintf(stderr, "left for %p\n", (void *)w); - fprintf(stderr, "window x: %d, y: %d\n", window_x, window_y); + fprintf(stderr, "window x: %d, y: %d\n", m_window_x, m_window_y); #endif (void)set_bar_value(globals.widgets.x_bar, (*num_params == 0 ? (-2 * (int)mane.width / 3) - : (int)(-my_atof(*params) * mane.width)) - window_x, + : (int)(-my_atof(*params) * mane.width)) - m_window_x, (int)(globals.page.w - mane.width)); #else if (globals.widgets.x_bar != NULL) @@ -1827,20 +1996,19 @@ Act_left(Widget w, XEvent *event, (XtPointer) (*num_params == 0 ? (-2 * (int)mane.width / 3) : (int)(-my_atof(*params) * mane.width))); else { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Horizontal scrolling not possible"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "Horizontal scrolling not possible"); */ } #endif +#ifdef USE_PANNER handle_x_scroll(NULL, NULL, NULL, NULL); +#endif } static void Act_right(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1852,11 +2020,11 @@ Act_right(Widget w, XEvent *event, get_xy(); #ifdef TEST_SCROLLING fprintf(stderr, "right for %p\n", (void *)w); - fprintf(stderr, "window x: %d, y: %d\n", window_x, window_y); + fprintf(stderr, "window x: %d, y: %d\n", m_window_x, m_window_y); #endif (void)set_bar_value(globals.widgets.x_bar, (*num_params == 0 ? (2 * (int)mane.width / 3) - : (int)(my_atof(*params) * mane.width)) - window_x, + : (int)(my_atof(*params) * mane.width)) - m_window_x, (int)(globals.page.w - mane.width)); #else if (globals.widgets.x_bar != NULL) @@ -1864,20 +2032,19 @@ Act_right(Widget w, XEvent *event, (XtPointer) (*num_params == 0 ? (2 * (int)mane.width / 3) : (int)(my_atof(*params) * mane.width))); else { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Horizontal scrolling not possible"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "Horizontal scrolling not possible"); */ } #endif +#ifdef USE_PANNER handle_x_scroll(NULL, NULL, NULL, NULL); +#endif } static void Act_up(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1891,7 +2058,7 @@ Act_up(Widget w, XEvent *event, #endif get_xy(); (void)set_bar_value(globals.widgets.y_bar, (*num_params == 0 ? (-2 * (int)mane.height / 3) - : (int)(-my_atof(*params) * mane.height)) - window_y, + : (int)(-my_atof(*params) * mane.height)) - m_window_y, (int)(globals.page.h - mane.height)); #else if (globals.widgets.y_bar != NULL) @@ -1899,20 +2066,19 @@ Act_up(Widget w, XEvent *event, (XtPointer) (*num_params == 0 ? (-2 * (int)mane.height / 3) : (int)(-my_atof(*params) * mane.height))); else { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Vertical scrolling not possible"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "Vertical scrolling not possible"); */ } #endif +#ifdef USE_PANNER handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } static void Act_down(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1926,7 +2092,7 @@ Act_down(Widget w, XEvent *event, #endif get_xy(); (void)set_bar_value(globals.widgets.y_bar, (*num_params == 0 ? (2 * (int)mane.height / 3) - : (int)(my_atof(*params) * mane.height)) - window_y, + : (int)(my_atof(*params) * mane.height)) - m_window_y, (int)(globals.page.h - mane.height)); #else if (globals.widgets.y_bar != NULL) @@ -1934,20 +2100,19 @@ Act_down(Widget w, XEvent *event, (XtPointer) (*num_params == 0 ? (2 * (int)mane.height / 3) : (int)(my_atof(*params) * mane.height))); else { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Vertical scrolling not possible"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "Vertical scrolling not possible"); */ } #endif +#ifdef USE_PANNER handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } static void Act_down_or_next(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -1961,16 +2126,16 @@ Act_down_or_next(Widget w, XEvent *event, #ifdef MOTIF get_xy(); - if (window_y > (int)mane.height - (int)globals.page.h) { + if (m_window_y > (int)mane.height - (int)globals.page.h) { (void)set_bar_value(globals.widgets.y_bar, (*num_params == 0 ? (2 * (int)mane.height / 3) - : (int)(my_atof(*params) * mane.height)) - - window_y, (int)(globals.page.h - mane.height)); + : (int)(my_atof(*params) * mane.height)) - + m_window_y, (int)(globals.page.h - mane.height)); return; } #else if (globals.widgets.y_bar != NULL) { get_xy(); - if (window_y > (int)mane.height - (int)globals.page.h) { + if (m_window_y > (int)mane.height - (int)globals.page.h) { XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer) (*num_params == 0 ? (2 * (int)mane.height / 3) @@ -1985,10 +2150,13 @@ Act_down_or_next(Widget w, XEvent *event, search_signal_page_changed(); } else { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "At bottom of last page"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "At bottom of last page"); */ } +#ifdef USE_PANNER handle_y_scroll(NULL, NULL, NULL, NULL); +#endif + statusline_erase("Page history:"); } @@ -1996,9 +2164,6 @@ static void Act_up_or_previous(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -2011,17 +2176,17 @@ Act_up_or_previous(Widget w, XEvent *event, #endif #ifdef MOTIF get_xy(); - if (window_y < 0) { + if (m_window_y < 0) { (void)set_bar_value(globals.widgets.y_bar, (*num_params == 0 ? (-2 * (int)mane.height / 3) - : (int)(-my_atof(*params) * mane.height)) - window_y, + : (int)(-my_atof(*params) * mane.height)) - m_window_y, (int)(globals.page.h - mane.height)); return; } #else if (globals.widgets.y_bar != NULL) { get_xy(); - if (window_y < 0) { + if (m_window_y < 0) { XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer) (*num_params == 0 ? (-2 * (int)mane.height / 3) @@ -2036,10 +2201,13 @@ Act_up_or_previous(Widget w, XEvent *event, search_signal_page_changed(); } else { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "At top of first page"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "At top of first page"); */ } + statusline_erase("Page history:"); +#ifdef USE_PANNER handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } @@ -2049,9 +2217,6 @@ Act_set_margins(Widget w, XEvent *event, { Window dummy; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(params); UNUSED(num_params); @@ -2063,7 +2228,7 @@ Act_set_margins(Widget w, XEvent *event, (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, event->xkey.x, event->xkey.y, &resource.sidemargin_int, &resource.topmargin_int, &dummy); /* throw away last argument */ - statusline_print(STATUS_SHORT, "Margins set to cursor position (%d, %d)", resource.sidemargin_int, resource.topmargin_int); + statusline_info(STATUS_SHORT, "Margins set to cursor position (%d, %d)", resource.sidemargin_int, resource.topmargin_int); resource.sidemargin_int *= mane.shrinkfactor; resource.topmargin_int *= mane.shrinkfactor; } @@ -2072,15 +2237,12 @@ static void Act_show_display_attributes(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); UNUSED(params); UNUSED(num_params); - statusline_print(STATUS_SHORT, "Unit = %d, bitord = %d, byteord = %d", + statusline_error(STATUS_SHORT, "Unit = %d, bitord = %d, byteord = %d", BitmapUnit(DISP), BitmapBitOrder(DISP), ImageByteOrder(DISP)); } @@ -2136,7 +2298,7 @@ do_set_shrinkfactor(int arg, Boolean set_resource) /* We don't store this as preference since it may affect initial window geometry. */ /* store_preference(NULL, "shrinkFactor", "%d", arg); */ - if (resource.mouse_mode == MOUSE_TEXT_MODE) { + if (globals.curr_mode == TEXT_MODE_ACTIVE) { text_change_region(TEXT_SEL_CLEAR, NULL); } @@ -2144,14 +2306,11 @@ do_set_shrinkfactor(int arg, Boolean set_resource) if (set_resource) resource.shrinkfactor = mane.shrinkfactor; -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&arg, Act_set_shrink_factor, check_int); #if HAVE_XMP tb_set_zoom_sensitivity(arg != 1); #endif -#else - toggle_menu(arg, Act_set_shrink_factor); -#endif /* NEW_MENU_CREATION */ + if (arg != 1 && arg != shrink_bak) { shrink_bak = arg; #if GREY @@ -2171,13 +2330,66 @@ do_set_shrinkfactor(int arg, Boolean set_resource) htex_resize_page(); /* this seems unneccessary */ -/* if (!resource.keep_flag) */ -/* home(False); */ + /* if (!resource.keep_flag) */ + /* home(False); */ globals.ev.flags |= EV_NEWPAGE; XFlush(DISP); } + +/* A 'meta' action that is bound to mouse buttons and invokes actions depending on current mouse mode */ +void +Act_mouse_modes(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + int i; + size_t mode_idx = 0; /* default: one action for all modes */ + struct xdvi_action *my_action = NULL, *ap = NULL; + + if (*num_params > 1) { /* different actions */ + if (resource.mouse_mode >= *num_params) { + size_t k; + XDVI_WARNING((stderr, "Only %d parameters in X resource 'mouse-modes', should be %d", + *num_params, resource.mouse_mode + 1)); + for (k = 0; k < *num_params; k++) { + XDVI_WARNING((stderr, "Param %d: `%s'", k + 1, params[k])); + } + return; + } + mode_idx = resource.mouse_mode; + } + + my_action = compile_action(params[mode_idx]); + for (i = 0, ap = my_action; ap; ap = ap->next, i++) { + TRACE_EVENTS((stderr, "Action %d for mode %d: '%s', %d args |%s| maps to proc |%p|", + i, mode_idx, ap->command, ap->num_params, ap->param, ap->proc)); + String args[1]; + args[0] = ap->param; + + /* now call the action proc directly */ + XtCallActionProc(w, ap->command, event, args, ap->num_params); + + if (args[0] == Act_true_retval) { /* we may compare the pointers here */ + /* Special case: Only invoke first action, not subsequent ones, e.g. if mouse is over + * a link and action is Act_href (currently the only case where this is used). + */ + break; + } + } + + /* free all allocated action info. TODO: should we save it for later calls? */ + ap = my_action; + while (ap) { + struct xdvi_action *tmp_ap = ap; + free(ap->param); + free(ap->command); + ap = tmp_ap->next; + free(tmp_ap); + } +} + + void Act_set_shrink_factor(Widget w, XEvent *event, String *params, Cardinal *num_params) @@ -2192,9 +2404,6 @@ Act_set_shrink_factor(Widget w, XEvent *event, very large shrink factors ... */ static const int SHRINK_MAX = 999; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -2215,15 +2424,15 @@ Act_set_shrink_factor(Widget w, XEvent *event, } if (arg <= 0) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, - "No more enlarging possible"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, */ +/* "No more enlarging possible"); */ return; } if (arg > SHRINK_MAX) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, + xdvi_bell(); + statusline_info(STATUS_SHORT, "Shrink factor %d too large (maximum: %d)", arg, SHRINK_MAX); return; } @@ -2235,7 +2444,7 @@ Act_set_shrink_factor(Widget w, XEvent *event, XClearWindow(DISP, mane.win); } - statusline_print(STATUS_SHORT, "shrink factor: %d", arg); + statusline_info(STATUS_SHORT, "shrink factor: %d", arg); #if 0 /* Uncommented this, otherwise selecting `shrink to fit' with same value as current mane.shrinkfactor will clear the canvas (only fixed by changing shrink @@ -2261,9 +2470,6 @@ Act_shrink_to_dpi(Widget w, XEvent *event, int arg, arg_bak; Boolean clear_statusline = False; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -2280,8 +2486,8 @@ Act_shrink_to_dpi(Widget w, XEvent *event, arg = (double)resource.pixels_per_inch / arg + 0.5; if (arg <= 0) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, + xdvi_bell(); + statusline_info(STATUS_SHORT, "shrink-to-dpi requires a positive argument"); return; } @@ -2318,7 +2524,7 @@ do_set_density(double newgamma, Boolean force, Boolean update_resource) #ifdef GREY if (resource.use_grey) { if (newgamma == resource.gamma && !force) { - statusline_print(STATUS_SHORT, "density value: %.3f", newgamma); + statusline_info(STATUS_SHORT, "density value: %.3f", newgamma); return; } resource.gamma = newgamma; @@ -2335,17 +2541,17 @@ do_set_density(double newgamma, Boolean force, Boolean update_resource) } reset_fonts(); #endif /* COLOR */ - statusline_print(STATUS_SHORT, "density value: %.3f", newgamma); + statusline_info(STATUS_SHORT, "density value: %.3f", newgamma); } else #endif /* GREY */ { reset_fonts(); if (mane.shrinkfactor == 1) { - statusline_print(STATUS_SHORT, - "set-density ignored at magnification 1"); + statusline_info(STATUS_SHORT, + "set-density ignored at magnification 1"); return; } - statusline_print(STATUS_SHORT, "density value: %.3f", newgamma); + statusline_info(STATUS_SHORT, "density value: %.3f", newgamma); } store_preference(NULL, "gamma", "%f", resource.gamma); @@ -2360,24 +2566,21 @@ Act_set_density(Widget w, XEvent *event, { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); warn_num_params("set-density()", params, *num_params, 1); if (!get_int_arg(params, num_params, &arg)) { - XBell(DISP, 0); + xdvi_bell(); return; } -/* if (arg < 0) { */ -/* XBell(DISP, 0); */ -/* statusline_print(STATUS_SHORT, */ -/* "set-density requires a positive value"); */ -/* return; */ -/* } */ + /* if (arg < 0) { */ + /* XBell(DISP, 0); */ + /* statusline_info(STATUS_SHORT, */ + /* "set-density requires a positive value"); */ + /* return; */ + /* } */ do_set_density(arg != 0 ? arg / 100.0 : 1.0, False, True); #if MOTIF update_preferences_darkness(); @@ -2397,13 +2600,10 @@ Act_change_density(Widget w, XEvent *event, UNUSED(w); UNUSED(event); - if (block_this_mouse_event()) - return; - warn_num_params("change-density()", params, *num_params, 1); if (!get_int_arg(params, num_params, &arg)) { - XBell(DISP, 0); + xdvi_bell(); return; } diff = oldgamma / arg; @@ -2417,6 +2617,30 @@ Act_change_density(Widget w, XEvent *event, #endif } +static void h_restore_scroll_position(int orig_pos, +#ifndef MOTIF + Dimension *get_pos, +#endif + Widget scrollbar) +{ + if (resource.keep_flag && orig_pos != 0 && scrollbar != NULL) { +#ifdef MOTIF + if (!resource.fullscreen) { + /* only scroll back in non-fullscreen mode */ + (void)set_bar_value(scrollbar, orig_pos, INT_MAX); + } +#else + int curr_pos; + get_xy(); + XtVaGetValues(globals.widgets.clip_widget, XtNx, get_pos, NULL); + curr_pos = -((*get_pos) - m_window_x); + if (curr_pos - orig_pos > 0) { + XtCallCallbacks(scrollbar, XtNscrollProc, (XtPointer)(curr_pos - orig_pos)); + } +#endif /* MOTIF */ + } +} + static void Act_fullscreen(Widget w, XEvent *event, String *params, Cardinal *num_params) @@ -2432,9 +2656,6 @@ Act_fullscreen(Widget w, XEvent *event, static Dimension w_old = 0, h_old = 0; #endif - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -2464,31 +2685,11 @@ Act_fullscreen(Widget w, XEvent *event, XtVaGetValues(globals.widgets.clip_widget, XtNx, &get_x, NULL); if (globals.widgets.y_bar != NULL) XtVaGetValues(globals.widgets.clip_widget, XtNy, &get_y, NULL); - orig_x = -(get_x - window_x); - orig_y = -(get_y - window_y); + orig_x = -(get_x - m_window_x); + orig_y = -(get_y - m_window_y); #endif /* MOTIF */ - /* fprintf(stderr, "Current offsets: %d, %d, %d, %d\n", orig_x, window_x, orig_y, window_y); */ - } -#if 0 /* TODO: don't hardcode w/h values - - what's wrong with the set_windowsize() call below? */ - if (resource.fullscreen) { - XWindowAttributes attr; - if (XGetWindowAttributes(DISP, XtWindow(globals.widgets.top_level), &attr)) { - w_old = attr.width; - h_old = attr.height; - } - main_win_w = WidthOfScreen(SCRN); - main_win_h = HeightOfScreen(SCRN); + /* fprintf(stderr, "Current offsets: %d, %d, %d, %d\n", orig_x, m_window_x, orig_y, m_window_y); */ } - else if (w_old > 0 && h_old > 0) { - main_win_w = w_old; - main_win_h = h_old; - } - else { - main_win_w = 800; - main_win_h = 600; - } -#else if (resource.fullscreen) { set_windowsize(&main_win_w, &main_win_h, panel_width, 0, False); } @@ -2498,61 +2699,30 @@ Act_fullscreen(Widget w, XEvent *event, else set_windowsize(&old_w, &old_h, panel_width, 0, True); } -#endif -/* fprintf(stderr, "reconfigure window!\n"); */ + /* fprintf(stderr, "reconfigure window!\n"); */ if (resource.fullscreen) reconfigure_window(resource.fullscreen, main_win_w, main_win_h, True); else { reconfigure_window(resource.fullscreen, old_w, old_h, True); } - /* fprintf(stderr, "orig values: %d, %d\n", orig_x, orig_y); */ - /* restore horizontal scroll position */ - if (resource.keep_flag && orig_x != 0 && globals.widgets.x_bar != NULL) { -#ifdef MOTIF - if (!resource.fullscreen) { - /* only scroll back in non-fullscreen mode. This was: - if (resource.fullscreen) - (void)set_bar_value(globals.widgets.y_bar, orig_y, (int)(globals.page.h - mane.height)); - else ... - but that was broken (bogus values in globals.page.h - mane.height). - */ - (void)set_bar_value(globals.widgets.x_bar, orig_x, INT_MAX); - } -#else - int curr_x; - get_xy(); - XtVaGetValues(globals.widgets.clip_widget, XtNx, &get_x, NULL); - curr_x = -(get_x - window_x); - if (curr_x - orig_x > 0) - XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer)(curr_x - orig_x)); -#endif /* MOTIF */ - } - - /* restore vertical scroll position */ - if (resource.keep_flag && orig_y != 0 && globals.widgets.y_bar != NULL) { -#ifdef MOTIF - if (!resource.fullscreen) { - /* only scroll back in non-fullscreen mode. This was: - if (resource.fullscreen) - (void)set_bar_value(globals.widgets.y_bar, orig_y, (int)(globals.page.h - mane.height)); - else ... - but that was broken (bogus values in globals.page.h - mane.height). - */ - (void)set_bar_value(globals.widgets.y_bar, orig_y, INT_MAX); - } -#else - int curr_y; - get_xy(); - XtVaGetValues(globals.widgets.clip_widget, XtNy, &get_y, NULL); - curr_y = -(get_y - window_y); - if (curr_y - orig_y > 0) - XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer)(curr_y - orig_y)); -#endif /* MOTIF */ - } + /* restore horizontal/vertical scroll positions */ + h_restore_scroll_position(orig_x, +#ifndef MOTIF + &get_x, +#endif + globals.widgets.x_bar); + h_restore_scroll_position(orig_y, +#ifndef MOTIF + &get_y, +#endif + globals.widgets.y_bar); + +#ifdef USE_PANNER handle_x_scroll(NULL, NULL, NULL, NULL); handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } #ifdef GREY @@ -2563,9 +2733,6 @@ Act_set_greyscaling(Widget w, XEvent *event, { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -2577,10 +2744,10 @@ Act_set_greyscaling(Widget w, XEvent *event, } resource.use_grey = !resource.use_grey; if (resource.use_grey) { - statusline_print(STATUS_SHORT, "greyscaling on"); + statusline_info(STATUS_SHORT, "greyscaling on"); } else { - statusline_print(STATUS_SHORT, "greyscaling off"); + statusline_info(STATUS_SHORT, "greyscaling off"); } globals.ev.flags |= EV_NEWPAGE; XFlush(DISP); @@ -2590,17 +2757,17 @@ Act_set_greyscaling(Widget w, XEvent *event, switch (arg) { case 0: resource.use_grey = False; - statusline_print(STATUS_SHORT, "greyscaling off"); + statusline_info(STATUS_SHORT, "greyscaling off"); break; case 1: resource.use_grey = True; - statusline_print(STATUS_SHORT, "greyscaling on"); + statusline_info(STATUS_SHORT, "greyscaling on"); break; default: { float newgamma = arg != 0 ? arg / 100.0 : 1.0; resource.use_grey = newgamma; - statusline_print(STATUS_SHORT, "greyscale value: %.1f", newgamma); + statusline_info(STATUS_SHORT, "greyscale value: %.1f", newgamma); } } @@ -2639,12 +2806,12 @@ do_toggle_color(Boolean update_resource) scanned_page = scanned_page_ps; } #endif - statusline_print(STATUS_SHORT, "color specials off"); + statusline_info(STATUS_SHORT, "color specials off"); } else { resource.use_color = True; scanned_page = scanned_page_color = scanned_page_reset; - statusline_print(STATUS_SHORT, "color specials on"); + statusline_info(STATUS_SHORT, "color specials on"); } if (update_resource) globals.curr_use_color = resource.use_color; @@ -2662,9 +2829,6 @@ Act_set_color(Widget w, XEvent *event, UNUSED(w); UNUSED(event); - if (block_this_mouse_event()) - return; - if (!toggle_arg(resource.use_color, params, num_params)) { return; }; @@ -2687,9 +2851,6 @@ Act_set_ps(Widget w, XEvent *event, { int arg; - if (block_this_mouse_event()) - return; - UNUSED(event); UNUSED(w); @@ -2721,10 +2882,10 @@ Act_set_ps(Widget w, XEvent *event, if (scanned_page > scanned_page_ps) scanned_page = scanned_page_ps; if (resource.postscript == 1) { - statusline_print(STATUS_SHORT, "Postscript rendering on"); + statusline_info(STATUS_SHORT, "Postscript rendering on"); } else { - statusline_print(STATUS_SHORT, "Postscript rendering on (with bounding box)"); + statusline_info(STATUS_SHORT, "Postscript rendering on (with bounding box)"); } } else { @@ -2735,17 +2896,15 @@ Act_set_ps(Widget w, XEvent *event, scanned_page = scanned_page_color; } #endif - statusline_print(STATUS_SHORT, "Postscript rendering off; displaying bounding box instead"); + statusline_info(STATUS_SHORT, "Postscript rendering off; displaying bounding box instead"); } store_preference(NULL, "postscript", "%d", resource.postscript); psp.toggle(resource.postscript); -#if defined(NEW_MENU_CREATION) || defined(MOTIF) + set_menu(&resource.postscript, Act_set_ps, check_int); -#else - toggle_menu(resource.postscript, Act_set_ps); -#endif /* NEW_MENU_CREATION */ + /* like elsewhere */ if (globals.pausing.flag) { XClearWindow(DISP, mane.win); @@ -2766,9 +2925,6 @@ Act_htex_back(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - htex_back(); } @@ -2781,9 +2937,6 @@ Act_htex_forward(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - htex_forward(); } @@ -2794,9 +2947,6 @@ Act_htex_anchorinfo(Widget w, XEvent *event, int x, y; Window dummy; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(params); UNUSED(num_params); @@ -2814,28 +2964,22 @@ Act_set_gs_alpha(Widget w, XEvent *event, UNUSED(w); UNUSED(event); - if (block_this_mouse_event()) - return; - if (!toggle_arg(resource.gs_alpha, params, num_params)) { return; } resource.gs_alpha = !resource.gs_alpha; if (resource.gs_alpha) { - statusline_print(STATUS_SHORT, "ghostscript alpha active"); + statusline_info(STATUS_SHORT, "ghostscript alpha active"); } else { - statusline_print(STATUS_SHORT, "ghostscript alpha inactive"); + statusline_info(STATUS_SHORT, "ghostscript alpha inactive"); } store_preference(NULL, "gsAlpha", "%s", resource.gs_alpha ? "True" : "False"); -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.gs_alpha, Act_set_gs_alpha, check_toggle); -#else - toggle_menu(resource.gs_alpha, Act_set_gs_alpha); -#endif /* NEW_MENU_CREATION */ + #if GS_PIXMAP_CLEARING_HACK had_ps_specials = False; /* else infinite loop and/or crash in redraw! */ #endif @@ -2858,10 +3002,7 @@ Act_reread_dvi_file(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - -/* fprintf(stderr, "reread file!\n"); */ + /* fprintf(stderr, "reread file!\n"); */ globals.ev.flags |= EV_RELOAD; } @@ -2874,14 +3015,11 @@ Act_discard_number(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - m_have_arg = False; m_number = 0; m_sign = 1; - if (resource.expert_mode & XPRT_SHOW_STATUSLINE) /* too distracting for stdout */ - statusline_print(STATUS_SHORT, "numerical prefix discarded"); + + statusline_info(STATUS_SHORT, "numerical prefix discarded"); } /* @@ -2897,13 +3035,6 @@ static int text_last_page = -1; static void drag_motion(XEvent *); static void drag_release(XEvent *); -/* access for hyperref.c */ -Boolean dragging_text_selection(void) -{ - MYTRACE((stderr, "dragging selection? %d", mouse_motion == text_motion)); - return mouse_motion == text_motion; -} - static void text_release(XEvent * event) { @@ -2913,7 +3044,7 @@ text_release(XEvent * event) UNUSED(event); - MYTRACE((stderr, "text_release!")); + MYTRACE((stderr, "text_release!\n")); if (mouse_motion == null_mouse) return; @@ -2958,28 +3089,23 @@ text_release(XEvent * event) TRACE_GUI((stderr, "Selected `%s'", text)); if (text_len > 4 * XMaxRequestSize(DISP) - 32) { - MYTRACE((stderr, "selection too large: %d bytes", text_len)); - XBell(DISP, 10); - statusline_print(STATUS_MEDIUM, "Selection too large (%d bytes, maximum %d bytes)", + xdvi_bell(); + statusline_error(STATUS_MEDIUM, "Selection too large (%d bytes, maximum %d bytes)", text_len, 4 * XMaxRequestSize(DISP) - 32); - MYTRACE((stderr, "after statusline_print1")); return; } if (!set_selection(text, globals.widgets.top_level)) { - MYTRACE((stderr, "setting selection failed")); - XBell(DISP, 10); - statusline_print(STATUS_MEDIUM, "Could not set primary selection!"); - MYTRACE((stderr, "after statusline_print2")); + xdvi_bell(); + statusline_error(STATUS_MEDIUM, "Could not set primary selection!"); text_change_region(TEXT_SEL_CLEAR, NULL); - MYTRACE((stderr, "after text_change_region")); } - MYTRACE((stderr, "End of text_release")); } void text_motion(XEvent *event) { + MYTRACE((stderr, "motion!\n")); text_change_region(TEXT_SEL_MOVE, event); } @@ -3012,8 +3138,6 @@ text_change_region(textSelectionT mode, XEvent *event) static GC bboxGC = 0; static GC redrawGC = 0; /* needed since bboxGC is clipped to diff of old and new region */ - MYTRACE((stderr, "text_change_region: %d", mode)); - if (bboxGC == 0) { XGCValues values; unsigned long valuemask; @@ -3034,7 +3158,7 @@ text_change_region(textSelectionT mode, XEvent *event) redrawGC = XCreateGC(DISP, XtWindow(globals.widgets.top_level), valuemask, &values); } - MYTRACE((stderr, "text_change_region: after bboxGC")); + MYTRACE((stderr, "mode: %d\n", mode)); switch (mode) { case TEXT_SEL_MOVE: { @@ -3132,7 +3256,6 @@ text_change_region(textSelectionT mode, XEvent *event) } break; } - MYTRACE((stderr, "text_change_region: done")); } void @@ -3156,76 +3279,37 @@ text_selection_start(XEvent *event) text_last_x = text_last_y = -1; - MYTRACE((stderr, "selection start; mouse_release: %p; null: %p!", - (void *)mouse_release, (void *)null_mouse)); + MYTRACE((stderr, "selection start; mouse_release: %p; null: %p!\n", mouse_release, null_mouse)); if (mouse_release == null_mouse) { - MYTRACE((stderr, "init text_motion!")); + MYTRACE((stderr, "init text_motion!\n")); mouse_motion = text_motion; mouse_release = text_release; } -} - -/* - * If action list for does NOT contain a magnifier() binding, - * return that action list; else return NULL. - */ -static char * -btn1_no_magnifier_binding(void) -{ - static Boolean initialized = False; - static char *btn1_binding = NULL; - - if (!initialized) { /* cache value of previous calls */ - if (resource.main_translations != NULL) { - if ((btn1_binding = strstr(resource.main_translations, "")) != NULL) { - char *eol, *test; - btn1_binding = strchr(btn1_binding, ':'); - if (btn1_binding != NULL) - btn1_binding++; - while (isspace((int)*btn1_binding)) - btn1_binding++; - eol = strchr(btn1_binding, '\n'); - if (eol == NULL) - eol = btn1_binding + strlen(btn1_binding); - if ((test = strstr(btn1_binding, "magnifier(")) == NULL || test > eol) { - /* binding not found */ - return btn1_binding; - } - } - } -/* fprintf(stderr, "MAG: %d\n", btn1_has_magnifier); */ - initialized = True; - } - return btn1_binding; +/* resource.mouse_mode_text_selection_active = True; */ } void Act_switch_mode(Widget w, XEvent *event, String *params, Cardinal *num_params) { - mouseModeT prev_mode = resource.mouse_mode; +/* mouseModeT prev_mode = resource.mouse_mode; */ int arg = -1; - char *ptr; - - if (block_this_mouse_event()) - return; - - UNUSED(w); +/* char *ptr; */ + const char *mode_name = NULL; + const char *mode_description = NULL; +/* XEvent ev; */ - if ((ptr = btn1_no_magnifier_binding()) != NULL) { - XBell(DISP, 0); - statusline_print(STATUS_MEDIUM, - "Cannot switch modes: Action list for Btn1Down (%s) " - "does not contain magnifier() action.", ptr); - return; - } - -/* fprintf(stderr, "prev mode: %d\n", prev_mode); */ + /* if called the first time from main(), this is only used + * to initialize the menu according to the mode. + */ + Boolean initialization = (w == globals.widgets.top_level); + UNUSED(event); + if (get_int_arg(params, num_params, &arg)) { - if (arg < MOUSE_MAGNIFIER_MODE || arg >= MOUSE_MAX_MODE) { - statusline_print(STATUS_SHORT, "Argument for Act_switch_mode outside of range from %d to %d", - MOUSE_MAGNIFIER_MODE, MOUSE_MAX_MODE - 1); + if (arg < MOUSE_MODE1 || arg >= MOUSE_MODE_MAX) { + statusline_info(STATUS_SHORT, "Argument for Act_switch_mode outside of range from %d to %d", + MOUSE_MODE1, MOUSE_MODE_MAX - 1); resource.mouse_mode++; } else @@ -3235,99 +3319,52 @@ Act_switch_mode(Widget w, XEvent *event, resource.mouse_mode++; /* check if wrapped */ - if (resource.mouse_mode >= MOUSE_MAX_MODE) - resource.mouse_mode = MOUSE_MAGNIFIER_MODE; + if (resource.mouse_mode >= MOUSE_MODE_MAX) + resource.mouse_mode = MOUSE_MODE1; - /* undo effects of previous mode */ - switch (prev_mode) { - case MOUSE_RULER_MODE: + if (globals.curr_mode == RULER_MODE_ACTIVE) { clear_ruler(); mouse_motion = mouse_release = null_mouse; - break; - case MOUSE_TEXT_MODE: + } + else if (globals.curr_mode == TEXT_MODE_ACTIVE) { text_change_region(TEXT_SEL_CLEAR, NULL); mouse_motion = mouse_release = null_mouse; - break; - default: /* magnifier, nothing to do */ - break; } + globals.curr_mode = NO_MODE_ACTIVE; - if (resource.mouse_mode == MOUSE_RULER_MODE) { - XDefineCursor(DISP, CURSORWIN, globals.cursor.rule); - statusline_print(STATUS_SHORT, "Ruler mode; click Mouse-1 to set ruler"); - show_ruler(event); - show_distance_from_ruler(event, False); - } - else if (resource.mouse_mode == MOUSE_TEXT_MODE) { - statusline_print(STATUS_SHORT, "Text selection mode; click and drag Mouse-1 to select a region"); - } - else { /* default: MOUSE_MAGNIFIER_MODE */ - statusline_print(STATUS_SHORT, "Magnifier mode; click Mouse-1 to magnify text"); - mouse_motion = mouse_release = null_mouse; + switch(resource.mouse_mode) { + case MOUSE_MODE1: + mode_name = resource.mouse_mode1_name; + mode_description = resource.mouse_mode1_description; + break; + case MOUSE_MODE2: + mode_name = resource.mouse_mode2_name; + mode_description = resource.mouse_mode2_description; +/* globals.cursor.flags |= CURSOR_TEXT; /\*XXX FIXME: don't hardcode flag here; instead, have Act_text_selection set it *\/ */ + break; + case MOUSE_MODE3: + mode_name = resource.mouse_mode3_name; + mode_description = resource.mouse_mode3_description; +/* globals.cursor.flags |= CURSOR_RULER; */ + break; + default: /* can't happen */ + XDVI_WARNING((stderr, "resource.mouse_mode larger than %d!", resource.mouse_mode)); + break; } - + globals.ev.flags |= EV_CURSOR; XFlush(DISP); - -#if defined(NEW_MENU_CREATION) || defined(MOTIF) - set_menu(&resource.mouse_mode, Act_switch_mode, check_int); -#else - toggle_menu(resource.mouse_mode, Act_switch_mode); -#endif /* NEW_MENU_CREATION */ - store_preference(NULL, "mouseMode", "%d", resource.mouse_mode); -} - -static void -Act_text_mode(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - char *ptr; - - UNUSED(w); - UNUSED(event); - UNUSED(params); - UNUSED(num_params); - - if (block_this_mouse_event()) - return; - - if ((ptr = btn1_no_magnifier_binding()) != NULL) { - XBell(DISP, 0); - statusline_print(STATUS_MEDIUM, - "Cannot switch modes: Action list for Btn1Down (%s) " - "does not contain magnifier() action.", ptr); - return; - } - - if (resource.mouse_mode == MOUSE_TEXT_MODE) { - resource.mouse_mode++; - if (resource.mouse_mode >= MOUSE_MAX_MODE) - resource.mouse_mode = MOUSE_MAGNIFIER_MODE; - } - else - resource.mouse_mode = MOUSE_TEXT_MODE; - - if (resource.mouse_mode == MOUSE_TEXT_MODE) { - if (mouse_release != null_mouse && mouse_release != text_release) - return; - - globals.ev.flags |= EV_CURSOR; - - XFlush(DISP); - } - else { - mouse_motion = mouse_release = null_mouse; - globals.ev.flags |= EV_CURSOR; - text_change_region(TEXT_SEL_CLEAR, NULL); - - XFlush(DISP); + if (!initialization) { + statusline_info(STATUS_SHORT, "%s mode; %s", mode_name, mode_description); + store_preference(NULL, "mouseMode", "%d", resource.mouse_mode); } -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.mouse_mode, Act_switch_mode, check_int); -#else - toggle_menu(resource.mouse_mode, Act_switch_mode); -#endif /* NEW_MENU_CREATION || MOTIF */ + + + /*XXX FIXME: Activate mode by synthesizing a mouse event??? */ +/* synthesize_event(&ev, globals.widgets.draw_widget); */ +/* Act_mouse_modes(w, event, params, num_params); */ } static void @@ -3336,19 +3373,16 @@ Act_drag(Widget w, XEvent *event, { UNUSED(w); - if (block_this_mouse_event()) - return; - if (mouse_release != null_mouse && mouse_release != drag_release) return; - if (resource.mouse_mode == MOUSE_TEXT_MODE && text_last_page != -1 + if ((globals.curr_mode == TEXT_MODE_ACTIVE) && text_last_page != -1 /* this was: && (text_last_x != drag_last_x || text_last_y != drag_last_y) but that isn't restrictive enough */ ) { /* dragging would mess up region drawing */ - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Dragging page not possible while selection is active"); + xdvi_bell(); + statusline_info(STATUS_SHORT, "Cannot drag page when selection is active"); return; } @@ -3395,7 +3429,7 @@ drag_motion(XEvent * event) if (globals.cursor.flags & (CURSOR_DRAG_H | CURSOR_DRAG_A)) { /* horizontal motion */ #ifdef MOTIF (void)set_bar_value(globals.widgets.x_bar, - drag_last_x - event->xbutton.x_root - window_x, + drag_last_x - event->xbutton.x_root - m_window_x, (int)(globals.page.w - mane.width)); #else if (globals.widgets.x_bar != NULL) { @@ -3409,7 +3443,7 @@ drag_motion(XEvent * event) if (globals.cursor.flags & (CURSOR_DRAG_V | CURSOR_DRAG_A)) { /* vertical motion */ #ifdef MOTIF (void)set_bar_value(globals.widgets.y_bar, - drag_last_y - event->xbutton.y_root - window_y, + drag_last_y - event->xbutton.y_root - m_window_y, (int)(globals.page.h - mane.height)); #else if (globals.widgets.y_bar != NULL) { @@ -3419,8 +3453,10 @@ drag_motion(XEvent * event) #endif drag_last_y = event->xbutton.y_root; } +#ifdef USE_PANNER handle_x_scroll(NULL, NULL, NULL, NULL); handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } @@ -3449,9 +3485,6 @@ Act_wheel(Widget w, XEvent *event, UNUSED(w); - if (block_this_mouse_event()) - return; - if (*num_params != 1) { XDVI_WARNING((stderr, "wheel() requires 1 argument (got %d)", *num_params)); return; @@ -3460,7 +3493,7 @@ Act_wheel(Widget w, XEvent *event, : (int)(my_atof(*params) * resource.wheel_unit); #ifdef MOTIF get_xy(); - set_bar_value(globals.widgets.y_bar, dist - window_y, (int)(globals.page.h - mane.height)); + set_bar_value(globals.widgets.y_bar, dist - m_window_y, (int)(globals.page.h - mane.height)); #else if (globals.widgets.y_bar != NULL) XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer) dist); @@ -3468,7 +3501,9 @@ Act_wheel(Widget w, XEvent *event, wheel_button = event->xbutton.button; +#ifdef USE_PANNER handle_y_scroll(NULL, NULL, NULL, NULL); +#endif } @@ -3486,19 +3521,16 @@ Act_motion(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) { - MYTRACE((stderr, "returning!")); - return; - } - - if (resource.mouse_mode == MOUSE_RULER_MODE) { + MYTRACE((stderr, "act_motion!\n")); + + if (globals.curr_mode == RULER_MODE_ACTIVE) { show_distance_from_ruler(event, False); } /* This used to be: - (abs(x - old_x) > x_threshold || abs(y - old_y) > y_threshold)) + (abs(x - old_x) > x_threshold || abs(y - old_y) > y_threshold)) but that didn't work too well either. Just change it whenever user moves the mouse. */ - if (!MAGNIFIER_ACTIVE && resource.mouse_mode != MOUSE_RULER_MODE + if (!MAGNIFIER_ACTIVE && !(globals.curr_mode == RULER_MODE_ACTIVE) && pointerlocate(&x, &y) && (x != old_x || y != old_y)) { htex_displayanchor(x, y); old_x = x; @@ -3506,6 +3538,7 @@ Act_motion(Widget w, XEvent *event, } if ((int)(event->xbutton.button) != wheel_button) { + MYTRACE((stderr, "mouse_motion!\n")); mouse_motion(event); } } @@ -3519,9 +3552,6 @@ Act_release(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - if ((int)(event->xbutton.button) == wheel_button) { wheel_button = -1; return; @@ -3530,57 +3560,44 @@ Act_release(Widget w, XEvent *event, mouse_release(event); } -void -Act_ruler_mode(Widget w, XEvent *event, - String *params, Cardinal *num_params) +static void +Act_toggle_grid_mode(Widget w, XEvent *event, + String *params, Cardinal *num_params) { - char *ptr; - - UNUSED(w); - UNUSED(params); - UNUSED(num_params); + int arg; - if (block_this_mouse_event()) - return; + UNUSED(w); + UNUSED(event); - if ((ptr = btn1_no_magnifier_binding()) != NULL) { - XBell(DISP, 0); - statusline_print(STATUS_MEDIUM, - "Cannot switch modes: Action list for Btn1Down (%s) " - "does not contain magnifier() action.", ptr); - return; - } - - if (resource.mouse_mode == MOUSE_RULER_MODE) { - resource.mouse_mode++; - if (resource.mouse_mode >= MOUSE_MAX_MODE) - resource.mouse_mode = MOUSE_MAGNIFIER_MODE; - } - else - resource.mouse_mode = MOUSE_RULER_MODE; - - if (resource.mouse_mode == MOUSE_RULER_MODE) { - XDefineCursor(DISP, CURSORWIN, globals.cursor.rule); - statusline_print(STATUS_SHORT, "Ruler mode on; use Mouse-1 to set/drag ruler"); - show_ruler(event); - show_distance_from_ruler(event, False); + if (!get_int_arg(params, num_params, &arg)) { + arg = -1; } - else { - if (globals.cursor.flags & CURSOR_LINK) { - XDefineCursor(DISP, CURSORWIN, globals.cursor.link); + switch (arg) { + case -1: + resource.grid_mode = !resource.grid_mode; + if (resource.grid_mode) { + statusline_info(STATUS_SHORT, "Grid mode on"); } else { - XDefineCursor(DISP, CURSORWIN, globals.cursor.ready); + statusline_info(STATUS_SHORT, "Grid mode off"); } - statusline_print(STATUS_SHORT, "Ruler mode off"); - clear_ruler(); - mouse_motion = mouse_release = null_mouse; + break; + case 1: /* fall through */ + case 2: /* fall through */ + case 3: + resource.grid_mode = arg; + statusline_info(STATUS_SHORT, "Grid mode %d", arg); + break; + default: + xdvi_bell(); + statusline_info(STATUS_SHORT, + "Valid arguments for grid mode are: none (toggles), 1, 2, 3"); + return; } -#if defined(NEW_MENU_CREATION) || defined(MOTIF) - set_menu(&resource.mouse_mode, Act_switch_mode, check_int); -#else - toggle_menu(resource.mouse_mode, Act_switch_mode); -#endif /* NEW_MENU_CREATION || MOTIF */ + init_page(); + reconfig(); + globals.ev.flags |= EV_NEWPAGE; + XFlush(DISP); } @@ -3596,12 +3613,9 @@ Act_source_special(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - if ((event->type == ButtonPress && mouse_release != null_mouse) || MAGNIFIER_ACTIVE) { - XBell(DISP, 0); + xdvi_bell(); return; } @@ -3629,9 +3643,6 @@ Act_show_source_specials(Widget w, XEvent *event, int arg; Boolean clear_statusline = False; - if (block_this_mouse_event()) - return; - UNUSED(w); if (!get_int_arg(params, num_params, &arg)) @@ -3640,8 +3651,8 @@ Act_show_source_specials(Widget w, XEvent *event, clear_statusline = True; if ((event->type == ButtonPress && mouse_release != null_mouse) - || magnifier.win != (Window) 0) { - XBell(DISP, 0); + || !MAGNIFIER_ACTIVE) { + xdvi_bell(); return; } @@ -3666,9 +3677,6 @@ Act_source_what_special(Widget w, XEvent *event, UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, event->xkey.x, event->xkey.y, &my_x, &my_y, &dummy); /* throw away last argument */ my_x = (my_x + mane_base_x) * mane.shrinkfactor; @@ -3683,11 +3691,17 @@ select_cb(const char *filename, void *data) if (filename != NULL) { TRACE_FILES((stderr, "new filename: |%s|", filename)); - set_dvi_name_expand(filename); - current_page = 0; /* switch to first page */ - close_old_filep(); - globals.ev.flags |= EV_NEWDOC; - globals.ev.flags |= EV_PAGEHIST_INSERT; + if (resource.filesel_open_new_window) { + /* char *fname = expand_filename_append_dvi(filename); */ + launch_xdvi(filename, NULL); + } + else { + set_dvi_name_expand(filename); + current_page = 0; /* switch to first page */ + close_old_filep(); + globals.ev.flags |= EV_NEWDOC; + globals.ev.flags |= EV_PAGEHIST_INSERT; + } } } @@ -3695,25 +3709,26 @@ static void Act_select_dvi_file(Widget w, XEvent *event, String *params, Cardinal *num_params) { - static struct filesel_callback cb; /* static so that we can pass its address */ + /* static so that we can pass its address */ + static struct filesel_callback cb = { + NULL, NULL, "xdvik: Open File", "Open file:", "OK", "Cancel", + NULL, "*.dvi", True, False, NULL, NULL + }; int arg = -1; UNUSED(w); UNUSED(event); - if (block_this_mouse_event()) - return; - if (get_int_arg(params, num_params, &arg)) { /* try item from file history */ char *fname; int dummy_page; if (arg < 1) { - XBell(DISP, 0); - statusline_print(STATUS_MEDIUM, "Error: File history number must be >= 1"); + xdvi_bell(); + statusline_info(STATUS_MEDIUM, "Error: File history number must be >= 1"); } else if ((fname = file_history_get_elem(arg - 1, &dummy_page)) == NULL) { - statusline_print(STATUS_MEDIUM, "No file number %d in history (history size: %lu)", + statusline_info(STATUS_MEDIUM, "No file number %d in history (history size: %lu)", arg, (unsigned long)file_history_size()); } else { @@ -3722,20 +3737,13 @@ Act_select_dvi_file(Widget w, XEvent *event, return; } - cb.title = "Xdvi: Open file"; - cb.prompt = "Open file:"; - cb.ok = "OK"; - cb.cancel = "Cancel"; - cb.init_path = NULL; - cb.filemask = "*.dvi"; - cb.must_exist = True; - cb.exit_on_cancel = False; - cb.func_ptr = select_cb; - cb.data = NULL; - file_history_set_page(current_page); - XsraSelFile(globals.widgets.top_level, &cb); + cb.func_ptr = select_cb; + cb.init_path = globals.dvi_file.dirname; + if (cb.shell == NULL) + cb.shell = XsraSelFile(globals.widgets.top_level, &cb); + XsraSelFilePopup(&cb); } /* @@ -3774,9 +3782,6 @@ Act_set_expert_mode(Widget w, XEvent *event, int arg; Boolean clear_statusline = False; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -3832,7 +3837,7 @@ Act_set_expert_mode(Widget w, XEvent *event, break; #else case 3: -/* fprintf(stderr, "sidebar\n"); */ + /* fprintf(stderr, "sidebar\n"); */ resource.expert_mode ^= XPRT_SHOW_BUTTONS; toggle_buttons(); update_expert_mode(); @@ -3847,7 +3852,7 @@ Act_set_expert_mode(Widget w, XEvent *event, arg > 3 #endif ) { - statusline_print(STATUS_SHORT, "Number %d too large for `set-expert-mode', using 0 (= toggle) instead.", + statusline_info(STATUS_SHORT, "Number %d too large for `set-expert-mode', using 0 (= toggle) instead.", arg); } /* toggle all items */ @@ -3887,10 +3892,11 @@ Act_set_expert_mode(Widget w, XEvent *event, Boolean have_src_specials = False; static Boolean do_update_property = False; +#ifdef USE_PANNER void handle_x_scroll(Widget w, XtPointer closure, XEvent *ev, Boolean *cont) { -#ifndef MOTIF +#if !defined(MOTIF) Dimension get_x = 0; #endif @@ -3907,15 +3913,15 @@ handle_x_scroll(Widget w, XtPointer closure, XEvent *ev, Boolean *cont) #else get_xy(); XtVaGetValues(globals.widgets.clip_widget, XtNx, &get_x, NULL); - m_x_scroll = get_x - window_x; + m_x_scroll = get_x - m_window_x; scroll_x_panner(m_x_scroll); -#endif +#endif /* MOTIF */ } void handle_y_scroll(Widget w, XtPointer closure, XEvent *ev, Boolean *cont) { -#ifndef MOTIF +#if !defined(MOTIF) Dimension get_y = 0; #endif @@ -3932,10 +3938,11 @@ handle_y_scroll(Widget w, XtPointer closure, XEvent *ev, Boolean *cont) #else get_xy(); XtVaGetValues(globals.widgets.clip_widget, XtNy, &get_y, NULL); - m_y_scroll = get_y - window_y; + m_y_scroll = get_y - m_window_y; scroll_y_panner(m_y_scroll); -#endif +#endif /* MOTIF */ } +#endif /* USE_PANNER */ void handle_expose(Widget w, XtPointer closure, XEvent *ev, Boolean *cont) @@ -3961,7 +3968,6 @@ handle_expose(Widget w, XtPointer closure, XEvent *ev, Boolean *cont) do_update_property = True; } - MYTRACE((stderr, "Expose!")); expose(windowrec, (&(ev->xexpose))->x, (&(ev->xexpose))->y, (unsigned int)(&(ev->xexpose))->width, (unsigned int)(&(ev->xexpose))->height); } @@ -4030,18 +4036,7 @@ handle_property_change(Widget w, XtPointer junk, return; } set_dvi_name_expand(prop_ret); - /*FIXME: Here we would like to insert the first page of the new file - into the page history: - - page_history_insert(0); - - However, if the commandline had been: - xdvi -unique +5 file.dvi - then the following property change will change to page 5 and insert - page 5, so in this case two pages will be inserted by the xdvi invocation. - I guess to fix this we'd need a bitmask instead of 2 atoms to set both - features at the same time ... - */ + globals.ev.flags |= EV_NEWDOC; } else if ((&(ev->xproperty))->atom == atom_newpage()) { @@ -4066,7 +4061,7 @@ handle_property_change(Widget w, XtPointer junk, } if (newpage == total_pages - 1) { /* as in Act_goto_page() */ - goto_page(check_goto_page(newpage), resource.keep_flag ? NULL : home, False); + goto_page(check_goto_page(newpage, True), resource.keep_flag ? NULL : home, False); search_signal_page_changed(); } else { @@ -4127,6 +4122,13 @@ handle_sigalrm(int signo) sig_flags |= SF_ALRM; } +static RETSIGTYPE +ignore_sigusr(int signo) +{ + UNUSED(signo); + fprintf(stderr, "IGNORE SIGUSR1!\n"); +} + static RETSIGTYPE handle_sigusr(int signo) { @@ -4168,15 +4170,42 @@ setup_sigalarm(void) * Called from main to set up the signal handlers. */ void -setup_signal_handlers(void) +setup_signal_handlers(Boolean early) { #ifndef FLAKY_SIGPOLL - int sock_fd = ConnectionNumber(DISP); + int sock_fd = 0; #endif #if HAVE_SIGACTION struct sigaction a; #endif + if (early) { +#if HAVE_SIGACTION + a.sa_handler = ignore_sigusr; + (void) sigemptyset(&a.sa_mask); + (void) sigaddset(&a.sa_mask, SIGUSR1); + a.sa_flags = 0; + sigaction(SIGUSR1, &a, NULL); +#else /* not HAVE_SIGACTION */ + (void) signal(SIGUSR1, ignore_sigusr); +#endif /* not HAVE_SIGACTION */ + + (void)sigemptyset(&all_signals); + (void)sigaddset(&all_signals, SIGUSR1); + return; + } + + +#if HAVE_SIGACTION + a.sa_handler = handle_sigusr; + (void) sigemptyset(&a.sa_mask); + (void) sigaddset(&a.sa_mask, SIGUSR1); + a.sa_flags = 0; + sigaction(SIGUSR1, &a, NULL); +#else /* not HAVE_SIGACTION */ + (void) signal(SIGUSR1, handle_sigusr); +#endif /* not HAVE_SIGACTION */ + #ifndef FLAKY_SIGPOLL #if HAVE_SIGACTION /* Subprocess handling, e.g., MakeTeXPK, fails on the Alpha without @@ -4192,6 +4221,7 @@ setup_signal_handlers(void) (void) signal(SIGPOLL, handle_sigpoll); #endif /* not HAVE_SIGACTION */ + sock_fd = ConnectionNumber(DISP); prep_fd(sock_fd, False); #endif /* not FLAKY_SIGPOLL */ @@ -4230,16 +4260,6 @@ setup_signal_handlers(void) (void) signal(SIGCHLD, handle_sigchld); #endif /* not HAVE_SIGACTION */ -#if HAVE_SIGACTION - a.sa_handler = handle_sigusr; - (void) sigemptyset(&a.sa_mask); - (void) sigaddset(&a.sa_mask, SIGUSR1); - a.sa_flags = 0; - sigaction(SIGUSR1, &a, NULL); -#else /* not HAVE_SIGACTION */ - (void) signal(SIGUSR1, handle_sigusr); -#endif /* not HAVE_SIGACTION */ - (void)sigemptyset(&all_signals); (void)sigaddset(&all_signals, SIGPOLL); (void)sigaddset(&all_signals, SIGINT); @@ -4302,7 +4322,7 @@ clear_chld(struct xchild *cp) static void do_sigchld(void) { - pid_t pid; + pid_t pid; int status; sig_flags &= ~SF_CHLD; @@ -4448,6 +4468,7 @@ do_sigpoll(void) if (num_fds > max_fds) { if (fds != NULL) free(fds); fds = xmalloc(num_fds * sizeof *fds); + memset(fds, 0, num_fds * sizeof *fds); max_fds = num_fds; fds->fd = ConnectionNumber(DISP); fds->events = POLLIN; @@ -4475,9 +4496,9 @@ do_sigpoll(void) for (ip = iorecs; ip != NULL; ip = ip->next) { int revents = ip->pfd->revents; if (revents & POLLIN && ip->read_proc != NULL) - (void)(ip->read_proc)(ip->fd); + (void)(ip->read_proc)(ip->fd, ip->data); if (revents & POLLOUT && ip->write_proc != NULL) - (ip->write_proc)(ip->fd); + (ip->write_proc)(ip->fd, ip->data); } # else @@ -4506,9 +4527,9 @@ do_sigpoll(void) for (ip = iorecs; ip != NULL; ip = ip->next) { if (FD_ISSET(ip->fd, &readfds) && ip->read_proc != NULL) - (void)(ip->read_proc)(ip->fd); + (void)(ip->read_proc)(ip->fd, ip->data); if (FD_ISSET(ip->fd, &writefds) && ip->write_proc != NULL) - (ip->write_proc)(ip->fd); + (ip->write_proc)(ip->fd, ip->data); } # endif @@ -4525,9 +4546,9 @@ do_sigpoll(void) */ -static struct xtimer *timers = NULL; /* head of timer list */ +static struct xtimer *timers = NULL; /* head of timer list */ -static struct itimerval itv = {{0, 0}, {0, 0}}; +static struct itimerval itv = {{0, 0}, {0, 0}}; #ifndef timercmp #define timercmp(a, b, OP) (((a)->tv_sec OP (b)->tv_sec || \ @@ -4586,7 +4607,7 @@ set_timer(struct xtimer *tp, int ms) void cancel_timer(struct xtimer *tp) { - struct xtimer **tpp; + struct xtimer **tpp; if (globals.debug & DBG_EVENT) show_timers("beginning of cancel_timer"); @@ -4601,7 +4622,6 @@ cancel_timer(struct xtimer *tp) ASSERT(timers != NULL, "timers in cancel_timer() mustn't be NULL"); for (tpp = &timers; ; ) { /* remove from list */ - if (*tpp == tp) break; tpp = &(*tpp)->next; @@ -4633,7 +4653,7 @@ cancel_timer(struct xtimer *tp) * */ -static void xt_alarm (struct xtimer *); +static void xt_alarm(struct xtimer *this, void *data); static struct xtimer *xt_free_timers = NULL; @@ -4654,12 +4674,12 @@ XtAppAddTimeOut(XtAppContext app, unsigned long interval, XtTimerCallbackProc pr The following doesn't work, even after sigaddset(&all_signals, SIGALRM); - static sigset_t sig_set; - (void)sigprocmask(0, NULL, &sig_set); - if (sigismember(&sig_set, SIGALRM)) - ... OK ... - else - ... NOT OK ... + static sigset_t sig_set; + (void)sigprocmask(0, NULL, &sig_set); + if (sigismember(&sig_set, SIGALRM)) + ... OK ... + else + ... NOT OK ... */ ASSERT(sigalarm_initialized, "Shouldn't invoke XtAppAddTimeOut() before setup_sigalarm()"); @@ -4674,6 +4694,7 @@ XtAppAddTimeOut(XtAppContext app, unsigned long interval, XtTimerCallbackProc pr } tp->proc = xt_alarm; + tp->data = closure; tp->xt_proc = proc; tp->closure = closure; @@ -4709,12 +4730,13 @@ XtRemoveTimeOut(XtIntervalId id) } void -xt_alarm(struct xtimer *tp) +xt_alarm(struct xtimer *tp, void *data) { XtIntervalId id; + UNUSED(data); tp->proc = NULL; /* flag timer as used-up */ - id = (XtIntervalId) tp; + id = (XtIntervalId)tp; (tp->xt_proc)(tp->closure, &id); tp->next = xt_free_timers; @@ -4728,7 +4750,7 @@ xt_alarm(struct xtimer *tp) static void do_sigalrm(void) { - struct timeval now; + struct timeval now; sig_flags &= ~SF_ALRM; #ifndef HAVE_SIGACTION @@ -4740,7 +4762,7 @@ do_sigalrm(void) while (timers != NULL && timercmp(&timers->when, &now, <=)) { struct xtimer *tp = timers; timers = timers->next; /* unlink it _first_ */ - (tp->proc)(tp); + (tp->proc)(tp, tp->data); } if (timers != NULL) { /* set next timer */ @@ -4806,15 +4828,15 @@ do_sigterm(void) kill(cp->pid, SIGKILL); } - /* SU: Unlike non-k xdvi, we don't care about whether all children have been - killed, since processes forked via fork_process() (e.g. the web browser) - may still continue running. So we just exit here. - */ + /* SU: Unlike non-k xdvi, we don't care about whether all children have been + killed, since processes forked via fork_process() (e.g. the web browser) + may still continue running. So we just exit here. + */ xdvi_exit(EXIT_SUCCESS); - /* since xdvi_exit() may return, we mustn't do the following which - is in non-k xdvi, else we'll end up in a busy loop! I don't know - what's meant by `caller' here anyway ... + /* BUG ALERT: since xdvi_exit() may return (checks before writing to ~/.xdvirc), + we mustn't do the following which is in non-k xdvi, else we'll end up in a busy loop. + I don't know who the `caller' is anyway ... globals.ev.flags |= EV_TERM; /\* otherwise, let the caller handle it *\/ */ @@ -4897,129 +4919,129 @@ read_events(unsigned int ret_mask) #endif /* not FLAKY_SIGPOLL */ - { - for (;;) { - struct xio *ip; - - if (globals.debug & DBG_EVENT) - fprintf(stderr, "%s:%d: (flaky) sig_flags = %d\n", - __FILE__, __LINE__, sig_flags); - while (sig_flags) { - sigset_t oldsig; + { + for (;;) { + struct xio *ip; - (void) sigprocmask(SIG_BLOCK, &all_signals, &oldsig); + if (globals.debug & DBG_EVENT) + fprintf(stderr, "%s:%d: (flaky) sig_flags = %d\n", + __FILE__, __LINE__, sig_flags); + while (sig_flags) { + sigset_t oldsig; - while (sig_flags) { - flags_to_sigproc[sig_flags](); - } + (void) sigprocmask(SIG_BLOCK, &all_signals, &oldsig); - (void) sigprocmask(SIG_SETMASK, &oldsig, - (sigset_t *) NULL); + while (sig_flags) { + flags_to_sigproc[sig_flags](); } - if (XtPending()) - break; + (void) sigprocmask(SIG_SETMASK, &oldsig, + (sigset_t *) NULL); + } - if (globals.ev.flags & ret_mask) - return globals.ev.flags; + if (XtPending()) + break; - /* If a SIGUSR1 signal comes right now, then it will wait - until an X event or another SIGUSR1 signal arrives. */ + if (globals.ev.flags & ret_mask) + return globals.ev.flags; + + /* If a SIGUSR1 signal comes right now, then it will wait + until an X event or another SIGUSR1 signal arrives. */ #if HAVE_POLL - if (globals.debug & DBG_EVENT) - fprintf(stderr, "%s:%d: have_poll!\n", - __FILE__, __LINE__); - if (io_dirty) { - struct pollfd *fp; - - if (num_fds > max_fds) { - if (fds != NULL) free(fds); - fds = xmalloc(num_fds * sizeof *fds); - max_fds = num_fds; - fds->fd = ConnectionNumber(DISP); - fds->events = POLLIN; - } - fp = fds + 1; - for (ip = iorecs; ip != NULL; ip = ip->next) { - fp->fd = ip->fd; - fp->events = ip->xio_events; - ip->pfd = fp; - ++fp; - } - io_dirty = False; + if (globals.debug & DBG_EVENT) + fprintf(stderr, "%s:%d: have_poll!\n", + __FILE__, __LINE__); + if (io_dirty) { + struct pollfd *fp; + + if (num_fds > max_fds) { + if (fds != NULL) free(fds); + fds = xmalloc(num_fds * sizeof *fds); + max_fds = num_fds; + fds->fd = ConnectionNumber(DISP); + fds->events = POLLIN; + } + fp = fds + 1; + for (ip = iorecs; ip != NULL; ip = ip->next) { + fp->fd = ip->fd; + fp->events = ip->xio_events; + ip->pfd = fp; + ++fp; } + io_dirty = False; + } - for (;;) { - if (poll(fds, num_fds, -1) >= 0) { - for (ip = iorecs; ip != NULL; ip = ip->next) { - int revents = ip->pfd->revents; + for (;;) { + if (poll(fds, num_fds, -1) >= 0) { + for (ip = iorecs; ip != NULL; ip = ip->next) { + int revents = ip->pfd->revents; - if (revents & POLLIN && ip->read_proc != NULL) - (ip->read_proc)(ip->fd); - if (revents & POLLOUT && ip->write_proc != NULL) - (ip->write_proc)(ip->fd); - } - break; + if (revents & POLLIN && ip->read_proc != NULL) + (ip->read_proc)(ip->fd, ip->data); + if (revents & POLLOUT && ip->write_proc != NULL) + (ip->write_proc)(ip->fd, ip->data); } + break; + } - if (errno == EINTR) - break; + if (errno == EINTR) + break; - if (errno != EAGAIN) { - perror("xdvi: poll"); - break; - } + if (errno != EAGAIN) { + perror("xdvi: poll"); + break; } + } #else /* HAVE_POLL */ - if (globals.debug & DBG_EVENT) - fprintf(stderr, "%s:%d: NOT have_poll!\n", - __FILE__, __LINE__); - FD_ZERO(&readfds); - FD_ZERO(&writefds); - FD_SET(ConnectionNumber(DISP), &readfds); - for (ip = iorecs; ip != NULL; ip = ip->next) { - if (ip->xio_events & XIO_IN) - FD_SET(ip->fd, &readfds); - if (ip->xio_events & XIO_OUT) - FD_SET(ip->fd, &writefds); - } + if (globals.debug & DBG_EVENT) + fprintf(stderr, "%s:%d: NOT have_poll!\n", + __FILE__, __LINE__); + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_SET(ConnectionNumber(DISP), &readfds); + for (ip = iorecs; ip != NULL; ip = ip->next) { + if (ip->xio_events & XIO_IN) + FD_SET(ip->fd, &readfds); + if (ip->xio_events & XIO_OUT) + FD_SET(ip->fd, &writefds); + } - for (;;) { - if (select(numfds, &readfds, &writefds, (fd_set *) NULL, - (struct timeval *) NULL) >= 0) { - for (ip = iorecs; ip != NULL; ip = ip->next) { - if (FD_ISSET(ip->fd, &readfds) && ip->read_proc != NULL) { - if (globals.debug & DBG_EVENT) - fprintf(stderr, "%s:%d: reading from %d\n", - __FILE__, __LINE__, ip->fd); - (ip->read_proc)(ip->fd); - } - if (FD_ISSET(ip->fd, &writefds) && ip->write_proc != NULL) { - if (globals.debug & DBG_EVENT) - fprintf(stderr, "%s:%d: writing to %d\n", - __FILE__, __LINE__, ip->fd); - (ip->write_proc)(ip->fd); - } + for (;;) { + if (select(numfds, &readfds, &writefds, (fd_set *) NULL, + (struct timeval *) NULL) >= 0) { + for (ip = iorecs; ip != NULL; ip = ip->next) { + if (FD_ISSET(ip->fd, &readfds) && ip->read_proc != NULL) { + if (globals.debug & DBG_EVENT) + fprintf(stderr, "%s:%d: reading from %d\n", + __FILE__, __LINE__, ip->fd); + (ip->read_proc)(ip->fd, ip->data); + } + if (FD_ISSET(ip->fd, &writefds) && ip->write_proc != NULL) { + if (globals.debug & DBG_EVENT) + fprintf(stderr, "%s:%d: writing to %d\n", + __FILE__, __LINE__, ip->fd); + (ip->write_proc)(ip->fd, ip->data); } - break; } + break; + } - if (errno == EINTR) - break; + if (errno == EINTR) + break; - if (errno != EAGAIN) { - perror("xdvi: select"); - break; - } + if (errno != EAGAIN) { + perror("xdvi: select"); + break; } -#endif /* HAVE_POLL */ } +#endif /* HAVE_POLL */ } - XtAppNextEvent(app, &event); + } + XtAppNextEvent(globals.app, &event); #ifdef MOTIF if ((resource.expert_mode & XPRT_SHOW_TOOLBAR) != 0) - TipAppHandle(app, &event); + TipAppHandle(globals.app, &event); #endif if (resized) @@ -5031,8 +5053,7 @@ read_events(unsigned int ret_mask) continue; } else if (globals.broken_motif_event_handling && - (resource.mouse_mode == MOUSE_RULER_MODE || - resource.mouse_mode == MOUSE_TEXT_MODE)) { + (globals.cursor.flags & (CURSOR_RULER | CURSOR_TEXT))) { /* In this case, Act_motion() and Act_release() are not called properly * for updating the ruler/text selection (it works with the magnifier though), * so we need to invoke them ourselves here: */ @@ -5050,7 +5071,7 @@ read_events(unsigned int ret_mask) } #else if (resource.expert_mode & XPRT_SHOW_BUTTONS) - SubMenuHandleEvent(app, &event); + SubMenuHandleEvent(globals.app, &event); #endif XtDispatchEvent(&event); } @@ -5098,9 +5119,9 @@ redraw(struct WindowRec *windowrec) /* can't use ev_cursor here, since the event loop might not see this change quick enough */ if (!(globals.ev.flags & EV_CURSOR)) { TRACE_EVENTS((stderr, "Cursor: %ld", globals.cursor.flags)); - if (!(globals.cursor.flags & (CURSOR_DRAG_H | CURSOR_DRAG_V | CURSOR_DRAG_A))) { - if (resource.mouse_mode == MOUSE_RULER_MODE) - XDefineCursor(DISP, CURSORWIN, globals.cursor.rule); + if (!(globals.cursor.flags & (CURSOR_MAG | CURSOR_DRAG_H | CURSOR_DRAG_V | CURSOR_DRAG_A))) { + if (resource.mouse_mode == MOUSE_MODE3) + XDefineCursor(DISP, CURSORWIN, globals.cursor.mode3); else XDefineCursor(DISP, CURSORWIN, globals.cursor.wait); XFlush(DISP); @@ -5227,8 +5248,8 @@ redraw_page(void) #if MOTIF && !FIXED_FLUSHING_PAGING XtVaSetValues(XtParent(globals.widgets.draw_widget), XtNbackground, bg_current->pixel, NULL); #endif -/* XSetWindowBackground(DISP, mane.win, bg_current->pixel); */ -/* XClearWindow(DISP, mane.win); */ + /* XSetWindowBackground(DISP, mane.win, bg_current->pixel); */ + /* XClearWindow(DISP, mane.win); */ #if 0 /* don't recolor the cursor - gives too low contrast on color backgrounds, and bad appearance when part of the background is white and cursor mask is colored */ @@ -5254,13 +5275,13 @@ redraw_page(void) } else { get_xy(); - mane.min_x = -window_x; - mane.max_x = -window_x + mane.width; - mane.min_y = -window_y; - mane.max_y = -window_y + mane.height; + mane.min_x = -m_window_x; + mane.max_x = -m_window_x + mane.width; + mane.min_y = -m_window_y; + mane.max_y = -m_window_y + mane.height; } -/* update_TOC(); */ + /* update_TOC(); */ redraw(&mane); } @@ -5305,7 +5326,11 @@ do_pages(void) dviErrFlagT errflag; globals.ev.flags &= ~EV_RELOAD; - if (load_dvi_file(True, &errflag)) { + if (load_dvi_file( +#if !DELAYED_MKTEXPK + True, +#endif + &errflag)) { #if PS ps_clear_cache(); #if PS_GS @@ -5316,22 +5341,26 @@ do_pages(void) } #endif #endif - statusline_print(STATUS_SHORT, "File reloaded."); + statusline_info(STATUS_SHORT, "File reloaded."); } -/* else { */ -/* statusline_print(STATUS_MEDIUM, "File corrupted, not reloading."); */ -/* } */ + /* else { */ + /* statusline_info(STATUS_MEDIUM, "File corrupted, not reloading."); */ + /* } */ } if (globals.ev.flags & EV_NEWDOC) { dviErrFlagT errflag; TRACE_EVENTS((stderr, "EV_NEWDOC!")); -/* fprintf(stderr, "newdoc!\n"); */ + /* fprintf(stderr, "newdoc!\n"); */ TRACE_FILES((stderr, "current page: %d", current_page)); -/* file_history_set_page(current_page); */ + /* file_history_set_page(current_page); */ globals.ev.flags &= ~EV_NEWDOC; - if (load_dvi_file(True, &errflag)) { + if (load_dvi_file( +#if !DELAYED_MKTEXPK + True, +#endif + &errflag)) { statusline_append(STATUS_SHORT, "Opened ", "Opened \"%s\"", globals.dvi_name); -/* statusline_print(STATUS_SHORT, "Opened \"%s\"", globals.dvi_name); */ + /* statusline_info(STATUS_SHORT, "Opened \"%s\"", globals.dvi_name); */ TRACE_FILES((stderr, "Adding to history: |%s|\n", globals.dvi_name)); if (file_history_push(globals.dvi_name)) { /* it's a new file, add to history */ TRACE_FILES((stderr, "New entry!")); @@ -5363,10 +5392,17 @@ do_pages(void) (void)dvi_file_changed(); } } + else if (globals.ev.flags & EV_PAGEHIST_GOTO_PAGE) { + int pageno; + globals.ev.flags &= ~EV_PAGEHIST_GOTO_PAGE; + pageno = check_goto_page(page_history_get_page(), False); + goto_page(pageno, resource.keep_flag ? NULL : home, False); + TRACE_FILES((stderr, "got page: %d", pageno)); + } else if (globals.ev.flags & EV_FILEHIST_GOTO_PAGE) { int pageno; globals.ev.flags &= ~EV_FILEHIST_GOTO_PAGE; - pageno = check_goto_page(file_history_get_page()); + pageno = check_goto_page(file_history_get_page(), True); goto_page(pageno, resource.keep_flag ? NULL : home, False); TRACE_FILES((stderr, "got page: %d", pageno)); } @@ -5394,6 +5430,16 @@ do_pages(void) continue; anchor_search(g_anchor_pos); + + /* added, otherwise anchors on same page may not be drawn */ + /* NOTE: This caused a crash when clicking on link "Langer" on p3 of diss.dvi + since the color stack wasn't allocated for the target pages. Removed for the + time being, since I can't reproduce the problem for which it was introduced. + CVS commit message was: + "fix anchor drawing for other window" + */ + /* redraw(&mane); */ + globals.ev.flags &= ~EV_ANCHOR; } else if (globals.ev.flags & EV_SRC) { @@ -5444,14 +5490,14 @@ do_pages(void) globals.ev.flags &= ~EV_FIND; } else if (globals.ev.flags & EV_MAG_MOVE) { - MYTRACE((stderr, "moving mag!")); + MYTRACE((stderr, "moving mag!\n")); move_magnifier(); } else if (globals.ev.flags & EV_EXPOSE) { if (magnifier.min_x < MAXDIM) { -/* fprintf(stderr, "magnifier < maxdim!\n"); */ + /* fprintf(stderr, "magnifier < maxdim!\n"); */ if (mane.min_x >= MAXDIM) { -/* fprintf(stderr, "mane >= maxdim!\n"); */ + /* fprintf(stderr, "mane >= maxdim!\n"); */ globals.ev.flags &= ~EV_EXPOSE; } redraw(&magnifier); @@ -5480,20 +5526,20 @@ do_pages(void) curr = globals.cursor.drag_h; else if (globals.cursor.flags & CURSOR_DRAG_A) curr = globals.cursor.drag_a; - else if (resource.mouse_mode == MOUSE_RULER_MODE) - curr = globals.cursor.rule; - else if (resource.mouse_mode == MOUSE_TEXT_MODE && !(globals.cursor.flags & CURSOR_LINK)) - curr = globals.cursor.text; + else if (resource.mouse_mode == MOUSE_MODE3) + curr = globals.cursor.mode3; + else if (resource.mouse_mode == MOUSE_MODE2) + curr = globals.cursor.mode2; else if (globals.cursor.flags & CURSOR_LINK) curr = globals.cursor.link; else if (globals.cursor.flags & CURSOR_MAG) - curr = globals.cursor.mag; + curr = globals.cursor.empty; else if (globals.cursor.flags & CURSOR_CORRUPTED) curr = globals.cursor.corrupted; else if (globals.pausing.flag) curr = globals.cursor.pause; else - curr = globals.cursor.ready; + curr = globals.cursor.mode1; XDefineCursor(DISP, CURSORWIN, curr); globals.ev.flags &= ~EV_CURSOR; } @@ -5507,9 +5553,6 @@ static void Act_unpause_or_next(Widget w, XEvent *event, String *params, Cardinal *num_params) { - if (block_this_mouse_event()) - return; - if (globals.pausing.flag) { globals.pausing.num++; if (globals.pausing.num_save) @@ -5543,7 +5586,7 @@ watch_file_cb(XtPointer client_data, XtIntervalId *id) } watch_time_ms = (unsigned long)(resource.watch_file * 1000); - timer = XtAppAddTimeOut(app, watch_time_ms, watch_file_cb, (XtPointer)NULL); + timer = XtAppAddTimeOut(globals.app, watch_time_ms, watch_file_cb, (XtPointer)NULL); } } @@ -5551,9 +5594,6 @@ void Act_pagehistory_back(Widget w, XEvent *event, String *params, Cardinal *num { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -5567,9 +5607,6 @@ void Act_pagehistory_forward(Widget w, XEvent *event, String *params, Cardinal * { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -5586,9 +5623,6 @@ void Act_pagehistory_clear(Widget w, XEvent *event, String *params, Cardinal *nu UNUSED(params); UNUSED(num_params); - if (block_this_mouse_event()) - return; - page_history_clear(); } @@ -5596,9 +5630,6 @@ void Act_pagehistory_delete_backward(Widget w, XEvent *event, String *params, Ca { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -5612,9 +5643,6 @@ void Act_pagehistory_delete_forward(Widget w, XEvent *event, String *params, Car { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); @@ -5629,9 +5657,6 @@ void Act_prefs_dialog(Widget w, XEvent *event, String *params, Cardinal *num_par { int arg; - if (block_this_mouse_event()) - return; - UNUSED(w); UNUSED(event); diff --git a/Build/source/texk/xdvik/events.h b/Build/source/texk/xdvik/events.h index 93c6ca18d33..182f5534af9 100644 --- a/Build/source/texk/xdvik/events.h +++ b/Build/source/texk/xdvik/events.h @@ -40,12 +40,13 @@ #define EV_FIND_CANCEL (1<<9) /* 512 - string search cancelled */ #define EV_FILEHIST_GOTO_PAGE (1<<10) /* 1024 - get page from file history */ #define EV_PAGEHIST_INSERT (1<<11) /* 2048 - get page from file history */ -#define EV_NEWPAGE (1<<12) /* 4096 - new page requested */ -#define EV_PS_TOGGLE (1<<13) /* 8192 - PostScript toggled on or off */ -#define EV_RELOAD (1<<14) /* 16384 - reload dvi file */ -#define EV_NEWDOC (1<<15) /* 32768 - new dvi file requested */ -#define EV_TERM (1<<16) /* 65536 - quit */ -#define EV_MAXPLUS1 (1<<17) /* 131072 - marker for highest element */ +#define EV_PAGEHIST_GOTO_PAGE (1<<12) /* 4096 - go to page from file history */ +#define EV_NEWPAGE (1<<13) /* 8192 - new page requested */ +#define EV_PS_TOGGLE (1<<14) /* 16384 - PostScript toggled on or off */ +#define EV_RELOAD (1<<15) /* 32768 - reload dvi file */ +#define EV_NEWDOC (1<<16) /* 65536 - new dvi file requested */ +#define EV_TERM (1<<17) /* 131072 - quit */ +#define EV_MAXPLUS1 (1<<18) /* 262144 - marker for highest element */ #define EV_GE_IDLE (EV_MAXPLUS1 - EV_IDLE) #define EV_GT_IDLE (EV_MAXPLUS1 - EV_CURSOR) @@ -74,8 +75,9 @@ struct xio { #if HAVE_POLL struct pollfd *pfd; #endif - char *(*read_proc) (int); /* call to read from fd, or NULL */ - void (*write_proc) (int); /* call to write to fd, or NULL */ + char *(*read_proc) (int, void *); /* call to read from fd, or NULL */ + void (*write_proc) (int, void *); /* call to write to fd, or NULL */ + void *data; /* data passed as second argument to read_proc()/write_proc() */ }; struct xchild; /* forward declaration */ @@ -109,7 +111,8 @@ struct xtimer { struct xtimer *next; /* link to next in chain */ struct timeval when; /* when to call the routine */ xtimerT type; /* timer type */ - void (*proc) (struct xtimer *); /* procedure to call */ + void (*proc) (struct xtimer *this, void *data); /* procedure to call */ + void *data; #if XDVI_XT_TIMER_HACK XtTimerCallbackProc xt_proc; /* additional data for Xt callbacks */ XtPointer closure; @@ -124,7 +127,7 @@ extern XtActionsRec *get_actions(void); extern int atopix(const char *, Boolean); -extern int check_goto_page(int pageno); +extern int check_goto_page(int pageno, Boolean insert_into_pagehist); extern Boolean get_int_arg(String * param, Cardinal *num_params, int *res); extern Boolean toggle_arg(int arg, String * param, Cardinal *num_params); @@ -153,12 +156,14 @@ typedef void (*home_proc) (wide_bool); extern void goto_page(int page, home_proc proc, Boolean force); extern void setup_sigalarm(void); -extern void setup_signal_handlers(void); +extern void setup_signal_handlers(Boolean early); extern int shrink_to_fit(void); extern void do_pages(void); extern void do_set_density(double newgamma, Boolean force, Boolean update_resource); extern void do_toggle_color(Boolean update_resource); +extern void Act_mouse_modes(Widget w, XEvent *event, String *params, Cardinal *num_params); + #ifdef PS extern void Act_set_ps(Widget w, XEvent *event, String *params, Cardinal *num_params); #endif @@ -193,12 +198,15 @@ extern void Act_pagehistory_back(Widget w, XEvent *event, String *params, Cardin extern void Act_pagehistory_forward(Widget w, XEvent *event, String *params, Cardinal *num_params); extern void Act_pagehistory_delete_backward(Widget w, XEvent *event, String *params, Cardinal *num_params); extern void Act_pagehistory_delete_forward(Widget w, XEvent *event, String *params, Cardinal *num_params); +extern void Act_magnifier(Widget w, XEvent *event, String *params, Cardinal *num_params); +extern void Act_ruler(Widget w, XEvent *event, String *params, Cardinal *num_params); +extern void Act_text_selection(Widget w, XEvent *event, String *params, Cardinal *num_params); +extern void Act_switch_magnifier_units(Widget w, XEvent *event, String *params, Cardinal *num_params); +extern void Act_href(Widget w, XEvent *event, String *params, Cardinal *num_params); +extern void Act_href_newwindow(Widget w, XEvent *event, String *params, Cardinal *num_params); extern void null_mouse(XEvent *ignored); -extern void block_next_mouse_event(void); -extern Boolean block_this_mouse_event(void); extern void text_motion(XEvent *event); -extern Boolean dragging_text_selection(void); typedef enum { TEXT_SEL_MOVE, TEXT_SEL_CLEAR, TEXT_SEL_REDRAW, TEXT_SEL_ERASE } textSelectionT; extern void text_change_region(textSelectionT mode, XEvent *event); @@ -221,6 +229,7 @@ extern Boolean check_int(void *val, const char *param); struct xdvi_action { XtActionProc proc; Cardinal num_params; + String command; String param; struct xdvi_action *next; }; @@ -229,8 +238,10 @@ extern struct xdvi_action *compile_action(const char *str); extern void watch_file_cb(XtPointer client_data, XtIntervalId * id); extern void redraw_page(void); +#ifdef USE_PANNER extern void handle_x_scroll(Widget w, XtPointer closure, XEvent *ev, Boolean *cont); extern void handle_y_scroll(Widget w, XtPointer closure, XEvent *ev, Boolean *cont); +#endif extern void xdvi_exit_callback(Widget w, XtPointer client_data, XtPointer call_data); #endif /* EVENTS_H_ */ diff --git a/Build/source/texk/xdvik/exit-handlers.c b/Build/source/texk/xdvik/exit-handlers.c new file mode 100644 index 00000000000..79a0629a973 --- /dev/null +++ b/Build/source/texk/xdvik/exit-handlers.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2004 Stefan Ulrich + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/* + Exit handlers: Procedures taking a void * that can be registered + via register_exit_handler() and will be called fromx xdvi_exit(). +*/ + +#include "xdvi-config.h" +#include "xdvi.h" +#include "exit-handlers.h" +#include "util.h" + +static struct exit_list { + exit_procedure proc; + void *arg; +} *exit_procs = NULL; + +static size_t exit_procs_size = 0; + +void register_exit_handler(exit_procedure proc, void *arg) +{ + size_t idx = exit_procs_size; + exit_procs_size++; + exit_procs = xrealloc(exit_procs, sizeof *exit_procs * exit_procs_size); + exit_procs[idx].proc = proc; + exit_procs[idx].arg = arg; +} + +void unregister_exit_handler(exit_procedure proc) +{ + size_t i; + for (i = 0; i < exit_procs_size; i++) { + if (exit_procs[i].proc == proc) { + fprintf(stderr, "unregistering %p!\n", (void *)proc); + exit_procs[i].proc = NULL; + exit_procs[i].arg = NULL; + } + } +} + +void call_exit_handlers(void) +{ + size_t i; + for (i = 0; i < exit_procs_size; i++) { + if (exit_procs[i].proc) + exit_procs[i].proc(exit_procs[i].arg); + /* fprintf(stderr, "calling exit proc %lu\n", (unsigned long)i); */ + } + free(exit_procs); +} diff --git a/Build/source/texk/xdvik/exit-handlers.h b/Build/source/texk/xdvik/exit-handlers.h new file mode 100644 index 00000000000..507f528358c --- /dev/null +++ b/Build/source/texk/xdvik/exit-handlers.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2004 Stefan Ulrich + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef EXIT_HANDLERS_H_ +#define EXIT_HANDLERS_H_ + +typedef void (*exit_procedure) (void *); + +extern void unregister_exit_handler(exit_procedure proc); +extern void register_exit_handler(exit_procedure proc, void *arg); +extern void call_exit_handlers(void); + +#endif /* EXIT_HANDLERS_H_ */ diff --git a/Build/source/texk/xdvik/filehist.c b/Build/source/texk/xdvik/filehist.c index 43664025e1e..f6974f0bff8 100644 --- a/Build/source/texk/xdvik/filehist.c +++ b/Build/source/texk/xdvik/filehist.c @@ -18,7 +18,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ /* List of recently visited files, initialized from X resource @@ -30,6 +30,7 @@ #include "xdvi-config.h" #include "xdvi.h" #include "util.h" +#include "dl_list.h" #include "my-snprintf.h" #include "string-utils.h" #include "dvi-init.h" @@ -352,13 +353,16 @@ file_history_open(const char *fname) } else { dviErrFlagT errflag; - if (load_dvi_file(True, &errflag)) { + if (load_dvi_file( +#if !DELAYED_MKTEXPK + True, +#endif + &errflag)) { /* page_history_insert(pageno); */ set_dvi_name(new_dvi_name); globals.ev.flags |= EV_NEWDOC; globals.ev.flags |= EV_FILEHIST_GOTO_PAGE; - globals.ev.flags |= EV_PAGEHIST_INSERT; } else { /* re-open old file */ popup_message(globals.widgets.top_level, @@ -374,8 +378,11 @@ file_history_open(const char *fname) m_file_history_length--; filehist_menu_refresh(); - if (!internal_open_dvi(globals.dvi_name, &errflag, True)) { -/* || !internal_init_dvi(&errflag, True)) { */ + if (!internal_open_dvi(globals.dvi_name, &errflag, True +#if DELAYED_MKTEXPK + , True +#endif + )) { popup_message(globals.widgets.top_level, MSG_ERR, NULL, diff --git a/Build/source/texk/xdvik/font-open.c b/Build/source/texk/xdvik/font-open.c index da9762ad282..c6fc2c04f5f 100644 --- a/Build/source/texk/xdvik/font-open.c +++ b/Build/source/texk/xdvik/font-open.c @@ -1,34 +1,35 @@ /* - font_open.c: find font filenames. This bears no relation (but the - interface) to the original font_open.c. + font_open.c: find font filenames. This bears no relation (but the + interface) to the original font_open.c. -Copyright (c) 1999-2004 The texk project + Copyright (c) 1999-2004 The texk project -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +*/ #include "xdvi-config.h" #include "xdvi.h" #include "dvi-draw.h" #include "util.h" #include "events.h" +#include "dvi-init.h" #include "my-snprintf.h" #include "print-log.h" @@ -87,19 +88,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif /* HAVE_POLL */ #if 0 -// static int mktexpk_io[2]; -// static struct xchild mktexpk_child = { NULL, 0, True, "font creation", NULL, NULL, mktexpk_ended }; -// -// static char *read_from_mktexpk(int ignored); -// static void write_to_mktexpk(int ignored); -// -// static struct xio mktexpk_xio = { NULL, 0, XIO_IN, -// #if HAVE_POLL -// NULL, -// #endif -// read_from_mktexpk, -// NULL}; -// +static int mktexpk_io[2]; +static struct xchild mktexpk_child = { NULL, 0, True, "font creation", NULL, NULL, mktexpk_ended }; + +static char *read_from_mktexpk(int ignored); +static void write_to_mktexpk(int ignored); + +static struct xio mktexpk_xio = { NULL, 0, XIO_IN, +#if HAVE_POLL + NULL, +#endif + read_from_mktexpk, + NULL, NULL}; + static void mktexpk_ended(int status, struct xchild *this) @@ -109,9 +110,9 @@ mktexpk_ended(int status, struct xchild *this) fprintf(stderr, "------- MKTEXPK_ENDED!\n"); if (this->io != NULL && WIFEXITED(status)) { - err_msg = (this->io->read_proc)(this->io->fd); + err_msg = (this->io->read_proc)(this->io->fd, NULL); SNPRINTF(str, 1024, "\nProcess `%s' returned exit code %d.\n", - this->name, WEXITSTATUS(status)); + this->name, WEXITSTATUS(status)); str[1024 - 1] = '\0'; printlog_append_str(str); if (err_msg != NULL) { @@ -120,29 +121,29 @@ mktexpk_ended(int status, struct xchild *this) } } printlog_enable_closebutton(); -/* free(this->name); */ -/* free(this->io); */ -/* free(this); */ + /* free(this->name); */ + /* free(this->io); */ + /* free(this); */ -// read_from_mktexpk(0); -// clear_io(this->io); -// (void)close(mktexpk_xio.fd); -// -// if (WIFEXITED(status)) { -// if (WEXITSTATUS(status) == 0) { -// printlog_append("Done.\n", strlen("Done.\n")); -// } -// else -// sprintf(str, "\nPrint process returned exit code %d.\n", -// WEXITSTATUS(status)); -// } -// else if (WIFSIGNALED(status)) -// sprintf(str, "\nPrint process terminated by signal %d.\n", -// WTERMSIG(status)); -// else -// sprintf(str, "\nPrint process returned unknown status 0x%x.\n", -// status); -// + read_from_mktexpk(0); + clear_io(this->io); + (void)close(mktexpk_xio.fd); + + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) == 0) { + printlog_append("Done.\n", strlen("Done.\n")); + } + else + sprintf(str, "\nPrint process returned exit code %d.\n", + WEXITSTATUS(status)); + } + else if (WIFSIGNALED(status)) + sprintf(str, "\nPrint process terminated by signal %d.\n", + WTERMSIG(status)); + else + sprintf(str, "\nPrint process returned unknown status 0x%x.\n", + status); + } @@ -173,7 +174,7 @@ read_from_mktexpk(int fd) #ifdef MOTIF line[bytes] = '\0'; #endif - // fprintf(stderr, "------- READ_FROM_MKTEXPK:|%s|\n", line); + fprintf(stderr, "------- READ_FROM_MKTEXPK:|%s|\n", line); printlog_append(line, bytes); } } @@ -183,47 +184,132 @@ read_from_mktexpk(int fd) return buf; } -// static void -// write_to_mktexpk(int ignored) -// { -// UNUSED(ignored); -// -// return; -// } +static void +write_to_mktexpk(int ignored) +{ + UNUSED(ignored); + + return; +} #endif /* 0 */ +#if DELAYED_MKTEXPK + +/* hash table for names of missing fonts, and their indexes */ +static hashTableT missing_font_hash; -/* We try for a VF first because that's what dvips does. Also, it's - easier to avoid running mktexpk if we have a VF this way. */ +/* counters for missing fonts */ +static int missing_font_ctr = 0; +static int missing_font_curr = 0; + +static const char *const dummy_font_value = ""; /* used as value in hash table of missing fonts ... */ + +/* static char **all_fonts = NULL; */ +/* static size_t all_fonts_size = 0; */ + +void +reset_missing_font_count(void) +{ + missing_font_ctr = missing_font_curr = 0; +} + +/* Register font `fname' at size `dpi' as a font for which we'll need + * to create a PK file + */ +static void +add_missing_font(const char *fname, int dpi) +{ + char *buf = NULL; + + if (missing_font_hash.size == 0) { + missing_font_hash = hash_create(197); + } + + /* font name (hash key) needs to be dynamically allocated here */ + buf = xmalloc(strlen(fname) + strlen(" at ") + LENGTH_OF_INT + 1); + sprintf(buf, "%s at %d", fname, dpi); + if (hash_lookup(missing_font_hash, buf) == NULL) { + missing_font_ctr++; + hash_insert(&missing_font_hash, buf, dummy_font_value); + } +} + +/* Check if font `fname' at size `dpi' is in the hash of fonts for which + * we need to create a PK file. If it is, return its index (>= 0) and delete + * it from the hash table; else, return -1. + */ +static Boolean +get_and_remove_missing_font(const char *fname, int dpi) +{ + char buf[1024]; + + if (missing_font_hash.size == 0) + return False; + + SNPRINTF(buf, 1024, "%s at %d", fname, dpi); + buf[1023] = '\0'; + if (hash_lookup(missing_font_hash, buf) == NULL) { + return False; + } + + hash_remove(&missing_font_hash, buf, dummy_font_value); + return True; +} + + +static Boolean +message_font_creation(const char *fname, int dpi) +{ + if (get_and_remove_missing_font(fname, dpi)) { + missing_font_curr++; + statusline_info(STATUS_MEDIUM, + "Creating PK font: %s at %d dpi (%d of %d) ...", + fname, + dpi, + missing_font_curr, + missing_font_ctr); + force_statusline_update(); + return True; + } + return False; +} +#endif /* DELAYED_MKTEXPK */ FILE * -font_open(char *font, char **font_ret, - double dpi, int *dpi_ret, - char **filename_ret +font_open( +#if DELAYED_MKTEXPK + Boolean load_font_now, +#endif + struct font *fontp, + char **font_ret, + int *dpi_ret, #ifdef T1LIB - , int *t1id + int *t1id, #endif - ) + Boolean use_t1lib) { char *name; kpse_glyph_file_type file_ret; - +#if DELAYED_MKTEXPK + Boolean message_done = False; + Boolean need_statusline_update = False; +#endif /* defaults in case of success; filename_ret will be non-NULL iff the fallback font is used. */ *font_ret = NULL; /* filename_ret is NULL iff a T1 version of a font has been used */ - *filename_ret = NULL; - *dpi_ret = dpi; + fontp->filename = NULL; + *dpi_ret = fontp->fsize; if (resource.omega) { /* for omega, first try 16-bit ovf's, then 8-bit vf's. */ - name = kpse_find_ovf(font); + name = kpse_find_ovf(fontp->fontname); if (name == NULL) - name = kpse_find_vf(font); + name = kpse_find_vf(fontp->fontname); } else { - name = kpse_find_vf(font); + name = kpse_find_vf(fontp->fontname); } #ifdef T1LIB @@ -234,172 +320,31 @@ font_open(char *font, char **font_ret, if (name) { /* found a vf font */ /* pretend it has the expected dpi value, else caller will complain */ - *dpi_ret = dpi; - *filename_ret = name; + *dpi_ret = fontp->fsize; + fontp->filename = name; return XFOPEN(name, FOPEN_R_MODE); } #ifdef T1LIB - if (resource.t1lib) { - /* First attempt: T1 font of correct size */ - *t1id = find_T1_font(font); + if (resource.t1lib && use_t1lib +#if DELAYED_MKTEXPK + && load_font_now +#endif + ) { + /* First attempt: T1 font of correct size + * (for delayed_mtkexpk, only when scanning postamble for the first time) + */ + *t1id = find_T1_font(fontp->fontname); if (*t1id >= 0) { - TRACE_T1((stderr, "found T1 font %s", font)); + TRACE_T1((stderr, "found T1 font %s", fontp->fontname)); return NULL; } TRACE_T1((stderr, "T1 version of font %s not found, trying pixel version next, then fallback", - font)); + fontp->fontname)); } #endif /* T1LIB */ -#ifdef EXPERIMENTAL_DELAYED_MTKEXPK - /* - From this point on, kpathsea might create some fonts (and fail horribly ...) - We want to catch its error messages and present them to the user in a window, - so fork and collect all output of the child into a pipe, similar to what's done for - dvips. - - Actually, the approach outlined here is bogus, since it still - ignores the main issue of knowing, in the parent, when all the - font creation commands have finished (so that we can start - drawing the pages). What is needed here is a child procedure - that works through a stack of font names, creating the fonts if - needed, and the parent checking the return values from these - font creation processes. Only after the child is finished, - xdvi can go on drawing the page, by calling the drawing routine - *from within* mktexpk_ended(). - */ - { - struct xchild *mktexpk_child = xmalloc(sizeof *mktexpk_child); - struct xio *mktexpk_xio = xmalloc(sizeof *mktexpk_xio); - int mktexpk_io[2]; - int pid; - - fprintf(stderr, "BEFORE CREATING PIPE\n"); - - if (xpipe(mktexpk_io) != 0) { - perror("[xdvi] pipe"); - return NULL; - } - - /* flush output buffers to avoid double buffering (i.e. data - waiting in the output buffer being written twice, by the parent - and the child) */ - fflush(stderr); - fflush(stdout); - - switch (pid = fork()) { - case -1: /* forking error */ - perror("fork"); - close(mktexpk_io[0]); - close(mktexpk_io[1]); - return NULL; - case 0: /* child */ - fprintf(stderr, "CHILD\n"); - close(mktexpk_io[0]); /* no reading from io */ - - /* make stdout and stderr of child go to mktexpk_io[1] */ - if (mktexpk_io[1] == STDOUT_FILENO) - XDVI_ABORT((stderr, "mktexpk_io[1] shouldn't be STDOUT_FILENO")); - if (dup2(mktexpk_io[1], STDOUT_FILENO) != STDOUT_FILENO) - XDVI_ABORT((stderr, "dup2: mktexpk_io[1], STDOUT_FILENO: %s", strerror(errno))); - - if (mktexpk_io[1] == STDERR_FILENO) - XDVI_ABORT((stderr, "mktexpk_io[1] shouldn't be STDERR_FILENO")); - if (dup2(mktexpk_io[1], STDERR_FILENO) != STDERR_FILENO) - XDVI_ABORT((stderr, "dup2: mktexpk_io[1], STDERR_FILENO: %s", strerror(errno))); - close(mktexpk_io[1]); - - fprintf(stderr, "Running ...\n"); - fprintf(stdout, "Running to stdout ...\n"); - - /* TODO: We could use a convenience routine from kpathsea (which we'd need to create first though) - like - kpse_find_glyph_nocreate() - that just returns NULL instead of invoking mktexpk. However this still doesn't give us - access to error messages from mktexpk etc. - Maybe it would be better to collect all output from mktexpk into a `log' window, and at - the same time filter the output for (shorter) messages in the statusline, a la: - `generating font %s (n of m) ...' - How is the `n of m' part done in e.g. kdvi? Investigate. - */ - - /* Second attempt: PK/GF/... font within allowable size range */ - name = kpse_find_glyph(font, (unsigned)(dpi + .5), - kpse_any_glyph_format, &file_ret); - - if (name) { /* success */ - fprintf(stderr, "\n1 DPI: %d\nFONTNAME: %s\n", file_ret.dpi, name); - *dpi_ret = file_ret.dpi; - *filename_ret = name; - _exit(0); - /* ? return XFOPEN(name, FOPEN_R_MODE); */ - } - else if (resource.alt_font != NULL) { - /* The strange thing about kpse_find_glyph() is that it - won't create a PK version of alt_font if it doesn't - already exist. So we invoke it explicitly a second time - for that one. - */ - TRACE_T1((stderr, "Trying fallback")); -#ifdef T1LIB - if (resource.t1lib) { - /* Third attempt: T1 version of fallback font */ - *t1id = find_T1_font(resource.alt_font); - if (*t1id >= 0) { - TRACE_T1((stderr, "found fallback font for %s: %s", font, resource.alt_font)); - *font_ret = xstrdup(resource.alt_font); - _exit(0); - } - TRACE_T1((stderr, - "Type1 version of fallback font %s not found, trying pixel version", - resource.alt_font)); - } -#endif /* T1LIB */ - /* Forth attempt: PK version of fallback font */ - name = kpse_find_glyph(resource.alt_font, (unsigned)(dpi + .5), - kpse_any_glyph_format, &file_ret); - if (name) { /* success */ - fprintf(stderr, "\n2 DPI: %d\nFONTNAME: %s\nRET_FONT: %s\n", file_ret.dpi, name, resource.alt_font); - *dpi_ret = file_ret.dpi; - *filename_ret = name; - *font_ret = xstrdup(resource.alt_font); - _exit(0); - /* ? return XFOPEN(name, FOPEN_R_MODE); */ - } - } - _exit(1); - default: /* parent */ - close(mktexpk_io[1]); /* no writing to io */ - - mktexpk_xio->next = NULL; - mktexpk_xio->fd = mktexpk_io[0]; - mktexpk_xio->xio_events = XIO_IN; -#if HAVE_POLL - mktexpk_xio->pfd = NULL; -#endif - mktexpk_xio->read_proc = read_from_mktexpk; - mktexpk_xio->write_proc = NULL; - - mktexpk_child->next = NULL; - mktexpk_child->pid = pid; - mktexpk_child->name = xstrdup(font); - mktexpk_child->data = NULL; - mktexpk_child->proc = mktexpk_ended; - mktexpk_child->io = mktexpk_xio; - - set_chld(mktexpk_child); - - /* TODO: get DPI and FONTNAME from the log window, save to *dpi_ret, *filename_ret and *font_ret - and return XFOPEN(name, FOPEN_R_MODE); - */ - - return NULL; - } - } - -#else /* EXPERIMENTAL_DELAYED_MTKEXPK */ /* TODO: @@ -408,30 +353,30 @@ font_open(char *font, char **font_ret, 1. Read the postamble to get all font definitions. Then, set: - kpse_set_program_enabled(kpse_any_glyph_format, False, kpse_src_compile); + kpse_set_program_enabled(kpse_any_glyph_format, False, kpse_src_compile); - and run load_font() on all of the fonts, with an array in which to save - the names that don't exist (that returned NULL). + and run load_font() on all of the fonts, with an array in which to save + the names that don't exist (that returned NULL). 2. Run load_font() again on the fonts that didn't exist in step - (1) and display the output in a window. This somehow needs to - be fork()ed so that the window itself remains responsive. - (Maybe it's easier to call mktexpk directly on the command-line?) - - _________________________________________________________ - | | - | Xdvi is creating fonts, please be patient ... | - | | - | Font xyz (n of m) | - | | - | Errors: 0 [ Show Details ... ] | - | | - | [ ... some progress meter or busy indicator ... ] | - | | - | | - | [ Exit xdvi ] [ Help ] | - | | - --------------------------------------------------------- + (1) and display the output in a window. This somehow needs to + be fork()ed so that the window itself remains responsive. + (Maybe it's easier to call mktexpk directly on the command-line?) + + _________________________________________________________ + | | + | Xdvi is creating fonts, please be patient ... | + | | + | Font xyz (n of m) | + | | + | Errors: 0 [ Show Details ... ] | + | | + | [ ... some progress meter or busy indicator ... ] | + | | + | | + | [ Exit xdvi ] [ Help ] | + | | + --------------------------------------------------------- This window can be shown before the main window is opened. @@ -443,17 +388,75 @@ font_open(char *font, char **font_ret, of the fallback font (e.g. cmr10.600pk) if the PK version exists, so the Type1 version of the fallback won't get used at all. But maybe this isn't that severe, given that the font is grossly wrong anyway. - */ - name = kpse_find_glyph(font, (unsigned)(dpi + .5), + */ +#if DELAYED_MKTEXPK + if (load_font_now) { + fprintf(stderr, "loading font now\n"); + if (message_font_creation(fontp->fontname, (int)(fontp->fsize + 0.5))) { + message_done = True; + name = kpse_find_glyph(fontp->fontname, (unsigned)(fontp->fsize + .5), + kpse_any_glyph_format, &file_ret); + } + else { + kpse_set_program_enabled(kpse_any_glyph_format, False, kpse_src_compile); + name = kpse_find_glyph(fontp->fontname, (unsigned)(fontp->fsize + .5), + kpse_any_glyph_format, &file_ret); + /* no success if either name is NULL or the filename returned in file_ret is + a different font */ +#if 1 + /* ??? Bug with tex/test2.tex if cmbr exists but cmr doesn't ??? */ + fprintf(stderr, "creating %s\n", fontp->fontname); + if (!name || strcmp(file_ret.name, fontp->fontname) != 0) { + statusline_info(STATUS_MEDIUM, + "Creating PK font: %s at %d dpi ...", + fontp->fontname, + (int)(fontp->fsize + 0.5)); + need_statusline_update = True; + force_statusline_update(); + kpse_set_program_enabled(kpse_any_glyph_format, resource.makepk, kpse_src_compile); + name = kpse_find_glyph(fontp->fontname, (unsigned)(fontp->fsize + .5), + kpse_any_glyph_format, &file_ret); + } +#endif + } + } + else { + name = kpse_find_glyph(fontp->fontname, (unsigned)(fontp->fsize + .5), + kpse_any_glyph_format, &file_ret); + } +#else /* DELAYED_MKTEXPK */ + name = kpse_find_glyph(fontp->fontname, (unsigned)(fontp->fsize + .5), kpse_any_glyph_format, &file_ret); +#endif /* DELAYED_MKTEXPK */ if (name) { /* success */ +#if DELAYED_MKTEXPK + if (need_statusline_update) { + statusline_info(STATUS_SHORT, "Creating PK font: %s at %d dpi ... done", + fontp->fontname, + (int)(fontp->fsize + 0.5)); + force_statusline_update(); + } +#endif *dpi_ret = file_ret.dpi; - *filename_ret = name; + fontp->filename = name; *font_ret = file_ret.name; TRACE_T1((stderr, "Found pixel version: %s at %d dpi", file_ret.name, *dpi_ret)); +#if DELAYED_MKTEXPK + if (message_done) { + statusline_append(STATUS_VERYSHORT, "DUMMY", /* append text, don't overwrite */ + "done."); + force_statusline_update(); + } +#endif return XFOPEN(name, FOPEN_R_MODE); } +#if DELAYED_MKTEXPK + else if (!load_font_now) { + add_missing_font(fontp->fontname, (int)(fontp->fsize + 0.5)); + return NULL; + } +#endif else if (resource.alt_font != NULL) { /* The strange thing about kpse_find_glyph() is that it won't create a PK version of alt_font if it doesn't @@ -462,11 +465,15 @@ font_open(char *font, char **font_ret, */ TRACE_T1((stderr, "Trying fallback")); #ifdef T1LIB - if (resource.t1lib) { + if (resource.t1lib +#if DELAYED_MKTEXPK + && load_font_now +#endif + ) { /* Third attempt: T1 version of fallback font */ *t1id = find_T1_font(resource.alt_font); if (*t1id >= 0) { - TRACE_T1((stderr, "found fallback font for %s: %s", font, resource.alt_font)); + TRACE_T1((stderr, "found fallback font for %s: %s", fontp->fontname, resource.alt_font)); *font_ret = xstrdup(resource.alt_font); return NULL; } @@ -476,12 +483,12 @@ font_open(char *font, char **font_ret, } #endif /* T1LIB */ /* Forth attempt: PK version of fallback font */ - name = kpse_find_glyph(resource.alt_font, (unsigned)(dpi + .5), + name = kpse_find_glyph(resource.alt_font, (unsigned)(fontp->fsize + .5), kpse_any_glyph_format, &file_ret); if (name) { /* success */ TRACE_T1((stderr, "Success for PK version of fallback")); *dpi_ret = file_ret.dpi; - *filename_ret = name; + fontp->filename = name; *font_ret = xstrdup(resource.alt_font); return XFOPEN(name, FOPEN_R_MODE); } @@ -489,7 +496,7 @@ font_open(char *font, char **font_ret, TRACE_T1((stderr, "Failure for PK version of fallback")); } } -#endif /* EXPERIMENTAL_DELAYED_MTKEXPK */ + /* all other cases are failure */ TRACE_T1((stderr, "Failure")); return NULL; diff --git a/Build/source/texk/xdvik/font-open.h b/Build/source/texk/xdvik/font-open.h index cd4a2d94975..91cc4854425 100644 --- a/Build/source/texk/xdvik/font-open.h +++ b/Build/source/texk/xdvik/font-open.h @@ -23,10 +23,20 @@ #ifndef FONT_OPEN_H_ #define FONT_OPEN_H_ -extern FILE *font_open(char * font, char ** font_ret, double dpi, int * dpi_ret, char ** filename_ret +extern FILE *font_open( +#if DELAYED_MKTEXPK + Boolean load_font_now, +#endif + struct font *fontp, + char **font_ret, + int *dpi_ret, #ifdef T1LIB - , int * t1id + int *t1id, +#endif + Boolean use_t1lib); + +#if DELAYED_MKTEXPK +void reset_missing_font_count(void); #endif - ); #endif /* FONT_OPEN_H_ */ diff --git a/Build/source/texk/xdvik/gf.c b/Build/source/texk/xdvik/gf.c index 8c0d9a6da11..72dab5ffe36 100644 --- a/Build/source/texk/xdvik/gf.c +++ b/Build/source/texk/xdvik/gf.c @@ -180,7 +180,7 @@ read_GF_char(struct font *fontp, case SKIP2: case SKIP3: basep += get_bytes(GF_file, (int)(cmnd - SKIP0)) * bytes_wide / sizeof(bmUnitT); -/* *((char **)&basep) += get_bytes(GF_file, WIDENINT cmnd - SKIP0) * bytes_wide; */ + /* *((char **)&basep) += get_bytes(GF_file, WIDENINT cmnd - SKIP0) * bytes_wide; */ case SKIP0: new_row = True; paint_switch = White; @@ -201,7 +201,7 @@ read_GF_char(struct font *fontp, } /* end switch */ if (new_row) { basep += bytes_wide / sizeof(bmUnitT); -/* *((char **)&basep) += bytes_wide; */ + /* *((char **)&basep) += bytes_wide; */ if (basep >= maxp || cp >= basep) too_many_bits(ch); cp = basep; @@ -256,7 +256,7 @@ read_GF_index(struct font *fontp, wide_bool hushcs) */ fseek(GF_file, (long)-4, SEEK_END); while (get_bytes(GF_file, 4) != ((unsigned long)TRAILER << 24 | TRAILER << 16 - | TRAILER << 8 | TRAILER)) + | TRAILER << 8 | TRAILER)) fseek(GF_file, (long)-5, SEEK_CUR); fseek(GF_file, (long)-5, SEEK_CUR); for (;;) { diff --git a/Build/source/texk/xdvik/gui/Makefile.in b/Build/source/texk/xdvik/gui/Makefile.in index affe40e0b51..125e595dfcb 100644 --- a/Build/source/texk/xdvik/gui/Makefile.in +++ b/Build/source/texk/xdvik/gui/Makefile.in @@ -6,7 +6,7 @@ # -### NOTE: ac_include paths must be relative to texk/xdvik, since that +### NOTE: kpse_include paths must be relative to texk/xdvik, since that ### is from where the configure is run! kpse_include ../make/paths.mk kpse_include ../make/library.mk @@ -15,6 +15,9 @@ kpse_include ../make/programs.mk kpathsea_parent = ../.. +# additional flags for kpathsea +LIBKPATHSEACPPFLAGS=@LIBKPATHSEACPPFLAGS@ + CPP = @CPP@ RANLIB = @RANLIB@ @@ -24,7 +27,7 @@ x_cppflags = @X_CFLAGS@ # Extra xdvi-specific compiler options. ps_def = @PS_DEF@ -DXSERVER_INFO -prog_cflags = @XTRA_WARN_CFLAGS@ -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) +prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBKPATHSEACPPFLAGS) -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) # Note: to be able to use one depend.mk file for both Motif/Xaw (which # is needed since only maintainers are supposed to invoke `make depend') diff --git a/Build/source/texk/xdvik/gui/Makefile.in.orig b/Build/source/texk/xdvik/gui/Makefile.in.orig new file mode 100644 index 00000000000..873f41e92de --- /dev/null +++ b/Build/source/texk/xdvik/gui/Makefile.in.orig @@ -0,0 +1,83 @@ +# Makefile for xdvik +# +# - 1999/05/08: janl: Removed submakes for libwww and kpathsea. That's what +# the top makefile is for! +# + + +### NOTE: ac_include paths must be relative to texk/xdvik, since that +### is from where the configure is run! +ac_include ../make/paths.mk +ac_include ../make/library.mk +ac_include ../make/common.mk +ac_include ../make/programs.mk + +kpathsea_parent = ../.. + +# additional flags for kpathsea +LIBKPATHSEACPPFLAGS=@LIBKPATHSEACPPFLAGS@ + +CPP = @CPP@ +RANLIB = @RANLIB@ + +# Make `#include ' and `-lX...' work. +# This matches web2c (needed only for Metafont). +x_cppflags = @X_CFLAGS@ + +# Extra xdvi-specific compiler options. +ps_def = @PS_DEF@ -DXSERVER_INFO +prog_cflags = @XTRA_WARN_CFLAGS@ $(LIBKPATHSEACPPFLAGS) -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) + +# Note: to be able to use one depend.mk file for both Motif/Xaw (which +# is needed since only maintainers are supposed to invoke `make depend') +# we include *all* object files and have tests for #ifdef MOTIF/XAW inside +# the files. +objects = \ + help-window.o \ + message-window.o \ + mag.o \ + menu.o \ + Panner.o \ + pagesel.o \ + print-dialog.o \ + print-log.o \ + search-dialog.o \ + selection.o \ + sfDir.o \ + sfDraw.o \ + sfPath.o \ + sfSelFile.o \ + statusline.o \ + Tip.o \ + topic-window.o \ + xaw_bitmaps.o \ + xaw_menu.o \ + xicon.o \ + xlwradio.o \ + xm_colorsel.o \ + xm_filesel.o \ + xm_menu.o \ + xm_prefs.o \ + xm_prefs_appearance.o \ + xm_prefs_fonts.o \ + xm_prefs_page.o \ + xm_prefs_scroll.o \ + xm_prefs_helpers.o \ + xm_toolbar.o + +libgui.a: $(objects) +### hmm, I don't understand ar ... sometimes objects were NOT replaced. +### Play it safe and always remove the archive before creating new one. + rm -f $@ + $(AR) $(ARFLAGS) $@ $(objects) + $(RANLIB) $@ + +ac_include ../make/dist.mk +ac_include ../make/clean.mk + +clean:: + rm -f *.o *.a + +c_auto_h_dir = .. +ac_include ../make/rdepend.mk +ac_include ./gui/depend.mk diff --git a/Build/source/texk/xdvik/gui/Panner.c b/Build/source/texk/xdvik/gui/Panner.c index 1ff157b6242..9acca69ac14 100644 --- a/Build/source/texk/xdvik/gui/Panner.c +++ b/Build/source/texk/xdvik/gui/Panner.c @@ -1,28 +1,28 @@ /* * $XConsortium: Panner.c,v 1.52 95/01/10 14:31:26 kaleb Exp $ * -Copyright (c) 1989, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. + Copyright (c) 1989, 1994 X Consortium + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from the X Consortium. * * Author: Jim Fulton, MIT X Consortium */ @@ -57,17 +57,17 @@ extern Bool XmuDistinguishablePixels(); /* not defined in any Xmu headers */ #define offset(field) XtOffsetOf(SimpleRec, simple.field) static XtResource resources[] = { - {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), offset(cursor), XtRImmediate, (XtPointer) None}, - {XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), + {XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), offset(insensitive_border), XtRImmediate, (XtPointer) NULL}, - {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel), + {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel), offset(pointer_fg), XtRString, XtDefaultForeground}, - {XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel), + {XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel), offset(pointer_bg), XtRString, XtDefaultBackground}, - {XtNcursorName, XtCCursor, XtRString, sizeof(String), + {XtNcursorName, XtCCursor, XtRString, sizeof(String), offset(cursor_name), XtRString, NULL}, - {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), + {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), offset(international), XtRImmediate, (XtPointer) FALSE}, #undef offset }; @@ -77,47 +77,47 @@ static Bool SetValues(Widget current, Widget request, Widget new, ArgList args, static Bool ChangeSensitive(Widget w); SimpleClassRec simpleClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &widgetClassRec, - /* class_name */ "Simple", - /* widget_size */ sizeof(SimpleRec), - /* class_initialize */ ClassInitialize, - /* class_part_initialize */ ClassPartInitialize, - /* class_inited */ FALSE, - /* initialize */ NULL, - /* initialize_hook */ NULL, - /* realize */ Realize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ NULL, - /* resize */ NULL, - /* expose */ NULL, + { /* core fields */ + /* superclass */ (WidgetClass) &widgetClassRec, + /* class_name */ "Simple", + /* widget_size */ sizeof(SimpleRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ NULL, + /* expose */ NULL, #warning FIXME: incompatible pointer type - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ NULL, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple fields */ - /* change_sensitive */ ChangeSensitive + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ ChangeSensitive #ifndef HAVE_OLD_XAW - , NULL + , NULL #endif - } + } }; WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec; @@ -126,18 +126,18 @@ static void ClassInitialize() { static XtConvertArgRec convertArg[] = { {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), - sizeof(Screen *)}, + sizeof(Screen *)}, {XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)}, {XtResourceString, (XtPointer) XtNpointerColorBackground, - sizeof(Pixel)}, + sizeof(Pixel)}, {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap), - sizeof(Colormap)} + sizeof(Colormap)} }; XawInitializeWidgetSet(); XtSetTypeConverter( XtRString, XtRColorCursor, XmuCvtStringToColorCursor, - convertArg, XtNumber(convertArg), - XtCacheByDisplay, (XtDestructor)NULL); + convertArg, XtNumber(convertArg), + XtCacheByDisplay, (XtDestructor)NULL); } static void ClassPartInitialize(class) @@ -145,14 +145,14 @@ static void ClassPartInitialize(class) { SimpleWidgetClass c = (SimpleWidgetClass) class; SimpleWidgetClass super = (SimpleWidgetClass) - c->core_class.superclass; + c->core_class.superclass; if (c->simple_class.change_sensitive == NULL) { char buf[BUFSIZ]; (void) sprintf(buf, - "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", - c->core_class.class_name); + "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", + c->core_class.class_name); XtWarning(buf); c->simple_class.change_sensitive = ChangeSensitive; } @@ -178,7 +178,7 @@ static void Realize(w, valueMask, attributes) w->core.depth); border_pixmap = w->core.border_pixmap; attributes->border_pixmap = - w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; + w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; *valueMask |= CWBorderPixmap; *valueMask &= ~CWBorderPixel; @@ -204,7 +204,7 @@ static void Realize(w, valueMask, attributes) static void ConvertCursor(w) -Widget w; + Widget w; { SimpleWidget simple = (SimpleWidget) w; XrmValue from, to; @@ -248,19 +248,19 @@ SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *nu if ( XtIsSensitive(current) != XtIsSensitive(new) ) (*((SimpleWidgetClass)XtClass(new))-> - simple_class.change_sensitive) ( new ); + simple_class.change_sensitive) ( new ); if (s_old->simple.cursor != s_new->simple.cursor) { new_cursor = TRUE; } -/* - * We are not handling the string cursor_name correctly here. - */ + /* + * We are not handling the string cursor_name correctly here. + */ if ( (s_old->simple.pointer_fg != s_new->simple.pointer_fg) || - (s_old->simple.pointer_bg != s_new->simple.pointer_bg) || - (s_old->simple.cursor_name != s_new->simple.cursor_name) ) { + (s_old->simple.pointer_bg != s_new->simple.pointer_bg) || + (s_old->simple.cursor_name != s_new->simple.cursor_name) ) { ConvertCursor(new); new_cursor = TRUE; } @@ -291,7 +291,7 @@ static Bool ChangeSensitive(Widget w) w->core.depth); XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), ((SimpleWidget)w)-> - simple.insensitive_border ); + simple.insensitive_border ); } } return False; @@ -316,7 +316,7 @@ void XawInitializeWidgetSet () } static char defaultTranslations[] = - ": start() \n\ +": start() \n\ : move() \n\ : notify() stop() \n\ : abort() \n\ @@ -357,39 +357,39 @@ static XtActionsRec actions[] = { static XtResource panner_resources[] = { #define poff(field) XtOffsetOf(PannerRec, panner.field) { XtNallowOff, XtCAllowOff, XtRBoolean, sizeof(Boolean), - poff(allow_off), XtRImmediate, (XtPointer) FALSE }, + poff(allow_off), XtRImmediate, (XtPointer) FALSE }, { XtNresize, XtCResize, XtRBoolean, sizeof(Boolean), - poff(resize_to_pref), XtRImmediate, (XtPointer) TRUE }, + poff(resize_to_pref), XtRImmediate, (XtPointer) TRUE }, { XtNreportCallback, XtCReportCallback, XtRCallback, sizeof(XtPointer), - poff(report_callbacks), XtRCallback, (XtPointer) NULL }, + poff(report_callbacks), XtRCallback, (XtPointer) NULL }, { XtNdefaultScale, XtCDefaultScale, XtRDimension, sizeof(Dimension), - poff(default_scale), XtRImmediate, (XtPointer) PANNER_DEFAULT_SCALE }, + poff(default_scale), XtRImmediate, (XtPointer) PANNER_DEFAULT_SCALE }, { XtNrubberBand, XtCRubberBand, XtRBoolean, sizeof(Boolean), - poff(rubber_band), XtRImmediate, (XtPointer) FALSE }, + poff(rubber_band), XtRImmediate, (XtPointer) FALSE }, { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - poff(foreground), XtRString, (XtPointer) XtDefaultBackground }, + poff(foreground), XtRString, (XtPointer) XtDefaultBackground }, { XtNinternalSpace, XtCInternalSpace, XtRDimension, sizeof(Dimension), - poff(internal_border), XtRImmediate, (XtPointer) 4 }, + poff(internal_border), XtRImmediate, (XtPointer) 4 }, { XtNlineWidth, XtCLineWidth, XtRDimension, sizeof(Dimension), - poff(line_width), XtRImmediate, (XtPointer) 0 }, + poff(line_width), XtRImmediate, (XtPointer) 0 }, { XtNcanvasWidth, XtCCanvasWidth, XtRDimension, sizeof(Dimension), - poff(canvas_width), XtRImmediate, (XtPointer) 0 }, + poff(canvas_width), XtRImmediate, (XtPointer) 0 }, { XtNcanvasHeight, XtCCanvasHeight, XtRDimension, sizeof(Dimension), - poff(canvas_height), XtRImmediate, (XtPointer) 0 }, + poff(canvas_height), XtRImmediate, (XtPointer) 0 }, { XtNsliderX, XtCSliderX, XtRPosition, sizeof(Position), - poff(slider_x), XtRImmediate, (XtPointer) 0 }, + poff(slider_x), XtRImmediate, (XtPointer) 0 }, { XtNsliderY, XtCSliderY, XtRPosition, sizeof(Position), - poff(slider_y), XtRImmediate, (XtPointer) 0 }, + poff(slider_y), XtRImmediate, (XtPointer) 0 }, { XtNsliderWidth, XtCSliderWidth, XtRDimension, sizeof(Dimension), - poff(slider_width), XtRImmediate, (XtPointer) 0 }, + poff(slider_width), XtRImmediate, (XtPointer) 0 }, { XtNsliderHeight, XtCSliderHeight, XtRDimension, sizeof(Dimension), - poff(slider_height), XtRImmediate, (XtPointer) 0 }, + poff(slider_height), XtRImmediate, (XtPointer) 0 }, { XtNshadowColor, XtCShadowColor, XtRPixel, sizeof(Pixel), - poff(shadow_color), XtRString, (XtPointer) XtDefaultForeground }, + poff(shadow_color), XtRString, (XtPointer) XtDefaultForeground }, { XtNshadowThickness, XtCShadowThickness, XtRDimension, sizeof(Dimension), - poff(shadow_thickness), XtRImmediate, (XtPointer) 2 }, + poff(shadow_thickness), XtRImmediate, (XtPointer) 2 }, { XtNbackgroundStipple, XtCBackgroundStipple, XtRString, sizeof(String), - poff(stipple_name), XtRImmediate, (XtPointer) NULL }, + poff(stipple_name), XtRImmediate, (XtPointer) NULL }, #undef poff }; @@ -407,49 +407,49 @@ static void SetValuesAlmost(); /* deal with failed setval geom req */ static XtGeometryResult QueryGeometry(); /* say how big we would like to be */ PannerClassRec pannerClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &simpleClassRec, - /* class_name */ "Panner", - /* widget_size */ sizeof(PannerRec), - /* class_initialize */ XawInitializeWidgetSet, - /* class_part_initialize */ NULL, - /* class_inited */ FALSE, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ PannerRealize, - /* actions */ actions, - /* num_actions */ XtNumber(actions), - /* resources */ panner_resources, - /* num_resources */ XtNumber(panner_resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ Destroy, - /* resize */ Resize, - /* expose */ Redisplay, - /* set_values */ PannerSetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ SetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ defaultTranslations, - /* query_geometry */ QueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple fields */ - /* change_sensitive */ XtInheritChangeSensitive + { /* core fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "Panner", + /* widget_size */ sizeof(PannerRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ PannerRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ panner_resources, + /* num_resources */ XtNumber(panner_resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ PannerSetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ SetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ XtInheritChangeSensitive #ifndef HAVE_OLD_XAW - , NULL + , NULL #endif - }, - { /* panner fields */ - /* ignore */ 0 - } + }, + { /* panner fields */ + /* ignore */ 0 + } }; WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec; @@ -475,9 +475,9 @@ static void reset_shadow_gc (pw) /* used when resources change */ pixels[2] = pw->panner.shadow_color; if (!pw->panner.stipple_name && !XmuDistinguishablePixels (XtDisplay (pw), pw->core.colormap, - pixels, 3) && + pixels, 3) && XmuDistinguishablePixels (XtDisplay (pw), pw->core.colormap, - pixels, 2)) + pixels, 2)) { valuemask = GCTile | GCFillStyle; values.fill_style = FillTiled; @@ -633,17 +633,17 @@ static void rescale (pw) int vpad = hpad; if (pw->panner.canvas_width < 1) - pw->panner.canvas_width = pw->core.width; + pw->panner.canvas_width = pw->core.width; if (pw->panner.canvas_height < 1) - pw->panner.canvas_height = pw->core.height; + pw->panner.canvas_height = pw->core.height; if ((int)pw->core.width <= hpad) hpad = 0; if ((int)pw->core.height <= vpad) vpad = 0; pw->panner.haspect = ((double) pw->core.width - hpad) / - (double) pw->panner.canvas_width; + (double) pw->panner.canvas_width; pw->panner.vaspect = ((double) pw->core.height - vpad) / - (double) pw->panner.canvas_height; + (double) pw->panner.canvas_height; scale_knob (pw, TRUE, TRUE); } @@ -665,25 +665,25 @@ static Boolean get_event_xy (pw, event, x, y) int pad = pw->panner.internal_border; switch (event->type) { - case ButtonPress: - case ButtonRelease: + case ButtonPress: + case ButtonRelease: *x = event->xbutton.x - pad; *y = event->xbutton.y - pad; return TRUE; - case KeyPress: - case KeyRelease: + case KeyPress: + case KeyRelease: *x = event->xkey.x - pad; *y = event->xkey.y - pad; return TRUE; - case EnterNotify: - case LeaveNotify: + case EnterNotify: + case LeaveNotify: *x = event->xcrossing.x - pad; *y = event->xcrossing.y - pad; return TRUE; - case MotionNotify: + case MotionNotify: *x = event->xmotion.x - pad; *y = event->xmotion.y - pad; return TRUE; @@ -717,20 +717,20 @@ static int parse_page_string (s, pagesize, canvassize, relative) return 0; } - /* skip over numbers */ + /* skip over numbers */ for (cp = s; isascii(*s) && (isdigit(*s) || *s == '.'); s++) ; val *= atof(cp); - /* skip blanks */ + /* skip blanks */ for (; isascii(*s) && isspace(*s); s++) ; if (*s) { /* if units */ switch (s[0]) { - case 'p': case 'P': + case 'p': case 'P': val *= (double) pagesize; break; - case 'c': case 'C': + case 'c': case 'C': val *= (double) canvassize; break; } @@ -786,7 +786,7 @@ static void Initialize (greq, gnew, args, num_args) if (req->panner.canvas_width < 1) new->panner.canvas_width = 1; if (req->panner.canvas_height < 1) new->panner.canvas_height = 1; if (req->panner.default_scale < 1) - new->panner.default_scale = PANNER_DEFAULT_SCALE; + new->panner.default_scale = PANNER_DEFAULT_SCALE; get_default_size (req, &defwidth, &defheight); if (req->core.width < 1) new->core.width = defwidth; @@ -826,7 +826,7 @@ static void PannerRealize (gw, valuemaskp, attr) } } (*pannerWidgetClass->core_class.superclass->core_class.realize) - (gw, valuemaskp, attr); + (gw, valuemaskp, attr); if (gotpm) XFreePixmap (XtDisplay(gw), pm); } @@ -906,7 +906,7 @@ static Boolean PannerSetValues (Widget gcur, Widget greq, Widget gnew, ArgList a if (cur->panner.foreground != new->panner.foreground) { reset_slider_gc (new); if (cur->panner.foreground != cur->core.background_pixel) - reset_xor_gc (new); + reset_xor_gc (new); redisplay = TRUE; } else if (cur->panner.line_width != new->panner.line_width || cur->core.background_pixel != new->core.background_pixel) { @@ -916,7 +916,7 @@ static Boolean PannerSetValues (Widget gcur, Widget greq, Widget gnew, ArgList a if (cur->panner.shadow_color != new->panner.shadow_color) { reset_shadow_gc (new); if (cur->panner.foreground == cur->core.background_pixel) - reset_xor_gc (new); + reset_xor_gc (new); redisplay = TRUE; } if (cur->panner.shadow_thickness != new->panner.shadow_thickness) { @@ -952,8 +952,8 @@ static Boolean PannerSetValues (Widget gcur, Widget greq, Widget gnew, ArgList a get_default_size (new, &new->core.width, &new->core.height); redisplay = TRUE; } else if (cur->panner.canvas_width != new->panner.canvas_width || - cur->panner.canvas_height != new->panner.canvas_height || - cur->panner.internal_border != new->panner.internal_border) { + cur->panner.canvas_height != new->panner.canvas_height || + cur->panner.internal_border != new->panner.internal_border) { rescale (new); /* does a scale_knob as well */ redisplay = TRUE; } else { @@ -996,11 +996,11 @@ static XtGeometryResult QueryGeometry (gw, intended, pref) (CWWidth | CWHeight)) && intended->width == pref->width && intended->height == pref->height) - return XtGeometryYes; + return XtGeometryYes; else if (pref->width == pw->core.width && pref->height == pw->core.height) - return XtGeometryNo; + return XtGeometryNo; else - return XtGeometryAlmost; + return XtGeometryAlmost; } @@ -1170,12 +1170,12 @@ static void ActionNotify (Widget gw, XEvent *event, String *params, Cardinal *nu if (pw->panner.slider_x > (tmp = (((Position) pw->panner.canvas_width) - ((Position) pw->panner.slider_width)))) - pw->panner.slider_x = tmp; + pw->panner.slider_x = tmp; if (pw->panner.slider_x < 0) pw->panner.slider_x = 0; if (pw->panner.slider_y > (tmp = (((Position) pw->panner.canvas_height) - ((Position) pw->panner.slider_height)))) - pw->panner.slider_y = tmp; + pw->panner.slider_y = tmp; if (pw->panner.slider_y < 0) pw->panner.slider_y = 0; } diff --git a/Build/source/texk/xdvik/gui/Tip.c b/Build/source/texk/xdvik/gui/Tip.c index 76a83f188b9..1033a54cc29 100644 --- a/Build/source/texk/xdvik/gui/Tip.c +++ b/Build/source/texk/xdvik/gui/Tip.c @@ -140,59 +140,59 @@ static XtResource resources[] = { TipClassRec tipClassRec = { { - /* superclass */ (WidgetClass) & overrideShellClassRec, - /* class_name */ "Tip", - /* widget size */ (Cardinal) sizeof(TipRec), - /* class_init */ NULL, - /* class_part_init */ (XtWidgetClassProc) NULL, - /* class_inited */ (XtEnum) FALSE, - /* initialize */ (XtInitProc) initialize, - /* init_hook */ (XtArgsProc) NULL, - /* realize */ XtInheritRealize, - /* actions */ (XtActionList) 0, - /* num_actions */ (Cardinal) 0, - /* resources */ (XtResourceList) resources, - /* num_resources */ (Cardinal) XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposur */ (XtEnum) FALSE, - /* compress enterleave */ TRUE, - /* visibility_interest */ FALSE, - /* destroy */ destroy, - /* resize */ XtInheritResize, - /* expose, */ XtInheritExpose, - /* set_values */ (XtSetValuesFunc) set_values, - /* set_values_hook */ (XtArgsFunc) NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ (XtArgsProc) NULL, - /* accept_focus */ XtInheritAcceptFocus, - /* version */ XtVersion, - /* callback_private */ (XtPointer) NULL, - /* translations */ XtInheritTranslations, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ (XtPointer) 0, - }, + /* superclass */ (WidgetClass) & overrideShellClassRec, + /* class_name */ "Tip", + /* widget size */ (Cardinal) sizeof(TipRec), + /* class_init */ NULL, + /* class_part_init */ (XtWidgetClassProc) NULL, + /* class_inited */ (XtEnum) FALSE, + /* initialize */ (XtInitProc) initialize, + /* init_hook */ (XtArgsProc) NULL, + /* realize */ XtInheritRealize, + /* actions */ (XtActionList) 0, + /* num_actions */ (Cardinal) 0, + /* resources */ (XtResourceList) resources, + /* num_resources */ (Cardinal) XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposur */ (XtEnum) FALSE, + /* compress enterleave */ TRUE, + /* visibility_interest */ FALSE, + /* destroy */ destroy, + /* resize */ XtInheritResize, + /* expose, */ XtInheritExpose, + /* set_values */ (XtSetValuesFunc) set_values, + /* set_values_hook */ (XtArgsFunc) NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ (XtArgsProc) NULL, + /* accept_focus */ XtInheritAcceptFocus, + /* version */ XtVersion, + /* callback_private */ (XtPointer) NULL, + /* translations */ XtInheritTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ (XtPointer) 0, + }, /* composite part */ { - /* geometry_manager */ XtInheritGeometryManager, - /* change_managed */ XtInheritChangeManaged, - /* insert_child */ XtInheritInsertChild, - /* delete_child */ XtInheritDeleteChild, - /* extension */ NULL - }, + /* geometry_manager */ XtInheritGeometryManager, + /* change_managed */ XtInheritChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, /* Shell */ { - (XtPointer) NULL, - }, + (XtPointer) NULL, + }, /* Override Shell */ { - 0, - }, + 0, + }, /* tip */ { - 0, - } + 0, + } }; WidgetClass tipWidgetClass = (WidgetClass) & tipClassRec; @@ -372,7 +372,7 @@ static void timeout_event(XtPointer client_data, XtIntervalId *id) event before (for some reason, not all Enters are followed by Leaves). This is especially apparent when running xdvi from a remote display over a slow connection. - */ + */ Window root, child; int root_x, root_y; unsigned int keys_buttons; @@ -399,8 +399,8 @@ static void timeout_event(XtPointer client_data, XtIntervalId *id) * (NOT the widget, in case the widget is large!) */ ptr_y += 20; -/* abs_x += w_width / 2; */ -/* abs_y += w_height; */ + /* abs_x += w_width / 2; */ + /* abs_y += w_height; */ XmbTextExtents(tw->tip.fontset, obj->text, obj->size, &ink, &logical); @@ -460,12 +460,12 @@ static void enter(struct tip_context *obj, XEvent * xevent, /* it seems that this makes the tooltips somewhat unpredictable (they don't show when hovering fast over several buttons, then staying on one button); disabled this for the time being. */ -/* if ((event->time - tw->tip.HelpPopDownTime) > tw->tip.cwp) */ -/* current_waitPeriod = tw->tip.waitPeriod; */ -/* else */ -/* current_waitPeriod = 0; */ + /* if ((event->time - tw->tip.HelpPopDownTime) > tw->tip.cwp) */ + /* current_waitPeriod = tw->tip.waitPeriod; */ + /* else */ + /* current_waitPeriod = 0; */ -/* current_waitPeriod = tw->tip.waitPeriod; */ + /* current_waitPeriod = tw->tip.waitPeriod; */ current_waitPeriod = resource.tooltips_wait_period; if (current_waitPeriod >= 0) { tw->tip.tid = XtAppAddTimeOut(app, current_waitPeriod, timeout_event, diff --git a/Build/source/texk/xdvik/gui/depend.mk b/Build/source/texk/xdvik/gui/depend.mk index 2f62ce49923..29339a59251 100644 --- a/Build/source/texk/xdvik/gui/depend.mk +++ b/Build/source/texk/xdvik/gui/depend.mk @@ -1,528 +1,1286 @@ -help-window.o: help-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +Panner.o: Panner.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - message-window.h ../util.h \ - $(kpathsea_srcdir)/c-stat.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h ../string-utils.h ../my-vsnprintf.h \ - topic-window.h help-window.h -mag.o: mag.c \ - ../xdvi-config.h ../c-auto.h \ - ../c-openmx.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h +Tip.o: Tip.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ $(kpathsea_srcdir)/systypes.h \ - ../xdvi.h ../xdvi-debug.h ../version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + Tip.h \ + ../xdvi-debug.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h +help-window.o: help-window.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h \ - $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h ../dvi-draw.h ../dvi-init.h \ - statusline.h ../hypertex.h mag.h xm_toolbar.h xm_menu.h menu.h \ - xaw_menu.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../version.h \ + message-window.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - pagesel.h -menu.o: menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../x_util.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + topic-window.h \ + help-window.h +mag.o: mag.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../c-openmx.h \ + $(kpathsea_srcdir)/c-limits.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h menu.h xm_menu.h xaw_menu.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + ../dvi-draw.h \ + ../dvi-init.h \ + statusline.h \ + ../hypertex.h \ + mag.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ - $(kpathsea_srcdir)/tex-file.h -message-window.o: message-window.c \ - ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + pagesel.h +menu.o: menu.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../string-utils.h ../my-vsnprintf.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + menu.h \ + xm_menu.h \ + xaw_menu.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h message-window.h -pagesel.o: pagesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h +message-window.o: \ + message-window.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - xm_toolbar.h xm_menu.h menu.h ../events.h \ - xaw_menu.h ../x_util.h \ - message-window.h pagesel.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../string-utils.h ../my-vsnprintf.h \ - ../dvi-init.h statusline.h print-dialog.h ../search-internal.h \ - search-dialog.h ../dvisel.h ../print-internal.h ../pagehist.h -Panner.o: Panner.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + ../x_util.h \ + message-window.h +pagesel.o: pagesel.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../string-utils.h ../my-vsnprintf.h + $(kpathsea_srcdir)/c-fopen.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + ../events.h \ + xaw_menu.h \ + ../x_util.h \ + message-window.h \ + pagesel.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../dvi-init.h \ + statusline.h \ + print-dialog.h \ + ../print-internal.h \ + ../dvi-init.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../print-internal.h \ + ../pagehist.h print-dialog.o: print-dialog.c \ - ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ ../my-vsnprintf.h \ - print-dialog.h print-log.h ../print-internal.h ../dvi-init.h \ - ../events.h ../string-utils.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../x_util.h message-window.h pagesel.h \ - ../my-snprintf.h sfSelFile.h ../dvisel.h xlwradio.h statusline.h \ - search-dialog.h ../search-internal.h ../special.h + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + print-dialog.h \ + ../print-internal.h \ + ../dvi-init.h \ + print-log.h \ + ../events.h \ + ../dvi-init.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../x_util.h \ + message-window.h \ + pagesel.h \ + ../my-snprintf.h \ + sfSelFile.h \ + ../dvisel.h \ + ../print-internal.h \ + xlwradio.h \ + statusline.h \ + search-dialog.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../special.h print-log.o: print-log.c \ - ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ $(kpathsea_srcdir)/c-minmax.h \ $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - print-dialog.h print-log.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../xdvi-debug.h \ + print-dialog.h \ + ../print-internal.h \ + ../dvi-init.h \ + print-log.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h xlwradio.h -search-dialog.o: search-dialog.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../x_util.h \ + xlwradio.h +search-dialog.o: search-dialog.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h ../dvi-init.h search-dialog.h \ - ../search-internal.h ../dvisel.h ../print-internal.h print-dialog.h \ - xlwradio.h statusline.h ../string-utils.h ../my-vsnprintf.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + ../dvi-init.h \ + search-dialog.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../dvi-init.h \ + ../print-internal.h \ + xlwradio.h \ + statusline.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - message-window.h ../x_util.h -selection.o: selection.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string_list.h \ + ../util.h \ + message-window.h \ + ../x_util.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h +selection.o: selection.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../events.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../events.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../encodings.h message-window.h selection.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../encodings.h \ + message-window.h \ + selection.h \ statusline.h -sfDir.o: sfDir.c ../xdvi-config.h ../c-auto.h sfDir.h \ - $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +sfDir.o: sfDir.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h sfDir.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-stat.h -sfDraw.o: sfDraw.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +sfDraw.o: sfDraw.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-stat.h \ - ../xdvi.h ../xdvi-debug.h ../version.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - sfDraw.h sfDir.h sfPath.h -sfPath.o: sfPath.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-fopen.h \ + sfDraw.h \ + sfDir.h \ + $(kpathsea_srcdir)/c-dir.h \ + sfPath.h +sfPath.o: sfPath.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-stat.h \ - ../xdvi.h ../xdvi-debug.h ../version.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - sfDir.h sfDraw.h sfPath.h sfSelFile.h -sfSelFile.o: sfSelFile.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-fopen.h \ + sfDir.h \ + $(kpathsea_srcdir)/c-dir.h \ + sfDraw.h \ + sfPath.h \ + sfSelFile.h +sfSelFile.o: sfSelFile.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../dvi-init.h message-window.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../dvi-init.h \ + message-window.h \ $(kpathsea_srcdir)/c-stat.h \ - sfDir.h sfPath.h sfDraw.h sfSelFile.h \ - ../util.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/tex-file.h \ - ../events.h $(kpathsea_srcdir)/c-fopen.h -statusline.o: statusline.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ - $(kpathsea_srcdir)/c-memstr.h \ - $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ - $(kpathsea_srcdir)/c-pathmx.h \ + sfDir.h \ + $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-dir.h \ - $(kpathsea_srcdir)/c-vararg.h \ - statusline.h xm_menu.h menu.h ../events.h \ - xaw_menu.h ../x_util.h ../pagehist.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + sfPath.h \ + sfDraw.h \ + sfSelFile.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../my-vsnprintf.h -Tip.o: Tip.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + xlwradio.h \ + ../x_util.h \ + $(kpathsea_srcdir)/c-fopen.h +statusline.o: statusline.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - Tip.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../version.h \ + statusline.h \ + xm_menu.h \ + menu.h \ + ../events.h \ + xaw_menu.h \ + ../x_util.h \ + ../pagehist.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h -topic-window.o: topic-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../my-vsnprintf.h \ + ../util.h +topic-window.o: topic-window.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - topic-window.h ../string-utils.h ../my-vsnprintf.h ../util.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../version.h \ + topic-window.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../x_util.h -xaw_bitmaps.o: xaw_bitmaps.c xaw_bitmaps.h -xaw_menu.o: xaw_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + ../x_util.h +xaw_bitmaps.o: xaw_bitmaps.c \ + xaw_bitmaps.h +xaw_menu.o: xaw_menu.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../c-openmx.h ../events.h ../dvi-draw.h \ - ../dvi-init.h statusline.h pagesel.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../c-openmx.h \ + ../events.h \ + ../dvi-draw.h \ + ../dvi-init.h \ + statusline.h \ + pagesel.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../x_util.h xaw_menu.h message-window.h \ - ../my-snprintf.h ../filehist.h -xicon.o: xicon.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ - ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../x_util.h \ + xaw_menu.h \ + menu.h \ + xm_menu.h \ + message-window.h \ + ../my-snprintf.h \ + ../filehist.h \ + xaw_bitmaps.h +xicon.o: xicon.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - xicon.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + xicon.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ ../events.h \ - ../xdvi.icon ../pixmaps/xdvi32x32.xpm ../pixmaps/xdvi16x16.xpm \ + ../xdvi-debug.h \ + ../xdvi.icon \ + ../pixmaps/xdvi32x32.xpm \ + ../pixmaps/xdvi16x16.xpm \ ../pixmaps/xdvi48x48.xpm -xlwradio.o: xlwradio.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ +xlwradio.o: xlwradio.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../xdvi-debug.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h xaw_bitmaps.h xlwradioP.h \ - xlwradio.h -xm_colorsel.o: xm_colorsel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + xaw_bitmaps.h \ + xlwradioP.h \ + xlwradio.h +xm_colorsel.o: xm_colorsel.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ Tip.h \ - ../x_util.h xm_colorsel.h xm_prefsP.h \ - xm_prefs.h ../events.h ../dvi-draw.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + ../x_util.h \ + xm_colorsel.h \ + xm_prefsP.h \ + xm_prefs.h \ + ../events.h \ + ../dvi-draw.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - topic-window.h ../search-internal.h \ - search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h \ - print-dialog.h -xm_filesel.o: xm_filesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + topic-window.h \ + ../version.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../dvi-init.h \ + ../print-internal.h +xm_filesel.o: xm_filesel.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - sfSelFile.h ../dvi.h ../string-utils.h \ - ../my-vsnprintf.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + sfSelFile.h \ + ../dvi.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h message-window.h ../dvi-init.h -xm_menu.o: xm_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + ../events.h \ + message-window.h \ + ../dvi-init.h \ + ../x_util.h +xm_menu.o: xm_menu.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - xm_menu.h menu.h ../events.h xaw_menu.h \ - xm_toolbar.h ../my-snprintf.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + xm_menu.h \ + menu.h \ + ../events.h \ + xaw_menu.h \ + xm_toolbar.h \ + ../my-snprintf.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../x_util.h statusline.h ../pagehist.h \ - ../dvi-init.h ../filehist.h ../c-openmx.h message-window.h -xm_prefs_appearance.o: xm_prefs_appearance.c ../xdvi-config.h ../c-auto.h \ - ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../x_util.h \ + ../version.h \ + statusline.h \ + ../pagehist.h \ + ../dvi-init.h \ + ../filehist.h \ + ../c-openmx.h \ + message-window.h +xm_prefs.o: xm_prefs.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h ../my-snprintf.h xm_colorsel.h \ - topic-window.h message-window.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + message-window.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h xm_toolbar.h xm_menu.h menu.h \ - xaw_menu.h statusline.h pagesel.h xm_prefsP.h xm_prefs_appearance.h -xm_prefs.o: xm_prefs.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + xm_prefsP.h \ + xm_prefs.h \ + xm_prefs_appearance.h \ + xm_prefs_fonts.h \ + xm_prefs_helpers.h \ + xm_prefs_page.h \ + xm_prefs_scroll.h \ + ../dvi-draw.h \ + ../search-internal.h \ + search-dialog.h \ + ../dvisel.h \ + ../dvi-init.h \ + ../print-internal.h \ + statusline.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + pagesel.h +xm_prefs_appearance.o: \ + xm_prefs_appearance.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - message-window.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + ../my-snprintf.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + message-window.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h xm_prefsP.h xm_prefs.h \ - xm_prefs_appearance.h xm_prefs_fonts.h xm_prefs_helpers.h \ - xm_prefs_page.h xm_prefs_scroll.h ../dvi-draw.h ../search-internal.h \ - search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h \ - print-dialog.h statusline.h xm_toolbar.h xm_menu.h menu.h xaw_menu.h \ - pagesel.h -xm_prefs_fonts.o: xm_prefs_fonts.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + xm_toolbar.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + statusline.h \ + pagesel.h \ + xm_prefsP.h \ + xm_prefs_appearance.h +xm_prefs_fonts.o: \ + xm_prefs_fonts.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../hypertex.h ../my-snprintf.h \ - xm_prefsP.h xm_prefs_fonts.h -xm_prefs_helpers.o: xm_prefs_helpers.c ../xdvi-config.h ../c-auto.h \ - ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + ../hypertex.h \ + ../my-snprintf.h \ + xm_prefsP.h \ + xm_prefs_fonts.h +xm_prefs_helpers.o: \ + xm_prefs_helpers.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../string-utils.h \ - ../my-vsnprintf.h message-window.h xm_menu.h menu.h xaw_menu.h \ - xm_prefsP.h xm_prefs.h xm_prefs_helpers.h -xm_prefs_page.o: xm_prefs_page.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + ../util.h \ + ../string_list.h \ + message-window.h \ + ../events.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + xm_prefsP.h \ + xm_prefs.h \ + xm_prefs_helpers.h +xm_prefs_page.o: xm_prefs_page.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h statusline.h xm_prefsP.h \ - xm_prefs_page.h ../my-snprintf.h -xm_prefs_scroll.o: xm_prefs_scroll.c ../xdvi-config.h ../c-auto.h \ - ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + statusline.h \ + xm_prefsP.h \ + xm_prefs_page.h \ + ../my-snprintf.h +xm_prefs_scroll.o: \ + xm_prefs_scroll.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - ../x_util.h xm_colorsel.h topic-window.h \ - ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h \ + xm_colorsel.h \ + topic-window.h \ + ../version.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ $(kpathsea_srcdir)/tex-file.h \ - ../events.h ../dvi-init.h statusline.h \ - xm_prefsP.h xm_prefs_scroll.h ../my-snprintf.h -xm_toolbar.o: xm_toolbar.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ - ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ - $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ - $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../events.h \ + ../dvi-init.h \ + statusline.h \ + xm_prefsP.h \ + xm_prefs_scroll.h \ + ../my-snprintf.h +xm_toolbar.o: xm_toolbar.c \ + ../xdvi-config.h \ + $(kpathsea_dir)/c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h \ $(kpathsea_srcdir)/c-errno.h \ - $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ - $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ - $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ $(kpathsea_srcdir)/c-pathmx.h \ $(kpathsea_srcdir)/c-dir.h \ $(kpathsea_srcdir)/c-vararg.h \ - pagesel.h help-window.h message-window.h \ - $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/expand.h statusline.h \ - ../dvi-init.h ../events.h ../dvi-draw.h xm_menu.h menu.h xaw_menu.h \ - xm_toolbar.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/c-fopen.h \ + pagesel.h \ + help-window.h \ + message-window.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/expand.h \ + statusline.h \ + ../dvi-init.h \ + ../events.h \ + ../dvi-draw.h \ + xm_menu.h \ + menu.h \ + xaw_menu.h \ + xm_toolbar.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ $(kpathsea_srcdir)/hash.h \ - ../x_util.h Tip.h \ - ../c-openmx.h ../pixmaps/toolbar.xpm + $(kpathsea_srcdir)/tex-file.h \ + ../events.h \ + ../x_util.h \ + Tip.h \ + ../c-openmx.h \ + ../pixmaps/toolbar.xpm diff --git a/Build/source/texk/xdvik/gui/depend.mk.orig b/Build/source/texk/xdvik/gui/depend.mk.orig new file mode 100644 index 00000000000..7b968b7c351 --- /dev/null +++ b/Build/source/texk/xdvik/gui/depend.mk.orig @@ -0,0 +1,559 @@ +Panner.o: Panner.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h ../my-vsnprintf.h +Tip.o: Tip.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + Tip.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h +help-window.o: help-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + message-window.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../x_util.h ../string-utils.h \ + ../my-vsnprintf.h topic-window.h help-window.h +mag.o: mag.c \ + ../xdvi-config.h ../c-auto.h \ + ../c-openmx.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/systypes.h \ + ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h ../dvi-draw.h ../dvi-init.h statusline.h ../hypertex.h \ + mag.h xm_toolbar.h xm_menu.h menu.h xaw_menu.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + pagesel.h +menu.o: menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h menu.h xm_menu.h xaw_menu.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h +message-window.o: message-window.c \ + ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../string-utils.h ../my-vsnprintf.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../x_util.h message-window.h +pagesel.o: pagesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + xm_toolbar.h xm_menu.h menu.h ../events.h xaw_menu.h ../x_util.h \ + message-window.h pagesel.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../string-utils.h ../my-vsnprintf.h \ + ../dvi-init.h statusline.h print-dialog.h ../print-internal.h \ + ../search-internal.h search-dialog.h ../dvisel.h ../pagehist.h +print-dialog.o: print-dialog.c \ + ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../my-vsnprintf.h print-dialog.h \ + ../print-internal.h ../dvi-init.h print-log.h ../events.h \ + ../string-utils.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../x_util.h message-window.h pagesel.h \ + ../my-snprintf.h sfSelFile.h ../dvisel.h xlwradio.h statusline.h \ + search-dialog.h ../search-internal.h ../special.h +print-log.o: print-log.c \ + ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + print-dialog.h ../print-internal.h ../dvi-init.h print-log.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../string-utils.h \ + ../my-vsnprintf.h ../x_util.h xlwradio.h +search-dialog.o: search-dialog.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h ../dvi-init.h search-dialog.h ../search-internal.h \ + ../dvisel.h ../print-internal.h xlwradio.h statusline.h \ + ../string-utils.h ../my-vsnprintf.h ../string_list.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + message-window.h ../x_util.h xm_menu.h menu.h \ + xaw_menu.h +selection.o: selection.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../events.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../encodings.h message-window.h selection.h \ + statusline.h +sfDir.o: sfDir.c ../xdvi-config.h ../c-auto.h sfDir.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-stat.h +sfDraw.o: sfDraw.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-stat.h \ + ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + sfDraw.h \ + sfDir.h sfPath.h +sfPath.o: sfPath.c ../xdvi-config.h ../c-auto.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-stat.h \ + ../xdvi.h ../xdvi-debug.h ../version.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + sfDir.h \ + sfDraw.h sfPath.h sfSelFile.h +sfSelFile.o: sfSelFile.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../dvi-init.h message-window.h $(kpathsea_srcdir)/c-stat.h \ + sfDir.h sfPath.h \ + sfDraw.h sfSelFile.h ../util.h $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xlwradio.h ../x_util.h +statusline.o: statusline.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + statusline.h xm_menu.h menu.h ../events.h xaw_menu.h ../x_util.h \ + ../pagehist.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../my-vsnprintf.h +topic-window.o: topic-window.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + topic-window.h ../string-utils.h \ + ../my-vsnprintf.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../x_util.h +xaw_bitmaps.o: xaw_bitmaps.c xaw_bitmaps.h +xaw_menu.o: xaw_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../c-openmx.h ../events.h ../dvi-draw.h ../dvi-init.h statusline.h \ + pagesel.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../x_util.h xaw_menu.h menu.h xm_menu.h \ + message-window.h ../my-snprintf.h ../filehist.h +xicon.o: xicon.c ../xdvi-config.h ../c-auto.h ../xdvi.h ../xdvi-debug.h \ + ../version.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + xicon.h \ + ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h \ + ../xdvi.icon ../pixmaps/xdvi32x32.xpm ../pixmaps/xdvi16x16.xpm \ + ../pixmaps/xdvi48x48.xpm +xlwradio.o: xlwradio.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xaw_bitmaps.h xlwradioP.h \ + xlwradio.h +xm_colorsel.o: xm_colorsel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + Tip.h \ + ../x_util.h xm_colorsel.h xm_prefsP.h xm_prefs.h ../events.h \ + ../dvi-draw.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + topic-window.h ../search-internal.h \ + search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h +xm_filesel.o: xm_filesel.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + sfSelFile.h ../dvi.h ../string-utils.h ../my-vsnprintf.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h message-window.h ../dvi-init.h \ + ../x_util.h +xm_menu.o: xm_menu.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + xm_menu.h \ + menu.h ../events.h xaw_menu.h xm_toolbar.h ../my-snprintf.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../x_util.h statusline.h ../pagehist.h \ + ../dvi-init.h ../filehist.h ../c-openmx.h message-window.h +xm_prefs.o: xm_prefs.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h message-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xm_prefsP.h xm_prefs.h \ + xm_prefs_appearance.h xm_prefs_fonts.h xm_prefs_helpers.h \ + xm_prefs_page.h xm_prefs_scroll.h ../dvi-draw.h ../search-internal.h \ + search-dialog.h ../dvisel.h ../dvi-init.h ../print-internal.h \ + statusline.h xm_toolbar.h xm_menu.h menu.h xaw_menu.h pagesel.h +xm_prefs_appearance.o: xm_prefs_appearance.c ../xdvi-config.h ../c-auto.h \ + ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h ../my-snprintf.h xm_colorsel.h topic-window.h \ + message-window.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h xm_toolbar.h xm_menu.h menu.h \ + xaw_menu.h statusline.h pagesel.h xm_prefsP.h xm_prefs_appearance.h +xm_prefs_fonts.o: xm_prefs_fonts.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../hypertex.h ../my-snprintf.h \ + xm_prefsP.h xm_prefs_fonts.h +xm_prefs_helpers.o: xm_prefs_helpers.c ../xdvi-config.h ../c-auto.h \ + ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../string-utils.h \ + ../my-vsnprintf.h ../string_list.h message-window.h xm_menu.h menu.h \ + xaw_menu.h xm_prefsP.h xm_prefs.h xm_prefs_helpers.h +xm_prefs_page.o: xm_prefs_page.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h statusline.h xm_prefsP.h \ + xm_prefs_page.h ../my-snprintf.h +xm_prefs_scroll.o: xm_prefs_scroll.c ../xdvi-config.h ../c-auto.h \ + ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + ../x_util.h xm_colorsel.h topic-window.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../events.h ../dvi-init.h statusline.h \ + xm_prefsP.h xm_prefs_scroll.h ../my-snprintf.h +xm_toolbar.o: xm_toolbar.c ../xdvi-config.h ../c-auto.h ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + pagesel.h \ + help-window.h message-window.h $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/expand.h statusline.h ../dvi-init.h ../events.h \ + ../dvi-draw.h xm_menu.h menu.h xaw_menu.h xm_toolbar.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + ../x_util.h Tip.h \ + ../c-openmx.h ../pixmaps/toolbar.xpm diff --git a/Build/source/texk/xdvik/gui/help-window.c b/Build/source/texk/xdvik/gui/help-window.c index 8f7e6612a0e..a69f2cfb393 100644 --- a/Build/source/texk/xdvik/gui/help-window.c +++ b/Build/source/texk/xdvik/gui/help-window.c @@ -89,8 +89,8 @@ create_help_text(Widget parent, const char *name, const char *value) XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; XtSetArg(args[n], XmNwordWrap, True); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; -/* XtSetArg(args[n], XmNtopWidget, top_widget); n++; */ -/* XtSetArg(args[n], XmNtopOffset, 10); n++; */ + /* XtSetArg(args[n], XmNtopWidget, top_widget); n++; */ + /* XtSetArg(args[n], XmNtopOffset, 10); n++; */ XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; @@ -356,19 +356,9 @@ initialize_items(struct topic_info *info) " Open a new xdvi window displaying the link\n", " at the cursor position if the link is a DVI file;\n", " else, try to launch an application to view the file.\n", - "B", -#if MOTIF - ", toolbar button 9\n", -#else - "\n", -#endif + "B\n", " Go back to the previous hyperlink in the history.\n", - "F", -#if MOTIF - ", toolbar button 10\n", -#else - "\n", -#endif + "F\n", " Go forward to the next hyperlink in the history.\n", "\n", "By default, the hyperlinks are displayed in the colors \n", @@ -385,7 +375,12 @@ initialize_items(struct topic_info *info) static const char *default_help_othercommands[] = { "Other Commands\tMiscellaneous other commands\n", - "Ctrl-f\n", + "Ctrl-f", +#if MOTIF + ", toolbar button 12\n", +#else + "\n", +#endif " Opens a dialog window to search for a text string\n", " in the DVI file.\n", "\n", @@ -504,15 +499,15 @@ initialize_items(struct topic_info *info) "\n", "Ctrl-+", #if MOTIF - ", toolbar button 7\n", + ", toolbar button 9\n", #else "\n", #endif " Makes the display of the page larger (zooms in).\n", "\n", - "Ctrl-+", + "Ctrl--", #if MOTIF - ", toolbar button 8\n", + ", toolbar button 10\n", #else "\n", #endif @@ -520,7 +515,7 @@ initialize_items(struct topic_info *info) "\n", "Alt-Ctrl-+", #if MOTIF - ", toolbar button 16\n", + ", toolbar button 17\n", #else "\n", #endif @@ -528,11 +523,11 @@ initialize_items(struct topic_info *info) "\n", "Alt-Ctrl--", #if MOTIF - ", toolbar button 17\n", + ", toolbar button 18\n", #else "\n", #endif - " Makes the fonts lighter (by substracting from the gamma\n", + " Makes the fonts lighter (by subtracting from the gamma\n", " value).\n", "\n", NULL @@ -560,7 +555,7 @@ initialize_items(struct topic_info *info) " Ctrl-n: toggle mark of current page, then move one page forward,\n", " Ctrl-u: move one page back, then toggle mark of that page.\n", #if MOTIF - "- Use one of the toobar buttons 12 to 15 to toggle the marks\n", + "- Use the toobar buttons 13 to 16 to toggle the marks\n", " of odd pages, toggle the marks of even pages, toggle the mark\n", " of the current page, or unmark all pages, respectively.\n", #endif @@ -579,11 +574,21 @@ initialize_items(struct topic_info *info) static const char *default_help_pagemotion[] = { "Page Motion\tMoving around in the document\n", "\n", - "[\n", + "[", +#if MOTIF + ", toolbar button 7\n", +#else + "\n", +#endif " Moves back one item in the page history. With a prefix\n", " argument n, move back n history items.\n" "\n", - "]\n", + "]", +#if MOTIF + ", toolbar button 8\n", +#else + "\n", +#endif " Moves forward one item in the page history. With a prefix\n", " argument n, move forward n history items.\n" "\n", @@ -597,7 +602,7 @@ initialize_items(struct topic_info *info) " to the history item after the deleted one. With a prefix\n", " argument n, delete n next history items.\n", "\n", - "n or f or Space or Return or LineFeed or PgDn", + "n or f or Return or LineFeed or PgDn", #if MOTIF ", toolbar button 5\n", #else @@ -606,7 +611,10 @@ initialize_items(struct topic_info *info) " Moves to the next page (or to the nth next page if a\n", " number is given).\n", "\n", - "p or b or Ctrl-h or BackSpace or Del or PgUp", + "Space key\n", + " Moves down or to the next page.", + "\n", + "p or b or Ctrl-h or BackSpace or PgUp", #if MOTIF ", toolbar button 4\n", #else @@ -614,6 +622,9 @@ initialize_items(struct topic_info *info) #endif " Moves to the previous page (or back n pages).\n", "\n", + "Del key\n", + " Moves up on the page or to the previous page.", + "\n", "Up-arrow\n", " Scrolls page up.\n", "\n", @@ -1039,7 +1050,7 @@ show_help(Widget toplevel, const char *topic) info.ok_callback = NULL; info.cancel_callback = NULL; info.items = items; -/* info.items_size = NUM_HELP_TOPICS; */ + /* info.items_size = NUM_HELP_TOPICS; */ help_shell = create_topic_window(toplevel, "xdvik: Help", diff --git a/Build/source/texk/xdvik/gui/mag.c b/Build/source/texk/xdvik/gui/mag.c index 1df6cd92cab..21526269c6d 100644 --- a/Build/source/texk/xdvik/gui/mag.c +++ b/Build/source/texk/xdvik/gui/mag.c @@ -83,6 +83,36 @@ static int mag_conv_y = 0; static Position new_mag_x = 0; static Position new_mag_y = 0; + +/* default magnifier dimensions */ +static struct mg_size_rec { + int w; + int h; +} mg_size[] = { + {200, 150}, {400, 250}, {700, 500}, {1000, 800}, {1200, 1200} +}; + +size_t get_magglass_items(void) { + return XtNumber(mg_size); +} + +int get_magglass_width(int idx) { + return mg_size[idx].w; +} + +int get_magglass_height(int idx) { + return mg_size[idx].h; +} + +void set_magglass_widht(int idx, int w) { + mg_size[idx].w = w; +} + +void set_magglass_height(int idx, int h) { + mg_size[idx].h = h; +} + + static void can_exposures(struct WindowRec *windowrec) { @@ -134,20 +164,20 @@ mag_release(XEvent * event) over a hyperlink). Forcing a redraw with - redraw(&mane); + redraw(&mane); may cause a `BadDrawable' X error with color material (e.g. from #702288), or a `draw_part: shouldn't happen: POST encountered' error. Neither do the following work: - globals.ev.flags |= EV_EXPOSE; (doesn't fix the bug) - draw_page(); (same effect as redraw(&mane)) - globals.ev.flags |= EV_NEWPAGE; (works, but is crude and causes flicker) + globals.ev.flags |= EV_EXPOSE; (doesn't fix the bug) + draw_page(); (same effect as redraw(&mane)) + globals.ev.flags |= EV_NEWPAGE; (works, but is crude and causes flicker) So I decided to use expose() for the time being, which sets mane.min_x to the current x point (which doesn't happen with EV_EXPOSE; this causes the test for `mane.min_x < MAXDIM' to fail in events.c; look for `see comment in mag.c'). */ -/* fprintf(stderr, "========triggering expose!\n"); */ + /* fprintf(stderr, "========triggering expose!\n"); */ expose(&mane, event->xbutton.x_root, event->xbutton.y_root, 10, 10); } } @@ -220,10 +250,8 @@ draw_ticks(unsigned int width, unsigned int height, GC ourGC) The user can select the units via a resource (e.g. XDvi*tickUnits: bp), or a command-line option (e.g. -xrm '*tickUnits: cm'). The length of the ticks can be controlled by a resource (e.g. XDvi*tickLength: 10), or - a command-line option (e.g. -xrm '*tickLength: 10000'). If the tick - length exceeds the popup window size, then a graph-paper grid is drawn - over the whole window. Zero, or negative, tick length completely - suppresses rulers. */ + a command-line option (e.g. -xrm '*tickLength: 10000'). Zero, or negative, + tick length completely suppresses rulers. */ pixels_per_tick = (double)resource.pixels_per_inch; if (strcmp(resource.tick_units, "pt") == 0) @@ -395,8 +423,8 @@ do_movemag(int x, int y) compute_mag_pos(&xx, &yy); XMoveWindow(DISP, magnifier.win, xx, yy); scroll_window(&magnifier, - (x + mane_base_x) * mane.shrinkfactor - (int)magnifier.width / 2, - (y + mane_base_y) * mane.shrinkfactor - (int)magnifier.height / 2); + (x + mane_base_x) * mane.shrinkfactor - (int)magnifier.width / 2, + (y + mane_base_y) * mane.shrinkfactor - (int)magnifier.height / 2); draw_ticks(magnifier.width, magnifier.height, globals.gc.ruler); } @@ -479,7 +507,7 @@ show_distance_from_ruler(XEvent *event, Boolean to_stdout) precision, 0.000, resource.tick_units)); } else { - statusline_print(STATUS_FOREVER, + statusline_info(STATUS_FOREVER, "Ruler/Point: %d,%d, dx: %.*f %s, dy: %.*f %s, dt: %.*f %s", loc_x, loc_y, precision, 0.000, resource.tick_units, @@ -502,7 +530,7 @@ show_distance_from_ruler(XEvent *event, Boolean to_stdout) precision, unit_z, resource.tick_units)); } else { - statusline_print(STATUS_FOREVER, + statusline_info(STATUS_FOREVER, "Ruler: %d,%d, Point: %d,%d, dx: %.*f %s, dy: %.*f %s, dr: %.*f %s", g_ruler_pos_x, g_ruler_pos_y, loc_x, loc_y, precision, unit_x, resource.tick_units, @@ -525,47 +553,6 @@ move_magnifier(void) do_movemag(new_mag_x, new_mag_y); } -static void -Act_href(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - int x, y; - Window dummy; - - UNUSED(w); - UNUSED(num_params); - UNUSED(params); - - if (resource.mouse_mode == MOUSE_RULER_MODE) - return; - - (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, - event->xkey.x, event->xkey.y, &x, &y, &dummy); - if (htex_handleref(x, y, False)) { - block_next_mouse_event(); - } -} - -static void -Act_href_newwindow(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - int x, y; - Window dummy; - - UNUSED(w); - UNUSED(num_params); - UNUSED(params); - - if (resource.mouse_mode == MOUSE_RULER_MODE) - return; - - (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win, - event->xkey.x, event->xkey.y, &x, &y, &dummy); - if (htex_handleref(x, y, True)) { - block_next_mouse_event(); - } -} void clear_ruler(void) @@ -627,114 +614,15 @@ redraw_ruler(void) draw_ruler(g_ruler_pos_x, g_ruler_pos_y); } -void -drag_ruler_motion(XEvent *event) -{ - int loc_x, loc_y; - if (event == NULL) { /* toggled via menu */ - /* hack to avoid redrawing ruler at last g_* positions when mode is - toggled on via menu, then off via keystroke */ - g_ruler_pos_x = g_ruler_pos_y = 0; - return; - } - - loc_x = event->xbutton.x; - loc_y = event->xbutton.y; - - if (event->xbutton.window != mane.win) { - Window dummy; - (void)XTranslateCoordinates(DISP, - RootWindowOfScreen(SCRN), mane.win, - event->xbutton.x_root, - event->xbutton.y_root, - &loc_x, - &loc_y, - &dummy); - } - - /* map everything below 0 to the origin */ - if (loc_x < 0) - loc_x = 0; - if (loc_y < 0) - loc_y = 0; - - clear_ruler(); - draw_ruler(loc_x, loc_y); - g_ruler_pos_x = loc_x; - g_ruler_pos_y = loc_y; -} - -void -drag_ruler_release(XEvent *event) -{ - UNUSED(event); - mouse_motion = mouse_release = null_mouse; -} - -/**************************************************************************** - * Actions specific to the handling of the magnifier - */ - -static void -Act_magnifier(Widget w, XEvent *event, - String *params, Cardinal *num_params) +void magnifier_move(String params, XEvent *event) { - const char *p; int x, y; XSetWindowAttributes attr; #ifndef MOTIF Window throwaway; #endif - UNUSED(w); - - MYTRACE((stderr, "magnifier!\n")); - - if (block_this_mouse_event()) - return; - else if (dvi_file_changed()) { - globals.ev.flags |= EV_RELOAD; - return; - } - -#ifdef MOTIF - /* see xm_menu.c for an explanation of this */ - if (pulldown_menu_active(event->xany.serial)) { - return; - } -#endif - - if (bg_current == NULL) { - /* - HACK ALERT: we can arrive here after loading a new file via the file selector - for which not all fonts have been generated. In that case, dereferencing - bg_current would bomb. Try to recover by simply returning here. - */ - return; - } - - if (resource.mouse_mode == MOUSE_RULER_MODE && event->xbutton.button == 1) { - show_ruler(event); - XDefineCursor(DISP, CURSORWIN, globals.cursor.rule); - show_distance_from_ruler(event, False); - return; - } - else if (resource.mouse_mode == MOUSE_TEXT_MODE && event->xbutton.button == 1) { - text_selection_start(event); - text_motion(event); - return; - } + const char *p = params; - if (event->type != ButtonPress || mouse_release != null_mouse - || magnifier.win != (Window)0 || mane.shrinkfactor == 1 || *num_params != 1) { - XBell(DISP, 0); - if (mane.shrinkfactor == 1) { - statusline_print(STATUS_SHORT, - "No magnification available at shrink factor 1"); - } - return; - } - - p = *params; if (*p == '*') { int n = atoi(p + 1) - 1; @@ -763,9 +651,6 @@ Act_magnifier(Widget w, XEvent *event, 0, 0, &mag_conv_x, &mag_conv_y, &throwaway); #endif - globals.cursor.flags |= CURSOR_MAG; - globals.ev.flags |= EV_CURSOR; - mag_x = event->xbutton.x + mag_conv_x; mag_y = event->xbutton.y + mag_conv_y; main_x = event->xbutton.x_root - mag_x; @@ -806,46 +691,64 @@ Act_magnifier(Widget w, XEvent *event, if (!resource.delay_rulers) draw_ticks(magnifier.width, magnifier.height, globals.gc.ruler); + globals.cursor.flags |= CURSOR_MAG; + globals.ev.flags |= EV_CURSOR; + magnifier_stat = 1; /* waiting for exposure */ mouse_motion = mag_motion; mouse_release = mag_release; } -static void -Act_switch_magnifier_units(Widget w, XEvent *event, - String *params, Cardinal *num_params) +void +drag_ruler_motion(XEvent *event) { - size_t k = 0; - static char *TeX_units[] = { - "mm", "pt", "in", "sp", "bp", "cc", "dd", "pc", "px", - }; - - UNUSED(w); - UNUSED(event); - UNUSED(params); - UNUSED(num_params); - - for (k = 0; k < XtNumber(TeX_units); ++k) - if (strcmp(resource.tick_units, TeX_units[k]) == 0) - break; - k++; - if (k >= XtNumber(TeX_units)) - k = 0; - resource.tick_units = TeX_units[k]; - if (resource.mouse_mode != MOUSE_RULER_MODE) { - statusline_print(STATUS_SHORT, "Ruler units: %s\n", resource.tick_units); + int loc_x, loc_y; + if (event == NULL) { /* toggled via menu */ + /* hack to avoid redrawing ruler at last g_* positions when mode is + toggled on via menu, then off via keystroke */ + g_ruler_pos_x = g_ruler_pos_y = 0; + return; } - else { - show_distance_from_ruler(event, False); + + loc_x = event->xbutton.x; + loc_y = event->xbutton.y; + + if (event->xbutton.window != mane.win) { + Window dummy; + (void)XTranslateCoordinates(DISP, + RootWindowOfScreen(SCRN), mane.win, + event->xbutton.x_root, + event->xbutton.y_root, + &loc_x, + &loc_y, + &dummy); } + + /* map everything below 0 to the origin */ + if (loc_x < 0) + loc_x = 0; + if (loc_y < 0) + loc_y = 0; + + clear_ruler(); + draw_ruler(loc_x, loc_y); + g_ruler_pos_x = loc_x; + g_ruler_pos_y = loc_y; } -XtActionsRec mag_actions[] = { - {"magnifier", Act_magnifier}, - {"do-href", Act_href}, - {"do-href-newwindow", Act_href_newwindow}, - {"switch-magnifier-units", Act_switch_magnifier_units}, -}; +void +drag_ruler_release(XEvent *event) +{ + UNUSED(event); + mouse_motion = mouse_release = null_mouse; +} + +/* XtActionsRec mag_actions[] = { */ +/* {"magnifier", Act_magnifier}, */ +/* {"do-href", Act_href}, */ +/* {"do-href-newwindow", Act_href_newwindow}, */ +/* {"switch-magnifier-units", Act_switch_magnifier_units}, */ +/* }; */ /* * This isn't creating the actual magnifier. It is created lazily on demand @@ -854,8 +757,8 @@ XtActionsRec mag_actions[] = { * application. */ -void -create_magnifier(void) -{ - XtAppAddActions(app, mag_actions, XtNumber(mag_actions)); -} +/* void */ +/* create_magnifier(void) */ +/* { */ +/* XtAppAddActions(globals.app, mag_actions, XtNumber(mag_actions)); */ +/* } */ diff --git a/Build/source/texk/xdvik/gui/mag.h b/Build/source/texk/xdvik/gui/mag.h index 608019f3ac2..f09ea35f9c6 100644 --- a/Build/source/texk/xdvik/gui/mag.h +++ b/Build/source/texk/xdvik/gui/mag.h @@ -29,6 +29,13 @@ #define MAGBORD 1 /* border size for magnifier */ + +extern size_t get_magglass_items(void); +extern int get_magglass_width(int idx); +extern int get_magglass_height(int idx); +extern void set_magglass_widht(int idx, int w); +extern void set_magglass_height(int idx, int h); + extern void show_distance_from_ruler(XEvent *event, Boolean to_stdout); extern void drag_ruler_motion(XEvent *event); extern void drag_ruler_release(XEvent *event); @@ -37,6 +44,7 @@ extern void show_ruler(XEvent *event); extern void redraw_ruler(void); extern void ruler_snap_origin(XEvent *event); +extern void magnifier_move(String params, XEvent *event); extern void mag_release(XEvent * event); extern void move_magnifier(void); extern void create_magnifier(void); diff --git a/Build/source/texk/xdvik/gui/menu.c b/Build/source/texk/xdvik/gui/menu.c index 575ef162f9b..b78210d7658 100644 --- a/Build/source/texk/xdvik/gui/menu.c +++ b/Build/source/texk/xdvik/gui/menu.c @@ -31,8 +31,6 @@ #include "menu.h" #include "util.h" -#if defined(NEW_MENU_CREATION) || defined(MOTIF) - #ifdef MOTIF # include # include @@ -74,24 +72,18 @@ set_menu_info(void *val, XtActionProc proc, Boolean (*cmp)(), struct button_info && item->elems[i].action->proc != NULL && item->elems[i].action->proc == proc && item->elems[i].action->param != NULL) { - Boolean on; + Boolean state; ASSERT(cmp != NULL, "comparison function musn't be NULL!"); - on = cmp(val, item->elems[i].action->param); + state = cmp(val, item->elems[i].action->param); #ifdef MOTIF ASSERT(item->elems[i].widget != 0, "Widget musn't be NULL!"); - XmToggleButtonSetState(item->elems[i].widget, on, False); -#else -#ifdef NEW_MENU_CREATION - ASSERT(item->elems[i].widget != 0, "Widget musn't be NULL!"); - xaw_set_button_state(item->elems + i, on); + XmToggleButtonSetState(item->elems[i].widget, state, False); #else - static Arg args = { XtNleftBitmap, (XtArgVal) 0 }; - if (on) - args.value = (XtArgVal) menu_check_bitmap; - else - args.value = (XtArgVal) menu_uncheck_bitmap; - XtSetValues(item->elems[i].widget, &args, 1); -#endif /* NEW_MENU_CREATION */ + if (item->elems[i].widget == 0) { + XDVI_WARNING((stderr, "Widget for menu `%s' is null!", item->elems[i].title)); + continue; + } + xaw_set_button_state(item->elems + i, state); #endif } if (item->elems[i].submenu != NULL) { /* invoke it recursively */ @@ -105,7 +97,7 @@ set_menu_info(void *val, XtActionProc proc, Boolean (*cmp)(), struct button_info void set_menu(void *val, XtActionProc proc, Boolean (*cmp)()) { - /* non-standard cast function ptr -> void ptr */ + /* removed following since cast from function pointer to void pointer is not supported by ANSI C */ /* TRACE_GUI((stderr, "set_menu_info: %d, %p, %p", *(int *)val, (void *)proc, (void *)cmp)); */ set_menu_info(val, proc, cmp, m_button_info); } @@ -124,14 +116,18 @@ initialize_menus(void) #endif set_menu(&use_gs, Act_set_ps, check_int); +#ifdef PS_GS set_menu(&resource.gs_alpha, Act_set_gs_alpha, check_toggle); +#endif set_menu(&resource.keep_flag, Act_set_keep_flag, check_toggle); shrinkval = resource.pixels_per_inch / mane.shrinkfactor; set_menu(&shrinkval, Act_shrink_to_dpi, check_int); set_menu(&mane.shrinkfactor, Act_set_shrink_factor, check_int); set_menu(&resource.use_tex_pages, Act_use_tex_pages, check_toggle); +#if 0 set_menu((char *)resource.paper, Act_set_paper_landscape, check_paper_landscape); set_menu((char *)resource.paper, Act_set_papersize, check_papersize); +#endif /* 0 */ set_menu(&resource.mouse_mode, Act_switch_mode, check_int); set_menu(&resource.expert_mode, Act_set_expert_mode, check_resource_expert); } @@ -162,7 +158,6 @@ add_info(struct button_info **info, buttonTypeT bt_type, char mnemonic, const char *title, const char *accelerator, struct xdvi_action *action) { -/* fprintf(stderr, "creating new item for info %p: |%s|\n", *info, title); */ size_t idx = (*info)->size++; (*info)->elems = xrealloc((*info)->elems, (*info)->size * sizeof *((*info)->elems)); (*info)->elems[idx].title = xstrdup(title); @@ -191,8 +186,6 @@ insert_items(struct button_info **info, char **items, size_t num_items, Boolean found = False; Boolean have_error = False; -/* fprintf(stderr, "------ insert_items called for |%s|, %p, |%s|\n", *items, *info, action); */ - if (*items == NULL) { /* should be a separator, which is treated as a special case since there's no menu title: */ @@ -207,7 +200,7 @@ insert_items(struct button_info **info, char **items, size_t num_items, entry_items = split_line(items[0], ENTRY_SEP, 0, entry_len, &entry_count); if (entry_count < 2) { - XDVI_WARNING((stderr, "Missing Mnemonic in button info `%s'\n", items[0])); + XDVI_WARNING((stderr, "Missing Mnemonic in button info `%s'", items[0])); entry_count++; entry_items = xrealloc(entry_items, entry_count * sizeof *entry_items); entry_items[1] = xstrdup(""); @@ -229,8 +222,6 @@ insert_items(struct button_info **info, char **items, size_t num_items, /* if it's a `leaf' in the menu hierarchy, compile the action and set the button type */ if (num_items == 1) { -/* fprintf(stderr, "button_type: |%s|\n", button_type); */ - char *fmt = strchr(entry_items[0], '$'); if (fmt != NULL && (fmt == entry_items[0] || (fmt > entry_items[0] && *(fmt - 1) != '\\')) @@ -261,7 +252,6 @@ insert_items(struct button_info **info, char **items, size_t num_items, free_items(entry_items, entry_count); if (num_items > 1 || (num_items == 1 && strcmp(button_type, "SEP") == 0)) { /* not a leaf, invoke recursivly for next level */ -/* fprintf(stderr, "invoking recursively for %d, %p\n", idx, (*info)->elems[idx].submenu); */ if ((*info)->elems[idx].submenu == NULL) { /* submenu didn't exist yet, create it */ struct button_info *new_submenu = xmalloc(sizeof *new_submenu); new_submenu->elems = NULL; @@ -309,8 +299,8 @@ parse_button_translations(struct button_info **info) size_t line_count = 0; char **line_items; line_items = split_line(curr_p, LINE_SEP, 0, line_len, &line_count); -/* fprintf(stderr, "length of line: %d; %d items\n", line_len, line_count); */ -/* show_items("LINE", line_items, line_count); */ + /* fprintf(stderr, "length of line: %d; %d items\n", line_len, line_count); */ + /* show_items("LINE", line_items, line_count); */ if (line_count != 4) { /* error */ XDVI_WARNING((stderr, "Wrong number of items (%lu) in translations line:\n\"%.*s\" " "(skipping this line).\n", @@ -323,14 +313,14 @@ parse_button_translations(struct button_info **info) size_t menu_count = 0; char **menu_items; if (menu_len == 0) { /* error */ - XDVI_WARNING((stderr, "Menu description (1st item) mustn't be empty:\n\"%.*s\" " + XDVI_WARNING((stderr, "Menu description (first item) mustn't be empty:\n\"%.*s\" " "(skipping this line).\n", (int)line_len, curr_p)); free_items(line_items, line_count); continue; } menu_items = split_line(line_items[0], MENU_SEP, 0, menu_len, &menu_count); -/* show_items(" MENU", menu_items, menu_count); */ + /* show_items(" MENU", menu_items, menu_count); */ insert_items(info, menu_items, menu_count, line_items[1], line_items[2], line_items[3]); free_items(menu_items, menu_count); @@ -343,7 +333,7 @@ parse_button_translations(struct button_info **info) /* Top-level routine: creates the pulldown menu buttons for Motif and Xaw. - For Motif, sets *globals.widgets.menu_bar to the address of the new widget created, + For Motif, sets `*menu_bar' to the address of the new widget created, for Xaw, sets *width to the width of the button panel created. */ void @@ -357,12 +347,10 @@ create_menu_buttons(Widget parent, { #ifdef MOTIF Widget menu = 0; + size_t i; #else /* MOTIF */ Widget panel = 0; - Boolean first_time = True; - int menu_depth = 0; #endif - size_t i; m_button_info = xmalloc(sizeof *m_button_info); m_button_info->elems = NULL; @@ -371,7 +359,7 @@ create_menu_buttons(Widget parent, #ifdef MOTIF *menu_bar = XmCreateMenuBar(parent, "menuBar", NULL, 0); parse_button_translations(&m_button_info); -/* menu = xm_create_menu(*menu_bar, m_button_info); */ + for (i = 0; i < m_button_info->size; i++) { menu = xm_create_menu(*menu_bar, m_button_info->elems[i].title, @@ -382,14 +370,11 @@ create_menu_buttons(Widget parent, XtVaSetValues(*menu_bar, XmNmenuHelpWidget, menu, NULL); } #else /* MOTIF */ - if (first_time) { - first_time = False; - xaw_initialize_menu_bitmaps(); - panel = xaw_create_menu_widgets(parent); - parse_button_translations(&m_button_info); - } - xaw_create_menu(m_button_info, panel, menu_depth, width); + xaw_initialize_menu_bitmaps(); + panel = xaw_create_menu_widgets(parent); + parse_button_translations(&m_button_info); + xaw_create_menu(m_button_info, panel, width); #endif /* MOTIF */ initialize_menus(); } -#endif /* NEW_MENU_CREATION || MOTIF */ + diff --git a/Build/source/texk/xdvik/gui/message-window.c b/Build/source/texk/xdvik/gui/message-window.c index 55e148daa1b..832bc80dbc7 100644 --- a/Build/source/texk/xdvik/gui/message-window.c +++ b/Build/source/texk/xdvik/gui/message-window.c @@ -1,25 +1,25 @@ /*------------------------------------------------------------ -message-window.c: message popups for xdvi. + message-window.c: message popups for xdvi. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------*/ + ------------------------------------------------------------*/ @@ -30,22 +30,22 @@ Suggested Policy for using the GUI messages: ============================================ - Use the statusline for shorter messages, a message window for more - important messages or such where you'd like to give further help info - (see the `helptext' argument of popup_message()). When in doubt, - prefer the statusline (excessive use of popup windows is a nuisance - for the user). +important messages or such where you'd like to give further help info +(see the `helptext' argument of popup_message()). When in doubt, +prefer the statusline (excessive use of popup windows is a nuisance +for the user). - Don't use any of the GUI messages to report internal workings of - the program; for important internal information, there should be a - debugging setting to print it to stderr. Use the GUI messages - only in situations such as the following: +the program; for important internal information, there should be a +debugging setting to print it to stderr. Use the GUI messages +only in situations such as the following: - - to give the user feedback on actions that (s)he initiated +- to give the user feedback on actions that (s)he initiated - - to indicate that an internal action causes a delay perceptible - by the user (as a rough guide: a delay of more than half a second) +- to indicate that an internal action causes a delay perceptible +by the user (as a rough guide: a delay of more than half a second) - - to report situations that might require new actions by the user. +- to report situations that might require new actions by the user. */ @@ -55,7 +55,7 @@ Suggested Policy for using the GUI messages: #include "xdvi.h" #include "string-utils.h" -/* Xaw specific stuff */ + /* Xaw specific stuff */ #include #include #ifdef MOTIF @@ -85,19 +85,19 @@ Suggested Policy for using the GUI messages: #include "x_util.h" #include "message-window.h" -/* have no more than MAX_POPUPS open simultaneously */ + /* have no more than MAX_POPUPS open simultaneously */ #define MAX_POPUPS 10 -/* offset for cascading popups */ + /* offset for cascading popups */ #define POPUP_OFFSET ((my_popup_num * 20)) #ifdef MOTIF -/* wrap messages after MSG_WRAP_LEN characters at whitespace */ + /* wrap messages after MSG_WRAP_LEN characters at whitespace */ #define MSG_WRAP_LEN 60 #endif -/* array of active popups: */ -static int g_popup_array[MAX_POPUPS]; + /* array of active popups: */ + static int g_popup_array[MAX_POPUPS]; static Atom WM_DELETE_WINDOW; @@ -123,27 +123,27 @@ static struct message_map { #ifdef MOTIF , XmDIALOG_QUESTION #endif - }, /* MSG_QUESTION */ + }, { "Xdvi Help" #ifdef MOTIF , XmDIALOG_INFORMATION #endif - }, /* MSG_HELP */ + }, { "Xdvi Info" #ifdef MOTIF , XmDIALOG_INFORMATION #endif - }, /* MSG_INFO */ + }, { "Xdvi Warning" #ifdef MOTIF , XmDIALOG_WARNING #endif - }, /* MSG_WARN */ + }, { "Xdvi Error" #ifdef MOTIF , XmDIALOG_ERROR #endif - }, /* MSG_ERR */ + }, }; struct ok_or_cancel_cb { @@ -304,7 +304,7 @@ help_action(Widget w, XtPointer client_data, XtPointer call_data) /* * Callback for cancel button in choice_dialog. -*/ + */ static void cancel_action(Widget w, XtPointer client_data, XtPointer call_data) { @@ -487,13 +487,13 @@ create_dialogs(popupMessageSizeHintT size, /* We also need to override the default ESC binding to use our internal housekeeping functions */ translations_str = get_string_va("#override\nosfCancel:close-popup-cancel(%d)", cnt); -/* { */ -/* XtTranslations xlats; */ -/* char *translation_str = get_string_va("osfCancel:close-popup-cancel(%d)", cnt); */ -/* xlats = XtParseTranslationTable(translation_str); */ -/* free(translation_str); */ -/* XtOverrideTranslations(new_dialog, xlats); */ -/* } */ + /* { */ + /* XtTranslations xlats; */ + /* char *translation_str = get_string_va("osfCancel:close-popup-cancel(%d)", cnt); */ + /* xlats = XtParseTranslationTable(translation_str); */ + /* free(translation_str); */ + /* XtOverrideTranslations(new_dialog, xlats); */ + /* } */ new_dialog = XtVaCreateWidget(Xdvi_MESSAGE_DIALOG_NAME, xmMessageBoxWidgetClass, new_popup_window, XmNdialogType, XmDIALOG_WARNING, /* default */ @@ -568,8 +568,8 @@ create_dialogs(popupMessageSizeHintT size, NULL); new_message_text = XtVaCreateManagedWidget("message_text", asciiTextWidgetClass, new_message_paned, -/* XtNheight, 100, */ -/* XtNwidth, 400, */ + /* XtNheight, 100, */ + /* XtNwidth, 400, */ XtNwidth, msg_w, XtNheight, msg_h, /* wrap horizontally instead of scrolling @@ -647,21 +647,8 @@ create_dialogs(popupMessageSizeHintT size, ASSERT(0, "third button not yet implemented in Xaw!!!"); } + adjust_width_to_max(new_message_ok, new_message_help, new_message_not_ok, NULL); - { /* set all buttons to same size */ - Dimension w1, w2, w3, max; - XtVaGetValues(new_message_ok, XtNwidth, &w1, NULL); - XtVaGetValues(new_message_help, XtNwidth, &w2, NULL); - XtVaGetValues(new_message_not_ok, XtNwidth, &w3, NULL); - max = w1; - if (w2 > max) - max = w2; - if (w3 > max) - max = w3; - XtVaSetValues(new_message_ok, XtNwidth, max, NULL); - XtVaSetValues(new_message_help, XtNwidth, max, NULL); - XtVaSetValues(new_message_not_ok, XtNwidth, max, NULL); - } /* if helptext argument is not-NULL, add help_action callback, else unmanage help button */ if (helptext != NULL) { @@ -744,8 +731,9 @@ internal_popup_window(Widget parent, } if (my_popup_num == MAX_POPUPS) { /* already enough popups on screen, just dump it to stderr */ - fprintf(stderr, "%s:\n", win_title); + fprintf(stderr, "%s: ", win_title); fprintf(stderr, msg_buf); + fputc('\n', stderr); /* Note: If a mad function continues to open popups, this will * stop after MAX_POPUPS, but open a new window for each * window the user pops down. Maybe we ought to do something @@ -789,7 +777,7 @@ internal_popup_window(Widget parent, before_ptr = after_ptr = testwrap; /* try to find shortest sequence before or after point to wrap at; this seems to give the most pleasing results. - */ + */ while (before_ptr > msg_buf && !isspace((int)*--before_ptr)) { before_len++; } @@ -829,7 +817,7 @@ internal_popup_window(Widget parent, } XtPopup(XtParent(dialog[my_popup_num]), XtGrabNone); -/* XtPopup(XtParent(dialog[my_popup_num]), XtGrabExclusive); */ + /* XtPopup(XtParent(dialog[my_popup_num]), XtGrabExclusive); */ #else /* MOTIF */ @@ -877,7 +865,7 @@ internal_popup_window(Widget parent, } XtPopup(popup_window[my_popup_num], XtGrabNone); -/* XtPopup(XtParent(popup_window[my_popup_num]), XtGrabExclusive); */ + /* XtPopup(XtParent(popup_window[my_popup_num]), XtGrabExclusive); */ if (XtIsManaged(message_not_ok[my_popup_num]) && XtIsManaged(message_help[my_popup_num])) { /* center the help button. This is something of a sham, since it won't survive resizing; but in general most users won't resize dialogs ;-) */ diff --git a/Build/source/texk/xdvik/gui/message-window.h b/Build/source/texk/xdvik/gui/message-window.h index 7e38197abbc..98d5815677f 100644 --- a/Build/source/texk/xdvik/gui/message-window.h +++ b/Build/source/texk/xdvik/gui/message-window.h @@ -111,24 +111,4 @@ extern Boolean raise_message_windows(void); extern Boolean is_message_window(Widget w); extern Boolean kill_message_window(Widget w); -/* XawtextScrollWhenNeeded has been ditched in Xaw7 - (e.g. Xfree >= 4.x); from the man page: - - The value XawtextScrollWhenNeeded (and whenNeeded, recognized by - the converter), is accepted for backwards compatibilty with - resource specifications written for the Xaw6 Text widget, but - ignored (effectively treated as XawtextScrollNever). - - So we're forced to use `scrollAlways' here. -*/ -#define XAW_SCROLL_ALWAYS XawtextScrollAlways - -/* the reconfig stuff has been fixed - in XFree 4.1.0, vendor release 6510 (Slackware 8.0) */ -#define BROKEN_RECONFIG (( \ - (strstr(ServerVendor(DISP), "XFree") != NULL) \ - && VendorRelease(DISP) >= 4000 \ - && VendorRelease(DISP) < 4002 \ - )) - #endif /* MESSAGE_WINDOW_H_ */ diff --git a/Build/source/texk/xdvik/gui/pagesel.c b/Build/source/texk/xdvik/gui/pagesel.c index b3db730e481..3d14e3a8426 100644 --- a/Build/source/texk/xdvik/gui/pagesel.c +++ b/Build/source/texk/xdvik/gui/pagesel.c @@ -47,22 +47,22 @@ /* BUGS: - - with Xaw, the highlighting for the selected page (XawListHighlight) - vanishes when mouse is dragged outside the widget and then released - (but the respective page is selected, which is IMHO the desired behaviour). + - with Xaw, the highlighting for the selected page (XawListHighlight) + vanishes when mouse is dragged outside the widget and then released + (but the respective page is selected, which is IMHO the desired behaviour). - - with Xaw, scrolling the list with PgUp/PgDown until the current page - gets `out of focus' should un-highlight the current page number + - with Xaw, scrolling the list with PgUp/PgDown until the current page + gets `out of focus' should un-highlight the current page number - - The ASCII-based marks are *ugly*. Pixmaps (for the marked state) - would be better. The viewer gv has one (but it's Xaw only). Some - file directory widgets like - e.g. http://ftp.xfree86.org/pub/X.Org/contrib/widgets/ListTree-3.0b3.tar.gz - also have facilities for that, but most suffer from other - inadequacies (e.g. no such ting as browseSelection) and all kinds - of bitrot ... Another alternative would be using XmContainer - (see e.g. the `filemanager' example in demos/programs/filemanagers - in the openmotif distribution), but that's available for Motif >= 2.1 only. + - The ASCII-based marks are *ugly*. Pixmaps (for the marked state) + would be better. The viewer gv has one (but it's Xaw only). Some + file directory widgets like + e.g. http://ftp.xfree86.org/pub/X.Org/contrib/widgets/ListTree-3.0b3.tar.gz + also have facilities for that, but most suffer from other + inadequacies (e.g. no such ting as browseSelection) and all kinds + of bitrot ... Another alternative would be using XmContainer + (see e.g. the `filemanager' example in demos/programs/filemanagers + in the openmotif distribution), but that's available for Motif >= 2.1 only. */ @@ -142,11 +142,11 @@ static XtActionsRec CustomListActions[] = { { "ListDragMark", xm_list_drag_mark }, }; static char *motif_custom_translations = - "#override \n" - "s : ListDragMark(ListButtonMotion)\n" - ": ListSetMark(ListButtonMotion)\n" - ": ListSetMark(ListButtonMotion)\n" - ": ListSetMark(ListButtonMotion)\n" +"#override \n" +"s : ListDragMark(ListButtonMotion)\n" +": ListSetMark(ListButtonMotion)\n" +": ListSetMark(ListButtonMotion)\n" +": ListSetMark(ListButtonMotion)\n" /* /\* "s ~m ~a : ListMyProcessBtn2(ListBeginExtend)\n" *\/ */ /* /\* "s ~m ~a : ListMyProcessBtn2(ListEndExtend)\n" *\/ */ /* /\* "~c ~s ~m ~a : ListMyProcessBtn2(ListBeginSelect)\n" *\/ */ @@ -181,12 +181,12 @@ static int xaw_maybe_scroll_pagelist(int new_page, Boolean force_recenter, int o self-made page highlighting marker: - the marker overlaps with the ordinary XawListHighlight marker; - when un-highlighting a page, 1 pixel (vertically) at the edge of - the ordinary marker is overdrawn. + when un-highlighting a page, 1 pixel (vertically) at the edge of + the ordinary marker is overdrawn. - When the XawListHighlight crosses the self-drawn rectangle, - the vertical bars remain visible, but the horizontal bars - are erased. + the vertical bars remain visible, but the horizontal bars + are erased. The hack just redraws the appropriate items whenever one of the above can happen, i.e. when the two markers are 2 or less @@ -223,8 +223,8 @@ xaw_maybe_redraw_current_marker(int idx) Position x, y; Dimension w, h; -/* fprintf(stderr, "idx: %d, high: %d; diff: %d\n", idx + MOTIF_IDX_OFFSET, g_current_highlighted, */ -/* abs(idx + MOTIF_IDX_OFFSET - g_current_highlighted)); */ + /* fprintf(stderr, "idx: %d, high: %d; diff: %d\n", idx + MOTIF_IDX_OFFSET, g_current_highlighted, */ + /* abs(idx + MOTIF_IDX_OFFSET - g_current_highlighted)); */ if (abs((idx + MOTIF_IDX_OFFSET) - g_current_highlighted) <= 2 && my_list_pos_to_bounds(LIST_WIDGET, g_current_highlighted, &x, &y, &w, &h)) { refresh_highlight_marker(LIST_WIDGET, m_page_gc.fore, x, y, w, h); @@ -260,7 +260,7 @@ long pageinfo_get_offset(int page) { ASSERT(page >= 0 && page < (int)page_info.index_size, "Page number out of range"); -/* fprintf(stderr, "offset for page %d is %ld\n", page, page_info.index[page].offset); */ + /* fprintf(stderr, "offset for page %d is %ld\n", page, page_info.index[page].offset); */ return page_info.index[page].offset; } @@ -416,11 +416,7 @@ toggle_pagelist(void) NULL); } -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.expert_mode, Act_set_expert_mode, check_resource_expert); -#else - set_show_pagelist_option(); -#endif } #endif @@ -490,14 +486,14 @@ get_page_size(void) max_page /= 10, max_pageno_len++); return MAX(min_pageno_len, max_pageno_len); - /* Plus 1 for minus symbol */ + /* Plus 1 for minus symbol */ } #if !defined(LESSTIF_VERSION) /* draw or erase highlight marker at position x, y with widht w an height h, using suitable offsets (for sake of consistency of the latter, and because of the differences Xaw/Motif, this is a separate function). - */ +*/ static void refresh_highlight_marker(Widget widget, GC gc, Position x, Position y, Dimension w, Dimension h) @@ -618,12 +614,12 @@ xaw_drag_page_callback(Widget widget, XtPointer data, XEvent *event, Boolean *co actual_idx = xaw_maybe_scroll_pagelist(idx, False, actual_idx); XawListHighlight(LIST_WIDGET, idx - MOTIF_IDX_OFFSET); -/* if (event->xany.type == ButtonRelease) { */ -/* fprintf(stderr, "1\n"); */ -/* page_history_insert(idx - MOTIF_IDX_OFFSET); */ -/* goto_page(idx - MOTIF_IDX_OFFSET, resource.keep_flag ? NULL : home); */ -/* search_signal_page_changed(); */ -/* } */ + /* if (event->xany.type == ButtonRelease) { */ + /* fprintf(stderr, "1\n"); */ + /* page_history_insert(idx - MOTIF_IDX_OFFSET); */ + /* goto_page(idx - MOTIF_IDX_OFFSET, resource.keep_flag ? NULL : home); */ + /* search_signal_page_changed(); */ + /* } */ } static void @@ -698,7 +694,7 @@ my_list_pos_to_bounds(Widget widget, int idx, Position *x, Position *y, Dimensio /* it seems that in order to support scrolling of the page list with wheel mice, we need to program this explicitly. - */ +*/ static void wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean *cont) { @@ -733,7 +729,7 @@ wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean if (button == 5) { if (current_page >= total_pages - 1) { XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Last page of DVI file"); +/* statusline_info(STATUS_SHORT, "Last page of DVI file"); */ return; } pageno++; @@ -741,22 +737,23 @@ wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean else { if (current_page == 0) { XBell(DISP, 0); - statusline_print(STATUS_SHORT, "First page of DVI file"); +/* statusline_info(STATUS_SHORT, "First page of DVI file"); */ return; } pageno--; } - goto_page(check_goto_page(pageno), resource.keep_flag ? NULL : home, False); + goto_page(check_goto_page(pageno, True), resource.keep_flag ? NULL : home, False); search_signal_page_changed(); #endif } + statusline_erase("Page history:"); } #if !defined(LESSTIF_VERSION) /* draw a hightlight rectangle around the page the mouse is currently over, to make e.g. marking easier. - */ +*/ static void highlight_page_callback(Widget widget, XtPointer data, XEvent *event, Boolean *cont) { @@ -775,7 +772,7 @@ highlight_page_callback(Widget widget, XtPointer data, XEvent *event, Boolean *c /* might need to un-highlight previous one */ if (idx_bak >= 0 && idx_bak != curr_idx && my_list_pos_to_bounds(widget, idx_bak, &x, &y, &w, &h)) { -/* fprintf(stderr, "index: %d, %d, h: %d, w: %d\n", x, y, h, w); */ + /* fprintf(stderr, "index: %d, %d, h: %d, w: %d\n", x, y, h, w); */ refresh_highlight_marker(widget, m_page_gc.back, x, y, w, h); #if REDRAW_CURRENT_MARKER_HACK xaw_maybe_redraw_highlight(curr_idx); @@ -840,6 +837,7 @@ select_page_callback(Widget w, XtPointer closure, XtPointer call_data) maybe_scroll_pagelist(new, False); page_history_insert(new); goto_page(new, resource.keep_flag ? NULL : home, False); + statusline_erase("Page history:"); #endif search_signal_page_changed(); } @@ -896,7 +894,7 @@ xm_get_bottom_visible(int start) bot_visible. List is always scrolled so that 1 element is still visible below or above pointer, to make it possible to flip through document by repeatedly clicking on first/last. - */ +*/ static void xm_maybe_scroll_pagelist(int current, saveCmdT curr_cmd, int *top_visible, int *bot_visible) { @@ -957,7 +955,7 @@ xm_toggle_label(Widget widget, int idx, Boolean update) UNUSED(update); -/* ensure_labelinfo_size(idx); */ + /* ensure_labelinfo_size(idx); */ ASSERT(idx < (int)page_info.index_size, ""); if (!page_info.index[idx].marked) { sprintf(buf, pageno_format, '*', page_info.page_labels[idx]); @@ -969,7 +967,7 @@ xm_toggle_label(Widget widget, int idx, Boolean update) mark_font = "UNMARKED"; page_info.index[idx].marked = False; } -/* str = XmStringCreateLocalized(buf); */ + /* str = XmStringCreateLocalized(buf); */ str = XmStringCreateLtoR(buf, mark_font); XmListReplaceItemsPos(widget, &str, 1, idx + MOTIF_IDX_OFFSET); XmStringFree(str); @@ -988,13 +986,8 @@ mark_page_callback(Widget w, XtPointer data, XEvent *event, Boolean *cont) if (event->type == MotionNotify || event->xbutton.button == Button2) internal_process_button2(w, event); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } - + if (event->type != ButtonPress) + notify_print_dialog_have_marked(); } void @@ -1060,10 +1053,10 @@ xaw_toggle_label(Widget w, int idx, Boolean update) if (w == NULL) return; -/* ensure_labelinfo_size(idx); */ + /* ensure_labelinfo_size(idx); */ ASSERT(idx < (int)page_info.index_size, ""); if (!page_info.index[idx].marked) { -/* sprintf(toc[idx], "* %*d ", get_page_size(), page_index[idx].number); */ + /* sprintf(toc[idx], "* %*d ", get_page_size(), page_index[idx].number); */ sprintf(page_info.page_labels[idx], pageno_format, '*', get_page_size(), resource.use_tex_pages ? page_info.index[idx].number : idx + 1); page_info.index[idx].marked = True; @@ -1071,7 +1064,7 @@ xaw_toggle_label(Widget w, int idx, Boolean update) else { sprintf(page_info.page_labels[idx], pageno_format, ' ', get_page_size(), resource.use_tex_pages ? page_info.index[idx].number : idx + 1); -/* sprintf(toc[idx], " %*d ", get_page_size(), page_index[idx].number); */ + /* sprintf(toc[idx], " %*d ", get_page_size(), page_index[idx].number); */ page_info.index[idx].marked = False; } @@ -1091,14 +1084,14 @@ xaw_maybe_scroll_pagelist(int new_page, Boolean force_recenter, int idx_bak) if (LIST_WIDGET == NULL || (resource.expert_mode & XPRT_SHOW_BUTTONS) == 0) return idx_bak; -/* if (list_clip == 0) { */ -/* list_clip = XtNameToWidget(viewport, "clip"); */ -/* } */ -/* if (XtIsRealized(list_clip)) */ -/* XtVaGetValues(list_clip, XtNheight, &clip_height, XtNx, &cx, XtNy, &y1, NULL); */ + /* if (list_clip == 0) { */ + /* list_clip = XtNameToWidget(viewport, "clip"); */ + /* } */ + /* if (XtIsRealized(list_clip)) */ + /* XtVaGetValues(list_clip, XtNheight, &clip_height, XtNx, &cx, XtNy, &y1, NULL); */ if (viewport != NULL && XtIsRealized(viewport)) XtVaGetValues(viewport, XtNheight, &view_height, XtNx, &x, NULL); -/* fprintf(stderr, "diff: %d, %d, %d, %d, %d\n", cx - x, clip_height, view_height, y1, (int)y2); */ + /* fprintf(stderr, "diff: %d, %d, %d, %d, %d\n", cx - x, clip_height, view_height, y1, (int)y2); */ xaw_get_row_height(LIST_WIDGET, &row_height, &internal_height); y = row_height * new_page; @@ -1150,13 +1143,12 @@ toggle_label(Widget widget, int idx, Boolean update) void list_toggle_marks(int arg) { - int i; if (arg < 0) { /* mark all */ for (i = 0; i < total_pages; i++) { ASSERT(i < (int)page_info.index_size, ""); -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (!page_info.index[i].marked) { toggle_label(LIST_WIDGET, i, False); } @@ -1165,7 +1157,7 @@ list_toggle_marks(int arg) else if (arg == 0) { /* unmark all */ for (i = 0; i < total_pages; i++) { ASSERT(i < (int)page_info.index_size, ""); -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (page_info.index[i].marked) { toggle_label(LIST_WIDGET, i, False); } @@ -1184,6 +1176,7 @@ list_toggle_marks(int arg) #ifndef MOTIF xaw_update_list(); #endif + notify_print_dialog_have_marked(); } static Boolean PagelistInitialized = False; @@ -1194,20 +1187,20 @@ handle_pagelist_resize(void) { /* TODO: the following will mess up the geometry of the list (doesn't increase height, and incrementally decreases width): - if (list_widget) { - Dimension height; - --- without the (un)manage, I get an X Error: - XtMakeGeometryRequest - parent has no geometry manager - --- - XtUnmanageChild(viewport); - XtUnmanageChild(LIST_WIDGET); - XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); - height -= resource.btn_top_spacing + resource.btn_border_width + global_y_pos; - XtVaSetValues(viewport, XtNheight, height, NULL); - XtManageChild(LIST_WIDGET); - XtManageChild(viewport); - } - ... so we use brute force instead: */ + if (list_widget) { + Dimension height; + --- without the (un)manage, I get an X Error: + XtMakeGeometryRequest - parent has no geometry manager + --- + XtUnmanageChild(viewport); + XtUnmanageChild(LIST_WIDGET); + XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); + height -= resource.btn_top_spacing + resource.btn_border_width + global_y_pos; + XtVaSetValues(viewport, XtNheight, height, NULL); + XtManageChild(LIST_WIDGET); + XtManageChild(viewport); + } + ... so we use brute force instead: */ handle_destroy_pagelist(LIST_WIDGET, NULL, NULL); create_pagelist(); } @@ -1234,7 +1227,7 @@ create_pagelist(void) Pixel background, foreground; #ifdef MOTIF -/* items = xrealloc(items, sizeof *items * (total_pages + 2)); */ + /* items = xrealloc(items, sizeof *items * (total_pages + 2)); */ init_pagelabels(0, total_pages); xm_set_page_labels(); if (!PagelistInitialized) { @@ -1251,7 +1244,7 @@ create_pagelist(void) Don't use the highlighting hack with LessTif, since its XmListPosToBounds() is too broken to be usable (as of 0.93.36): - it returns generally too low values, apparently it doesn't take - XmNlistSpacing into account; + XmNlistSpacing into account; - it doesn't take scrollbar position into account. */ if (resource.pagelist_highlight_current) @@ -1317,7 +1310,7 @@ refresh_pagelist(int newsize, int newpage) fprintf(stderr, "=== refresh_pagelist: newsize %d, newpage %d\n", newsize, newpage); #endif #ifdef MOTIF -/* items = xrealloc(items, sizeof *items * (newsize + 2)); */ + /* items = xrealloc(items, sizeof *items * (newsize + 2)); */ init_pagelabels(0, newsize); xm_set_page_labels(); #else /* MOTIF */ @@ -1325,7 +1318,7 @@ refresh_pagelist(int newsize, int newpage) return; /* FIXME - is this really neccessary?? The alternative: - XawListChange(LIST_WIDGET, page_info.page_labels, newsize, 0, True); + XawListChange(LIST_WIDGET, page_info.page_labels, newsize, 0, True); has problems when freeing the page labels afterwards. */ handle_destroy_pagelist(LIST_WIDGET, NULL, NULL); @@ -1377,7 +1370,7 @@ maybe_scroll_pagelist(int newpage, Boolean force_recenter) last highlighted with our home-made `current selected' rectangle, it might overdraw that rectangle. In this case, restore it: - */ + */ xaw_maybe_redraw_current_marker(newpage); #endif #endif @@ -1389,7 +1382,7 @@ set_all_marks(int from, int to) { int i; for (i = from; i < to; i++) { -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ page_info.index[i].marked = True; toggle_label(LIST_WIDGET, i, False); } @@ -1402,12 +1395,12 @@ internal_process_button2_drag(Widget widget, XEvent *event) idx = get_item_index(widget, event->xbutton.y); for (i = 0; i < total_pages; i++) { -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (page_info.index[i].marked && i > max) max = i; } for (i = total_pages; i > 0; i--) { -/* ensure_labelinfo_size(i); */ + /* ensure_labelinfo_size(i); */ if (page_info.index[i].marked && i < min) min = i; } @@ -1536,21 +1529,16 @@ list_toggle_current(int arg) { toggle_label(LIST_WIDGET, arg, True); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } + notify_print_dialog_have_marked(); } #ifdef MOTIF static void xm_list_set_mark(Widget widget, - XEvent *event, - String *params, - Cardinal *num_params) + XEvent *event, + String *params, + Cardinal *num_params) { UNUSED(params); @@ -1559,12 +1547,8 @@ xm_list_set_mark(Widget widget, internal_process_button2(widget, event); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } + if (event->type != ButtonPress) + notify_print_dialog_have_marked(); } static void @@ -1580,12 +1564,8 @@ xm_list_drag_mark(Widget widget, internal_process_button2_drag(widget, event); - if (pageinfo_have_marked_pages()) { - notify_print_dialog_have_marked(True); - } - else { - notify_print_dialog_have_marked(False); - } + if (event->type != ButtonPress) + notify_print_dialog_have_marked(); } #endif /* MOTIF */ diff --git a/Build/source/texk/xdvik/gui/print-dialog.c b/Build/source/texk/xdvik/gui/print-dialog.c index c7187be6100..87e70a99cc1 100644 --- a/Build/source/texk/xdvik/gui/print-dialog.c +++ b/Build/source/texk/xdvik/gui/print-dialog.c @@ -21,26 +21,7 @@ */ /* - SU: Adapted from non-k xdvi's popups.c - - This implements a print popup (and a `save to file' popup). My idea - was to use the same window layout framework for both tasks, since - there's a big overlap in the widgets needed. However after looking - at the mess I've created, I'm no longer convinced this was a good - idea. (I reckon it's slightly better than the code duplication when - doing it in separate files, but only *slightly* ...) - - We need a more intelligent approach that bans this ugly kind of - `data proliferation' (those global arrays of widgets and helper - structures). Custom Widgets? Factory methods? Needs investigation. - - Also, in the long run, I guess we want the `Save' window to be more - similar to the file browser (i.e. to contain a file browser e.g. - in the upper part); in that case, the code will be moved into another - module anyway. - - Moreover, the GUI code should be completely separated from the backend - code. + SU: Adapted from non-k xdvi's popups.c and added saving functionality. */ #include @@ -50,6 +31,7 @@ #include #include "print-dialog.h" +#include "print-internal.h" #include "print-log.h" #include "print-internal.h" #include "events.h" @@ -122,141 +104,50 @@ struct output_format_mapping { { NULL, FMT_NONE, NULL } }; -typedef enum printRadioT_ { - NO_PRINT_VAL = -1, - PRINT_TO_PRINTER = 1, - PRINT_TO_FILE, - SAVE_TO_FILE -} printRadioT; - - -typedef enum pageRadioT_ { - NO_PAGE_VAL = -1, - PRINT_ALL = 1, - PRINT_MARKED, - PRINT_RANGE, - SAVE_ALL, - SAVE_MARKED, - SAVE_RANGE -} pageRadioT; - -static Boolean is_print_button(pageRadioT flag) { - return (flag <= PRINT_RANGE); -} - -struct dialog_info { - char *printer_name; - char *file_name; - /* fully canonicalized filename, not visible in window, but used in error messages. - It is either NULL, or a malloc()ed buffer (which is free()d immediately before use). */ - char *expanded_filename; - char *dvips_options; - char *from_page; - char *to_page; - printRadioT print_radio; - pageRadioT range_radio; - outputFormatT output_format; -}; - -/* - global widgets, and arrays of global widgets (mosly, one - for the printing and one for the saving dialog). Needs - cleanup! -*/ - -#define FORMAT_SEL_CNT 5 - -/* top-level widgets: one for printing, one for saving to file */ -static Widget print_shell = NULL; -static Widget save_shell = NULL; - -/* global structures for saving print info between invocations */ -static struct dialog_info save_pr_info = { - NULL, NULL, NULL, NULL, NULL, NULL, NO_PRINT_VAL, NO_PAGE_VAL, FMT_NONE -}; -static struct dialog_info save_save_info = { - NULL, NULL, NULL, NULL, NULL, NULL, NO_PRINT_VAL, NO_PAGE_VAL, FMT_NONE -}; +/* Widget names that are used in callbacks ... */ +#define Xdvi_SAVE_SHELL_NAME "save_popup" +#define Xdvi_PRINT_SHELL_NAME "print_popup" -/* - these contain the currently selected values, or defaults; - used in communication between callbacks -*/ -static struct dialog_info curr_pr_info = { - NULL, NULL, NULL, NULL, NULL, NULL, PRINT_TO_PRINTER, PRINT_ALL, FMT_NONE -}; -static struct dialog_info curr_save_info = { - NULL, NULL, NULL, NULL, NULL, NULL, SAVE_TO_FILE, SAVE_ALL, FMT_NONE -}; +#define Xdvi_PAGE_RANGE_FORM_NAME "page_range_form" -static void print_precheck1(XtPointer info); -static void print_precheck2(XtPointer info); +#define Xdvi_PAGES_ALL_RADIO_NAME "pages_all" +#define Xdvi_PAGES_MARKED_RADIO_NAME "pages_marked" +#define Xdvi_PAGES_RANGE_RADIO_NAME "pages_range" -/* access methods ... */ -const char * -get_printer_options(void) -{ - return save_pr_info.printer_name; -} +#define Xdvi_PAGES_RANGE_FROM_LABEL_NAME "range_from_lab" +#define Xdvi_PAGES_RANGE_FROM_TEXT_NAME "range_from_text" +#define Xdvi_PAGES_RANGE_TO_LABEL_NAME "range_to_lab" +#define Xdvi_PAGES_RANGE_TO_TEXT_NAME "range_to_text" +#define Xdvi_PAGES_RANGE_OF_LABEL_NAME "range_of_lab" -char * -get_dvips_options(printOrSaveActionT act) -{ - if (act == FILE_PRINT) - return save_pr_info.dvips_options; - else - return save_save_info.dvips_options; -} +#define Xdvi_TO_PRINTER_NAME "to_printer" +#define Xdvi_TO_PRINTER_TEXT "printer_text" +#define Xdvi_TO_FILE_NAME "to_file" +#define Xdvi_TO_FILE_TEXT "file_text" +#define Xdvi_BROWSE_BUTTON "file_button" -#ifdef MOTIF -static Widget from_label[FILE_ALL] = { None, None }; -static Widget format_selection_option; -XmString format_selection_texts[FORMAT_SEL_CNT]; +#define Xdvi_DVIPS_OPTIONS_NAME "dvips_options_name" +#define Xdvi_DVIPS_OPTIONS_TEXT "dvips_options_text" +#define Xdvi_FORMAT_SELECTION_BUTTON_NAME "format_selection_button" -#else /* MOTIF */ +/* number of items in `format' pulldown menu */ +#define FORMAT_SEL_CNT 5 -static Widget format_selection_label; -static Widget format_selection_button; -#if 0 -static Widget format_selection_b1; -#endif -static Widget format_selection_popup; -static Widget format_selection_menu[FORMAT_SEL_CNT]; +static void print_check_page_values(struct save_or_print_info *info); +static void print_check_dvi_file(struct save_or_print_info *info); +static void print_check_target_file(XtPointer info); +#ifndef MOTIF static void xaw_print_save_act_go(Widget, XEvent *, String *, Cardinal *); +#endif /* not MOTIF */ -#endif /* MOTIF */ - -static void print_cancel(Widget, XEvent *, String *, Cardinal *); -static void save_cancel(Widget, XEvent *, String *, Cardinal *); - -static Widget to_printer_radio; -static Widget to_file_radio_or_label[FILE_ALL] = { None, None }; -static Widget to_label[FILE_ALL] = { None, None }; -static Widget of_label[FILE_ALL] = { None, None }; -static Widget range_all_radio[FILE_ALL] = { None, None }; -static Widget range_marked_radio[FILE_ALL] = { None, None }; -static Widget range_from_to_radio[FILE_ALL] = { None, None }; -static Widget cancel_button[FILE_ALL] = { None, None }; -static Widget ok_button[FILE_ALL] = { None, None }; -static Widget print_to_printer_text; -static Widget print_to_file_text[FILE_ALL] = { None, None }; -static Widget print_to_file_button[FILE_ALL] = { None, None }; -static Widget dvips_options_text[FILE_ALL] = { None, None }; -static Widget page_from_text[FILE_ALL] = { None, None }; -static Widget page_to_text[FILE_ALL] = { None, None }; - -static int print_is_active = False; /* False if window is unmanaged or not created yet, True if managed */ -static int save_is_active = False; /* False if window is unmanaged or not created yet, True if managed */ - +static void wm_cancel(Widget, XEvent *, String *, Cardinal *); static XtActionsRec print_actions[] = { #ifndef MOTIF - {"saveInternal", xaw_print_save_act_go }, - {"printInternal", xaw_print_save_act_go}, + {"xaw_print_or_save", xaw_print_save_act_go }, #endif - {"WM_print_cancel", print_cancel }, - {"WM_save_cancel", save_cancel }, + {"WM_cancel", wm_cancel }, }; /* @@ -265,27 +156,6 @@ static XtActionsRec print_actions[] = { ============================================================ */ -/* - Return the printer name, eventually followed by `-P$PRINTER', - since the `-o' option of dvips doesn't evaluate the environment - variable. -*/ -static char * -get_printer_name(void) -{ - char *printcmd, *printer; - - if (resource.dvips_printer_str != NULL && strlen(resource.dvips_printer_str) > 0) { - return xstrdup(resource.dvips_printer_str); - } - printcmd = xstrdup("lpr"); - printer = getenv("PRINTER"); - if (printer != NULL) { - printcmd = xstrcat(printcmd, " -P"); - printcmd = xstrcat(printcmd, printer); - } - return printcmd; -} /* return basename of `old_name' with `old_ext' replaced by `new_ext', in fresh memory */ static char * @@ -294,7 +164,7 @@ get_new_file_name(const char *old_name, const char *old_ext, const char *new_ext /* old_name contains the normalized DVI file name, with path and extension */ char *basename, *new_name; size_t len; - + basename = strrchr(old_name, DIR_SEPARATOR); if (basename != NULL) { @@ -308,7 +178,12 @@ get_new_file_name(const char *old_name, const char *old_ext, const char *new_ext } len = strlen(new_name); - strcpy(new_name + len - strlen(old_ext), new_ext); + if (old_ext == NULL) { + strcpy(new_name + len, new_ext); + } + else { + strcpy(new_name + len - strlen(old_ext), new_ext); + } return new_name; } @@ -334,6 +209,7 @@ get_dvips_papersize(Boolean *landscape) return NULL; papersize = xstrdup(resource.paper); + /* fprintf(stderr, "PAPERSIZE: |%s|\n", papersize); */ *landscape = False; if (papersize[strlen(papersize) - 1] == 'r') { /* landscape size */ papersize[strlen(papersize) - 1] = '\0'; @@ -343,92 +219,6 @@ get_dvips_papersize(Boolean *landscape) return papersize; } -static void -set_outfile_name(struct dialog_info *info, struct dialog_info *save_info, printOrSaveActionT act) -{ - free(info->file_name); - if (act == FILE_PRINT) { - info->file_name = get_new_file_name(globals.dvi_name, ".dvi", ".ps"); - } - else { /* saving to file */ - if (save_info->range_radio == SAVE_ALL) { - info->file_name = get_new_file_name(globals.dvi_name, ".dvi", - output_format_mapping[resource.default_saving_format].extension); - } - else { - char *tmp = xstrdup("_pp"); - tmp = xstrcat(tmp, output_format_mapping[resource.default_saving_format].extension); - - info->file_name = get_new_file_name(globals.dvi_name, ".dvi", tmp); - free(tmp); - } - } -} - -/* get initial values for dialog texts */ -static void -get_initial_dialog_values(struct dialog_info *info, printOrSaveActionT act) -{ - if (act == FILE_PRINT && info->printer_name == NULL) - info->printer_name = get_printer_name(); - - if (info->dvips_options == NULL) { - info->dvips_options = xstrdup(""); - - /* add -t option if not already present */ - if (resource.dvips_options_str != NULL - && strstr(resource.dvips_options_str, "-t ") == NULL) { - Boolean dvips_landscape = False; - char *dvips_paper_size = get_dvips_papersize(&dvips_landscape); - if (dvips_paper_size != NULL) { - info->dvips_options = xstrdup("-t "); - info->dvips_options = xstrcat(info->dvips_options, dvips_paper_size); - free(dvips_paper_size); - if (dvips_landscape) { - info->dvips_options = xstrcat(info->dvips_options, " -t landscape"); - } - } - } - - if (resource.dvips_options_str != NULL) { - if (strlen(info->dvips_options) > 0) - info->dvips_options = xstrcat(info->dvips_options, " "); - info->dvips_options = xstrcat(info->dvips_options, resource.dvips_options_str); - } - } - - if (info->from_page == NULL) { - info->from_page = xmalloc(LENGTH_OF_INT + 1); - sprintf(info->from_page, "%d", current_page + globals.pageno_correct); - } - - if (info->to_page == NULL) { - info->to_page = xmalloc(LENGTH_OF_INT + 1); - sprintf(info->to_page, "%d", current_page + globals.pageno_correct); - } -} - - -#if MOTIF -static void -set_sensitivity(int i) -{ - Boolean sensitivity; - -/* if (i == curr_pr_info.print_radio) /\* if no change *\/ */ -/* return; */ - - curr_pr_info.print_radio = i; - - sensitivity = (i == PRINT_TO_PRINTER); - XtSetSensitive(print_to_printer_text, sensitivity); - -/* sensitivity ^= (True ^ False); */ - XtSetSensitive(print_to_file_text[FILE_PRINT], !sensitivity); - XtSetSensitive(print_to_file_button[FILE_PRINT], !sensitivity); -} -#endif /* MOTIF */ - static void update_dvips_options_sensitivity(int idx, Widget top) { @@ -437,8 +227,8 @@ update_dvips_options_sensitivity(int idx, Widget top) #if MOTIF Widget dvips_options; - if (get_widget_by_name(&dvips_label, top, "dvips_options_name", True) && - get_widget_by_name(&dvips_options, top, "dvips_options_text", True)) { + if (get_widget_by_name(&dvips_label, top, Xdvi_DVIPS_OPTIONS_NAME, True) && + get_widget_by_name(&dvips_options, top, Xdvi_DVIPS_OPTIONS_TEXT, True)) { if (output_format_mapping[idx].fmt == FMT_PS || output_format_mapping[idx].fmt == FMT_PS2PDF) { XtSetSensitive(dvips_label, True); @@ -450,7 +240,7 @@ update_dvips_options_sensitivity(int idx, Widget top) } } #else - if (get_widget_by_name(&dvips_label, top, "dvips_options_name", True)) { + if (get_widget_by_name(&dvips_label, top, Xdvi_DVIPS_OPTIONS_NAME, True)) { XtSetSensitive(XtParent(dvips_label), output_format_mapping[idx].fmt == FMT_PS || output_format_mapping[idx].fmt == FMT_PS2PDF); @@ -461,118 +251,88 @@ update_dvips_options_sensitivity(int idx, Widget top) /* callbacks */ static void -select_format_cb(Widget w, XtPointer client_data, XtPointer call_data) +cb_select_format(Widget w, XtPointer client_data, XtPointer call_data) { - Widget file_text, top; - + struct save_or_print_info *info = NULL; + Widget file_text; char *filename; - int i; -#ifdef MOTIF - Widget f1, f2; - char *ptr; + int i = 0; + +#ifndef MOTIF + Widget button; + char *old_label, *new_label; + char tmp_label[1024]; +#endif - i = (int)client_data; UNUSED(call_data); - f1 = XtParent(w); - ASSERT(f1 != 0, "Parent of widget musn't be NULL!\n"); - f2 = XtParent(f1); - ASSERT(f2 != 0, "Parent of f1 musn't be NULL!\n"); - top = XtParent(f2); - ASSERT(top != 0, "Parent of f2 musn't be NULL!\n"); - - if ((file_text = XtNameToWidget(top, "*file_text")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"file_text\" widget!")); - return; - } - XtVaGetValues(file_text, XmNvalue, &filename, NULL); - if ((ptr = strrchr(filename, '.')) != NULL) { - char buf[1024]; - replace_extension(filename, output_format_mapping[i].extension, buf, sizeof buf); - XtVaSetValues(file_text, XmNvalue, buf, NULL); + +#ifdef MOTIF + i = (int)client_data; + XtVaGetValues(XtParent(w), XmNuserData, &info, NULL); + ASSERT(info != NULL, "Expected struct save_or_print_info * in XmNuserData of button!"); + + if (get_widget_by_name(&file_text, info->shell, Xdvi_TO_FILE_TEXT, True)) { + XtVaGetValues(file_text, XmNvalue, &filename, NULL); + if (strrchr(filename, '.') != NULL) { + char buf[1024]; + replace_extension(filename, output_format_mapping[i].extension, buf, sizeof buf); + XtVaSetValues(file_text, XmNvalue, buf, XmNcursorPosition, strlen(buf), NULL); + } } #else /* MOTIF */ + info = (struct save_or_print_info *)client_data; - Widget popup, button; - char *ptr1, *ptr2; - char buf[1024]; - - UNUSED(call_data); - popup = XtParent(w); - ASSERT(popup != 0, "Parent of menu musn't be NULL!\n"); - button = XtParent(popup); - ASSERT(button != 0, "Parent of popup musn't be NULL!\n"); - - top = (Widget)client_data; + if (get_widget_by_name(&file_text, info->shell, Xdvi_TO_FILE_TEXT, True) + && get_widget_by_name(&button, info->shell, Xdvi_FORMAT_SELECTION_BUTTON_NAME, True)) { - if ((file_text = XtNameToWidget(top, "*file_text")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"file_text\" widget!")); - return; - } + XtVaGetValues(file_text, XtNstring, &filename, NULL); - XtVaGetValues(file_text, XtNstring, &filename, NULL); -/* fprintf(stderr, "file text: |%s|\n", filename); */ + /* swap title strings */ + XtVaGetValues(button, XtNlabel, &old_label, NULL); + XtVaGetValues(w, XtNlabel, &new_label, NULL); + strncpy(tmp_label, old_label, sizeof tmp_label); - /* swap title strings */ - XtVaGetValues(button, XtNlabel, &ptr1, NULL); - XtVaGetValues(w, XtNlabel, &ptr2, NULL); - strncpy(buf, ptr1, sizeof buf); - - for (i = 0; output_format_mapping[i].fmt_string != NULL; i++) { - if (strcmp(ptr2, output_format_mapping[i].fmt_string) == 0) { - char buf2[1024]; - replace_extension(filename, output_format_mapping[i].extension, buf2, sizeof buf2); - XtVaSetValues(file_text, XtNstring, buf2, NULL); + /* update the filename with new format */ + for (i = 0; output_format_mapping[i].fmt_string != NULL; i++) { + if (strcmp(new_label, output_format_mapping[i].fmt_string) == 0) { + char buf[1024]; + replace_extension(filename, output_format_mapping[i].extension, buf, sizeof buf); + XtVaSetValues(file_text, XtNstring, buf, NULL); + XawTextSetInsertionPoint(file_text, strlen(buf)); - break; + break; + } } + /* format not found, complain: */ + if (output_format_mapping[i].fmt_string == NULL) { + popup_message(info->shell, + MSG_WARN, + REPORT_XDVI_BUG_TEMPLATE, + "Unrecognized string in format selector: |%s|", new_label); + } + XtVaSetValues(button, XtNlabel, new_label, NULL); + XtVaSetValues(w, XtNlabel, tmp_label, NULL); } - if (output_format_mapping[i].fmt_string == NULL) { - popup_message(get_matching_parent(w, globals.widgets.top_level, "print_popup", "save_popup", NULL), - MSG_WARN, - REPORT_XDVI_BUG_TEMPLATE, - "Unrecognized string in format selector: |%s|", ptr2); - } - XtVaSetValues(button, XtNlabel, ptr2, NULL); - XtVaSetValues(w, XtNlabel, buf, NULL); - #endif /* MOTIF */ - save_save_info.output_format = curr_save_info.output_format = output_format_mapping[i].fmt; - - update_dvips_options_sensitivity(i, save_shell); - - resource.default_saving_format = save_save_info.output_format; - set_outfile_name(&save_save_info, &curr_save_info, FILE_SAVE); -} - -static void -cb_print_cancel(Widget w, XtPointer client_data, XtPointer call_data) -{ - struct save_or_print_info *info = (struct save_or_print_info *)client_data; - UNUSED(w); - UNUSED(call_data); + update_dvips_options_sensitivity(i, info->shell); - ASSERT(info != NULL, "client_data in cb_print_cancel musn't be NULL!"); - if (info->message_popup != 0) { - kill_message_window(info->message_popup); - } - XtPopdown(print_shell); - print_is_active = False; + info->fmt = resource.default_saving_format = output_format_mapping[i].fmt; } static void -cb_save_cancel(Widget w, XtPointer client_data, XtPointer call_data) +cb_popdown(Widget w, XtPointer client_data, XtPointer call_data) { struct save_or_print_info *info = (struct save_or_print_info *)client_data; UNUSED(w); UNUSED(call_data); - ASSERT(info != NULL, "client_data in cb_save_cancel musn't be NULL!"); + ASSERT(info != NULL, "client_data in cb_popdown musn't be NULL!"); if (info->message_popup != 0) { kill_message_window(info->message_popup); } - XtPopdown(save_shell); - save_is_active = False; + /* fprintf(stderr, "Popping down shell: %p\n", (void *)info->shell); */ + XtPopdown(info->shell); } static void @@ -582,19 +342,19 @@ cb_print_or_save(Widget w, XtPointer client_data, XtPointer call_data) UNUSED(w); UNUSED(call_data); - print_precheck1((XtPointer)info); + print_check_page_values(info); } /* access from outside the module */ void cancel_saving(struct save_or_print_info *info) { - cb_save_cancel(NULL, info, NULL); + cb_popdown(NULL, info, NULL); } static void -print_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) +wm_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) { struct save_or_print_info *info = NULL; void *ptr; @@ -602,85 +362,89 @@ print_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) UNUSED(w); UNUSED(event); - ASSERT(*num_params > 0, "params in print_cancel must be > 0!"); - ASSERT(*params != NULL, "params in print_cancel mustn't be NULL!"); + ASSERT(*num_params > 0, "params in wm_cancel must be > 0!"); + ASSERT(*params != NULL, "params in wm_cancel mustn't be NULL!"); TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); sscanf(*params, "%p", &ptr); info = (struct save_or_print_info *)ptr; - cb_print_cancel(NULL, info, NULL); + cb_popdown(NULL, info, NULL); } +/* + * Callbacks to enable the corresponding radio button if the user clicks on a text field to + * edit it. This is more user-friendly than making the text field insensitive + * until the radio button has been clicked. There are 2 separate callbacks, one for + * printing vs. saving (only used when actually printing), and one for the page range. + */ static void -save_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) +text_print_vs_save_callback(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) { - struct save_or_print_info *info = NULL; - void *ptr; - - UNUSED(w); - UNUSED(event); + struct save_or_print_info *info = (struct save_or_print_info *)closure; + Widget to_printer; /* used to check where we have been called from */ + Widget radio_printer, radio_file; - ASSERT(*num_params > 0, "params in save_cancel must be > 0!"); - ASSERT(*params != NULL, "params in save_cancel mustn't be NULL!"); - - TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); - sscanf(*params, "%p", &ptr); - info = (struct save_or_print_info *)ptr; + UNUSED(ev); + UNUSED(cont); - cb_save_cancel(NULL, info, NULL); + if (get_widget_by_name(&to_printer, info->shell, Xdvi_TO_PRINTER_TEXT, True) + && get_widget_by_name(&radio_printer, info->shell, Xdvi_TO_PRINTER_NAME, True) + && get_widget_by_name(&radio_file, info->shell, Xdvi_TO_FILE_NAME, True)) { +#ifdef MOTIF + XmToggleButtonGadgetSetState(radio_printer, widget == to_printer, True); + XmToggleButtonGadgetSetState(radio_file, widget != to_printer, True); +#else + XawToggleSetCurrent(radio_printer, widget == to_printer ? (XtPointer)TO_PRINTER : (XtPointer)TO_FILE); +#endif + } } -#ifndef MOTIF - -/* - enable the `print to' button if user presses key or mouse button - inside that input field -*/ +/* This case is slightly simpler, since the callback only needs to enable + * the radio button for the page range, never disable it. + */ static void -xaw_print_handle_key(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) +text_page_range_callback(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) { - char *number; - int i; + struct save_or_print_info *info = (struct save_or_print_info *)closure; + Widget radio_all, radio_selected, radio_range; - number = (char *)closure; - i = atoi(number); - ASSERT(i == 2 || i == 3, "Button index should be 2 or 3"); - UNUSED(widget); UNUSED(ev); UNUSED(cont); + UNUSED(widget); - if (i == 2) { - XawToggleSetCurrent(to_printer_radio, (XtPointer)PRINT_TO_PRINTER); - } - else { - ASSERT(to_file_radio_or_label[FILE_PRINT] != NULL, ""); - XawToggleSetCurrent(to_file_radio_or_label[FILE_PRINT], (XtPointer)PRINT_TO_FILE); + if (get_widget_by_name(&radio_all, info->shell, Xdvi_PAGES_ALL_RADIO_NAME, True) + && get_widget_by_name(&radio_selected, info->shell, Xdvi_PAGES_MARKED_RADIO_NAME, True) + && get_widget_by_name(&radio_range, info->shell, Xdvi_PAGES_RANGE_RADIO_NAME, True)) { +#ifdef MOTIF + XmToggleButtonGadgetSetState(radio_all, False, True); + XmToggleButtonGadgetSetState(radio_selected, False, True); + XmToggleButtonGadgetSetState(radio_range, True, True); +#else + XawToggleSetCurrent(radio_all, (XtPointer)PAGE_RANGE); +#endif } } -/* - enable the `print range' button if user presses key or mouse button - inside that input field -*/ +#ifdef MOTIF + +/* Motif type callbacks for the above. */ static void -xaw_range_handle_key(Widget widget, XtPointer closure, XEvent *ev, Boolean *cont) +cb_text_print_vs_save(Widget w, XtPointer client_data, XtPointer call_data) { - printOrSaveActionT act = (printOrSaveActionT)closure; - UNUSED(widget); - UNUSED(ev); - UNUSED(cont); - - if (act == FILE_PRINT && curr_pr_info.range_radio != PRINT_RANGE) { - ASSERT(range_all_radio[act] != NULL, "button should have been initialized"); - XawToggleSetCurrent(range_all_radio[act], (XtPointer)PRINT_RANGE); - } - else if (act == FILE_SAVE && curr_save_info.range_radio != SAVE_RANGE) { - ASSERT(range_all_radio[act] != NULL, "button should have been initialized"); - XawToggleSetCurrent(range_all_radio[act], (XtPointer)SAVE_RANGE); - } + UNUSED(call_data); + /* fprintf(stderr, "************ cb_text_print_vs_save!\n"); */ + text_print_vs_save_callback(w, client_data, NULL, NULL); +} + +static void +cb_text_page_range(Widget w, XtPointer client_data, XtPointer call_data) +{ + UNUSED(call_data); + text_page_range_callback(w, client_data, NULL, NULL); } +#else /* MOTIF */ static void xaw_print_save_act_go(Widget w, XEvent *event, String *params, Cardinal *num_params) @@ -691,167 +455,89 @@ xaw_print_save_act_go(Widget w, XEvent *event, String *params, Cardinal *num_par UNUSED(w); UNUSED(event); - ASSERT(*num_params > 0, "params in search_cancel must be > 0!"); - ASSERT(*params != NULL, "params in search_cancel mustn't be NULL!"); + ASSERT(*num_params > 0, "params in xaw_print_save_act_go must be > 0!"); + ASSERT(*params != NULL, "params in xaw_print_save_act_go mustn't be NULL!"); TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); sscanf(*params, "%p", &ptr); info = (struct save_or_print_info *)ptr; - print_precheck1((XtPointer)info); + print_check_page_values(info); } -#if 0 +#endif /* MOTIF */ + static void -xaw_popup_menu_cb(Widget w, XtPointer client_data, XtPointer call_data) +cb_print_vs_save(Widget w, XtPointer client_data, XtPointer call_data) { - Position x, y; - Dimension h; - int pos_x, pos_y; - Window dummy; - - Widget popup = (Widget)client_data; - fprintf(stderr, "popup: %p\n", popup); - XtVaGetValues(w, XtNx, &x, XtNy, &y, XtNheight, &h, NULL); - fprintf(stderr, "x: %d, y: %d, h: %d\n", x, y, h); - XTranslateCoordinates(DISP, XtWindow(w), RootWindowOfScreen(SCRN), - x, y, &pos_x, &pos_y, &dummy); - XtRealizeWidget(popup); - /* WRONG - would need to use x position of its left widget ... */ - XtVaSetValues(popup, XtNx, pos_x, XtNy, pos_y + h + 1, NULL); - XtPopup(popup, XtGrabNone); -} -#endif /* 0 */ + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + Widget radio_printer, radio_file; + /* Widget file_button; */ -#endif /* not MOTIF */ + UNUSED(call_data); -static void -cb_print_vs_file(Widget w, XtPointer client_data, XtPointer call_data) -{ + if (get_widget_by_name(&radio_printer, info->shell, Xdvi_TO_PRINTER_NAME, True) + && get_widget_by_name(&radio_file, info->shell, Xdvi_TO_FILE_NAME, True)) { #ifdef MOTIF - Boolean to_printer = False, to_file = False; - if (((XmToggleButtonCallbackStruct *)call_data)->set) { - if (w == to_printer_radio) - to_printer = True; - else - to_file = True; + Widget text; - } - else { - if (w == to_printer_radio) - to_file = True; + if (radio_printer == w) { + XmToggleButtonGadgetSetState(radio_printer, True, False); + XmToggleButtonGadgetSetState(radio_file, False, False); + if (get_widget_by_name(&text, info->shell, Xdvi_TO_PRINTER_TEXT, True)) + XmProcessTraversal(text, XmTRAVERSE_CURRENT); + } + else { + XmToggleButtonGadgetSetState(radio_printer, False, False); + XmToggleButtonGadgetSetState(radio_file, True, False); + if (get_widget_by_name(&text, info->shell, Xdvi_TO_FILE_TEXT, True)) + XmProcessTraversal(text, XmTRAVERSE_CURRENT); + } +#endif + if (radio_printer == w) + info->print_target = TO_PRINTER; else - to_printer = True; + info->print_target = TO_FILE; } - - XmToggleButtonGadgetSetState(to_file_radio_or_label[FILE_PRINT], to_file, False); - XmToggleButtonGadgetSetState(to_printer_radio, to_printer, False); - - set_sensitivity((int)client_data); - XmProcessTraversal(curr_pr_info.print_radio == PRINT_TO_PRINTER - ? print_to_printer_text - : print_to_file_text[FILE_PRINT], - XmTRAVERSE_CURRENT); -#else /* MOTIF */ - int i = (int) XawToggleGetCurrent(to_printer_radio); - - UNUSED(w); - UNUSED(client_data); - UNUSED(call_data); - - /* - NOTE: Unlike non-k xdvi, we don't use set_sensitivity for the - Xaw version, since the text inside the textfield cannot be made - insensitive, so it won't be obvious to users why they cannot - change the text. Also, the page range isn't set insensitive - either. - */ - if (i != 0) - curr_pr_info.print_radio = i; -#endif /* MOTIF */ - } - - static void cb_range(Widget w, XtPointer client_data, XtPointer call_data) { - pageRadioT flag = (pageRadioT)client_data; - printOrSaveActionT act; - -#ifdef MOTIF - - Boolean sensitivity; - UNUSED(call_data); - ASSERT(flag != PRINT_MARKED || flag != SAVE_MARKED || pageinfo_have_marked_pages(), - "PRINT_MARKED or SAVE_MARKED shouldn't be togglable if there are no marked pages!"); - - if (is_print_button(flag)) { - curr_pr_info.range_radio = (int)client_data; - sensitivity = (curr_pr_info.range_radio == PRINT_RANGE); - act = FILE_PRINT; - } - else { - curr_save_info.range_radio = (int)client_data; - sensitivity = (curr_save_info.range_radio == SAVE_RANGE); - act = FILE_SAVE; - } - - /* switch off other radio buttons, switch on current one */ - XmToggleButtonGadgetSetState(range_all_radio[act], False, False); - XmToggleButtonGadgetSetState(range_marked_radio[act], False, False); - XmToggleButtonGadgetSetState(range_from_to_radio[act], False, False); - XmToggleButtonGadgetSetState(w, True, False); - - /* set from-to range to sensitive if appropriate */ - XtSetSensitive(from_label[act], sensitivity); - XtSetSensitive(page_from_text[act], sensitivity); - XtSetSensitive(to_label[act], sensitivity); - XtSetSensitive(page_to_text[act], sensitivity); - XtSetSensitive(of_label[act], sensitivity); - -#else /* MOTIF */ + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + Widget radio_all, radio_selected, radio_range; - int i; UNUSED(call_data); - if (is_print_button(flag)) { - act = FILE_PRINT; - } - else { - act = FILE_SAVE; - } - +#ifndef MOTIF UNUSED(w); +#endif - i = (int) XawToggleGetCurrent(range_all_radio[act]); - - if (i != 0) { - ASSERT(i != PRINT_MARKED || i != SAVE_MARKED || pageinfo_have_marked_pages(), - "PRINT_MARKED or SAVE_MARKED shouldn't be togglable if there are no marked pages!"); + if (get_widget_by_name(&radio_all, info->shell, Xdvi_PAGES_ALL_RADIO_NAME, True) + && get_widget_by_name(&radio_selected, info->shell, Xdvi_PAGES_MARKED_RADIO_NAME, True) + && get_widget_by_name(&radio_range, info->shell, Xdvi_PAGES_RANGE_RADIO_NAME, True)) { - if (act == FILE_PRINT) - curr_pr_info.range_radio = i; - else - curr_save_info.range_radio = i; +#ifdef MOTIF + XmToggleButtonGadgetSetState(radio_all, radio_all == w, False); + XmToggleButtonGadgetSetState(radio_selected, radio_selected == w, False); + XmToggleButtonGadgetSetState(radio_range, radio_range == w, False); +#endif } -#endif /* MOTIF */ + /* update_page_range_sensitivity(info->shell, radio_range == w); */ } static void set_filename_callback(const char *fname, void *data) { + /* fprintf(stderr, "Filename: |%s|; widget: %p\n", fname, data); */ if (fname != NULL) { Widget w = (Widget)data; - XtVaSetValues(w, #ifdef MOTIF - XmNvalue, fname, - XmNcursorPosition, strlen(fname), + XtVaSetValues(w, XmNvalue, fname, XmNcursorPosition, strlen(fname), NULL); #else - XtNstring, fname, + XtVaSetValues(w, XtNstring, fname, NULL); + XawTextSetInsertionPoint(w, strlen(fname)); #endif - NULL); } } @@ -859,735 +545,122 @@ set_filename_callback(const char *fname, void *data) static void cb_browse(Widget w, XtPointer client_data, XtPointer call_data) { -/* char *fname; */ struct save_or_print_info *info = (struct save_or_print_info *)client_data; printOrSaveActionT act = info->act; -/* Widget ret_widget; */ - Widget parent; + Widget file_text; + /* static so that we can pass its address */ + static struct filesel_callback cb[2] = { + { NULL, NULL, + "xdvik: Save to file", "Save to file:", "OK", "Cancel", + NULL, NULL, False, False, NULL, NULL }, + { NULL, NULL, + "xdvik: Print to file", "Print to file:", "OK", "Cancel", + NULL, "*.ps", False, False, NULL, NULL } + }; UNUSED(call_data); -#ifdef MOTIF - UNUSED(w); -#else + + /* switch on `to file' radio button */ if (act == FILE_PRINT) - xaw_print_handle_key(w, (XtPointer)"3", NULL, NULL); -#endif + text_print_vs_save_callback(w, (XtPointer)info, NULL, NULL); + + if (!get_widget_by_name(&file_text, info->shell, Xdvi_TO_FILE_TEXT, True)) + return; if (act == FILE_SAVE) { - static struct filesel_callback cb; /* static so that we can pass its address */ - cb.title = "Xdvi: Save to file"; - cb.prompt = "Save to file:"; - cb.ok = "OK"; - cb.cancel = "Cancel"; - cb.init_path = NULL; - cb.filemask = "*.dvi"; - cb.must_exist = False; - cb.exit_on_cancel = False; - cb.func_ptr = set_filename_callback; - cb.data = print_to_file_text[act]; - - if (!get_widget_by_name(&parent, globals.widgets.top_level, Xdvi_SAVE_SHELL_NAME, True)) - parent = globals.widgets.top_level; - XsraSelFile(parent, &cb); -/* fprintf(stderr, "done saving: return widget = %p\n", ret_widget); */ + if (resource.default_saving_format == FMT_PS) + cb[0].filemask = "*.ps"; + else if (resource.default_saving_format == FMT_PS2PDF) + cb[0].filemask = "*.pdf"; + else if (resource.default_saving_format == FMT_DVI) + cb[0].filemask = "*.dvi"; + else + cb[0].filemask = "*.txt"; + cb[0].func_ptr = set_filename_callback; + cb[0].data = file_text; + cb[0].browse_fname = xt_strdup(globals.cwd); + + /* fprintf(stderr, "==== text widget save: %p; shell: %p\n", (void *)file_text, (void *)info->shell); */ + if (cb[0].shell == NULL) + cb[0].shell = XsraSelFile(info->shell, &cb[0]); + XsraSelFilePopup(&cb[0]); + /* fprintf(stderr, "done saving: return widget = %p\n", ret_widget); */ } else { - static struct filesel_callback cb; /* static so that we can pass its address */ - cb.title = "Xdvi: Print to file"; - cb.prompt = "Print to file:"; - cb.ok = "OK"; - cb.cancel = "Cancel"; - cb.init_path = NULL; - cb.filemask = "*.ps"; - cb.must_exist = False; - cb.exit_on_cancel = False; - cb.func_ptr = set_filename_callback; - cb.data = print_to_file_text[act]; + cb[1].func_ptr = set_filename_callback; + cb[1].data = file_text; + cb[1].init_path = globals.cwd; - if (!get_widget_by_name(&parent, globals.widgets.top_level, Xdvi_PRINT_SHELL_NAME, True)) - parent = globals.widgets.top_level; - XsraSelFile(parent, &cb); -/* fname = XsraSelFile(parent, "Xdvi: Print to file", "Print to file:", */ -/* "OK", "Cancel", */ -/* NULL, */ -/* "*.ps", False, &ret_widget); */ -/* fprintf(stderr, "done printing: return widget = %p\n", ret_widget); */ + /* fprintf(stderr, "==== text widget print: %p; shell: %p\n", (void *)file_text, (void *)info->shell); */ + /* if (!get_widget_by_name(&parent, globals.widgets.top_level, Xdvi_PRINT_SHELL_NAME, True)) */ + /* parent = globals.widgets.top_level; */ + if (cb[1].shell == NULL) + cb[1].shell = XsraSelFile(info->shell, &cb[1]); + XsraSelFilePopup(&cb[1]); } - -/* if (fname != NULL) { */ -/* XtVaSetValues(print_to_file_text[act], */ -/* #ifdef MOTIF */ -/* XmNvalue, fname, XmNcursorPosition, strlen(fname), */ -/* #else */ -/* XtNstring, fname, */ -/* #endif */ -/* NULL); */ -/* } */ -/* free(fname); */ } -/* create a popup dialog for printing a DVI file OR saving pages from a DVI file */ -static Widget -create_print_or_save_window(struct save_or_print_info *info, char *ofstring) +/* create a dialog for printing OR saving */ +#ifdef MOTIF + +static void +motif_create_dialog(struct save_or_print_info *info) { printOrSaveActionT act = info->act; - Widget top_level_shell; Atom WM_DELETE_WINDOW; -#ifndef MOTIF - Widget form, paned, box; - Widget f01form, f02form; /* dummy forms to get indentation consistent */ - Widget r1form; - Widget r1label; - Widget r2form, r3form, r4form = 0; - Widget r4label; - Widget r5label; - Widget r6form; - Widget r61form; - Widget r7form; - char *str; - - XtTranslations xlats, xlats2, wm_translations; - XtAccelerators accels2; - int ddist; - - static Dimension w_avg = 220; - Dimension w_curr; + char *ptr; + char ofstring[1024]; - /* handy abbrevs */ -#define HORIZONTAL_RESIZING_NO XtNleft, XtChainLeft, XtNright, XtChainLeft -#define HORIZONTAL_RESIZING_YES XtNleft, XtChainLeft, XtNright, XtChainRight -#define VERTICAL_RESIZING_NO XtNtop, XtChainTop, XtNbottom, XtChainTop + Widget form, pane, box; + Widget print_or_save_frame, destination_label, destination_form; + Widget dvips_options_label; + Widget pages_frame, pages_label, pages_form; + Widget print_to_file_text, to_file_radio_or_label; + Widget dvips_options_text; + Widget print_to_file_button; + Widget range_marked_radio, range_from_to_radio, to_printer_radio = NULL, + print_to_printer_text = NULL, format_selection_option = NULL, + print_or_save_range_all_radio, + page_from_text, to_label, page_to_text, of_label, ok_button, cancel_button; + Widget from_label; + XmString str; + XmString format_selection_texts[FORMAT_SEL_CNT]; + XtTranslations xlats; XtAddActions(print_actions, XtNumber(print_actions)); - if (act == FILE_SAVE) { - str = get_string_va("WM_PROTOCOLS: WM_save_cancel(%p)\n" - "Escape:WM_save_cancel(%p)\n" - "q:WM_save_cancel(%p)", - info, info, info); - wm_translations = XtParseTranslationTable(str); - free(str); - } - else { - str = get_string_va("WM_PROTOCOLS: WM_print_cancel(%p)\n" - "Escape:WM_print_cancel(%p)\n" - "q:WM_print_cancel(%p)", - info, info, info); - wm_translations = XtParseTranslationTable(str); - free(str); - } - - top_level_shell = XtVaCreatePopupShell(act == FILE_SAVE ? Xdvi_SAVE_SHELL_NAME : Xdvi_PRINT_SHELL_NAME, - transientShellWidgetClass, - globals.widgets.top_level, - XtNtitle, act == FILE_SAVE ? "xdvik: Save file" : "xdvik: Print DVI file", - XtNmappedWhenManaged, False, - XtNtransientFor, globals.widgets.top_level, - XtNallowShellResize, True, - XtNtranslations, wm_translations, - NULL); - - WM_DELETE_WINDOW = XInternAtom(XtDisplay(top_level_shell), "WM_DELETE_WINDOW", False); - - paned = XtVaCreateManagedWidget(act == FILE_SAVE ? "save_paned" : "print_paned", - panedWidgetClass, top_level_shell, NULL); - - form = XtVaCreateManagedWidget("form", formWidgetClass, - paned, - XtNallowResize, True, - NULL); - XtVaGetValues(form, XtNdefaultDistance, &ddist, NULL); -/* fprintf(stderr, "form1: %ld\n", (long)form); */ - - xlats = XtParseTranslationTable(":highlight(Always)\n" - ":unhighlight()\n" - ",:set()notify()"); - - if (act == FILE_PRINT) { - str = get_string_va("Return:printInternal(%p)", info); - xlats2 = XtParseTranslationTable(str); - } - else { - str = get_string_va("Return:saveInternal(%p)", info); - xlats2 = XtParseTranslationTable(str); - } - free(str); - - if (act == FILE_PRINT) { /* selection `to printer/to file' */ - /* FIXME: set real sizes here */ -/* Dimension w_curr; */ - f01form = XtVaCreateManagedWidget("dummy_print_to_label_form", formWidgetClass, - form, - XtNresizable, True, - XtNborderWidth, 0, - /* XtNvertDistance, 10, */ - HORIZONTAL_RESIZING_YES, - NULL); - r1label = XtVaCreateManagedWidget("print_to", labelWidgetClass, - f01form, - XtNlabel, "Print to: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - NULL); - - r2form = XtVaCreateManagedWidget("print_to_printer_form", formWidgetClass, - form, - XtNresizable, True, - XtNborderWidth, 0, - XtNvertDistance, 0, - XtNfromVert, f01form, - HORIZONTAL_RESIZING_YES, - XtNallowResize, True, - NULL); - - accels2 = XtParseAcceleratorTable(",:set()notify()"); + ptr = get_string_va("#override \nosfCancel:WM_cancel(%p)", info); + xlats = XtParseTranslationTable(ptr); + free(ptr); - to_printer_radio = XtVaCreateManagedWidget("to_printer", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r2form, - XtNlabel, "Printer: ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioData, PRINT_TO_PRINTER, - XtNstate, resource.default_printing_target == PRINT_TO_PRINTER, - XtNtranslations, xlats, - XtNaccelerators, accels2, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - - XtAddCallback(to_printer_radio, XtNcallback, cb_print_vs_file, NULL); - XtInstallAccelerators(r2form, to_printer_radio); - - print_to_printer_text = XtVaCreateManagedWidget("printer_text", asciiTextWidgetClass, - r2form, - XtNwidth, w_avg, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - /* XtNresize, XawtextResizeWidth, */ - XtNfromHoriz, to_printer_radio, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - /* XtNscrollHorizontal, XawtextScrollAlways, */ - NULL); - XtOverrideTranslations(print_to_printer_text, xlats2); - XtAddEventHandler(print_to_printer_text, KeyPressMask | ButtonPressMask, False, - xaw_print_handle_key, (XtPointer)"2"); - - adjust_vertically(to_printer_radio, print_to_printer_text, ddist); - - r3form = XtVaCreateManagedWidget("print_to_file_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNvertDistance, 0, - XtNfromVert, r2form, - HORIZONTAL_RESIZING_YES, - NULL); - - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r3form, - XtNhighlightThickness, 1, - XtNborderWidth, 0, - XtNlabel, "File: ", - XtNstate, resource.default_printing_target == PRINT_TO_FILE, - XtNradioGroup, to_printer_radio, - XtNradioData, PRINT_TO_FILE, - XtNtranslations, xlats, - XtNaccelerators, accels2, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - XtAddCallback(to_file_radio_or_label[act], XtNcallback, cb_print_vs_file, NULL); - XtInstallAccelerators(r3form, to_file_radio_or_label[act]); - - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", asciiTextWidgetClass, - r3form, - XtNwidth, w_avg, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNfromHoriz, to_file_radio_or_label[act], - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(print_to_file_text[act], xlats2); - XtAddEventHandler(print_to_file_text[act], KeyPressMask | ButtonPressMask, False, - xaw_print_handle_key, (XtPointer)"3"); - } - else { /* not printing, but saving */ - int i; - Dimension max_entry_width = 0; - f01form = XtVaCreateManagedWidget("dummy_save_as_form", formWidgetClass, - form, - XtNresizable, True, - XtNborderWidth, 0, - /* XtNvertDistance, 10, */ - HORIZONTAL_RESIZING_YES, - NULL); - r1label = XtVaCreateManagedWidget("save_as", labelWidgetClass, - f01form, - XtNlabel, "Save as: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - NULL); - r1form = XtVaCreateManagedWidget("save_to_file_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, f01form, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); -/* fprintf(stderr, "formr1: %ld\n", (long)r1form); */ -#if 0 - menu_double_arrow_bitmap - = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), - RootWindowOfScreen(XtScreen(globals.widgets.top_level)), - (char *)menu_double_arrow_bits, MENU_DOUBLE_ARROW_W, MENU_DOUBLE_ARROW_H); -#endif - format_selection_label = XtVaCreateManagedWidget("format_selection_label", labelWidgetClass, - r1form, - XtNlabel, "Format: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - format_selection_button = XtVaCreateManagedWidget("format_selection_button", menuButtonWidgetClass, - r1form, - XtNmenuName, "format_selection_popup", - XtNlabel, output_format_mapping[resource.default_saving_format].fmt_string, - XtNjustify, XtJustifyLeft, - XtNborderWidth, resource.btn_border_width, - XtNfromHoriz, format_selection_label, -#if 0 - XtNhighlightThickness, 0, -#endif - NULL); -#if 0 /* Hack for arrow - menuButtonWidget cannot have a XtNrightBitmap!!! */ - format_selection_b1 = XtVaCreateManagedWidget("format_selection_b1", commandWidgetClass, - r1form, - XtNborderWidth, resource.btn_border_width, - XtNfromHoriz, format_selection_button, - XtNhorizDistance, -1, - XtNhighlightThickness, 0, - XtNbitmap, menu_double_arrow_bitmap, - NULL); - adjust_heights(format_selection_button, format_selection_b1, NULL); -#endif - format_selection_popup = XtCreatePopupShell("format_selection_popup", simpleMenuWidgetClass, - format_selection_button, -/* globals.widgets.top_level, */ - NULL, 0); -#if 0 - XtAddCallback(format_selection_b1, XtNcallback, xaw_popup_menu_cb, format_selection_popup); -#endif - for (i = 1; i < FORMAT_SEL_CNT; i++) { - char name[1024]; - Dimension curr_entry_width; - SNPRINTF(name, sizeof name, "format_selection_pulldown_%d", i); - format_selection_menu[i] = XtVaCreateManagedWidget(name, smeBSBObjectClass, - format_selection_popup, - XtNjustify, XtJustifyLeft, - XtNlabel, - i == resource.default_saving_format - ? output_format_mapping[0].fmt_string - : output_format_mapping[i].fmt_string, - NULL); - XtVaGetValues(format_selection_menu[i], XtNwidth, &curr_entry_width, NULL); - if (curr_entry_width > max_entry_width) - max_entry_width = curr_entry_width; - XtAddCallback(format_selection_menu[i], XtNcallback, select_format_cb, form); - } - XtVaSetValues(format_selection_button, XtNwidth, max_entry_width, NULL); - - r3form = XtVaCreateManagedWidget("to_file_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r1form, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", labelWidgetClass, - r3form, - XtNlabel, "File name: ", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", asciiTextWidgetClass, - r3form, - XtNwidth, w_avg, - XtNdataCompression, False, - /* XtNvertDistance, ddist + 5, */ - XtNeditType, XawtextEdit, - XtNfromHoriz, to_file_radio_or_label[act], - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(print_to_file_text[act], xlats2); - - - { /* align left edges of format selection pulldown and filename field */ - Dimension w1, w2, w_max; - XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); - XtVaGetValues(to_file_radio_or_label[act], XtNwidth, &w2, NULL); - w_max = MAX(w1, w2); - XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); - XtVaSetValues(print_to_file_text[act], XtNhorizDistance, ddist + (w_max - w2), NULL); - } - } - -#define DIST_1 8 /* FIXME */ - print_to_file_button[act] = XtVaCreateManagedWidget("file_button", commandWidgetClass, - r3form, - XtNlabel, "Browse ...", - XtNfromHoriz, print_to_file_text[act], - XtNhorizDistance, DIST_1, - /* attach to right of form, no resizing: */ - XtNleft, XtChainRight, XtNright, XtChainRight, - VERTICAL_RESIZING_NO, - NULL); - - XtVaGetValues(print_to_file_button[act], XtNwidth, &w_curr, NULL); - XtVaSetValues(print_to_file_text[act], XtNwidth, w_avg - w_curr - DIST_1 - 2, NULL); -#undef DIST_1 - - adjust_vertically(to_file_radio_or_label[act], print_to_file_text[act], ddist + 5); - adjust_vertically(print_to_file_text[act], to_file_radio_or_label[act], ddist + 5); - adjust_vertically(print_to_file_button[act], to_file_radio_or_label[act], ddist + 5); - - XtAddCallback(print_to_file_button[act], XtNcallback, cb_browse, (XtPointer)info); - - /* other dvips options */ - r4form = XtVaCreateManagedWidget("dvips_options_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r3form, - XtNvertDistance, 0, - HORIZONTAL_RESIZING_YES, - NULL); - - r4label = XtVaCreateManagedWidget("dvips_options_name", labelWidgetClass, - r4form, - XtNlabel, "Dvips Options:", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - - dvips_options_text[act] = XtVaCreateManagedWidget("dvips_options_text", asciiTextWidgetClass, - r4form, - XtNwidth, w_avg, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNfromHoriz, r4label, - HORIZONTAL_RESIZING_YES, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(dvips_options_text[act], xlats2); - - { /* align left edges of input fields */ - Dimension w1, w2, w3, w_max; - - if (act == FILE_PRINT) - XtVaGetValues(to_printer_radio, XtNwidth, &w1, NULL); - else - XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); - - XtVaGetValues(to_file_radio_or_label[act], XtNwidth, &w2, NULL); - XtVaGetValues(r4label, XtNwidth, &w3, NULL); - - w_max = MAX(MAX(w1, w2), w3); - - if (act == FILE_PRINT) - XtVaSetValues(print_to_printer_text, XtNhorizDistance, ddist + (w_max - w1), NULL); - else - XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); - - XtVaSetValues(print_to_file_text[act], XtNhorizDistance, ddist + (w_max - w2), NULL); - XtVaSetValues(dvips_options_text[act], XtNhorizDistance, ddist + (w_max - w3), NULL); - } - - /* page selection */ - - f02form = XtVaCreateManagedWidget("dummy_pages_form", formWidgetClass, - form, - XtNfromVert, r4form, - XtNresizable, True, - XtNborderWidth, 0, - /* XtNvertDistance, 10, */ - HORIZONTAL_RESIZING_NO, - NULL); - - r5label = XtVaCreateManagedWidget("range_lab", labelWidgetClass, - f02form, - XtNlabel, "Pages:", - XtNborderWidth, 0, - HORIZONTAL_RESIZING_NO, - NULL); - - r6form = XtVaCreateManagedWidget("page_range_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, f02form, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - NULL); - - accels2 = XtParseAcceleratorTable(",:set()notify()"); - range_all_radio[act] = XtVaCreateManagedWidget("range_all", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r6form, - XtNlabel, "All ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioData, act == FILE_PRINT ? PRINT_ALL : SAVE_ALL, - XtNstate, True, /* enable this button by default */ - XtNtranslations, xlats, - XtNaccelerators, accels2, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(range_all_radio[act], XtNcallback, cb_range, (XtPointer)PRINT_ALL); - else - XtAddCallback(range_all_radio[act], XtNcallback, cb_range, (XtPointer)SAVE_ALL); - XtInstallAccelerators(r6form, range_all_radio[act]); - - r61form = XtVaCreateManagedWidget("range_marked_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r6form, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - NULL); - - range_marked_radio[act] = XtVaCreateManagedWidget("range_marked", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - - r61form, - XtNlabel, "Marked ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioGroup, range_all_radio[act], - XtNradioData, act == FILE_PRINT ? PRINT_MARKED : SAVE_MARKED, - XtNtranslations, xlats, - XtNaccelerators, accels2, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(range_marked_radio[act], XtNcallback, cb_range, (XtPointer)PRINT_RANGE); - else - XtAddCallback(range_marked_radio[act], XtNcallback, cb_range, (XtPointer)SAVE_RANGE); - XtInstallAccelerators(r61form, range_marked_radio[act]); - - r7form = XtVaCreateManagedWidget("range_from_to_form", formWidgetClass, - form, - XtNborderWidth, 0, - XtNfromVert, r61form, - /* XtNvertDistance, 0, */ - XtNresizable, True, - /* HORIZONTAL_RESIZING_NO, */ - NULL); - - range_from_to_radio[act] = XtVaCreateManagedWidget("range_from_to", -#ifdef XAW - radioWidgetClass, -#else - toggleWidgetClass, -#endif - r7form, - XtNlabel, "From: ", - XtNborderWidth, 0, - XtNhighlightThickness, 1, - XtNradioGroup, range_all_radio[act], - XtNradioData, act == FILE_PRINT ? PRINT_RANGE : SAVE_RANGE, - XtNtranslations, xlats, - XtNaccelerators, accels2, - /* XtNvertDistance, 0, */ - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(range_from_to_radio[act], XtNcallback, cb_range, (XtPointer)PRINT_RANGE); - else - XtAddCallback(range_from_to_radio[act], XtNcallback, cb_range, (XtPointer)SAVE_RANGE); - XtInstallAccelerators(r7form, range_from_to_radio[act]); - - page_from_text[act] = XtVaCreateManagedWidget("range_from", asciiTextWidgetClass, - r7form, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNwidth, 50, - XtNfromHoriz, range_from_to_radio[act], - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(page_from_text[act], xlats2); - XtAddEventHandler(page_from_text[act], KeyPressMask | ButtonPressMask, False, - xaw_range_handle_key, (XtPointer)act); - - to_label[act] = XtVaCreateManagedWidget("range_to_lab", labelWidgetClass, - r7form, - XtNlabel, "to: ", - XtNborderWidth, 0, - XtNfromHoriz, page_from_text[act], - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - - page_to_text[act] = XtVaCreateManagedWidget("range_to", asciiTextWidgetClass, - r7form, - XtNdataCompression, False, - XtNeditType, XawtextEdit, - XtNwidth, 50, - XtNfromHoriz, to_label[act], - HORIZONTAL_RESIZING_NO, - VERTICAL_RESIZING_NO, - NULL); - XtOverrideTranslations(page_to_text[act], xlats2); - XtAddEventHandler(page_to_text[act], KeyPressMask | ButtonPressMask, False, - xaw_range_handle_key, (XtPointer)act); - - of_label[act] = XtVaCreateManagedWidget("range_of", labelWidgetClass, - r7form, - XtNlabel, ofstring, - XtNborderWidth, 0, - XtNresizable, True, - XtNfromHoriz, page_to_text[act], - /* HORIZONTAL_RESIZING_NO, */ - XtNleft, XtChainLeft, - VERTICAL_RESIZING_NO, - NULL); - - adjust_vertically(range_from_to_radio[act], page_from_text[act], ddist); - adjust_vertically(to_label[act], page_from_text[act], ddist); - adjust_vertically(of_label[act], page_from_text[act], ddist); - - /* box for the OK/Cancel button */ - box = XtVaCreateManagedWidget("box", formWidgetClass, - paned, - /* resizing by user isn't needed */ - XtNshowGrip, False, - XtNdefaultDistance, 6, /* some padding */ - /* resizing the window shouldn't influence this box, - * but only the pane widget - */ - XtNskipAdjust, True, - XtNaccelerators, G_accels_cr, - NULL); - - ok_button[act] = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", - commandWidgetClass, box, - XtNlabel, act == FILE_PRINT ? "Print" : "Save", - XtNaccelerators, G_accels_cr, - XtNtop, XtChainTop, - XtNbottom, XtChainBottom, - HORIZONTAL_RESIZING_NO, - NULL); - if (act == FILE_PRINT) - XtAddCallback(ok_button[act], XtNcallback, cb_print_or_save, (XtPointer)info); - else - XtAddCallback(ok_button[act], XtNcallback, cb_print_or_save, (XtPointer)info); - - XtInstallAccelerators(form, ok_button[act]); - if (act == FILE_PRINT) - XtInstallAccelerators(print_to_printer_text, ok_button[act]); - XtInstallAccelerators(print_to_file_text[act], ok_button[act]); - - cancel_button[act] = XtVaCreateManagedWidget("cancel", commandWidgetClass, - box, - XtNlabel, "Cancel", - XtNfromHoriz, ok_button[act], - XtNbottom, XtChainBottom, - XtNjustify, XtJustifyRight, - XtNleft, XtChainRight, - XtNright, XtChainRight, - NULL); - if (act == FILE_PRINT) - XtAddCallback(cancel_button[act], XtNcallback, cb_print_cancel, (XtPointer)info); + if (globals.pageno_correct == 1) + sprintf(ofstring, "of %d physical pages", total_pages); else - XtAddCallback(cancel_button[act], XtNcallback, cb_save_cancel, (XtPointer)info); - - XtManageChild(top_level_shell); - center_window(top_level_shell, globals.widgets.top_level); - XtMapWidget(top_level_shell); - XSetWMProtocols(XtDisplay(top_level_shell), XtWindow(top_level_shell), &WM_DELETE_WINDOW, 1); - - if (pageinfo_have_marked_pages()) { - XawToggleSetCurrent(range_all_radio[act], - act == FILE_PRINT ? (XtPointer)PRINT_MARKED : (XtPointer)SAVE_MARKED); - } - else if ((act == FILE_PRINT && save_pr_info.range_radio == PRINT_MARKED) - || (act == FILE_SAVE && save_save_info.range_radio == SAVE_MARKED)) { - XawToggleSetCurrent(range_all_radio[act], - act == FILE_PRINT ? (XtPointer)PRINT_ALL : (XtPointer)SAVE_ALL); - } - -#else /* not MOTIF */ - Widget form, pane, box; - Widget frame1, f1label, f1child; - Widget r4label; - Widget frame2, f2label, f2child; - XmString str; - XtTranslations xlats; - - XtAddActions(print_actions, XtNumber(print_actions)); - - if (act == FILE_SAVE) { - char *ptr = get_string_va("#override \nosfCancel:WM_save_cancel(%p)", info); - xlats = XtParseTranslationTable(ptr); - free(ptr); - } - else { - char *ptr = get_string_va("#override \nosfCancel:WM_print_cancel(%p)", info); - xlats = XtParseTranslationTable(ptr); - free(ptr); - } + sprintf(ofstring, "of %d to %d pages", globals.pageno_correct, total_pages + globals.pageno_correct - 1); - top_level_shell = XtVaCreatePopupShell(act == FILE_SAVE ? "save_popup" : "print_popup", - xmDialogShellWidgetClass, globals.widgets.top_level, - XmNtitle, act == FILE_SAVE ? "Save file" : "Print DVI file", - XmNallowShellResize, True, - XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ - XmNmappedWhenManaged, False, /* so that we can center it first */ - NULL); + info->shell = XtVaCreatePopupShell(act == FILE_SAVE ? "save_popup" : "print_popup", + xmDialogShellWidgetClass, globals.widgets.top_level, + XmNtitle, act == FILE_SAVE ? "xdvik: Save File" : "xdvik: Print File", + XmNallowShellResize, True, + XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ + XmNmappedWhenManaged, False, /* so that we can center it first */ + NULL); /* make the window manager destroy action just pop down the dialog */ - WM_DELETE_WINDOW = XmInternAtom(XtDisplay(top_level_shell), "WM_DELETE_WINDOW", False); - if (act == FILE_SAVE) - XmAddWMProtocolCallback(top_level_shell, WM_DELETE_WINDOW, cb_save_cancel, (XtPointer)info); - else - XmAddWMProtocolCallback(top_level_shell, WM_DELETE_WINDOW, cb_print_cancel, (XtPointer)info); + WM_DELETE_WINDOW = XmInternAtom(XtDisplay(info->shell), "WM_DELETE_WINDOW", False); + XmAddWMProtocolCallback(info->shell, WM_DELETE_WINDOW, cb_popdown, (XtPointer)info); + pane = XtVaCreateWidget(act == FILE_SAVE ? "save_paned" : "print_paned", - xmPanedWindowWidgetClass, top_level_shell, + xmPanedWindowWidgetClass, info->shell, /* make sashes invisible */ XmNsashWidth, 1, XmNsashHeight, 1, /* turn separator off, since it gives visual noise with the frames */ XmNseparatorOn, False, NULL); - + form = XtVaCreateWidget("form", xmFormWidgetClass, pane, @@ -1600,137 +673,138 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) if (act == FILE_PRINT) { /* First frame: print to printer or file */ - frame1 = XtVaCreateWidget("print_to_frame", xmFrameWidgetClass, form, - XmNmarginWidth, DDIST, - XmNmarginHeight, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); - + print_or_save_frame = XtVaCreateWidget("print_to_frame", xmFrameWidgetClass, form, + XmNmarginWidth, DDIST, + XmNmarginHeight, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + str = XmStringCreateLocalized("Print to:"); - f1label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, - frame1, - XmNchildType, XmFRAME_TITLE_CHILD, - XmNlabelString, str, - NULL); + destination_label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, + print_or_save_frame, + XmNchildType, XmFRAME_TITLE_CHILD, + XmNlabelString, str, + NULL); XmStringFree(str); - - f1child = XtVaCreateWidget("form", xmFormWidgetClass, frame1, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); - + + destination_form = XtVaCreateWidget("destination_form", xmFormWidgetClass, print_or_save_frame, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + str = XmStringCreateLocalized("Printer:"); - to_printer_radio = XtVaCreateManagedWidget("to_printer", - xmToggleButtonGadgetClass, f1child, + to_printer_radio = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_NAME, xmToggleButtonGadgetClass, destination_form, XmNlabelString, str, XmNindicatorType, XmONE_OF_MANY, - XmNset, resource.default_printing_target == PRINT_TO_PRINTER, + XmNset, resource.default_printing_target == TO_PRINTER, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 0, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 0, NULL); XmStringFree(str); - XtAddCallback(to_printer_radio, XmNvalueChangedCallback, cb_print_vs_file, (XtPointer)1); - + XtAddCallback(to_printer_radio, XmNvalueChangedCallback, cb_print_vs_save, (XtPointer)info); + XtOverrideTranslations(to_printer_radio, xlats); - - print_to_printer_text = XtVaCreateManagedWidget("print_text", xmTextFieldWidgetClass, - f1child, + + print_to_printer_text = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_TEXT, xmTextFieldWidgetClass, destination_form, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 0, XmNleftAttachment, XmATTACH_WIDGET, XmNrightAttachment, XmATTACH_FORM, XmNleftWidget, to_printer_radio, + /* XmNsensitive, resource.default_printing_target == TO_PRINTER, */ XTranslations, xlats, NULL); - XtAddCallback(print_to_printer_text, XmNactivateCallback, cb_print_or_save, info); + XtAddCallback(print_to_printer_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(print_to_printer_text, XmNfocusCallback, cb_text_print_vs_save, (XtPointer)info); adjust_heights(to_printer_radio, print_to_printer_text, NULL); - str = XmStringCreateLocalized("File:"); - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", xmToggleButtonGadgetClass, - f1child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, print_to_printer_text, - XmNleftAttachment, XmATTACH_FORM, - XmNset, resource.default_printing_target == PRINT_TO_FILE, - XmNleftOffset, 0, - NULL); + str = XmStringCreateLocalized("PS File:"); + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, xmToggleButtonGadgetClass, destination_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_to_printer_text, + XmNleftAttachment, XmATTACH_FORM, + XmNset, resource.default_printing_target == TO_FILE, + XmNleftOffset, 0, + NULL); XmStringFree(str); - XtAddCallback(to_file_radio_or_label[act], XmNvalueChangedCallback, cb_print_vs_file, (XtPointer)2); - + XtAddCallback(to_file_radio_or_label, XmNvalueChangedCallback, cb_print_vs_save, (XtPointer)info); + str = XmStringCreateLocalized("Browse ..."); - print_to_file_button[act] = XtVaCreateManagedWidget("file_button", xmPushButtonWidgetClass, - f1child, - XmNlabelString, str, - XmNsensitive, resource.default_printing_target == PRINT_TO_FILE, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, print_to_printer_text, - XmNrightAttachment, XmATTACH_FORM, - NULL); + print_to_file_button = XtVaCreateManagedWidget(Xdvi_BROWSE_BUTTON, xmPushButtonWidgetClass, destination_form, + XmNlabelString, str, + /* XmNsensitive, resource.default_printing_target == TO_FILE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_to_printer_text, + XmNrightAttachment, XmATTACH_FORM, + NULL); XmStringFree(str); - - XtOverrideTranslations(to_file_radio_or_label[act], xlats); - XtOverrideTranslations(print_to_file_button[act], xlats); - - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", xmTextFieldWidgetClass, - f1child, - XmNsensitive, resource.default_printing_target == PRINT_TO_FILE, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, print_to_printer_text, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, print_to_file_button[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, to_file_radio_or_label[act], - XTranslations, xlats, - NULL); - - adjust_heights(to_file_radio_or_label[act], print_to_file_button[act], print_to_file_text[act], NULL); - - XtAddCallback(print_to_file_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - XtAddCallback(print_to_file_button[act], XmNactivateCallback, cb_browse, (XtPointer)info); - - XtManageChild(f1child); - XtManageChild(frame1); - - } /* saving, not printing */ - else { - frame1 = XtVaCreateWidget("save_as_frame", xmFrameWidgetClass, - form, - XmNmarginWidth, DDIST, - XmNmarginHeight, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - + + XtOverrideTranslations(to_file_radio_or_label, xlats); + XtOverrideTranslations(print_to_file_button, xlats); + + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, xmTextFieldWidgetClass, destination_form, + /* XmNsensitive, resource.default_printing_target == TO_FILE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_to_printer_text, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, print_to_file_button, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, to_file_radio_or_label, + XTranslations, xlats, + NULL); + + adjust_heights(to_file_radio_or_label, print_to_file_button, print_to_file_text, NULL); + + XtAddCallback(print_to_file_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(print_to_file_text, XmNfocusCallback, cb_text_print_vs_save, (XtPointer)info); + XtAddCallback(print_to_file_button, XmNactivateCallback, cb_browse, (XtPointer)info); + + XtManageChild(destination_form); + XtManageChild(print_or_save_frame); + + /* initial value for printer name */ + XtVaSetValues(print_to_printer_text, + XmNvalue, info->printer_options, + XmNcursorPosition, strlen(info->printer_options), + NULL); + } + else { /* saving, not printing */ + print_or_save_frame = XtVaCreateWidget("save_as_frame", xmFrameWidgetClass, form, + XmNmarginWidth, DDIST, + XmNmarginHeight, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + NULL); + str = XmStringCreateLocalized("Save as:"); - f1label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, - frame1, - XmNchildType, XmFRAME_TITLE_CHILD, - XmNlabelString, str, - NULL); + destination_label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, print_or_save_frame, + XmNchildType, XmFRAME_TITLE_CHILD, + XmNlabelString, str, + NULL); XmStringFree(str); - f1child = XtVaCreateWidget("form", xmFormWidgetClass, frame1, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); -/* fprintf(stderr, "CHILD: 0x%x\n", (long)f1child); */ + destination_form = XtVaCreateWidget("destination_form", xmFormWidgetClass, print_or_save_frame, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + /* fprintf(stderr, "CHILD: 0x%x\n", (long)destination_form); */ str = XmStringCreateLocalized("Format:"); format_selection_texts[0] = XmStringCreateLocalized((char *)output_format_mapping[0].fmt_string); format_selection_texts[1] = XmStringCreateLocalized((char *)output_format_mapping[1].fmt_string); @@ -1738,17 +812,18 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) format_selection_texts[3] = XmStringCreateLocalized((char *)output_format_mapping[3].fmt_string); format_selection_texts[4] = XmStringCreateLocalized((char *)output_format_mapping[4].fmt_string); format_selection_option - = XmVaCreateSimpleOptionMenu(f1child, "format_selection_option", + = XmVaCreateSimpleOptionMenu(destination_form, "format_selection_option", str, 'F', resource.default_saving_format, /*initial menu selection*/ - select_format_cb, /* callback */ + cb_select_format, /* callback */ XmVaPUSHBUTTON, format_selection_texts[0], 'P', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[1], 'F', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[2], 'D', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[3], 'T', NULL, NULL, XmVaPUSHBUTTON, format_selection_texts[4], 'U', NULL, NULL, + XmNuserData, (XtPointer)info, NULL); - + XmStringFree(str); XmStringFree(format_selection_texts[0]); XmStringFree(format_selection_texts[1]); @@ -1757,44 +832,46 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) XmStringFree(format_selection_texts[4]); str = XmStringCreateLocalized("File name:"); - to_file_radio_or_label[act] = XtVaCreateManagedWidget("to_file", xmLabelGadgetClass, - f1child, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, format_selection_option, - XmNleftAttachment, XmATTACH_FORM, - /* XmNchildType, XmFRAME_TITLE_CHILD, */ - XmNlabelString, str, - NULL); + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, xmLabelGadgetClass, destination_form, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, format_selection_option, + XmNleftAttachment, XmATTACH_FORM, + /* XmNchildType, XmFRAME_TITLE_CHILD, */ + XmNlabelString, str, + NULL); XmStringFree(str); str = XmStringCreateLocalized("Browse ..."); - print_to_file_button[act] = XtVaCreateManagedWidget("file_button", xmPushButtonWidgetClass, - f1child, - XmNlabelString, str, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, format_selection_option, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); - print_to_file_text[act] = XtVaCreateManagedWidget("file_text", xmTextFieldWidgetClass, - f1child, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, format_selection_option, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, to_file_radio_or_label[act], - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, print_to_file_button[act], - XTranslations, xlats, - NULL); - - adjust_heights(to_file_radio_or_label[act], print_to_file_button[act], print_to_file_text[act], NULL); - XtAddCallback(print_to_file_button[act], XmNactivateCallback, cb_browse, (XtPointer)info); + print_to_file_button = XtVaCreateManagedWidget(Xdvi_BROWSE_BUTTON, xmPushButtonWidgetClass, destination_form, + XmNlabelString, str, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, format_selection_option, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, xmTextFieldWidgetClass, destination_form, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, format_selection_option, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, to_file_radio_or_label, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, print_to_file_button, + XTranslations, xlats, + NULL); + + adjust_heights(to_file_radio_or_label, print_to_file_button, print_to_file_text, NULL); + XtAddCallback(print_to_file_button, XmNactivateCallback, cb_browse, (XtPointer)info); } - -#if 1 + + /* initial value for filename */ + XtVaSetValues(print_to_file_text, + XmNvalue, info->finfo->out_file, + XmNcursorPosition, strlen(info->finfo->out_file), + NULL); + { /* align left edges of widgets */ Dimension w1, w2; - - XtVaGetValues(to_file_radio_or_label[act], XmNwidth, &w2, NULL); + + XtVaGetValues(to_file_radio_or_label, XmNwidth, &w2, NULL); if (act == FILE_PRINT) XtVaGetValues(to_printer_radio, XmNwidth, &w1, NULL); else { @@ -1806,11 +883,11 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) w1 = w2; } } - + if (w1 > w2) { Dimension offset = DDIST; offset += w1 - w2; - XtVaSetValues(print_to_file_text[act], XmNleftOffset, offset, NULL); + XtVaSetValues(print_to_file_text, XmNleftOffset, offset, NULL); } else if (w2 > w1) { Dimension offset = DDIST; @@ -1824,534 +901,926 @@ create_print_or_save_window(struct save_or_print_info *info, char *ofstring) Dimension curr_w; XtVaGetValues(w, XmNwidth, &curr_w, NULL); XtVaSetValues(w, XmNwidth, curr_w + offset, NULL); - */ + */ /* fprintf(stderr, "Setting width from %d to: %d\n", curr_w, curr_w + offset); */ XtVaSetValues(w, XmNmarginRight, offset, XmNalignment, XmALIGNMENT_BEGINNING, NULL); } - + } } } -#endif /* 0 */ if (act == FILE_SAVE) { XtManageChild(format_selection_option); - XtManageChild(f1child); - XtManageChild(frame1); + XtManageChild(destination_form); + XtManageChild(print_or_save_frame); } - + /* additional dvips options */ str = XmStringCreateLocalized("Dvips Options:"); - r4label = XtVaCreateManagedWidget("dvips_options_name", xmLabelGadgetClass, - form, - XmNlabelString, str, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, frame1, - XmNleftAttachment, XmATTACH_FORM, - NULL); + dvips_options_label = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_NAME, xmLabelGadgetClass, form, + XmNlabelString, str, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_or_save_frame, + XmNleftAttachment, XmATTACH_FORM, + NULL); XmStringFree(str); - - dvips_options_text[act] = XtVaCreateManagedWidget("dvips_options_text", xmTextFieldWidgetClass, - form, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, frame1, - XmNleftAttachment, XmATTACH_WIDGET, - XmNrightAttachment, XmATTACH_FORM, - XmNleftWidget, r4label, - XmNcolumns, 20, - XTranslations, xlats, - NULL); - XtAddCallback(dvips_options_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - adjust_heights(r4label, dvips_options_text[act], NULL); - + + dvips_options_text = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_TEXT, xmTextFieldWidgetClass, form, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, print_or_save_frame, + XmNleftAttachment, XmATTACH_WIDGET, + XmNrightAttachment, XmATTACH_FORM, + XmNleftWidget, dvips_options_label, + XmNcolumns, 20, + XTranslations, xlats, + NULL); + XtAddCallback(dvips_options_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + adjust_heights(dvips_options_label, dvips_options_text, NULL); + + /* initial value for dvips options */ + XtVaSetValues(dvips_options_text, + XmNvalue, info->dvips_options, + XmNcursorPosition, strlen(info->dvips_options), + NULL); + /* page selection */ - frame2 = XtVaCreateWidget(act == FILE_PRINT ? "print_page_frame" : "save_page_frame", xmFrameWidgetClass, - form, - XmNmarginWidth, DDIST, - XmNmarginHeight, DDIST, - XmNresizable, True, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, dvips_options_text[act], - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XTranslations, xlats, - NULL); + pages_frame = XtVaCreateWidget(act == FILE_PRINT ? "print_page_frame" : "save_page_frame", xmFrameWidgetClass, form, + XmNmarginWidth, DDIST, + XmNmarginHeight, DDIST, + XmNresizable, True, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, dvips_options_text, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XTranslations, xlats, + NULL); str = XmStringCreateLocalized("Pages:"); - f2label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, - frame2, - XmNchildType, XmFRAME_TITLE_CHILD, - XmNlabelString, str, - NULL); + pages_label = XtVaCreateManagedWidget("title", xmLabelGadgetClass, pages_frame, + XmNchildType, XmFRAME_TITLE_CHILD, + XmNlabelString, str, + NULL); XmStringFree(str); - f2child = XtVaCreateWidget("form", xmFormWidgetClass, frame2, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNresizable, True, - XTranslations, xlats, - XTranslations, xlats, - NULL); + pages_form = XtVaCreateWidget("pages_form", xmFormWidgetClass, pages_frame, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNresizable, True, + XTranslations, xlats, + NULL); str = XmStringCreateLocalized("All"); - range_all_radio[act] = XtVaCreateManagedWidget("all", - xmToggleButtonGadgetClass, f2child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNset, True, - XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, 0, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 0, - XTranslations, xlats, - NULL); + print_or_save_range_all_radio = XtVaCreateManagedWidget(Xdvi_PAGES_ALL_RADIO_NAME, xmToggleButtonGadgetClass, pages_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNset, True, + XmNtopAttachment, XmATTACH_FORM, + XmNtopOffset, 0, + XmNleftAttachment, XmATTACH_FORM, + XmNleftOffset, 0, + XTranslations, xlats, + NULL); XmStringFree(str); - if (act == FILE_PRINT) { - XtAddCallback(range_all_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)PRINT_ALL); - } - else { - XtAddCallback(range_all_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)SAVE_ALL); - } + XtAddCallback(print_or_save_range_all_radio, XmNvalueChangedCallback, cb_range, (XtPointer)info); str = XmStringCreateLocalized("Marked"); - range_marked_radio[act] = XtVaCreateManagedWidget("marked", - xmToggleButtonGadgetClass, f2child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_all_radio[act], - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 0, - XTranslations, xlats, - NULL); + range_marked_radio = XtVaCreateManagedWidget(Xdvi_PAGES_MARKED_RADIO_NAME, xmToggleButtonGadgetClass, pages_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNsensitive, pageinfo_have_marked_pages(), + XmNtopWidget, print_or_save_range_all_radio, + XmNleftAttachment, XmATTACH_FORM, + XmNleftOffset, 0, + XTranslations, xlats, + NULL); XmStringFree(str); - if (act == FILE_PRINT) { - XtAddCallback(range_marked_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)PRINT_MARKED); - } - else { - XtAddCallback(range_marked_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)SAVE_MARKED); - } - + XtAddCallback(range_marked_radio, XmNvalueChangedCallback, cb_range, (XtPointer)info); + str = XmStringCreateLocalized("Range:"); - range_from_to_radio[act] = XtVaCreateManagedWidget("range", - xmToggleButtonGadgetClass, f2child, - XmNlabelString, str, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 0, - XTranslations, xlats, - NULL); + range_from_to_radio = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_RADIO_NAME, xmToggleButtonGadgetClass, pages_form, + XmNlabelString, str, + XmNindicatorType, XmONE_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_FORM, + XmNleftOffset, 0, + XTranslations, xlats, + NULL); XmStringFree(str); - if (act == FILE_PRINT) { - XtAddCallback(range_from_to_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)PRINT_RANGE); - } - else { - XtAddCallback(range_from_to_radio[act], XmNvalueChangedCallback, cb_range, (XtPointer)SAVE_RANGE); - } + XtAddCallback(range_from_to_radio, XmNvalueChangedCallback, cb_range, (XtPointer)info); + str = XmStringCreateLocalized("From"); - from_label[act] = XtVaCreateManagedWidget("from", xmLabelGadgetClass, - f2child, - XmNlabelString, str, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, range_from_to_radio[act], - NULL); + from_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_FROM_LABEL_NAME, xmLabelGadgetClass, pages_form, + XmNlabelString, str, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, range_from_to_radio, + NULL); XmStringFree(str); - page_from_text[act] = XtVaCreateManagedWidget("from_page", - xmTextFieldWidgetClass, f2child, - XmNcolumns, 5, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, from_label[act], - XTranslations, xlats, - NULL); - XtAddCallback(page_from_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); + page_from_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_FROM_TEXT_NAME, xmTextFieldWidgetClass, pages_form, + XmNcolumns, 5, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, from_label, + XTranslations, xlats, + NULL); + XtAddCallback(page_from_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(page_from_text, XmNfocusCallback, cb_text_page_range, (XtPointer)info); str = XmStringCreateLocalized("to"); - to_label[act] = XtVaCreateManagedWidget("to", xmLabelGadgetClass, - f2child, - XmNlabelString, str, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, page_from_text[act], - NULL); + to_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_LABEL_NAME, xmLabelGadgetClass, pages_form, + XmNlabelString, str, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, page_from_text, + NULL); XmStringFree(str); - page_to_text[act] = XtVaCreateManagedWidget("to_page", xmTextFieldWidgetClass, - f2child, - XmNcolumns, 5, - XmNsensitive, False, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, to_label[act], - XTranslations, xlats, - NULL); - XtAddCallback(page_to_text[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); + page_to_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_TEXT_NAME, xmTextFieldWidgetClass, pages_form, + XmNcolumns, 5, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, to_label, + XTranslations, xlats, + NULL); + XtAddCallback(page_to_text, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtAddCallback(page_to_text, XmNfocusCallback, cb_text_page_range, (XtPointer)info); str = XmStringCreateLocalized(ofstring); - of_label[act] = XtVaCreateManagedWidget("of", xmLabelGadgetClass, - f2child, - XmNlabelString, str, - XmNsensitive, False, - XmNresizable, True, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, range_marked_radio[act], - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, page_to_text[act], - NULL); + of_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_OF_LABEL_NAME, xmLabelGadgetClass, pages_form, + XmNlabelString, str, + /* XmNsensitive, info->page_selection == PAGE_RANGE, */ + XmNresizable, True, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, range_marked_radio, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, page_to_text, + NULL); XmStringFree(str); - adjust_heights(range_from_to_radio[act], - from_label[act], page_from_text[act], - to_label[act], page_to_text[act], - of_label[act], + adjust_heights(range_from_to_radio, + from_label, page_from_text, + to_label, page_to_text, + of_label, NULL); - XtManageChild(f2child); - XtManageChild(frame2); + XtManageChild(pages_form); + XtManageChild(pages_frame); /* box for the OK/Cancel button */ - box = XtVaCreateManagedWidget("box", xmFormWidgetClass, - pane, + box = XtVaCreateManagedWidget("box", xmFormWidgetClass, pane, XmNskipAdjust, True, /* don't resize this area */ XTranslations, xlats, NULL); - - if (act == FILE_PRINT) - str = XmStringCreateLocalized("Print"); - else - str = XmStringCreateLocalized("Save"); - ok_button[act] = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNshowAsDefault, True, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNleftOffset, 10, - NULL); + + str = XmStringCreateLocalized(act == FILE_PRINT ? "Print" : "Save"); + + ok_button = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNshowAsDefault, True, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + /* to mimick appearance of native dialog buttons: */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNleftOffset, 10, + NULL); XmStringFree(str); - if (act == FILE_PRINT) - XtAddCallback(ok_button[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - else - XtAddCallback(ok_button[act], XmNactivateCallback, cb_print_or_save, (XtPointer)info); - - XtOverrideTranslations(ok_button[act], XtParseTranslationTable("Return:ArmAndActivate()")); + + XtAddCallback(ok_button, XmNactivateCallback, cb_print_or_save, (XtPointer)info); + XtOverrideTranslations(ok_button, XtParseTranslationTable("Return:ArmAndActivate()")); str = XmStringCreateLocalized("Cancel"); - cancel_button[act] = XtVaCreateManagedWidget("cancel", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNrightOffset, 10, - NULL); + cancel_button = XtVaCreateManagedWidget("cancel", xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + /* to mimick appearance of native dialog buttons: */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNrightOffset, 10, + NULL); XmStringFree(str); + + XtOverrideTranslations(print_or_save_range_all_radio, xlats); + XtOverrideTranslations(range_marked_radio, xlats); + XtOverrideTranslations(range_from_to_radio, xlats); + XtOverrideTranslations(ok_button, xlats); + XtOverrideTranslations(cancel_button, xlats); - XtOverrideTranslations(range_all_radio[act], xlats); - XtOverrideTranslations(range_marked_radio[act], xlats); - XtOverrideTranslations(range_from_to_radio[act], xlats); - XtOverrideTranslations(ok_button[act], xlats); - XtOverrideTranslations(cancel_button[act], xlats); - - if (act == FILE_PRINT) - XtAddCallback(cancel_button[act], XmNactivateCallback, cb_print_cancel, (XtPointer)info); - else - XtAddCallback(cancel_button[act], XmNactivateCallback, cb_save_cancel, (XtPointer)info); + XtAddCallback(cancel_button, XmNactivateCallback, cb_popdown, (XtPointer)info); { /* make the buttons the same size: */ Dimension w1, w2; - XtVaGetValues(ok_button[act], XtNwidth, &w1, NULL); - XtVaGetValues(cancel_button[act], XtNwidth, &w2, NULL); + XtVaGetValues(ok_button, XtNwidth, &w1, NULL); + XtVaGetValues(cancel_button, XtNwidth, &w2, NULL); if (w1 < w2) - XtVaSetValues(ok_button[act], XtNwidth, w2, NULL); + XtVaSetValues(ok_button, XtNwidth, w2, NULL); else if (w2 > w1) - XtVaSetValues(cancel_button[act], XtNwidth, w1, NULL); + XtVaSetValues(cancel_button, XtNwidth, w1, NULL); } - + if (pageinfo_have_marked_pages()) { - XmToggleButtonGadgetSetState(range_marked_radio[act], True, True); + XmToggleButtonGadgetSetState(range_marked_radio, True, True); } - else if (save_pr_info.range_radio == PRINT_MARKED) { - XmToggleButtonGadgetSetState(range_all_radio[act], True, True); + else if (info->page_selection == PAGE_MARKED) { + XmToggleButtonGadgetSetState(print_or_save_range_all_radio, True, True); } XtManageChild(form); XtManageChild(pane); - center_window(top_level_shell, globals.widgets.top_level); - XtMapWidget(top_level_shell); - XmProcessTraversal(ok_button[act], XmTRAVERSE_CURRENT); -#endif /* not MOTIF */ - - /* set default output format */ - save_save_info.output_format = curr_save_info.output_format = - output_format_mapping[resource.default_saving_format].fmt; - - if (act == FILE_SAVE) - update_dvips_options_sensitivity(resource.default_saving_format, top_level_shell); - - return top_level_shell; -} -#undef HORIZONTAL_RESIZING_NO -#undef HORIZONTAL_RESIZING_YES -#undef VERTICAL_RESIZING_NO - + center_window(info->shell, globals.widgets.top_level); + XtMapWidget(info->shell); + XmProcessTraversal(ok_button, XmTRAVERSE_CURRENT); + + /* if (act == FILE_PRINT) { */ + /* if (resource.default_printing_target == TO_PRINTER) */ + /* XmProcessTraversal(print_to_printer_text, XmTRAVERSE_CURRENT); */ + /* else */ + /* XmProcessTraversal(print_to_file_text, XmTRAVERSE_CURRENT); */ + /* } */ +} -static void -set_target_radio(struct dialog_info *save_info, struct dialog_info *curr_info, printOrSaveActionT act) -{ -#ifdef MOTIF - if (save_info->print_radio > 0 && save_info->print_radio != curr_info->print_radio) { - XmToggleButtonGadgetSetState(save_info->print_radio == PRINT_TO_PRINTER - ? to_printer_radio - : to_file_radio_or_label[act], True, True); - } #else /* MOTIF */ - UNUSED(act); - UNUSED(curr_info); - XawToggleSetCurrent(to_printer_radio, (XtPointer)save_info->print_radio); -#endif /* MOTIF */ -} - + static void -set_range_radio(struct dialog_info *save_info, struct dialog_info *curr_info, printOrSaveActionT act) -{ -#ifdef MOTIF - if (save_info->range_radio > 0 && save_info->range_radio != curr_info->range_radio) { - Widget selected = 0; - switch (save_info->range_radio) { - case PRINT_ALL: - case SAVE_ALL: - selected = range_all_radio[act]; - break; - case PRINT_MARKED: - case SAVE_MARKED: - selected = range_marked_radio[act]; - break; - case PRINT_RANGE: - case SAVE_RANGE: - selected = range_from_to_radio[act]; - break; - default: - ASSERT(0, "wrong button type in set_range_radio()"); - } - XmToggleButtonGadgetSetState(selected, True, True); - } -#else /* MOTIF */ - UNUSED(curr_info); - XawToggleSetCurrent(range_all_radio[act], (XtPointer)save_info->range_radio); -#endif /* MOTIF */ -} - -void -save_or_print_callback(struct save_or_print_info *info) +xaw_create_dialog(struct save_or_print_info *info) { printOrSaveActionT act = info->act; - static char ofstring[1024]; /* should be ample */ - struct dialog_info *save_info = NULL, *curr_info = NULL; - - if (act == FILE_PRINT) { - save_info = &save_pr_info; - curr_info = &curr_pr_info; - if (print_is_active) { - XBell(DISP, 0); - XRaiseWindow(DISP, XtWindow(print_shell)); - return; - } + Atom WM_DELETE_WINDOW; + char *ptr; + char ofstring[1024]; + + Widget form, paned, box; + Widget dummy_label_form, dummy_pages_form; /* dummy forms to get indentation consistent */ + Widget save_to_file_form; + Widget dest_label; + Widget print_to_printer_form, print_to_file_form, dvips_options_form; + Widget dvips_options_label; + Widget range_label; + Widget page_range_form; + Widget range_marked_form; + Widget range_from_to_form; + Widget print_to_file_text, to_file_radio_or_label; + Widget dvips_options_text; + Widget print_to_file_button; + Widget format_selection_menu[FORMAT_SEL_CNT]; + Widget format_selection_label = NULL, format_selection_button = NULL, format_selection_popup; + Widget range_marked_radio, range_from_to_radio, to_printer_radio = NULL, print_to_printer_text = NULL, + print_or_save_range_all_radio, + page_from_text, to_label, page_to_text, of_label, ok_button, cancel_button; + + XtTranslations xlats, xlats2, wm_translations; + XtAccelerators accels2; + int ddist; - if (printlog_raise_active()) { - XBell(DISP, 0); - return; - } - } - else if (act == FILE_SAVE) { - save_info = &save_save_info; - curr_info = &curr_save_info; - if (save_is_active) { - XBell(DISP, 0); - XRaiseWindow(DISP, XtWindow(save_shell)); - return; - } - } - else { - ASSERT(0, "wrong action type in save_or_print_callback()"); - } + static Dimension w_avg = 220; + Dimension w_curr; + + /* handy abbrevs */ +#define HORIZONTAL_RESIZING_NO XtNleft, XtChainLeft, XtNright, XtChainLeft +#define HORIZONTAL_RESIZING_YES XtNleft, XtChainLeft, XtNright, XtChainRight +#define VERTICAL_RESIZING_NO XtNtop, XtChainTop, XtNbottom, XtChainTop - if (globals.dvi_file.bak_fp == NULL) { - popup_message(globals.widgets.top_level, - MSG_ERR, - NULL, - "Empty or incomplete DVI file. " - "Please select a new DVI file via File -> Open."); - return; - } + XtAddActions(print_actions, XtNumber(print_actions)); if (globals.pageno_correct == 1) sprintf(ofstring, "of %d physical pages", total_pages); else sprintf(ofstring, "of %d to %d pages", globals.pageno_correct, total_pages + globals.pageno_correct - 1); + + ptr = get_string_va("WM_PROTOCOLS: WM_cancel(%p)\n" + "Escape:WM_cancel(%p)\n" + "q:WM_cancel(%p)", + info, info, info); + wm_translations = XtParseTranslationTable(ptr); + free(ptr); + + info->shell = XtVaCreatePopupShell(act == FILE_SAVE ? Xdvi_SAVE_SHELL_NAME : Xdvi_PRINT_SHELL_NAME, + transientShellWidgetClass, globals.widgets.top_level, + XtNtitle, act == FILE_SAVE ? "xdvik: Save File" : "xdvik: Print File", + XtNmappedWhenManaged, False, + XtNtransientFor, globals.widgets.top_level, + XtNallowShellResize, True, + XtNtranslations, wm_translations, + NULL); + + WM_DELETE_WINDOW = XInternAtom(XtDisplay(info->shell), "WM_DELETE_WINDOW", False); + + paned = XtVaCreateManagedWidget("paned", panedWidgetClass, info->shell, NULL); + + form = XtVaCreateManagedWidget("save_or_print_form", formWidgetClass, paned, + XtNallowResize, True, + NULL); + XtVaGetValues(form, XtNdefaultDistance, &ddist, NULL); + /* fprintf(stderr, "form1: %ld\n", (long)form); */ + + xlats = XtParseTranslationTable(":highlight(Always)\n" + ":unhighlight()\n" + ",:set()notify()"); - if (act == FILE_PRINT && print_shell == NULL) { - curr_info->print_radio = resource.default_printing_target; - print_shell = create_print_or_save_window(info, ofstring); -#ifdef MOTIF - set_sensitivity(resource.default_printing_target); + ptr = get_string_va("Return:xaw_print_or_save(%p)", info); + xlats2 = XtParseTranslationTable(ptr); + free(ptr); + + if (act == FILE_PRINT) { /* selection `to printer/to file' */ + /* FIXME: set real sizes here */ + /* Dimension w_curr; */ + dummy_label_form = XtVaCreateManagedWidget("dummy_print_to_label_form", formWidgetClass, form, + XtNresizable, True, + XtNborderWidth, 0, + HORIZONTAL_RESIZING_YES, + NULL); + dest_label = XtVaCreateManagedWidget("print_to", labelWidgetClass, dummy_label_form, + XtNlabel, "Print to: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + NULL); + + print_to_printer_form = XtVaCreateManagedWidget("print_to_printer_form", formWidgetClass, form, + XtNresizable, True, + XtNborderWidth, 0, + XtNvertDistance, 0, + XtNfromVert, dummy_label_form, + HORIZONTAL_RESIZING_YES, + XtNallowResize, True, + NULL); + + accels2 = XtParseAcceleratorTable(",:set()notify()"); + + to_printer_radio = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + print_to_printer_form, + XtNlabel, "Printer: ", + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioData, TO_PRINTER, + XtNstate, resource.default_printing_target == TO_PRINTER, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + + XtAddCallback(to_printer_radio, XtNcallback, cb_print_vs_save, (XtPointer)info); + XtInstallAccelerators(print_to_printer_form, to_printer_radio); + + print_to_printer_text = XtVaCreateManagedWidget(Xdvi_TO_PRINTER_TEXT, asciiTextWidgetClass, print_to_printer_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + /* XtNresize, XawtextResizeWidth, */ + XtNfromHoriz, to_printer_radio, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + /* XtNscrollHorizontal, XawtextScrollAlways, */ + NULL); + XtOverrideTranslations(print_to_printer_text, xlats2); + XtAddEventHandler(print_to_printer_text, KeyPressMask | ButtonPressMask, False, + text_print_vs_save_callback, (XtPointer)info); + + adjust_vertically(to_printer_radio, print_to_printer_text, ddist); + + print_to_file_form = XtVaCreateManagedWidget("print_to_file_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNvertDistance, -ddist, + XtNfromVert, print_to_printer_form, + HORIZONTAL_RESIZING_YES, + NULL); + + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, #endif + print_to_file_form, + XtNhighlightThickness, 1, + XtNborderWidth, 0, + XtNlabel, "PS File: ", + XtNstate, resource.default_printing_target == TO_FILE, + XtNradioGroup, to_printer_radio, + XtNradioData, TO_FILE, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(to_file_radio_or_label, XtNcallback, cb_print_vs_save, (XtPointer)info); + XtInstallAccelerators(print_to_file_form, to_file_radio_or_label); + + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, asciiTextWidgetClass, print_to_file_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNfromHoriz, to_file_radio_or_label, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(print_to_file_text, xlats2); + XtAddEventHandler(print_to_file_text, KeyPressMask | ButtonPressMask, False, + text_print_vs_save_callback, (XtPointer)info); + + /* initial value for printer name */ + XtVaSetValues(print_to_printer_text, XtNstring, info->printer_options, NULL); + XawTextSetInsertionPoint(print_to_printer_text, strlen(info->printer_options)); } - else if (act == FILE_SAVE && save_shell == NULL) - save_shell = create_print_or_save_window(info, ofstring); - else { /* if the window was already created */ -#ifdef MOTIF - XmString str; + else { /* not printing, but saving */ + int i; + Dimension max_entry_width = 0; + dummy_label_form = XtVaCreateManagedWidget("dummy_save_as_form", formWidgetClass, form, + XtNresizable, True, + XtNborderWidth, 0, + HORIZONTAL_RESIZING_YES, + NULL); + dest_label = XtVaCreateManagedWidget("save_as", labelWidgetClass, dummy_label_form, + XtNlabel, "Save as: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + NULL); + save_to_file_form = XtVaCreateManagedWidget("save_to_file_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, dummy_label_form, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + /* fprintf(stderr, "formr1: %ld\n", (long)save_to_file_form); */ +#if 0 + menu_double_arrow_bitmap + = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), + RootWindowOfScreen(XtScreen(globals.widgets.top_level)), + (char *)menu_double_arrow_bits, MENU_DOUBLE_ARROW_W, MENU_DOUBLE_ARROW_H); #endif - /* XXX: is this actually needed??? */ - /* XXX: To test, remove the following */ - if (!pageinfo_have_marked_pages()) { - if (act == FILE_PRINT && save_pr_info.range_radio == PRINT_MARKED) { - save_pr_info.range_radio = PRINT_ALL; - } - else if (act == FILE_SAVE && save_save_info.range_radio == SAVE_MARKED) { - save_save_info.range_radio = SAVE_ALL; - } + format_selection_label = XtVaCreateManagedWidget("format_selection_label", labelWidgetClass, save_to_file_form, + XtNlabel, "Format: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + format_selection_button = XtVaCreateManagedWidget(Xdvi_FORMAT_SELECTION_BUTTON_NAME, menuButtonWidgetClass, save_to_file_form, + XtNmenuName, "format_selection_popup", + XtNlabel, output_format_mapping[resource.default_saving_format].fmt_string, + XtNjustify, XtJustifyLeft, + XtNborderWidth, resource.btn_border_width, + XtNfromHoriz, format_selection_label, +#if 0 + XtNhighlightThickness, 0, +#endif + NULL); +#if 0 /* Hack for arrow - menuButtonWidget cannot have a XtNrightBitmap!!! */ + format_selection_b1 = XtVaCreateManagedWidget("format_selection_b1", commandWidgetClass, save_to_file_form, + XtNborderWidth, resource.btn_border_width, + XtNfromHoriz, format_selection_button, + XtNhorizDistance, -1, + XtNhighlightThickness, 0, + XtNbitmap, menu_double_arrow_bitmap, + NULL); + adjust_heights(format_selection_button, format_selection_b1, NULL); +#endif + format_selection_popup = XtCreatePopupShell("format_selection_popup", simpleMenuWidgetClass, format_selection_button, + /* globals.widgets.top_level, */ + NULL, 0); +#if 0 + XtAddCallback(format_selection_b1, XtNcallback, xaw_popup_menu_cb, format_selection_popup); +#endif + for (i = 1; i < FORMAT_SEL_CNT; i++) { + char name[1024]; + Dimension curr_entry_width; + SNPRINTF(name, sizeof name, "format_selection_pulldown_%d", i); + format_selection_menu[i] = XtVaCreateManagedWidget(name, smeBSBObjectClass, format_selection_popup, + XtNjustify, XtJustifyLeft, + XtNlabel, + i == resource.default_saving_format + ? output_format_mapping[0].fmt_string + : output_format_mapping[i].fmt_string, + NULL); + XtVaGetValues(format_selection_menu[i], XtNwidth, &curr_entry_width, NULL); + if (curr_entry_width > max_entry_width) + max_entry_width = curr_entry_width; + XtAddCallback(format_selection_menu[i], XtNcallback, cb_select_format, (XtPointer)info); } + XtVaSetValues(format_selection_button, XtNwidth, max_entry_width, NULL); - if (act == FILE_PRINT) - set_target_radio(save_info, curr_info, act); - set_range_radio(save_info, curr_info, act); -#ifdef MOTIF - str = XmStringCreateLocalized(ofstring); - XtVaSetValues(of_label[act], XmNlabelString, str, NULL); - XmStringFree(str); - - /* FIXME: this seems neccessary, otherwise labels are misaligned - again if window is closed and opened a second time? */ - adjust_heights(range_from_to_radio[act], - from_label[act], page_from_text[act], - to_label[act], page_to_text[act], - of_label[act], - NULL); + print_to_file_form = XtVaCreateManagedWidget("to_file_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, save_to_file_form, + XtNvertDistance, -ddist, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + to_file_radio_or_label = XtVaCreateManagedWidget(Xdvi_TO_FILE_NAME, labelWidgetClass, print_to_file_form, + XtNlabel, "File name: ", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + print_to_file_text = XtVaCreateManagedWidget(Xdvi_TO_FILE_TEXT, asciiTextWidgetClass, print_to_file_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNfromHoriz, to_file_radio_or_label, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(print_to_file_text, xlats2); - if (save_info->dvips_options != NULL) { - XtVaSetValues(dvips_options_text[act], XmNvalue, save_info->dvips_options, - XmNcursorPosition, strlen(save_info->dvips_options), NULL); - } - else { - XtVaSetValues(dvips_options_text[act], XmNvalue, "", NULL); - } -#else /* MOTIF */ - XtVaSetValues(of_label[act], XtNlabel, ofstring, NULL); - - if (save_info->dvips_options != NULL) { - XtVaSetValues(dvips_options_text[act], XtNstring, save_info->dvips_options, NULL); - XawTextSetInsertionPoint(dvips_options_text[act], strlen(save_info->dvips_options)); - } - else { - XtVaSetValues(dvips_options_text[act], XtNstring, "", NULL); + + { /* align left edges of format selection pulldown and filename field */ + Dimension w1, w2, w_max; + XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); + XtVaGetValues(to_file_radio_or_label, XtNwidth, &w2, NULL); + w_max = MAX(w1, w2); + XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); + XtVaSetValues(print_to_file_text, XtNhorizDistance, ddist + (w_max - w2), NULL); } -#endif /* MOTIF */ } - get_initial_dialog_values(save_info, act); - -#ifdef MOTIF - if (act == FILE_PRINT) - XtVaSetValues(print_to_printer_text, XmNvalue, save_info->printer_name, - XmNcursorPosition, strlen(save_info->printer_name), NULL); + /* initial value for filename */ + XtVaSetValues(print_to_file_text, XtNstring, info->finfo->out_file, NULL); + XawTextSetInsertionPoint(print_to_file_text, strlen(info->finfo->out_file)); + +#define DIST_1 8 /* FIXME */ + print_to_file_button = XtVaCreateManagedWidget(Xdvi_BROWSE_BUTTON, commandWidgetClass, print_to_file_form, + XtNlabel, "Browse ...", + XtNfromHoriz, print_to_file_text, + XtNhorizDistance, DIST_1, + /* XtNsensitive, act == FILE_PRINT ? resource.default_printing_target == TO_FILE : True, */ + /* attach to right of form, no resizing: */ + XtNleft, XtChainRight, XtNright, XtChainRight, + VERTICAL_RESIZING_NO, + NULL); + + XtVaGetValues(print_to_file_button, XtNwidth, &w_curr, NULL); + XtVaSetValues(print_to_file_text, XtNwidth, w_avg - w_curr - DIST_1 - 2, NULL); +#undef DIST_1 + + adjust_vertically(to_file_radio_or_label, print_to_file_text, ddist + 5); + adjust_vertically(print_to_file_text, to_file_radio_or_label, ddist + 5); + adjust_vertically(print_to_file_button, to_file_radio_or_label, ddist + 5); + + XtAddCallback(print_to_file_button, XtNcallback, cb_browse, (XtPointer)info); + + /* other dvips options */ + dvips_options_form = XtVaCreateManagedWidget("dvips_options_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, print_to_file_form, + XtNvertDistance, 3 * ddist, + HORIZONTAL_RESIZING_YES, + NULL); + + dvips_options_label = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_NAME, labelWidgetClass, dvips_options_form, + XtNlabel, "Dvips Options:", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + + dvips_options_text = XtVaCreateManagedWidget(Xdvi_DVIPS_OPTIONS_TEXT, asciiTextWidgetClass, dvips_options_form, + XtNwidth, w_avg, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNfromHoriz, dvips_options_label, + HORIZONTAL_RESIZING_YES, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(dvips_options_text, xlats2); + + { /* align left edges of input fields */ + Dimension w1, w2, w3, w_max; + + if (act == FILE_PRINT) + XtVaGetValues(to_printer_radio, XtNwidth, &w1, NULL); + else + XtVaGetValues(format_selection_label, XtNwidth, &w1, NULL); + + XtVaGetValues(to_file_radio_or_label, XtNwidth, &w2, NULL); + XtVaGetValues(dvips_options_label, XtNwidth, &w3, NULL); + + w_max = MAX(MAX(w1, w2), w3); + + if (act == FILE_PRINT) + XtVaSetValues(print_to_printer_text, XtNhorizDistance, ddist + (w_max - w1), NULL); + else + XtVaSetValues(format_selection_button, XtNhorizDistance, ddist + (w_max - w1), NULL); + + XtVaSetValues(print_to_file_text, XtNhorizDistance, ddist + (w_max - w2), NULL); + XtVaSetValues(dvips_options_text, XtNhorizDistance, ddist + (w_max - w3), NULL); + } + + /* initial value for dvips options */ + XtVaSetValues(dvips_options_text, XtNstring, info->dvips_options, NULL); + XawTextSetInsertionPoint(dvips_options_text, strlen(info->dvips_options)); + + /* page selection */ + dummy_pages_form = XtVaCreateManagedWidget("dummy_pages_form", formWidgetClass, form, + XtNfromVert, dvips_options_form, + XtNresizable, True, + XtNborderWidth, 0, + XtNvertDistance, 3 * ddist, + HORIZONTAL_RESIZING_NO, + NULL); + + range_label = XtVaCreateManagedWidget("range_lab", labelWidgetClass, dummy_pages_form, + XtNlabel, "Pages:", + XtNborderWidth, 0, + HORIZONTAL_RESIZING_NO, + NULL); + + page_range_form = XtVaCreateManagedWidget(Xdvi_PAGE_RANGE_FORM_NAME, formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, dummy_pages_form, + XtNvertDistance, 0, + HORIZONTAL_RESIZING_NO, + NULL); + + accels2 = XtParseAcceleratorTable(",:set()notify()"); + print_or_save_range_all_radio = XtVaCreateManagedWidget(Xdvi_PAGES_ALL_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + page_range_form, + XtNlabel, "All ", + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioData, PAGE_ALL, + /* enable this button by default */ + XtNstate, True, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(print_or_save_range_all_radio, XtNcallback, cb_range, (XtPointer)info); + XtInstallAccelerators(page_range_form, print_or_save_range_all_radio); + + range_marked_form = XtVaCreateManagedWidget("range_marked_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, page_range_form, + XtNvertDistance, 0, + HORIZONTAL_RESIZING_NO, + NULL); + + range_marked_radio = XtVaCreateManagedWidget(Xdvi_PAGES_MARKED_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif - XtVaSetValues(dvips_options_text[act], XmNvalue, save_info->dvips_options, - XmNcursorPosition, strlen(save_info->dvips_options), NULL); + range_marked_form, + XtNlabel, "Marked ", + XtNsensitive, pageinfo_have_marked_pages(), + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioGroup, print_or_save_range_all_radio, + XtNradioData, PAGE_MARKED, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(range_marked_radio, XtNcallback, cb_range, (XtPointer)info); + XtInstallAccelerators(range_marked_form, range_marked_radio); + + range_from_to_form = XtVaCreateManagedWidget("range_from_to_form", formWidgetClass, form, + XtNborderWidth, 0, + XtNfromVert, range_marked_form, + XtNvertDistance, 0, + XtNresizable, True, + /* HORIZONTAL_RESIZING_NO, */ + NULL); - XtVaSetValues(page_from_text[act], XmNvalue, save_info->from_page, - XmNcursorPosition, strlen(save_info->from_page), NULL); + range_from_to_radio = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + range_from_to_form, + XtNlabel, "From: ", + XtNborderWidth, 0, + XtNhighlightThickness, 1, + XtNradioGroup, print_or_save_range_all_radio, + XtNradioData, PAGE_RANGE, + XtNtranslations, xlats, + XtNaccelerators, accels2, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtAddCallback(range_from_to_radio, XtNcallback, cb_range, (XtPointer)info); + XtInstallAccelerators(range_from_to_form, range_from_to_radio); + + page_from_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_FROM_TEXT_NAME, asciiTextWidgetClass, range_from_to_form, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNwidth, 50, + XtNfromHoriz, range_from_to_radio, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(page_from_text, xlats2); + XtAddEventHandler(page_from_text, KeyPressMask | ButtonPressMask, False, + text_page_range_callback, (XtPointer)info); + + to_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_LABEL_NAME, labelWidgetClass, range_from_to_form, + XtNlabel, "to: ", + XtNborderWidth, 0, + XtNfromHoriz, page_from_text, + /* XtNsensitive, info->page_selection == PAGE_RANGE, */ + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + + page_to_text = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_TO_TEXT_NAME, asciiTextWidgetClass, range_from_to_form, + XtNdataCompression, False, + XtNeditType, XawtextEdit, + XtNwidth, 50, + XtNfromHoriz, to_label, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, + NULL); + XtOverrideTranslations(page_to_text, xlats2); + XtAddEventHandler(page_to_text, KeyPressMask | ButtonPressMask, False, + text_page_range_callback, (XtPointer)info); + + of_label = XtVaCreateManagedWidget(Xdvi_PAGES_RANGE_OF_LABEL_NAME, labelWidgetClass, range_from_to_form, + XtNlabel, ofstring, + XtNborderWidth, 0, + /* XtNsensitive, info->page_selection == PAGE_RANGE, */ + XtNresizable, True, + XtNfromHoriz, page_to_text, + /* HORIZONTAL_RESIZING_NO, */ + XtNleft, XtChainLeft, + VERTICAL_RESIZING_NO, + NULL); + + adjust_vertically(range_from_to_radio, page_from_text, ddist); + adjust_vertically(to_label, page_from_text, ddist); + adjust_vertically(of_label, page_from_text, ddist); - XtVaSetValues(page_to_text[act], XmNvalue, save_info->to_page, - XmNcursorPosition, strlen(save_info->to_page), NULL); -#else /* MOTIF */ - if (act == FILE_PRINT) { - XtVaSetValues(print_to_printer_text, XtNstring, save_info->printer_name, NULL); - XawTextSetInsertionPoint(print_to_printer_text, strlen(save_info->printer_name)); + /* box for the OK/Cancel button */ + box = XtVaCreateManagedWidget("box", formWidgetClass, paned, + /* resizing by user isn't needed */ + XtNshowGrip, False, + XtNdefaultDistance, 6, /* some padding */ + /* resizing the window shouldn't influence this box, + * but only the pane widget + */ + XtNskipAdjust, True, + XtNaccelerators, G_accels_cr, + NULL); + + ok_button = XtVaCreateManagedWidget(act == FILE_PRINT ? "print_button" : "save_button", commandWidgetClass, box, + XtNlabel, act == FILE_PRINT ? "Print" : "Save", + XtNaccelerators, G_accels_cr, + XtNtop, XtChainTop, + XtNbottom, XtChainBottom, + HORIZONTAL_RESIZING_NO, + NULL); + XtAddCallback(ok_button, XtNcallback, cb_print_or_save, (XtPointer)info); + + XtInstallAccelerators(form, ok_button); + if (act == FILE_PRINT) + XtInstallAccelerators(print_to_printer_text, ok_button); + XtInstallAccelerators(print_to_file_text, ok_button); + + cancel_button = XtVaCreateManagedWidget("cancel", commandWidgetClass, box, + XtNlabel, "Cancel", + XtNfromHoriz, ok_button, + XtNbottom, XtChainBottom, + XtNjustify, XtJustifyRight, + XtNleft, XtChainRight, + XtNright, XtChainRight, + NULL); + XtAddCallback(cancel_button, XtNcallback, cb_popdown, (XtPointer)info); + + XtManageChild(info->shell); + center_window(info->shell, globals.widgets.top_level); + XtMapWidget(info->shell); + XSetWMProtocols(XtDisplay(info->shell), XtWindow(info->shell), &WM_DELETE_WINDOW, 1); + + if (pageinfo_have_marked_pages()) { + XawToggleSetCurrent(print_or_save_range_all_radio, (XtPointer)PAGE_MARKED); + } + else if (info->page_selection == PAGE_MARKED) { + XawToggleSetCurrent(print_or_save_range_all_radio, (XtPointer)PAGE_ALL); } +#undef HORIZONTAL_RESIZING_NO +#undef HORIZONTAL_RESIZING_YES +#undef VERTICAL_RESIZING_NO +} + +#endif /* MOTIF */ - XtVaSetValues(dvips_options_text[act], XtNstring, save_info->dvips_options, NULL); - XawTextSetInsertionPoint(dvips_options_text[act], strlen(save_info->dvips_options)); +static void +get_initial_values(struct save_or_print_info *info) +{ + const char *extension = NULL; + char *tmp = NULL; + + info->finfo->tmp_dvi_file = NULL; + info->finfo->tmp_ps_file = NULL; + info->finfo->tmp_dvi_fp = NULL; + /* info->finfo->out_fp = NULL; */ - XtVaSetValues(page_from_text[act], XtNstring, save_info->from_page, NULL); - XawTextSetInsertionPoint(page_from_text[act], strlen(save_info->from_page)); + info->message_popup = NULL; - XtVaSetValues(page_to_text[act], XtNstring, save_info->to_page, NULL); - XawTextSetInsertionPoint(page_to_text[act], strlen(save_info->to_page)); -#endif /* MOTIF */ + info->dvips_options = info->printer_options = NULL; - if (act == FILE_PRINT) { - if (pageinfo_have_marked_pages()) { - XtSetSensitive(range_marked_radio[FILE_PRINT], True); - } - else { - XtSetSensitive(range_marked_radio[FILE_PRINT], False); + /* + * dvips options + */ + info->dvips_options = xstrdup(resource.dvips_options_str ? resource.dvips_options_str : ""); + + /* add -t options if needed */ + if (info->dvips_options == NULL || info->dvips_options[0] == '\0' || strstr(info->dvips_options, "-t ") == NULL) { + Boolean landscape = False; + char *paper = get_dvips_papersize(&landscape); + if (paper != NULL) { + if (info->dvips_options == NULL) + info->dvips_options = xstrdup("-t "); + else + info->dvips_options = xstrcat(info->dvips_options, " -t "); + + info->dvips_options = xstrcat(info->dvips_options, paper); + free(paper); + if (landscape) { + info->dvips_options = xstrcat(info->dvips_options, " -t landscape"); + } } - ASSERT(save_pr_info.range_radio != PRINT_MARKED || pageinfo_have_marked_pages(), - "PRINT_MARKED shouldn't be togglable if there are no marked pages!"); } - else if (act == FILE_SAVE) { - if (pageinfo_have_marked_pages()) { - XtSetSensitive(range_marked_radio[FILE_SAVE], True); - } - else { - XtSetSensitive(range_marked_radio[FILE_SAVE], False); + + /* + * printer options + */ + if (resource.dvips_printer_str != NULL) + info->printer_options = xstrdup(resource.dvips_printer_str); + else { + /* initialize with default. We add the $PRINTER environment variable + * since dvips otherwise doesn't use it. */ + char *printer = getenv("PRINTER"); + info->printer_options = xstrdup("lpr"); + if (printer != NULL) { + info->printer_options = xstrcat(info->printer_options, " -P"); + info->printer_options = xstrcat(info->printer_options, printer); } - ASSERT(save_save_info.range_radio != SAVE_MARKED || pageinfo_have_marked_pages(), - "SAVE_MARKED shouldn't be togglable if there are no marked pages!"); } - set_outfile_name(save_info, &curr_save_info, act); - -#ifdef MOTIF - XtVaSetValues(print_to_file_text[act], XmNvalue, save_info->file_name, - XmNcursorPosition, strlen(save_info->file_name), NULL); -#else /* MOTIF */ - XtVaSetValues(print_to_file_text[act], XtNstring, save_info->file_name, NULL); - XawTextSetInsertionPoint(print_to_file_text[act], strlen(save_info->file_name)); -#endif /* MOTIF */ + info->print_target = resource.default_printing_target; + info->fmt = resource.default_saving_format; - if (act == FILE_PRINT) { - XtPopup(print_shell, XtGrabNone); - print_is_active = True; + if (pageinfo_have_marked_pages()) { + info->page_selection = PAGE_MARKED; } else { - XtPopup(save_shell, XtGrabNone); - save_is_active = True; + info->page_selection = PAGE_ALL; } + + if (info->act == FILE_SAVE) + extension = output_format_mapping[resource.default_saving_format].extension; + else + extension = ".ps"; + + tmp = get_new_file_name(globals.dvi_name, + get_extension(globals.dvi_name), + extension); + info->finfo->out_file = xmalloc(strlen(globals.cwd) + strlen(tmp) + 2); /* 1 extra for dir separator */ + sprintf(info->finfo->out_file, "%s/%s", globals.cwd, tmp); + free(tmp); + TRACE_FILES((stderr, "OUTFILE: |%s|\n", info->finfo->out_file)); } static int -getpageno(Widget w) +textfield_to_int(Widget w) { char *s, *p; int pageno; @@ -2379,92 +1848,123 @@ getpageno(Widget w) return pageno; } - /* - return text value of Widget w in newly allocated memory, - free()ing old_val as appropriate. Returns NULL if - text value starts with '\0'. + Return a copy of the text value of Widget w in malloc'ed memory, + or NULL if the text is empty. */ + static char * -get_saved_command(char **old_val, Widget w) +widgets_get_textfield(Widget w) { - char *val = NULL; - - if (*old_val != NULL) { + char *ptr = NULL; + XtVaGetValues(w, #if MOTIF - XtFree((char *)*old_val); + XmNvalue, #else - free((char*)*old_val); + XtNstring, #endif - *old_val = NULL; - } -#if MOTIF - val = XmTextFieldGetString(w); - if (*val == '\0') { - XtFree((char *)val); - val = NULL; + &ptr, NULL); + + if (ptr == NULL || *ptr == '\0') + return NULL; + else + return xstrdup(ptr); +} + +static char * +widgets_get_textfield_by_name(const struct save_or_print_info *info, const char *widget_name) +{ + Widget w; + if (get_widget_by_name(&w, info->shell, widget_name, True)) { + return widgets_get_textfield(w); } + return NULL; +} + +static pageRadioT +widgets_get_page_selection(struct save_or_print_info *info) +{ + Widget radio_all; +#ifdef MOTIF + Widget radio_marked; +#endif + if (get_widget_by_name(&radio_all, info->shell, Xdvi_PAGES_ALL_RADIO_NAME, True) +#ifdef MOTIF + && get_widget_by_name(&radio_marked, info->shell, Xdvi_PAGES_MARKED_RADIO_NAME, True) +#endif + ) { +#ifdef MOTIF + if (XmToggleButtonGadgetGetState(radio_all)) + return PAGE_ALL; + else if (XmToggleButtonGadgetGetState(radio_marked)) + return PAGE_MARKED; + else + return PAGE_RANGE; #else - XtVaGetValues(w, XtNstring, &val, NULL); - if (*val == '\0') { - val = NULL; + return (pageRadioT)XawToggleGetCurrent(radio_all); +#endif } - else { - val = xstrdup(val); + return NO_PAGE_VAL; /* dummy */ +} + +static int +widgets_get_from_page(struct save_or_print_info *info) +{ + Widget w; + if (get_widget_by_name(&w, info->shell, Xdvi_PAGES_RANGE_FROM_TEXT_NAME, True)) { + return textfield_to_int(w); } -#endif - return val; + return 0; +} + +static int +widgets_get_to_page(struct save_or_print_info *info) +{ + Widget w; + if (get_widget_by_name(&w, info->shell, Xdvi_PAGES_RANGE_TO_TEXT_NAME, True)) { + return textfield_to_int(w); + } + return 0; } -/* fill curr_print_info and save_print_info with current values */ static void -get_save_window_state(struct dialog_info *save_info, struct dialog_info *curr_info, printOrSaveActionT act) +set_check_page_range(struct save_or_print_info *info, Boolean check) { - save_info->print_radio = curr_info->print_radio; - save_info->range_radio = curr_info->range_radio; + Widget text_from, text_to; - if (act == FILE_PRINT) { - save_info->printer_name = get_saved_command(&(save_info->printer_name), print_to_printer_text); - curr_info->printer_name = get_saved_command(&(curr_info->printer_name), print_to_printer_text); - } - save_info->file_name = get_saved_command(&(save_info->file_name), print_to_file_text[act]); - curr_info->file_name = get_saved_command(&(curr_info->file_name), print_to_file_text[act]); + if (get_widget_by_name(&text_from, info->shell, Xdvi_PAGES_RANGE_FROM_TEXT_NAME, True) + && get_widget_by_name(&text_to, info->shell, Xdvi_PAGES_RANGE_TO_TEXT_NAME, True)) { - save_info->dvips_options = get_saved_command(&(save_info->dvips_options), dvips_options_text[act]); - curr_info->dvips_options = get_saved_command(&(curr_info->dvips_options), dvips_options_text[act]); + char page_string[LENGTH_OF_INT]; - save_info->from_page = get_saved_command(&(save_info->from_page), page_from_text[act]); - save_info->to_page = get_saved_command(&(save_info->to_page), page_to_text[act]); - - TRACE_GUI((stderr, "saved options:\nprinter: |%s|, file: |%s|, dvips: |%s|, from: |%s|, to: |%s|\n", - save_info->printer_name ? save_info->printer_name : "", - save_info->file_name ? save_info->file_name : "", - save_info->dvips_options ? save_info->dvips_options : "", - save_info->from_page ? save_info->from_page : "", - save_info->to_page ? save_info->to_page : "")); + if (check) { /* check validity of current values */ + int curr_from = textfield_to_int(text_from); + int curr_to = textfield_to_int(text_to); + + if (curr_from < total_pages && curr_to < total_pages) /* values are OK */ + return; + } + + sprintf(page_string, "%d", current_page + globals.pageno_correct); + +#ifdef MOTIF + XtVaSetValues(text_from, XmNvalue, page_string, XmNcursorPosition, strlen(page_string), NULL); + XtVaSetValues(text_to, XmNvalue, page_string, XmNcursorPosition, strlen(page_string), NULL); +#else + XtVaSetValues(text_from, XtNstring, page_string, NULL); + XtVaSetValues(text_to, XtNstring, page_string, NULL); + XawTextSetInsertionPoint(text_from, strlen(page_string)); + XawTextSetInsertionPoint(text_to, strlen(page_string)); +#endif + } } static void popdown_dialog_and_print_or_save(XtPointer myinfo) { struct save_or_print_info *info = (struct save_or_print_info *)myinfo; - struct select_pages_info *pinfo = (struct select_pages_info *)info->pinfo; - struct dialog_info *curr_info = NULL; - /* pop down the dialog */ - if (pinfo->act == FILE_PRINT) { - curr_info = &save_pr_info; - cb_print_cancel(NULL, info, NULL); - /* when printing to file, set ps_out.fname to non-NULL; this will - notify called routines that printing should go to the file */ - if (curr_info->print_radio == PRINT_TO_FILE) { - pinfo->finfo->ps_out.fname = xstrdup(curr_info->expanded_filename); - } - } - else { - curr_info = &save_save_info; - cb_save_cancel(NULL, info, NULL); - } + cb_popdown(NULL, info, NULL); if (globals.dvi_file.bak_fp == NULL) { /* shouldn't happen */ info->message_popup = popup_message(globals.widgets.top_level, @@ -2473,66 +1973,17 @@ popdown_dialog_and_print_or_save(XtPointer myinfo) return; } - ASSERT(pinfo->finfo->dvi_in.fp != NULL, "DVI input FILE * must have been set!"); - - /* when saving, set the final file names */ - if (curr_info->range_radio == SAVE_RANGE - || curr_info->range_radio == SAVE_MARKED - || curr_info->range_radio == SAVE_ALL) { - switch (curr_info->output_format) { - case FMT_DVI: - pinfo->finfo->dvi_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "DVI out_name: |%s|", pinfo->finfo->dvi_out.fname)); - break; - case FMT_PS: - pinfo->finfo->ps_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "PS out_name: |%s|", pinfo->finfo->ps_out.fname)); - break; - case FMT_PS2PDF: - pinfo->finfo->pdf_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "PDF out_name: |%s|", pinfo->finfo->pdf_out.fname)); - break; - case FMT_ISO_8859_1: - case FMT_UTF8: - pinfo->finfo->txt_out.fname = xstrdup(curr_info->expanded_filename); - TRACE_GUI((stderr, "TXT out_name: |%s|", pinfo->finfo->txt_out.fname)); - break; - case FMT_NONE: - break; - } - } - - /* add info about page ranges */ - switch (curr_info->range_radio) { - case SAVE_RANGE: - case PRINT_RANGE: - /* convert from 1-based to 0-based */ - pinfo->from = strtoul(curr_info->from_page, (char **)NULL, 10) - 1; - pinfo->to = strtoul(curr_info->to_page, (char **)NULL, 10) - 1; - pinfo->callback = check_pagerange; - break; - case SAVE_MARKED: - case PRINT_MARKED: - pinfo->callback = check_marked; - break; - case SAVE_ALL: - case PRINT_ALL: - pinfo->callback = NULL; - break; - case NO_PAGE_VAL: - ASSERT(0, "Shouldn't happen: NO_PAGE_VAL passed to popdown_dialog_and_print_or_save()"); - break; - } + ASSERT(info->finfo->in_fp != NULL, "DVI input FILE * must have been set!"); - store_preference(NULL, "dvipsOptionsString", "%s", save_pr_info.dvips_options ? save_pr_info.dvips_options : ""); - if (pinfo->act == FILE_PRINT) { - store_preference(NULL, "defaultPrintingTarget", "%d", save_pr_info.print_radio); - store_preference(NULL, "dvipsPrinterString", "%s", save_pr_info.printer_name ? save_pr_info.printer_name : ""); - internal_print(pinfo); + store_preference(NULL, "dvipsOptionsString", "%s", info->dvips_options ? info->dvips_options : ""); + if (info->act == FILE_PRINT) { + store_preference(NULL, "defaultPrintingTarget", "%d", info->print_target); + store_preference(NULL, "dvipsPrinterString", "%s", info->printer_options ? info->printer_options : ""); + internal_print(info); } else { - store_preference(NULL, "defaultSavingFormat", "%d", save_save_info.output_format); - internal_save(pinfo, curr_info->output_format); + store_preference(NULL, "defaultSavingFormat", "%d", info->fmt); + internal_save(info); } } @@ -2541,178 +1992,124 @@ static void do_cleanup(XtPointer arg) { struct save_or_print_info *info = (struct save_or_print_info *)arg; - struct select_pages_info *pinfo = (struct select_pages_info *)info->pinfo; - struct file_info *finfo = pinfo->finfo; cancel_saving(info); - unlink(finfo->dvi_tmp.fname); + if (info->finfo->tmp_dvi_file != NULL) { + unlink(info->finfo->tmp_dvi_file); + info->finfo->tmp_dvi_file = NULL; + } + if (info->finfo->tmp_ps_file != NULL) { + unlink(info->finfo->tmp_ps_file); + info->finfo->tmp_ps_file = NULL; + } } -/* XXX: is the save_* stuff actually *needed*??? */ -static Boolean -validate_and_save_values(struct save_or_print_info *info) + +/* + * First round of sanity checks for page range etc. + */ +static void +print_check_page_values(struct save_or_print_info *info) { - int page_range_begin, page_range_end; - printOrSaveActionT act = info->act; + struct select_pages_info *pinfo = info->pinfo; + + /* get current dvips and printer options */ + free(info->dvips_options); + free(info->printer_options); + info->dvips_options = info->printer_options = NULL; + + info->dvips_options = widgets_get_textfield_by_name(info, Xdvi_DVIPS_OPTIONS_TEXT); + if (info->act == FILE_PRINT) + info->printer_options = widgets_get_textfield_by_name(info, Xdvi_TO_PRINTER_TEXT); + info->page_selection = widgets_get_page_selection(info); - if ((act == FILE_PRINT && curr_pr_info.range_radio == PRINT_RANGE) - || (act == FILE_SAVE && curr_save_info.range_radio == SAVE_RANGE)) { - page_range_begin = getpageno(page_from_text[act]); - page_range_end = getpageno(page_to_text[act]); - if (page_range_begin + 1 < 1) { + /* fprintf(stderr, "page selection: %d\n", info->page_selection); */ + + if (info->page_selection == PAGE_ALL) { + /* fprintf(stderr, "ALL!!!\n"); */ + pinfo->callback = NULL; + } + else if (info->page_selection == PAGE_MARKED) { + /* fprintf(stderr, "MARKED!!!\n"); */ + pinfo->callback = check_marked; + } + else { /* PAGE_RANGE */ + /* fprintf(stderr, "RANGE!!!\n"); */ + pinfo->from = widgets_get_from_page(info); + pinfo->to = widgets_get_to_page(info); + pinfo->callback = check_pagerange; + if (pinfo->from + 1 < 1) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Please specify a valid page range.", "Invalid page range: start (%d) < 1.", - page_range_begin + 1); - return False; + pinfo->from + 1); + return; } - else if (page_range_begin > page_range_end) { + else if (pinfo->from > pinfo->to) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Please specify a valid page range.", "Invalid page range: start (%d) > end (%d).", - page_range_begin + 1, page_range_end + 1); - return False; + pinfo->from + 1, pinfo->to + 1); + return; } - else if (page_range_end + 1 > total_pages) { + else if (pinfo->to + 1 > total_pages) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Please specify a valid page range.", "Invalid page range: end (%d) > total_pages (%d).", - page_range_end + 1, total_pages); - return False; - } - - if (act == FILE_PRINT) { - curr_pr_info.from_page = xrealloc(curr_pr_info.from_page, LENGTH_OF_INT + 1); - curr_pr_info.to_page = xrealloc(curr_pr_info.to_page, LENGTH_OF_INT + 1); - sprintf(curr_pr_info.from_page, "%d", page_range_begin); - sprintf(curr_pr_info.to_page, "%d", page_range_end); - } - else { - curr_save_info.from_page = xrealloc(curr_save_info.from_page, LENGTH_OF_INT + 1); - curr_save_info.to_page = xrealloc(curr_save_info.to_page, LENGTH_OF_INT + 1); - sprintf(curr_save_info.from_page, "%d", page_range_begin); - sprintf(curr_save_info.to_page, "%d", page_range_end); + pinfo->to + 1, total_pages); + return; } } - - if (act == FILE_PRINT) - get_save_window_state(&save_pr_info, &curr_pr_info, act); - else - get_save_window_state(&save_save_info, &curr_save_info, act); - - return True; -} - -/* - * Routines for freeing allocated resources in file_info: - * close file pointers, and free file name memory. - */ -static void -free_file_info(struct file_IO *info) -{ - if (info->fp != NULL) { - fclose(info->fp); - info->fp = NULL; - } - free(info->fname); - info->fname = NULL; -} -static void -reset_file_info(struct file_info *finfo) -{ - free_file_info(&(finfo->dvi_in)); - free_file_info(&(finfo->dvi_tmp)); - free_file_info(&(finfo->dvi_out)); - free_file_info(&(finfo->ps_out)); - free_file_info(&(finfo->pdf_out)); - free_file_info(&(finfo->txt_out)); + print_check_dvi_file(info); } /* - First round of sanity checks. Note the use of curr_pr_info here; - this is before the values are saved to save_pr_info. + Second round of sanity checks. */ static void -print_precheck1(XtPointer myinfo) +print_check_dvi_file(struct save_or_print_info *info) { - /* Initialize structures with defaults. Note: structures are - static, so that they survive between calls, and to make memory - management with callbacks (and all the stuff in print-internal.c) - easier. - */ - struct save_or_print_info *info = (struct save_or_print_info *)myinfo; - printOrSaveActionT act = info->act; - static struct select_pages_info pinfo = { - FILE_ALL, 0, 0, NULL, check_marked, { 0, NULL }, NO_ERROR - }; - static struct file_info finfo = { - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL }, - { NULL, NULL } - }; - char *ok_button_str = NULL; FILE *fin = NULL; /* Return if there are active popups; otherwise, the print process may get messed up */ if (raise_message_windows()) { XBell(DISP, 0); -/* popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, */ -/* MSG_WARN, NULL, */ -/* "Please close other open message windows first!"); */ +#if 0 + popup_message(info->shell, + MSG_WARN, NULL, + "Please close other open message windows first!"); +#endif return; } - /* free all pointers in case we've been called again */ - reset_file_info(&finfo); - - pinfo.finfo= &finfo; /* pass finfo in data field of pinfo to callbacks etc. */ - pinfo.act = act; - info->pinfo = &pinfo; - - /* Validate page ranges, and if they are correct, save them to the - * appropriate save_save_info/save_print_info structure. - * NOTE: From here on, always use the save_* variants to retrieve values! - */ - if (!validate_and_save_values(info)) - return; - - /* We need to create a temporary DVI file containing the selected or all pages - if we want to do one of the following: - - print the marked pages - - save to a DVI file - - print only the marked pages to a PS or a PDF file. - */ - if ((pinfo.act == FILE_PRINT && curr_pr_info.range_radio == PRINT_MARKED) - || (pinfo.act == FILE_SAVE - && (save_save_info.output_format == FMT_DVI - || ((save_save_info.output_format == FMT_PS || save_save_info.output_format == FMT_PS2PDF) - && save_save_info.range_radio == SAVE_MARKED)))) { - /* need to create a temporary DVI file containing the selected pages */ - int tmp_fd = xdvi_temp_fd(&(finfo.dvi_tmp.fname)); /* this allocates finfo.dvi_tmp.fname */ + /* If we want to print/save the marked pages, or save to a DVI file, + we need to create a temporary DVI file containing the selected or all pages. */ + if (info->page_selection == PAGE_MARKED || info->fmt == FMT_DVI) { + int tmp_fd; + free(info->finfo->tmp_dvi_file); + info->finfo->tmp_dvi_file = NULL; + tmp_fd = xdvi_temp_fd(&(info->finfo->tmp_dvi_file)); /* this allocates info->finfo->tmp_dvi_file */ if (tmp_fd == -1) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Couldn't create temporary DVI file for printing: %s", strerror(errno)); return; } /* don't use XFOPEN here, since we don't want to treat an error in opening the file as fatal. */ /* `b' in mode won't hurt ... */ - if ((finfo.dvi_tmp.fp = try_fdopen(tmp_fd, "wb+")) == NULL) { /* failure */ + if ((info->finfo->tmp_dvi_fp = try_fdopen(tmp_fd, "wb+")) == NULL) { /* failure */ info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, "Xdvi needs to create a temporary file containing the " "currently marked pages, but creating that file failed. " @@ -2726,7 +2123,7 @@ print_precheck1(XtPointer myinfo) /* We try to use the original DVI file unless it's corrupted, in which case we ask the user if they want to save the cached copy instead */ if ((fin = fopen(globals.dvi_name, "rb")) == NULL - || !find_postamble(fin, &(pinfo.errflag))) { + || !find_postamble(fin, &(info->pinfo->errflag))) { Boolean could_not_open = False; if (fin == NULL) could_not_open = True; @@ -2736,7 +2133,7 @@ print_precheck1(XtPointer myinfo) /* if we can't use the temporary file as source for our copy, this is a fatal error */ if (!resource.use_temp_fp) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Could not copy DVI file %s: The file %s", globals.dvi_name, could_not_open ? "doesn't exist any more" : "seems to be corrupted"); @@ -2746,56 +2143,50 @@ print_precheck1(XtPointer myinfo) /* else, we'll try to use the cached copy of the DVI file */ if ((fin = fopen(get_tmp_dvi_name(), "rb")) == NULL) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Something's very wrong here - opening of both the " "original DVI file and the cached copy failed!"); return; } - if (!find_postamble(fin, &(pinfo.errflag))) { + if (!find_postamble(fin, &(info->pinfo->errflag))) { info->message_popup = - popup_message(pinfo.act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Shouldn't happen: Cached copy of the DVI file seems corrupted!"); return; } - finfo.dvi_in.fp = fin; + info->finfo->in_fp = fin; /* tell user about it */ - if (pinfo.act == FILE_PRINT) - ok_button_str = "Print Copy"; - else - ok_button_str = "Save Copy"; - info->message_popup = - choice_dialog(pinfo.act == FILE_PRINT ? print_shell : save_shell, + choice_dialog(info->shell, MSG_QUESTION, NULL, #ifndef MOTIF NULL, /* TODO: binding for RET? */ #endif /* MOTIF */ NULL, NULL, /* no pre_callbacks */ - ok_button_str, print_precheck2, (XtPointer)info, + info->act == FILE_PRINT ? "Print Copy" : "Save Copy", + print_check_target_file, (XtPointer)info, "Cancel", do_cleanup, (XtPointer)info, "The DVI file %s %s. Do you want to %s a cached copy of the file?", globals.dvi_name, could_not_open ? "doesn't exist any more" : "seems to be corrupted", - pinfo.act == FILE_PRINT ? "print" : "save"); + info->act == FILE_PRINT ? "print" : "save"); } else { /* original DVI file is OK, copy it */ - finfo.dvi_in.fp = fin; - print_precheck2((XtPointer)info); + info->finfo->in_fp = fin; + print_check_target_file((XtPointer)info); } } static void -print_precheck2(XtPointer myinfo) +print_check_target_file(XtPointer myinfo) { struct save_or_print_info *info = (struct save_or_print_info *)myinfo; - char *expanded_filename = NULL; - struct select_pages_info *pinfo = (struct select_pages_info *)info->pinfo; - printOrSaveActionT act = pinfo->act; - const char *fname; + char *filename = widgets_get_textfield_by_name(info, Xdvi_TO_FILE_TEXT); + char *expanded_filename; /* Return if there are active popups; otherwise, the print process will be messed up. */ @@ -2804,70 +2195,61 @@ print_precheck2(XtPointer myinfo) return; } - /* expand and canonicalize path name */ - if (act == FILE_PRINT) - fname = save_pr_info.file_name; - else - fname = save_save_info.file_name; + /* if we're just printing to printer, go ahead */ + if (!(info->act == FILE_SAVE || (info->act == FILE_PRINT && info->print_target == TO_FILE))) { + popdown_dialog_and_print_or_save(info); + return; + } - if (fname == NULL) { + /* expand and canonicalize filename */ + if (filename == NULL) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_WARN, NULL, "No filename specified!"); return; } - expanded_filename = expand_homedir(fname); /* this allocates expanded_filename */ + expanded_filename = expand_homedir(filename); /* this allocates expanded_filename */ + if (expanded_filename == NULL) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_WARN, "Please specify either a filename or a full path, without using \"~\" or \"~user\".", "Couldn't expand filename \"%s\" to a full path.", - fname); + filename); + free(filename); return; } + free(filename); + free(info->finfo->out_file); + info->finfo->out_file = expanded_filename; - if (act == FILE_PRINT) { - free(save_pr_info.expanded_filename); - save_pr_info.expanded_filename = expanded_filename; - } - else { - free(save_save_info.expanded_filename); - save_save_info.expanded_filename = expanded_filename; - } - - - if (act == FILE_SAVE && save_save_info.output_format == FMT_DVI) { /* canonicalize filename */ - char *tmp = expand_filename_append_dvi(save_save_info.expanded_filename, USE_CWD_PATH, False); + if (info->act == FILE_SAVE && info->fmt == FMT_DVI) { /* canonicalize filename */ + char *tmp = expand_filename_append_dvi(info->finfo->out_file, USE_CWD_PATH, False); /* this mallocs tmp */ if (strcmp(tmp, globals.dvi_name) == 0) { info->message_popup = - popup_message(act == FILE_PRINT ? print_shell : save_shell, + popup_message(info->shell, MSG_ERR, NULL, "Cannot overwrite the current DVI file (%s). " - "Please select a different file name.", - save_save_info.expanded_filename); + "Please choose a different file name.", + info->finfo->out_file); free(tmp); + free(info->finfo->out_file); + info->finfo->out_file = NULL; return; } - free(save_save_info.expanded_filename); - save_save_info.expanded_filename = tmp; + free(info->finfo->out_file); + info->finfo->out_file = tmp; } - if (act == FILE_SAVE || (act == FILE_PRINT && curr_pr_info.print_radio == PRINT_TO_FILE)) { + if (info->act == FILE_SAVE || (info->act == FILE_PRINT && info->print_target == TO_FILE)) { /* check whether to clobber existing file */ struct stat statbuf; - - if ((act == FILE_SAVE - && stat(save_save_info.expanded_filename, &statbuf) == 0 - && S_ISREG(statbuf.st_mode)) - || (act == FILE_PRINT - && stat(save_pr_info.expanded_filename, &statbuf) == 0 - && S_ISREG(statbuf.st_mode))) { - + if (stat(info->finfo->out_file, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) { info->message_popup = - choice_dialog(act == FILE_PRINT ? print_shell : save_shell, + choice_dialog(info->shell, MSG_QUESTION, NULL, #ifndef MOTIF NULL, /* TODO: binding for RET */ @@ -2880,10 +2262,8 @@ print_precheck2(XtPointer myinfo) printing, but would probably just like to choose another filename */ "Cancel", NULL, (XtPointer)NULL, - "%s already exists.\nDo you want to replace it?", - act == FILE_SAVE - ? save_save_info.expanded_filename - : save_pr_info.expanded_filename); + "The file %s already exists.\nDo you want to replace it?", + info->finfo->out_file); return; } else { @@ -2895,79 +2275,165 @@ print_precheck2(XtPointer myinfo) } } -/* called from pagesel.c if user marks or unmarks a page in the page list */ -void -notify_print_dialog_have_marked(Boolean flag) +static void +notify_dialog(Widget w, pageRadioT *value_bak) { - /* Note: check for *both* windows, save and print: */ + Widget radio_all, radio_marked; +#ifdef MOTIF + Widget radio_range; +#endif + Boolean have_marked = pageinfo_have_marked_pages(); + pageRadioT value_curr; - static pageRadioT old_value = NO_PAGE_VAL; + /* fprintf(stderr, "have_marked: %d\n", have_marked); */ - if (save_is_active) { - if (!flag && curr_save_info.range_radio == SAVE_MARKED) { - /* switch button from `marked' to its previous value */ - switch (old_value) { - case SAVE_ALL: + if (get_widget_by_name(&radio_all, w, Xdvi_PAGES_ALL_RADIO_NAME, True) + && get_widget_by_name(&radio_marked, w, Xdvi_PAGES_MARKED_RADIO_NAME, True) #ifdef MOTIF - XmToggleButtonGadgetSetState(range_all_radio[FILE_SAVE], True, True); -#else - XawToggleSetCurrent(range_all_radio[FILE_SAVE], (XtPointer)old_value); + && get_widget_by_name(&radio_range, w, Xdvi_PAGES_RANGE_RADIO_NAME, True) #endif - break; - case SAVE_RANGE: + ) { + + /* get the current value */ #ifdef MOTIF - XmToggleButtonGadgetSetState(range_from_to_radio[FILE_SAVE], True, True); + if (XmToggleButtonGadgetGetState(radio_all)) + value_curr = PAGE_ALL; + else if (XmToggleButtonGadgetGetState(radio_marked)) + value_curr = PAGE_MARKED; + else + value_curr = PAGE_RANGE; #else - XawToggleSetCurrent(range_from_to_radio[FILE_SAVE], (XtPointer)old_value); + value_curr = (pageRadioT)XawToggleGetCurrent(radio_all); #endif - break; - default: break; - } - } - else if (flag) { - /* switch button to `marked', saving the current value */ - if (curr_save_info.range_radio != SAVE_MARKED) /* guard for second invocation on mouse release */ - old_value = curr_save_info.range_radio; + + /* fprintf(stderr, "current value: %d\n", value_curr); */ + + if (value_curr == PAGE_MARKED && have_marked) + return; + if (value_curr != PAGE_MARKED && !have_marked) { + XtVaSetValues(radio_marked, #ifdef MOTIF - XmToggleButtonGadgetSetState(range_marked_radio[FILE_SAVE], True, True); + XmNsensitive, #else - XawToggleSetCurrent(range_marked_radio[FILE_SAVE], (XtPointer)SAVE_MARKED); -#endif /* MOTIF */ + XtNsensitive, +#endif + False, NULL); + return; } - XtSetSensitive(range_marked_radio[FILE_SAVE], flag); - } - if (print_is_active) { - if (!flag && curr_pr_info.range_radio == PRINT_MARKED) { - /* switch button from `marked' to its previous value */ - switch (old_value) { - case PRINT_ALL: + /* otherwise, if we have marked pages now, we want to switch from + the current value to `marked', saving the current value in *value_bak. */ + + /* XXX FIXME: There's a bug with OpenMotif 2.1 if the following order is used: + - without marked pages, open dialog + - mark a page; button `marked' is selected + - select button `all' + - select button `range' + - unmark page; `marked' becomes insensitive + - mark page, `marked' becomes sensitive and is selected, `range' is unselected + - up to here, everything is as expected, but if you now select `range', + it doesn't work, no button changes its state. As a workaround, if you select + `marked' again and then `range', it works. Strangely, the callback when unsetting + `range' is invoked correctly, so the button should be in the correct internal state ... + I think this is an OpenMotif bug. + */ + if (have_marked) { + *value_bak = value_curr; #ifdef MOTIF - XmToggleButtonGadgetSetState(range_all_radio[FILE_PRINT], True, True); + if (value_curr == PAGE_ALL) { + XmToggleButtonGadgetSetState(radio_all, False, True); + } + else { + XmToggleButtonGadgetSetState(radio_range, False, True); + } + XmToggleButtonGadgetSetState(radio_marked, True, True); + XtVaSetValues(radio_marked, XmNsensitive, True, NULL); + XmProcessTraversal(radio_marked, XmTRAVERSE_CURRENT); #else - XawToggleSetCurrent(range_all_radio[FILE_PRINT], (XtPointer)old_value); + XawToggleSetCurrent(radio_all, (XtPointer)PAGE_MARKED); + XtVaSetValues(radio_marked, XtNsensitive, True, NULL); #endif - break; - case PRINT_RANGE: + } + else { + /* no marked pages now; switch back to the value from *value_bak. */ + /* fprintf(stderr, "switching back to button %d\n", *value_bak); */ #ifdef MOTIF - XmToggleButtonGadgetSetState(range_from_to_radio[FILE_PRINT], True, True); + if (*value_bak == PAGE_ALL) { + XmToggleButtonGadgetSetState(radio_all, True, True); + XmProcessTraversal(radio_all, XmTRAVERSE_CURRENT); + } + else { + XmToggleButtonGadgetSetState(radio_range, True, True); + XmProcessTraversal(radio_range, XmTRAVERSE_CURRENT); + } + XmToggleButtonGadgetSetState(radio_marked, False, True); + XtVaSetValues(radio_marked, XmNsensitive, False, NULL); #else - XawToggleSetCurrent(range_from_to_radio[FILE_PRINT], (XtPointer)old_value); + XawToggleSetCurrent(radio_all, (XtPointer)*value_bak); + XtVaSetValues(radio_marked, XtNsensitive, *value_bak == PAGE_MARKED, NULL); #endif - break; - default: break; - } } - else if (flag) { - /* switch button to `marked', saving the current value */ - if (curr_pr_info.range_radio != PRINT_MARKED) /* guard for second invocation on mouse release */ - old_value = curr_pr_info.range_radio; + } +} + +/* access from pagesel.c if user marks or unmarks a page in the page list */ +void +notify_print_dialog_have_marked(void) +{ + Widget print_shell, save_shell; + static pageRadioT save_value_bak = PAGE_ALL; + static pageRadioT print_value_bak = PAGE_ALL; + + /* notify *both* windows, save and print, but only if they already exist */ + if (get_widget_by_name(&print_shell, globals.widgets.top_level, Xdvi_PRINT_SHELL_NAME, False)) + notify_dialog(print_shell, &save_value_bak); + + if (get_widget_by_name(&save_shell, globals.widgets.top_level, Xdvi_SAVE_SHELL_NAME, False)) + notify_dialog(save_shell, &print_value_bak); +} + +/* main entry point: pop up the dialog */ +void +save_or_print_callback(struct save_or_print_info *info) +{ + if (info->shell != NULL && window_is_mapped(XtWindow(info->shell), DISP)) { + XBell(DISP, 0); + XRaiseWindow(DISP, XtWindow(info->shell)); + return; + } + + if (info->act == FILE_PRINT && printlog_raise_active(info)) { + XBell(DISP, 0); + return; + } + + if (globals.dvi_file.bak_fp == NULL) { + popup_message(globals.widgets.top_level, + MSG_ERR, + NULL, + "Empty or incomplete DVI file. " + "Please select a new DVI file via File -> Open."); + return; + } + + if (info->shell == NULL) { /* first time */ + get_initial_values(info); #ifdef MOTIF - XmToggleButtonGadgetSetState(range_marked_radio[FILE_PRINT], True, True); + motif_create_dialog(info); #else - XawToggleSetCurrent(range_marked_radio[FILE_PRINT], (XtPointer)PRINT_MARKED); -#endif /* MOTIF */ - } - XtSetSensitive(range_marked_radio[FILE_PRINT], flag); + xaw_create_dialog(info); +#endif + /* fprintf(stderr, "SHELL IS: %p\n", (void *)info->shell); */ + set_check_page_range(info, False); /* set initial values */ + + if (info->act == FILE_SAVE) + update_dvips_options_sensitivity(resource.default_saving_format, info->shell); } + else { + set_check_page_range(info, False); /* was: True, use False to reset values to current page */ + } + + /* map the dialog */ + XtPopup(info->shell, XtGrabNone); } + diff --git a/Build/source/texk/xdvik/gui/print-dialog.h b/Build/source/texk/xdvik/gui/print-dialog.h index 95f73de3e18..7b7c6ccf4d6 100644 --- a/Build/source/texk/xdvik/gui/print-dialog.h +++ b/Build/source/texk/xdvik/gui/print-dialog.h @@ -23,22 +23,10 @@ #ifndef PRINT_DIALOG_H_ #define PRINT_DIALOG_H_ -#define Xdvi_SAVE_SHELL_NAME "save_popup" -#define Xdvi_PRINT_SHELL_NAME "print_popup" - -typedef enum { FILE_PRINT = 0, FILE_SAVE = 1, FILE_ALL = 2 } printOrSaveActionT; - -struct save_or_print_info { - printOrSaveActionT act; - Widget message_popup; - struct select_pages_info *pinfo; -}; +#include "print-internal.h" extern void save_or_print_callback(struct save_or_print_info *info); extern void cancel_saving(struct save_or_print_info *info); -extern const char *get_printer_options(void); -extern char *get_dvips_options(printOrSaveActionT act); - -extern void notify_print_dialog_have_marked(Boolean flag); +extern void notify_print_dialog_have_marked(void); #endif /* PRINT_DIALOG_H_ */ diff --git a/Build/source/texk/xdvik/gui/print-log.c b/Build/source/texk/xdvik/gui/print-log.c index dd1c26bc008..62e729fbe19 100644 --- a/Build/source/texk/xdvik/gui/print-log.c +++ b/Build/source/texk/xdvik/gui/print-log.c @@ -20,22 +20,33 @@ * OTHER DEALINGS IN THE SOFTWARE. */ + +/* + FIXME: The printlog presents too much detail and is confusing for users. + Re-implement it using an `printing page n of m' message, + i.e. according to the spec on: + http://xdvi.sourceforge.net/gui.html#file-print + Possible save the detailed log to a different window that can be viewed + via `File -> logs', as described on: + http://xdvi.sourceforge.net/gui.html#file-logs +*/ + #include #include "xdvi-config.h" #include "xdvi.h" #include "xdvi-debug.h" #include "print-dialog.h" +#include "print-internal.h" #include "print-log.h" /* for adjust_vertically() */ #include "util.h" +#include "string-utils.h" #include "x_util.h" #include "xlwradio.h" #include #include -/* FIXME: change #if XAW to #if !defined(MOTIF) to make it consistent with other files */ - #ifdef MOTIF # include # include @@ -67,30 +78,12 @@ #endif /* MOTIF */ -static Boolean printlog_active = False; /* if the print log is active */ -static Widget printlog_shell = NULL; - -/* global callbacks - FIXME: avoid this, by passing the callback as argument to the action? */ -static void (*g_close_callback)(Widget w, XtPointer client_data, XtPointer call_data); -static void (*g_cancel_callback)(Widget w, XtPointer client_data, XtPointer call_data); -static void (*g_destroy_callback)(Widget w, XtPointer client_data, XtPointer call_data); static void printlog_act_close(Widget, XEvent *, String *, Cardinal *); static void printlog_act_keep(Widget, XEvent *, String *, Cardinal *); static void printlog_act_unkeep(Widget, XEvent *, String *, Cardinal *); static void printlog_act_cancel(Widget, XEvent *, String *, Cardinal *); -static void printlog_act_destroy(Widget, XEvent *, String *, Cardinal *); - -#ifdef MOTIF -static void xm_printlog_act_destroy(Widget w, XtPointer a, XtPointer b) -{ - UNUSED(w); - UNUSED(a); - UNUSED(b); - ASSERT(g_destroy_callback != NULL, "Callback not initialized"); - (g_destroy_callback)(NULL, NULL, NULL); -} -#endif +static void printlog_act_cancel_or_destroy(Widget, XEvent *, String *, Cardinal *); static Atom WM_DELETE_WINDOW; @@ -99,385 +92,522 @@ static XtActionsRec printlog_actions[] = { {"printlogIntKeep", printlog_act_keep}, {"printlogIntUnkeep", printlog_act_unkeep}, {"printlogIntCancel", printlog_act_cancel}, - {"WM_destroy", printlog_act_destroy }, + {"WM_cancel_or_destroy", printlog_act_cancel_or_destroy }, }; -static char *text_translations = \ - "Return:printlogIntClose()\n" - "^c:printlogIntCancel()\n" - "^s:printlogIntKeep()\n" - "^q:printlogIntUnkeep()"; +static const char *const PRINTLOG_WINDOW_TRANSLATIONS = +#ifdef MOTIF +"osfCancel:WM_cancel_or_destroy(%p)" +#else +"Escape:WM_cancel_or_destroy(%p)" +#endif +; -static Widget printlog_text; -static Widget printlog_close; -static Widget printlog_unkeep; -static Widget printlog_cancel; +#ifdef MOTIF +static const char *const PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS = +"#override\n" +"osfCancel:WM_cancel_or_destroy(%p)"; +#endif +static const char *const PRINTLOG_TEXT_TRANSLATIONS = #ifdef MOTIF -static XmTextPosition printlog_length; +"osfCancel:WM_cancel_or_destroy(%p)\n" #else -static XawTextPosition printlog_length; +"Escape:WM_cancel_or_destroy(%p)\n" #endif +"Return:printlogIntClose(%p)\n" +"^c:printlogIntCancel(%p)\n" +"^s:printlogIntKeep(%p)\n" +"^q:printlogIntUnkeep(%p)\n" +"q:printlogIntClose(%p)"; + +#define Xdvi_PRINTLOG_TEXT_NAME "text" +#define Xdvi_PRINTLOG_CLOSE_NAME "close" +#define Xdvi_PRINTLOG_KEEP_NAME "keep" +#define Xdvi_PRINTLOG_CANCEL_NAME "cancel" + +static void +cb_printlog_act_cancel_or_destroy(Widget w, XtPointer client_data, XtPointer call_data) +{ + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + Widget cancel_button = NULL; + + UNUSED(w); + UNUSED(call_data); + + ASSERT(info->callbacks != NULL && info->callbacks->cb_destroy != NULL, "Callback not initialized"); + + /* If the `Cancel' button is still active, cancel printing, else close the window. */ + if (get_widget_by_name(&cancel_button, info->printlog, Xdvi_PRINTLOG_CANCEL_NAME, True)) { + Boolean sensitive = False; + + XtVaGetValues(cancel_button, +#ifdef MOTIF + XmNsensitive, +#else + XtNsensitive, +#endif + &sensitive, + NULL); + fprintf(stderr, "Sensitive: %d\n", sensitive); + if (sensitive) + info->callbacks->cb_cancel(w, info, NULL); + else + info->callbacks->cb_destroy(w, info, NULL); + } +} + Boolean -printlog_raise_active(void) +printlog_raise_active(struct save_or_print_info *info) { - if (printlog_active) { - XRaiseWindow(DISP, XtWindow(printlog_shell)); + Widget w = info->printlog; + if (w != NULL && window_is_mapped(XtWindow(w), DISP)) { + XRaiseWindow(DISP, XtWindow(w)); return True; } return False; } void -printlog_popup(void) +printlog_popup(struct save_or_print_info *info) { - printlog_length = 0; - center_window(printlog_shell, globals.widgets.top_level); - XtMapWidget(printlog_shell); -/* XtPopup(printlog_shell, XtGrabNone); */ - printlog_active = True; + Widget w = info->printlog; +#ifdef MOTIF + Widget cancel, text; +#endif + +#ifdef MOTIF + char *text_translations = get_string_va(PRINTLOG_TEXT_TRANSLATIONS, info, info, info, info, info, info); + char *window_translations = get_string_va(PRINTLOG_WINDOW_TRANSLATIONS, info); +#endif + + printlog_reset(info); + + center_window(w, globals.widgets.top_level); + XtMapWidget(w); + /* XtPopup(w, XtGrabNone); */ #ifndef MOTIF - XSetWMProtocols(XtDisplay(printlog_shell), XtWindow(printlog_shell), &WM_DELETE_WINDOW, 1); + XSetWMProtocols(XtDisplay(w), XtWindow(w), &WM_DELETE_WINDOW, 1); #else - XmProcessTraversal(printlog_cancel, XmTRAVERSE_CURRENT); - XtOverrideTranslations(printlog_text, XtParseTranslationTable(text_translations)); + XtOverrideTranslations(w, XtParseTranslationTable(window_translations)); + + if (get_widget_by_name(&cancel, w, Xdvi_PRINTLOG_CANCEL_NAME, True) + && get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) { + + /* This breaks PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS?? + * We don't want it activated on Return anyway ... + */ + /* XmProcessTraversal(cancel, XmTRAVERSE_CURRENT); */ + XtOverrideTranslations(text, XtParseTranslationTable(text_translations)); + XtOverrideTranslations(text, XtParseTranslationTable(window_translations)); + free(text_translations); + free(window_translations); + } #endif } void -printlog_reset(void) +printlog_reset(struct save_or_print_info *info) { - printlog_length = 0; -} + Widget w = info->printlog; + Widget text; + if (get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) { +#ifndef MOTIF + XtVaSetValues(text, XtNstring, "", NULL); + XawTextSetInsertionPoint(text, 0); +#else + XmTextSetString(text, ""); + XtVaSetValues(text, XmNcursorPosition, 0, NULL); +#endif + } +} void -printlog_create(const char *title, - const char *close_label, - void (*close_callback)(Widget w, XtPointer client_data, XtPointer call_data), - void (*cancel_callback)(Widget w, XtPointer client_data, XtPointer call_data), - void (*destroy_callback)(Widget w, XtPointer client_data, XtPointer call_data), - void (*unkeep_callback)(Widget w, XtPointer client_data, XtPointer call_data)) +printlog_create(struct save_or_print_info *info, + const char *title, + const char *close_label) { - /* - FIXME BETA: The printlog presents too much detail and is confusing for users. - Re-implement it using an `printing page n of m' message, - i.e. according to the spec on: - http://xdvi.sourceforge.net/gui.html#file-print - Possible save the detailed log to a different window that can be viewed - via `File -> logs', as described on: - http://xdvi.sourceforge.net/gui.html#file-logs - */ + Widget printlog_text, printlog_close, printlog_keep, printlog_cancel; + Widget form, paned, box; + char *window_translation_str; + +#ifdef MOTIF + XmString str; + XtTranslations window_override_translations; +#else + char *text_translation_str = NULL; + XtTranslations wm_translations; + XtTranslations window_translations; +#endif + +#ifdef MOTIF + window_translation_str = get_string_va(PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS, info); + window_override_translations = XtParseTranslationTable(window_translation_str); + free(window_translation_str); +#else + window_translation_str = get_string_va(PRINTLOG_WINDOW_TRANSLATIONS, info); + window_translations = XtParseTranslationTable(window_translation_str); + free(window_translation_str); +#endif + XtAddActions(printlog_actions, XtNumber(printlog_actions)); - g_destroy_callback = destroy_callback; #ifndef MOTIF - /* Create popup window */ - if (printlog_shell == NULL) { - Widget form, box, paned; -/* int ddist; */ -/* Dimension w0, w1, w2, w3, b; */ - XtTranslations wm_translations = XtParseTranslationTable("WM_PROTOCOLS: WM_destroy()"); - printlog_shell = XtVaCreatePopupShell("printlog", - transientShellWidgetClass, globals.widgets.top_level, - XtNtitle, title, - XtNtransientFor, globals.widgets.top_level, - XtNmappedWhenManaged, False, - XtNtranslations, wm_translations, - XtNtransientFor, globals.widgets.top_level, - NULL); - - WM_DELETE_WINDOW = XInternAtom(XtDisplay(printlog_shell), "WM_DELETE_WINDOW", False); + wm_translations = XtParseTranslationTable("WM_PROTOCOLS: WM_cancel_or_destroy()"); + info->printlog = XtVaCreatePopupShell("printlog", + transientShellWidgetClass, globals.widgets.top_level, + XtNtitle, title, + XtNtransientFor, globals.widgets.top_level, + XtNmappedWhenManaged, False, + XtNtranslations, wm_translations, + XtNtransientFor, globals.widgets.top_level, + NULL); + + WM_DELETE_WINDOW = XInternAtom(XtDisplay(info->printlog), "WM_DELETE_WINDOW", False); + + XtOverrideTranslations(info->printlog, window_translations); - paned = XtVaCreateManagedWidget("paned", panedWidgetClass, printlog_shell, NULL); + paned = XtVaCreateManagedWidget("paned", panedWidgetClass, info->printlog, NULL); - form = XtVaCreateManagedWidget("form", formWidgetClass, - paned, - XtNdefaultDistance, 6, - NULL); - printlog_text = XtVaCreateManagedWidget("text", - asciiTextWidgetClass, form, - XtNstring, "", - XtNdataCompression, False, - XtNeditType, XawtextAppend, - XtNscrollHorizontal, XawtextScrollAlways, - XtNscrollVertical, XawtextScrollAlways, - XtNwidth, 600, - XtNheight, 400, - XtNleft, XawChainLeft, - XtNright, XawChainRight, - XtNtop, XawChainTop, - XtNbottom, XawChainBottom, - NULL); - XtOverrideTranslations(printlog_text, XtParseTranslationTable(text_translations)); - - printlog_unkeep = XtVaCreateManagedWidget("keep", + form = XtVaCreateManagedWidget("form", formWidgetClass, + paned, + XtNdefaultDistance, 6, + NULL); + printlog_text = XtVaCreateManagedWidget(Xdvi_PRINTLOG_TEXT_NAME, + asciiTextWidgetClass, form, + XtNstring, "", + XtNdataCompression, False, + XtNeditType, XawtextAppend, + XtNscrollHorizontal, XawtextScrollAlways, + XtNscrollVertical, XawtextScrollAlways, + XtNwidth, 600, + XtNheight, 400, + XtNleft, XawChainLeft, + XtNright, XawChainRight, + XtNtop, XawChainTop, + XtNbottom, XawChainBottom, + NULL); + text_translation_str = get_string_va(PRINTLOG_TEXT_TRANSLATIONS, info, info, info, info, info, info); + XtOverrideTranslations(printlog_text, XtParseTranslationTable(text_translation_str)); + free(text_translation_str); + + printlog_keep = XtVaCreateManagedWidget(Xdvi_PRINTLOG_KEEP_NAME, #ifdef XAW - radioWidgetClass, + radioWidgetClass, #else - toggleWidgetClass, + toggleWidgetClass, #endif - form, - XtNlabel, close_label, - XtNborderWidth, 0, - XtNisRadio, False, - XtNhighlightThickness, 1, - XtNfromVert, printlog_text, - XtNleft, XawChainLeft, - XtNright, XawChainLeft, - XtNtop, XawChainBottom, - XtNbottom, XawChainBottom, - NULL); - XtVaSetValues(printlog_unkeep, - XtNstate, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, - NULL); - XtAddCallback(printlog_unkeep, XtNcallback, unkeep_callback, NULL); - - /* box for the Close/Cancel button */ - box = XtVaCreateManagedWidget("box", formWidgetClass, - paned, - /* resizing by user isn't needed */ - XtNshowGrip, False, - XtNdefaultDistance, 6, /* some padding */ - /* resizing the window shouldn't influence this box, - * but only the pane widget - */ - XtNskipAdjust, True, - XtNaccelerators, G_accels_cr, - NULL); + form, + XtNlabel, close_label, + XtNborderWidth, 0, +#ifdef XAW + XtNisRadio, False, +#endif + XtNhighlightThickness, 1, + XtNfromVert, printlog_text, + XtNleft, XawChainLeft, + XtNright, XawChainLeft, + XtNtop, XawChainBottom, + XtNbottom, XawChainBottom, + NULL); + XtVaSetValues(printlog_keep, + XtNstate, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, + NULL); + XtAddCallback(printlog_keep, XtNcallback, info->callbacks->cb_keep, (XtPointer)info); - printlog_close = XtVaCreateManagedWidget("close", - commandWidgetClass, box, - XtNlabel, "Close", - XtNsensitive, False, - XtNleft, XawChainLeft, - XtNright, XawChainLeft, - XtNtop, XawChainBottom, - XtNbottom, XawChainBottom, - NULL); - XtAddCallback(printlog_close, XtNcallback, close_callback, NULL); - g_close_callback = close_callback; + /* box for the Close/Cancel button */ + box = XtVaCreateManagedWidget("box", formWidgetClass, + paned, + /* resizing by user isn't needed */ + XtNshowGrip, False, + XtNdefaultDistance, 6, /* some padding */ + /* resizing the window shouldn't influence this box, + * but only the pane widget + */ + XtNskipAdjust, True, + XtNaccelerators, G_accels_cr, + NULL); - printlog_cancel = XtVaCreateManagedWidget("cancel", - commandWidgetClass, box, - XtNlabel, "Cancel", - XtNfromHoriz, printlog_unkeep, - XtNleft, XawChainRight, - XtNright, XawChainRight, - XtNtop, XawChainBottom, - XtNbottom, XawChainBottom, - NULL); - XtAddCallback(printlog_cancel, XtNcallback, cancel_callback, NULL); - g_cancel_callback = cancel_callback; - XtManageChild(printlog_shell); - } - else { - XtSetSensitive(printlog_close, False); - XtSetSensitive(printlog_cancel, True); - } - -#else /* MOTIF */ - - /* Create popup window */ - if (printlog_shell == NULL) { - Widget form, pane, box; - XmString str; - Arg args[10]; - int n; + printlog_close = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CLOSE_NAME, + commandWidgetClass, box, + XtNlabel, "Close", + XtNsensitive, False, + XtNleft, XawChainLeft, + XtNright, XawChainLeft, + XtNtop, XawChainBottom, + XtNbottom, XawChainBottom, + NULL); + XtAddCallback(printlog_close, XtNcallback, info->callbacks->cb_close, (XtPointer)info); - printlog_shell = XtVaCreatePopupShell("printlog", - xmDialogShellWidgetClass, globals.widgets.top_level, - XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ - XmNtitle, title, - XtNmappedWhenManaged, False, + printlog_cancel = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CANCEL_NAME, + commandWidgetClass, box, + XtNlabel, "Cancel", + XtNfromHoriz, printlog_keep, + XtNleft, XawChainRight, + XtNright, XawChainRight, + XtNtop, XawChainBottom, + XtNbottom, XawChainBottom, NULL); + XtAddCallback(printlog_cancel, XtNcallback, info->callbacks->cb_cancel, (XtPointer)info); + XtManageChild(info->printlog); - WM_DELETE_WINDOW = XmInternAtom(XtDisplay(printlog_shell), "WM_DELETE_WINDOW", False); - XmAddWMProtocolCallback(printlog_shell, WM_DELETE_WINDOW, xm_printlog_act_destroy, NULL); - - pane = XtVaCreateWidget("printlog_pane", xmPanedWindowWidgetClass, printlog_shell, - /* make sashes invisible */ - XmNsashWidth, 1, - XmNsashHeight, 1, - NULL); + printlog_enable_cancelbutton(info); - form = XtVaCreateWidget("form", xmFormWidgetClass, pane, - XmNhorizontalSpacing, DDIST, - XmNverticalSpacing, DDIST, - XmNautoUnmanage, False, - NULL); - /* force vertical scrollbars. Under Motif 2.x (2.1.0 and 2.2.2 at least), - XmNeditMode must be set early in order to have an effect. */ - n = 0; +#else /* MOTIF */ + info->printlog = XtVaCreatePopupShell("printlog", + xmDialogShellWidgetClass, globals.widgets.top_level, + XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ + XmNtitle, title, + XtNmappedWhenManaged, False, + XmNtranslations, window_override_translations, + NULL); + + WM_DELETE_WINDOW = XmInternAtom(XtDisplay(info->printlog), "WM_DELETE_WINDOW", False); + XmAddWMProtocolCallback(info->printlog, WM_DELETE_WINDOW, cb_printlog_act_cancel_or_destroy, (XtPointer)info); + + paned = XtVaCreateWidget("printlog_pane", xmPanedWindowWidgetClass, info->printlog, + /* make sashes invisible */ + XmNsashWidth, 1, + XmNsashHeight, 1, + XmNtranslations, window_override_translations, + NULL); + + form = XtVaCreateWidget("form", xmFormWidgetClass, paned, + XmNhorizontalSpacing, DDIST, + XmNverticalSpacing, DDIST, + XmNautoUnmanage, False, + XmNtranslations, window_override_translations, + NULL); + /* force vertical scrollbars. Under Motif 2.x (2.1.0 and 2.2.2 at least), + XmNeditMode must be set early in order to have an effect. */ + { + Arg args[10]; + int n = 0; XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; XtSetArg(args[n], XmNeditable, False); n++; XtSetArg(args[n], XmNrows, 24); n++; XtSetArg(args[n], XmNcolumns, 80); n++; - printlog_text = XmCreateScrolledText(form, "text", args, n); - - XtVaSetValues(XtParent(printlog_text), - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); + printlog_text = XmCreateScrolledText(form, Xdvi_PRINTLOG_TEXT_NAME, args, n); + } - XtManageChild(printlog_text); - - str = XmStringCreateLocalized((char *)close_label); - printlog_unkeep = XtVaCreateManagedWidget("keep", - xmToggleButtonGadgetClass, form, - XmNlabelString, str, - XmNnavigationType, XmTAB_GROUP, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, XtParent(printlog_text), - XmNleftAttachment, XmATTACH_FORM, - NULL); - XmStringFree(str); - XtAddCallback(printlog_unkeep, XmNvalueChangedCallback, unkeep_callback, NULL); - XmToggleButtonGadgetSetState(printlog_unkeep, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, False); - - /* box for Close/Cancel button */ - box = XtVaCreateManagedWidget("box", xmFormWidgetClass, - pane, - NULL); + XtVaSetValues(XtParent(printlog_text), + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNtranslations, window_override_translations, + NULL); + + XtManageChild(printlog_text); + + str = XmStringCreateLocalized((char *)close_label); + printlog_keep = XtVaCreateManagedWidget(Xdvi_PRINTLOG_KEEP_NAME, + xmToggleButtonGadgetClass, form, + XmNlabelString, str, + XmNindicatorType, XmN_OF_MANY, + XmNnavigationType, XmTAB_GROUP, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, XtParent(printlog_text), + XmNleftAttachment, XmATTACH_FORM, + XmNtranslations, window_override_translations, + NULL); + XmStringFree(str); + XtAddCallback(printlog_keep, XmNvalueChangedCallback, info->callbacks->cb_keep, (XtPointer)info); + XmToggleButtonGadgetSetState(printlog_keep, resource.dvips_hang > 0 && resource.dvips_fail_hang > 0, False); + + /* box for Close/Cancel button */ + box = XtVaCreateManagedWidget("box", xmFormWidgetClass, + paned, + NULL); - str = XmStringCreateLocalized("Close"); - printlog_close = XtVaCreateManagedWidget("close", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNshowAsDefault, True, - XmNsensitive, False, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNleftOffset, 10, - NULL); - XmStringFree(str); - XtAddCallback(printlog_close, XmNactivateCallback, close_callback, NULL); - g_close_callback = close_callback; - - str = XmStringCreateLocalized("Cancel"); - printlog_cancel = XtVaCreateManagedWidget("cancel", - xmPushButtonWidgetClass, box, - XmNlabelString, str, - XmNdefaultButtonShadowThickness, 1, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - /* to mimick appearance of native dialog buttons: */ - XmNmarginWidth, 6, - XmNmarginHeight, 4, - XmNtopOffset, 10, - XmNbottomOffset, 10, - XmNrightOffset, 10, - NULL); - XmStringFree(str); - XtAddCallback(printlog_cancel, XmNactivateCallback, cancel_callback, NULL); - g_cancel_callback = cancel_callback; - - XtManageChild(box); - XtManageChild(form); - XtManageChild(pane); -/* center_window(printlog_shell, globals.widgets.top_level); */ -/* XtMapWidget(printlog_shell); */ - /* this doesn't help */ - /* XtOverrideTranslations(form, XtParseTranslationTable(text_translations)); */ - /* XtOverrideTranslations(pane, XtParseTranslationTable(text_translations)); */ - } - else { - XtSetSensitive(printlog_close, False); - XtSetSensitive(printlog_cancel, True); - } + str = XmStringCreateLocalized("Close"); + printlog_close = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CLOSE_NAME, + xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNshowAsDefault, True, + XmNsensitive, False, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + /* mimick appearance of native dialog buttons (better way would be + to extend existing dialog with custom widgets, as in search-dialog.c) */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNleftOffset, 10, + XmNtranslations, window_override_translations, + NULL); + XmStringFree(str); + XtAddCallback(printlog_close, XmNactivateCallback, info->callbacks->cb_close, (XtPointer)info); + XtOverrideTranslations(printlog_close, XtParseTranslationTable("Return:ArmAndActivate()\n")); + + + str = XmStringCreateLocalized("Cancel"); + printlog_cancel = XtVaCreateManagedWidget(Xdvi_PRINTLOG_CANCEL_NAME, + xmPushButtonWidgetClass, box, + XmNlabelString, str, + XmNdefaultButtonShadowThickness, 1, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + /* to mimick appearance of native dialog buttons: */ + XmNmarginWidth, 6, + XmNmarginHeight, 4, + XmNtopOffset, 10, + XmNbottomOffset, 10, + XmNrightOffset, 10, + XmNtranslations, window_override_translations, + NULL); + XmStringFree(str); + XtAddCallback(printlog_cancel, XmNactivateCallback, info->callbacks->cb_cancel, (XtPointer)info); + XtOverrideTranslations(printlog_close, XtParseTranslationTable("Return:ArmAndActivate()\n")); + + XtManageChild(box); + XtManageChild(form); + XtManageChild(paned); + /* center_window(info->printlog, globals.widgets.top_level); */ + /* XtMapWidget(info->printlog); */ + /* this doesn't help */ + /* XtOverrideTranslations(form, XtParseTranslationTable(text_translation_str)); */ + /* XtOverrideTranslations(paned, XtParseTranslationTable(text_translation_str)); */ + + printlog_enable_cancelbutton(info); + #endif adjust_width(printlog_close, printlog_cancel); } void -printlog_append(const char *str, size_t len) +printlog_append(struct save_or_print_info *info, const char *str, size_t len) { -#ifndef MOTIF + Widget text; + Widget w = info->printlog; - static XawTextBlock block = {0, 0, NULL, 0}; + if (!get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) + return; + +#ifndef MOTIF + { + XawTextPosition point; + static XawTextBlock block = {0, 0, NULL, 0}; - block.ptr = (char *) str; - block.length = len; - block.format = XawFmt8Bit; - while (XawTextReplace(printlog_text, printlog_length, printlog_length, &block) - != XawEditDone) { - int length; + block.ptr = (char *) str; + block.length = len; + block.format = XawFmt8Bit; + + point = XawTextGetInsertionPoint(text); + while (XawTextReplace(text, point, point, &block) != XawEditDone) { + int length; - XtVaGetValues(printlog_text, XtNlength, &length, NULL); - printlog_length = length; + XtVaGetValues(text, XtNlength, &length, NULL); + point = length; + } + point += len; + XawTextSetInsertionPoint(text, point); } - printlog_length += len; - XawTextSetInsertionPoint(printlog_text, printlog_length); - #else /* MOTIF */ - - XmTextInsert(printlog_text, printlog_length, (char *) str); - printlog_length += len; - XtVaSetValues(printlog_text, XmNcursorPosition, printlog_length, NULL); - XmTextShowPosition(printlog_text, printlog_length); - + { + XmTextPosition point = XmTextGetInsertionPosition(text); + XmTextInsert(text, point, (char *) str); + point += len; + XtVaSetValues(text, XmNcursorPosition, point, NULL); + XmTextShowPosition(text, point); + } #endif /* MOTIF */ } void -printlog_append_str(const char *str) +printlog_append_str(struct save_or_print_info *info, const char *str) { - printlog_append(str, strlen(str)); + printlog_append(info, str, strlen(str)); +} + +/* enable cancel button, disable close button */ +void +printlog_enable_cancelbutton(struct save_or_print_info *info) +{ + Widget w = info->printlog; + Widget close, cancel; + + if (get_widget_by_name(&cancel, w, Xdvi_PRINTLOG_CANCEL_NAME, True) + && get_widget_by_name(&close, w, Xdvi_PRINTLOG_CLOSE_NAME, True)) { + + XtSetSensitive(close, False); + XtSetSensitive(cancel, True); +#if MOTIF + /* This breaks PRINTLOG_WINDOW_OVERRIDE_TRANSLATIONS?? + * We don't want it activated on Return anyway ... + */ + /* XmProcessTraversal(cancel, XmTRAVERSE_CURRENT); */ +#endif + } } /* disable cancel button, enable close button */ void -printlog_enable_closebutton(void) +printlog_enable_closebutton(struct save_or_print_info *info) { - XtSetSensitive(printlog_close, True); - XtSetSensitive(printlog_cancel, False); + Widget w = info->printlog; + Widget close, cancel; + + if (get_widget_by_name(&cancel, w, Xdvi_PRINTLOG_CANCEL_NAME, True) + && get_widget_by_name(&close, w, Xdvi_PRINTLOG_CLOSE_NAME, True)) { +#if MOTIF + char *window_translations = get_string_va(PRINTLOG_WINDOW_TRANSLATIONS, info); +#endif + XtSetSensitive(close, True); + XtSetSensitive(cancel, False); #if MOTIF - XmProcessTraversal(printlog_close, XmTRAVERSE_CURRENT); + XmProcessTraversal(close, XmTRAVERSE_CURRENT); + XtOverrideTranslations(close, XtParseTranslationTable(window_translations)); + free(window_translations); #endif + } } static void -printlog_internal_close(void) +printlog_internal_close(struct save_or_print_info *info) { - XtUnmapWidget(printlog_shell); - printlog_active = False; + Widget w = info->printlog; + Widget text; + + XtUnmapWidget(w); + + if (get_widget_by_name(&text, w, Xdvi_PRINTLOG_TEXT_NAME, True)) { #ifndef MOTIF - XtVaSetValues(printlog_text, XtNstring, "", NULL); + XtVaSetValues(text, XtNstring, "", NULL); #else - XmTextSetString(printlog_text, ""); + XmTextSetString(text, ""); #endif + } } void -printlog_popdown(Boolean force) +printlog_popdown(struct save_or_print_info *info, Boolean force) { + Widget w = info->printlog; + Widget keep; + if (force) { /* user clicked on `Close' */ - printlog_internal_close(); + printlog_internal_close(info); } - else { /* timer elapsed */ + else if (get_widget_by_name(&keep, w, Xdvi_PRINTLOG_KEEP_NAME, True)) { /* timer elapsed */ #ifndef MOTIF Boolean state; - XtVaGetValues(printlog_unkeep, XtNstate, &state, NULL); + XtVaGetValues(keep, XtNstate, &state, NULL); if (state) { - printlog_internal_close(); + printlog_internal_close(info); } #else - if (XmToggleButtonGadgetGetState(printlog_unkeep)) { - printlog_internal_close(); + if (XmToggleButtonGadgetGetState(keep)) { + printlog_internal_close(info); } #endif } @@ -487,66 +617,119 @@ printlog_popdown(Boolean force) static void printlog_act_close(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); - ASSERT(g_close_callback != NULL, "Callback not initialized"); - (g_close_callback)(NULL, NULL, NULL); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + ASSERT(info->callbacks != NULL && info->callbacks->cb_close != NULL, "Callback not initialized"); + info->callbacks->cb_close(w, info, NULL); } static void printlog_act_keep(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + Widget keep; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + ASSERT(info->callbacks != NULL && info->callbacks->cb_keep != NULL, "Callback not initialized"); + info->callbacks->cb_keep(w, info, NULL); + + if (get_widget_by_name(&keep, info->printlog, Xdvi_PRINTLOG_KEEP_NAME, True)) { #ifdef MOTIF - XmToggleButtonGadgetSetState(printlog_unkeep, False, False); + XmToggleButtonGadgetSetState(keep, False, False); #else - XtVaSetValues(printlog_unkeep, XtNstate, False, NULL); + XtVaSetValues(keep, XtNstate, False, NULL); #endif + } } - static void printlog_act_unkeep(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + Widget keep; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); + + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + if (get_widget_by_name(&keep, info->printlog, Xdvi_PRINTLOG_KEEP_NAME, True)) { #ifdef MOTIF - XmToggleButtonGadgetSetState(printlog_unkeep, True, False); + XmToggleButtonGadgetSetState(keep, True, False); #else - XtVaSetValues(printlog_unkeep, XtNstate, True, NULL); + XtVaSetValues(keep, XtNstate, True, NULL); #endif + } } + static void printlog_act_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); - ASSERT(g_cancel_callback != NULL, "Callback not initialized"); - (g_cancel_callback)(NULL, NULL, NULL); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + ASSERT(info->callbacks != NULL && info->callbacks->cb_cancel != NULL, "Callback not initialized"); + info->callbacks->cb_cancel(w, info, NULL); } + static void -printlog_act_destroy(Widget w, XEvent *event, String *params, Cardinal *num_params) +printlog_act_cancel_or_destroy(Widget w, XEvent *event, String *params, Cardinal *num_params) { + void *ptr; + struct save_or_print_info *info; + UNUSED(w); UNUSED(event); - UNUSED(params); - UNUSED(num_params); - ASSERT((g_destroy_callback) != NULL, "Callback not initialized"); - (g_destroy_callback)(NULL, NULL, NULL); + if (*num_params < 1) { + XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); + return; + } + sscanf(*params, "%p", &ptr); + info = (struct save_or_print_info *)ptr; + + cb_printlog_act_cancel_or_destroy(w, (XtPointer)ptr, NULL); + + /* ASSERT(info->callbacks != NULL && info->callbacks->cb_cancel != NULL, "Callback not initialized"); */ + /* info->callbacks->cb_cancel(w, info, NULL); */ } diff --git a/Build/source/texk/xdvik/gui/print-log.h b/Build/source/texk/xdvik/gui/print-log.h index 90e69be8343..53855d8e04e 100644 --- a/Build/source/texk/xdvik/gui/print-log.h +++ b/Build/source/texk/xdvik/gui/print-log.h @@ -23,24 +23,19 @@ #ifndef PRINT_LOG_H_ #define PRINT_LOG_H_ -/* printlog access functions */ +struct save_or_print_info *info; /* forward declaration */ -extern void printlog_create(const char *title, - const char *close_label, - /* callback for `close' button */ - void (*close_callback)(Widget w, XtPointer client_data, XtPointer call_data), - /* callback for `cancel' button */ - void (*cancel_callback)(Widget w, XtPointer client_data, XtPointer call_data), - /* callback for destroying window via window manager */ - void (*destroy_callback)(Widget w, XtPointer client_data, XtPointer call_data), - /* callback for `close automatically' checkbox */ - void (*unkeep_callback)(Widget w, XtPointer client_data, XtPointer call_data)); -extern Boolean printlog_raise_active(void); -extern void printlog_popup(void); -extern void printlog_reset(void); -extern void printlog_append(const char *str, size_t len); -extern void printlog_append_str(const char *str); -extern void printlog_enable_closebutton(void); -extern void printlog_popdown(Boolean override_timer); +/* printlog access functions */ +extern void printlog_create(struct save_or_print_info *info, + const char *title, + const char *close_label); +extern Boolean printlog_raise_active(struct save_or_print_info *info); +extern void printlog_popup(struct save_or_print_info *info); +extern void printlog_reset(struct save_or_print_info *info); +extern void printlog_append(struct save_or_print_info *info, const char *str, size_t len); +extern void printlog_append_str(struct save_or_print_info *info, const char *str); +extern void printlog_enable_closebutton(struct save_or_print_info *info); +extern void printlog_enable_cancelbutton(struct save_or_print_info *info); +extern void printlog_popdown(struct save_or_print_info *info, Boolean override_timer); #endif /* PRINT_LOG_H_ */ diff --git a/Build/source/texk/xdvik/gui/search-dialog.c b/Build/source/texk/xdvik/gui/search-dialog.c index c77fa9d219e..e84e6c4ec40 100644 --- a/Build/source/texk/xdvik/gui/search-dialog.c +++ b/Build/source/texk/xdvik/gui/search-dialog.c @@ -30,9 +30,11 @@ #include "xlwradio.h" #include "statusline.h" #include "string-utils.h" +#include "string_list.h" #include "util.h" #include "message-window.h" #include "x_util.h" +#include "xm_menu.h" /* for popdown_callback() */ #include #include @@ -51,6 +53,10 @@ # include # include # include +# if USE_COMBOBOX +# include +# include +# endif /* USE_COMBOBOX */ #else /* MOTIF */ # include # include @@ -91,6 +97,172 @@ # define ACTIVATE_CALLBACK_NAME XtNcallback #endif /* MOTIF */ +#if defined(MOTIF) && USE_COMBOBOX +struct search_history { + char **char_items; + size_t item_cnt; + Boolean empty; +}; + +#define Xdvi_HISTORY_EMPTY_MARKER "" + +static void +search_history_init(struct search_history *hist) +{ + if (resource.search_history == NULL) { + hist->empty = True; + hist->char_items = xmalloc(1 * sizeof *(hist->char_items)); + hist->char_items[0] = NULL; + hist->item_cnt = 0; + } + else { + hist->char_items = get_separated_list(resource.search_history, "\n", False); + hist->empty = False; + /* count number of items and save to hist->item_cnt */ + for (hist->item_cnt = 0; hist->char_items[hist->item_cnt] != NULL; hist->item_cnt++) { ; } + } +} + + +static void +search_history_update(struct search_history *hist, Widget w, const char *str) +{ + size_t i; + char *tmp; + XmString tmp_str = XmStringCreateLocalized((char *)str); + Boolean found = False; + Widget textfield = NULL; + + TRACE_FIND((stderr, "search_history_update for: |%s|\n", str)); + + /* special case if Xdvi_HISTORY_EMPTY_MARKER is present: Replace it with `str' */ + if (hist->empty) { + XmComboBoxDeletePos(w, 0); + hist->empty = False; + hist->char_items = string_list_prepend(hist->char_items, str); + XmComboBoxAddItem(w, tmp_str, 0, True); + hist->item_cnt++; + XmStringFree(tmp_str); + return; + } + + XtVaGetValues(w, XmNtextField, &textfield, NULL); + if (textfield == NULL) { + XDVI_ERROR((stderr, "Could not get text field from combo box!")); + XmStringFree(tmp_str); + return; + } + + /* if str is already in the history, just move it to the first position */ + for (i = 0; hist->char_items[i] != NULL; i++) { + if (strcmp(hist->char_items[i], str) == 0) { + found = True; + break; + } + } + if (found) { + hist->char_items = string_list_move_to_start(hist->char_items, i); + XmComboBoxDeletePos(w, i + 1); + XmComboBoxAddItem(w, tmp_str, 1, True); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(hist->char_items[0]), NULL); + XmStringFree(tmp_str); + return; + } + + if ((int)hist->item_cnt >= resource.search_history_size) { + /* history has reached its max size, delete the oldest element and + put the new element at the beginning */ + + XmComboBoxDeletePos(w, hist->item_cnt); + + free(hist->char_items[hist->item_cnt - 1]); + hist->char_items[hist->item_cnt - 1] = xstrdup(str); + hist->char_items = string_list_rotate_up(hist->char_items); + + XmComboBoxAddItem(w, tmp_str, 1, False); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(str), NULL); + } + else { /* add item */ + hist->char_items = string_list_prepend(hist->char_items, str); + XmComboBoxAddItem(w, tmp_str, 1, False); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(str), NULL); + + hist->item_cnt++; + } + + tmp = string_list_to_str(hist->char_items, "\n"); + TRACE_FIND((stderr, "Saving search history: |%s|\n", tmp)); + store_preference(NULL, "searchHistory", "%s", tmp); + free(tmp); + + + XmStringFree(tmp_str); +} + + +/* + * User selected an item from seach history list + */ +static void +cb_search_history_select(Widget w, XtPointer client_data, XtPointer call_data) +{ + XmComboBoxCallbackStruct *cb = (XmComboBoxCallbackStruct *)call_data; + struct search_history *hist = NULL; + Widget textfield; + int pos; + int idx; + + UNUSED(client_data); + + if (cb->event == NULL) /* only browsing, no selection */ + return; + + pos = cb->item_position; + TRACE_FIND((stderr, "POS: %d; reason: %d, event type: %d\n", pos, cb->reason, cb->event->type)); + + /* Return if user didn't select from menu, but entered text directly. + Strangely, `pos == 0' doesn't indicate this, contrary to what the docs say + about XmONE_BASED. */ + if (pos == 0 || cb->event->type != ButtonRelease) + return; + + + XtVaGetValues(w, + XmNuserData, &hist, + XmNtextField, &textfield, + NULL); + + if (hist == NULL || textfield == NULL) { + XDVI_ERROR((stderr, "Couldn't get XmNuserData or XmNtextField from combo box widget!\n")); + return; + } + + idx = pos - 1; + + if (idx == 0 && hist->char_items[0] == NULL) { /* Xdvi_HISTORY_EMPTY_MARKER selected, do nothing */ + XtVaSetValues(textfield, XmNvalue, "", NULL); + } + else { + XmString tmp_str; + + TRACE_FIND((stderr, "moving item %d, %s to pos 0\n", idx, hist->char_items[idx])); + hist->char_items = string_list_move_to_start(hist->char_items, idx); + + /* same for list in combo box */ + tmp_str = XmStringCreateLocalized(hist->char_items[0]); + XmComboBoxDeletePos(w, pos); + XmComboBoxAddItem(w, tmp_str, 1, True); + XmComboBoxSelectItem(w, tmp_str); + XtVaSetValues(textfield, XmNcursorPosition, strlen(hist->char_items[0]), NULL); + XmStringFree(tmp_str); + } +} + +#endif /* defined(MOTIF) && USE_COMBOBOX */ + static Boolean m_find_popup_active = False; /* flags for setting single bits in resource.search_window_defaults */ @@ -98,6 +270,7 @@ static const int SETTINGS_USE_REGEXP_FLAG = 1; static const int SETTINGS_CASE_SENSITIVE_FLAG = 2; static const int SETTINGS_BACKWARDS_FLAG = 4; static const int SETTINGS_IGNORE_LINEBREAKS_FLAG = 8; +static const int SETTINGS_WRAP_FLAG = 16; static void @@ -110,24 +283,21 @@ cb_search_go(Widget w, XtPointer client_data, XtPointer call_data) ASSERT(settings != NULL, "client_data cb_search_go mustn't be NULL!"); UNUSED(call_data); - TRACE_FIND((stderr, "cb_search_go: settings: searchterm=|%s|, down = %d, re = %d, case = %d", - settings->term, settings->direction, settings->use_regexp, settings->case_sensitive)); + TRACE_FIND((stderr, "cb_search_go: settings: searchterm=|%s|, down = %d, re = %d, case = %d, wrap = %d", + settings->term, settings->direction, settings->use_regexp, settings->case_sensitive, settings->wrap)); - /* retrieve the find popup window */ - if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_popup\" widget!")); - x = y = 0; - } - else { - XtVaGetValues(find_popup, XtNx, &x, XtNy, &y, NULL); - /* add some offsets */ - settings->x_pos = x + 10; - settings->y_pos = y + 10; - TRACE_GUI((stderr, "SHELL: %ld; x: %d, y: %d", (unsigned long)w, x, y)); - } + if (!get_widget_by_name(&find_popup, globals.widgets.top_level, "find_popup", True)) + return; + + XtVaGetValues(find_popup, XtNx, &x, XtNy, &y, NULL); + /* add some offsets */ + settings->x_pos = x + 10; + settings->y_pos = y + 10; + TRACE_GUI((stderr, "SHELL: %ld; x: %d, y: %d", (unsigned long)w, x, y)); settings->from_page = current_page; settings->message_window = 0; + settings->wrapcnt = 0; TRACE_FIND((stderr, "starting search from page: %d", settings->from_page)); search_dvi((XtPointer)settings); } @@ -136,14 +306,15 @@ static void show_settings(const char *func_name, struct search_settings *settings) { TRACE_FIND((stderr, "%s: settings: str=|%s|, down = %d, re = %d, " - "case = %d, ignore_hyphens = %d, ignore_linebreaks = %d\n", + "case = %d, ignore_hyphens = %d, ignore_linebreaks = %d, wrap = %d\n", func_name, settings->term, settings->direction, settings->use_regexp, settings->case_sensitive, settings->ignore_hyphens, - settings->ignore_linebreaks)); + settings->ignore_linebreaks, + settings->wrap)); } @@ -221,6 +392,26 @@ cb_backwards_search(Widget w, XtPointer client_data, XtPointer call_data) store_preference(NULL, "searchWindowDefaults", "%u", resource.search_window_defaults); } +static void +cb_wrap_search(Widget w, XtPointer client_data, XtPointer call_data) +{ + struct search_settings *settings = (struct search_settings *)client_data; + ASSERT(settings != NULL, "client_data cb_search_go mustn't be NULL!"); + UNUSED(w); + UNUSED(call_data); + + settings->wrap = !settings->wrap; + + show_settings("cb_wrap_search", settings); + + if (settings->wrap) + resource.search_window_defaults |= SETTINGS_WRAP_FLAG; + else + resource.search_window_defaults &= ~SETTINGS_WRAP_FLAG; + + store_preference(NULL, "searchWindowDefaults", "%u", resource.search_window_defaults); +} + static void cb_match_case(Widget w, XtPointer client_data, XtPointer call_data) { @@ -260,6 +451,7 @@ cb_linebreaks(Widget w, XtPointer client_data, XtPointer call_data) store_preference(NULL, "searchWindowDefaults", "%u", resource.search_window_defaults); } + static void cb_search_cancel(Widget w, XtPointer client_data, XtPointer call_data) { @@ -268,12 +460,9 @@ cb_search_cancel(Widget w, XtPointer client_data, XtPointer call_data) UNUSED(w); UNUSED(call_data); - - /* retrieve the find popup window */ - if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_popup\" widget!")); + + if (!get_widget_by_name(&find_popup, globals.widgets.top_level, "find_popup", True)) return; - } /* This flag is checked in the scanning routines, and will be eventually reset by do_pages() in events.c. @@ -297,6 +486,10 @@ cb_search_get_term_button(Widget w, XtPointer client_data, XtPointer call_data) struct search_settings *settings = (struct search_settings *)client_data; char *searchterm = NULL; +#if defined(MOTIF) && USE_COMBOBOX + struct search_history *hist = NULL; +#endif + Widget searchbox_input, paned, box; UNUSED(call_data); @@ -305,13 +498,26 @@ cb_search_get_term_button(Widget w, XtPointer client_data, XtPointer call_data) paned = XtParent(box); ASSERT(paned != 0, "Parent of box widget mustn't be NULL!"); - if ((searchbox_input = XtNameToWidget(paned, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); + if (!get_widget_by_name(&searchbox_input, paned, Xdvi_SEARCHBOX_INPUT_NAME, True)) return; - } #ifdef MOTIF +# if USE_COMBOBOX + { + Widget textfield = NULL; + XtVaGetValues(searchbox_input, + XmNtextField, &textfield, + XmNuserData, &hist, + NULL); + if (textfield == NULL || hist == NULL) { + XDVI_ERROR((stderr, "Couldn't get XmNtextField or XmNuserData from combo box widget!\n")); + return; + } + XtVaGetValues(textfield, XmNvalue, &searchterm, NULL); + } +# else XtVaGetValues(searchbox_input, XmNvalue, &searchterm, NULL); +# endif #else XtVaGetValues(searchbox_input, XtNstring, &searchterm, NULL); #endif @@ -322,6 +528,10 @@ cb_search_get_term_button(Widget w, XtPointer client_data, XtPointer call_data) TRACE_FIND((stderr, "searchterm1: |%s|", searchterm)); settings->term = searchterm; +#if defined(MOTIF) && USE_COMBOBOX + search_history_update(hist, searchbox_input, searchterm); +#endif + cb_search_go(w, settings, NULL); } @@ -355,26 +565,32 @@ cb_search_get_term(Widget w, XtPointer client_data, XtPointer call_data) { struct search_settings *settings = (struct search_settings *)client_data; char *searchterm = NULL; - Widget form, paned, searchbox_form; - Widget button; + Widget popup, button, textfield; XEvent ev; UNUSED(call_data); + TRACE_FIND((stderr, "cb_search_get_term!\n")); + +#if USE_COMBOBOX + UNUSED(w); + { + Widget combobox; + if (!get_widget_by_name(&combobox, globals.widgets.top_level, Xdvi_SEARCHBOX_INPUT_NAME, True) + || !get_widget_by_name(&textfield, globals.widgets.top_level, "Text", True)) + return; + } +#else + textfield = w; +#endif + /* retrieve the `Find' button widget */ - searchbox_form = XtParent(w); - ASSERT(searchbox_form != 0, "Parent of button widget mustn't be NULL!"); - form = XtParent(searchbox_form); - ASSERT(form != 0, "Parent of searchbox_form widget mustn't be NULL!"); - paned = XtParent(form); - ASSERT(paned != 0, "Parent of form widget mustn't be NULL!"); - if ((button = XtNameToWidget(paned, "*find_button")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_button\" widget!")); + if (!get_widget_by_name(&popup, globals.widgets.top_level, Xdvi_SEARCH_POPUP_NAME, True) + || !get_widget_by_name(&button, popup, "find_button", True)) return; - } if (settings != NULL) { /* retrieve search term from text input field */ - XtVaGetValues(w, XmNvalue, &searchterm, NULL); + XtVaGetValues(textfield, XmNvalue, &searchterm, NULL); if (searchterm == NULL) { XDVI_WARNING((stderr, "Searchterm in cb_search_get_term callback shouldn't be NULL!")); return; @@ -385,8 +601,8 @@ cb_search_get_term(Widget w, XtPointer client_data, XtPointer call_data) } /* make the `Find' button think it got pushed. - Also synthetisize an event, just to be sure ... */ - synthetisize_event(&ev, button); + Also synthesize an event, just to be sure ... */ + synthesize_event(&ev, button); XtCallActionProc(button, "ArmAndActivate", &ev, NULL, 0); /* the following don't make the button appear visually pressed: */ @@ -407,7 +623,7 @@ xm_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) if (params != NULL) { /* re-initialize search term */ ASSERT(*num_params == 1, "num_params in xm_search_go should be 1 if *params != NULL"); /* - * the *params char pointer contains the pointer value (address) of `settings'; + * the *params char pointer contains the pointer value (address) of `settings' as a string; * convert it back to a pointer: */ TRACE_GUI((stderr, "Pointer string value: |%s|", *params)); @@ -417,11 +633,9 @@ xm_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) ASSERT(settings != NULL, "Shouldn't happen: Couldn't get string representation of argument pointer."); } - if ((input = XtNameToWidget(globals.widgets.top_level, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); - return; + if (get_widget_by_name(&input, globals.widgets.top_level, "searchbox_input", True)) { + cb_search_get_term(input, settings, NULL); } - cb_search_get_term(input, settings, NULL); } #else /* MOTIF */ @@ -434,7 +648,7 @@ xaw_unset_button(XtPointer client_data, XtIntervalId *id) UNUSED(id); - synthetisize_event(&ev, button); + synthesize_event(&ev, button); XtCallActionProc(button, "unset", &ev, NULL, 0); } @@ -449,15 +663,9 @@ xaw_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) UNUSED(w); - /* retrieve the `Find' button widget */ - if ((button = XtNameToWidget(globals.widgets.top_level, "*find_button")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_button\" widget!")); + if (!get_widget_by_name(&button, globals.widgets.top_level, "find_button", True) + || !get_widget_by_name(&input, globals.widgets.top_level, "searchbox_input", True)) return; - } - if ((input = XtNameToWidget(globals.widgets.top_level, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); - return; - } XtVaGetValues(input, XtNstring, &searchterm, NULL); if (searchterm == NULL) { @@ -488,7 +696,7 @@ xaw_search_go(Widget w, XEvent *event, String *params, Cardinal *num_params) XtCallActionProc(button, "set", event, NULL, 0); XtCallActionProc(button, "notify", event, NULL, 0); XSync(DISP, False); - timeout = XtAppAddTimeOut(app, 150, xaw_unset_button, (XtPointer)button); + timeout = XtAppAddTimeOut(globals.app, 150, xaw_unset_button, (XtPointer)button); } @@ -531,6 +739,8 @@ static XtActionsRec search_actions[] = { { "cancel-search", search_cancel }, }; + + static Widget create_search_window(struct search_settings *settings) { @@ -539,11 +749,15 @@ create_search_window(struct search_settings *settings) Widget form, find_paned, box; unsigned char curr_state; +#if defined(MOTIF) && USE_COMBOBOX + static struct search_history hist = { NULL, 0, True }; +#endif + Widget searchbox_form, searchbox_label, searchbox_input; /* left and right column */ Widget options_left_form, options_right_form; /* checkboxes in left column */ - Widget regexp_checkbox, matchcase_checkbox, backwards_checkbox; + Widget regexp_checkbox, matchcase_checkbox, backwards_checkbox, wrap_checkbox; /* checkboxes in right column */ Widget linebreaks_checkbox; Widget find_button, cancel_button; @@ -579,10 +793,23 @@ create_search_window(struct search_settings *settings) translation_str = NULL; #endif /* not MOTIF */ + translation_str = get_string_va( +#ifdef MOTIF + "osfCancel:cancel-search(%p)\n" +#else + "Escape:cancel-search(%p)\n" +#endif + "Return:do-search(%p)\n" + "Ctrlg:find-next()", + (void *)settings, (void *)settings); + + xlats = XtParseTranslationTable(translation_str); + free(translation_str); + top_level_shell = XtVaCreatePopupShell("find_popup", SHELL_WIDGET, globals.widgets.top_level, - XtNtitle, "xdvik: Find in DVI file", + XtNtitle, "xdvik: Find in File", XtNmappedWhenManaged, False, /* so that we can center it first */ XtNtransientFor, globals.widgets.top_level, XtNallowShellResize, True, @@ -659,7 +886,83 @@ create_search_window(struct search_settings *settings) #endif NULL); - searchbox_input = XtVaCreateManagedWidget("searchbox_input", +#if defined(MOTIF) && USE_COMBOBOX + + { + Widget textfield = NULL; + Widget grab_shell = NULL; + size_t n; + XmStringTable items; + + search_history_init(&hist); + + /* initialize Motif string list */ + n = hist.item_cnt == 0 ? 1 : hist.item_cnt; + items = (XmStringTable)XtMalloc(n * sizeof(XmString *)); + + if (hist.item_cnt == 0) + items[0] = XmStringCreateLocalized(Xdvi_HISTORY_EMPTY_MARKER); + else { + for (n = 0; hist.char_items[n] != NULL; n++) + items[n] = XmStringCreateLocalized(hist.char_items[n]); + } + + searchbox_input = XtVaCreateManagedWidget(Xdvi_SEARCHBOX_INPUT_NAME, xmComboBoxWidgetClass, + searchbox_form, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, searchbox_label, + XmNbottomAttachment, XmATTACH_FORM, + XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX, + XmNitems, items, + XmNitemCount, n, + /* XmONE_BASED so that we can distinguish between + keyboard entry and selection from popdown list */ + XmNpositionMode, XmONE_BASED, + /* XmNitemCount, hist.item_cnt, */ + /* XmNvisibleItemCount, hist.item_cnt, */ + XmNuserData, &hist, + XmNarrowSize, Xdvi_COMBO_BOX_ARROW_SIZE, + NULL); + if (resource.search_history_size < 10) { + /* usually the dropdown list shows 10 entries */ + XtVaSetValues(searchbox_input, XmNvisibleItemCount, resource.search_history_size); + } + + /* free Motif strings */ + if (hist.item_cnt == 0) + XmStringFree(items[0]); + else { + for (n = 0; hist.char_items[n] != NULL; n++) + XmStringFree(items[n]); + } + XtFree((XtPointer)items); + + /* start with empty search field */ + XtVaGetValues(searchbox_input, XmNtextField, &textfield, NULL); + if (textfield == NULL) + XDVI_ERROR((stderr, "Couldn't get textfield from combo box widget!\n")); + + if (settings->term != NULL) { + XtVaSetValues(textfield, XmNvalue, settings->term, NULL); + } + else { + XtVaSetValues(textfield, XmNvalue, "", NULL); + } + XtAddCallback(textfield, XmNactivateCallback, cb_search_get_term, settings); + XtAddCallback(searchbox_input, XmNselectionCallback, cb_search_history_select, (XtPointer)settings); + + XtOverrideTranslations(textfield, xlats); + /* workaround for pointer grabbing bug (see xm_menu.c) */ + if (get_widget_by_name(&grab_shell, searchbox_input, "GrabShell", True)) { + XtAddCallback(grab_shell, XtNpopdownCallback, popdown_callback, NULL); + } + + } +#else /* defined(MOTIF) && USE_COMBOBOX */ + + searchbox_input = XtVaCreateManagedWidget(Xdvi_SEARCHBOX_INPUT_NAME, TEXT_WIDGET, searchbox_form, #ifdef MOTIF @@ -677,7 +980,9 @@ create_search_window(struct search_settings *settings) VERTICAL_RESIZING_NO, #endif NULL); - +#ifdef MOTIF + XtAddCallback(searchbox_input, XmNactivateCallback, cb_search_get_term, settings); +#endif if (settings->term != NULL) { XtVaSetValues(searchbox_input, @@ -688,11 +993,15 @@ create_search_window(struct search_settings *settings) #endif settings->term, NULL); } + +#endif /* defined(MOTIF) && USE_COMBOBOX */ + XtManageChild(searchbox_form); -#ifdef MOTIF - XtAddCallback(searchbox_input, XmNactivateCallback, cb_search_get_term, settings); + /* Fix for #1499566: Force input focus for text input field */ +#ifndef MOTIF + XtSetKeyboardFocus(find_paned, searchbox_input); #endif /* @@ -708,8 +1017,8 @@ create_search_window(struct search_settings *settings) XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, searchbox_form, XmNleftAttachment, XmATTACH_FORM, -/* XmNrightAttachment, XmATTACH_FORM, */ -/* XmNbottomAttachment, XmATTACH_FORM, */ + /* XmNrightAttachment, XmATTACH_FORM, */ + /* XmNbottomAttachment, XmATTACH_FORM, */ #else XtNborderWidth, 0, XtNfromVert, searchbox_form, @@ -731,7 +1040,7 @@ create_search_window(struct search_settings *settings) XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, options_left_form, XmNrightAttachment, XmATTACH_FORM, -/* XmNbottomAttachment, XmATTACH_FORM, */ + /* XmNbottomAttachment, XmATTACH_FORM, */ #else XtNborderWidth, 0, XtNfromVert, searchbox_form, @@ -778,7 +1087,6 @@ create_search_window(struct search_settings *settings) XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, regexp_checkbox, XmNleftAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, #else XtNlabel, "Find backwards", XtNfromVert, regexp_checkbox, @@ -792,6 +1100,34 @@ create_search_window(struct search_settings *settings) XtAddCallback(backwards_checkbox, VALUE_CALLBACK_NAME, cb_backwards_search, settings); +#ifdef MOTIF + XmStringFree(str); + str = XmStringCreateLocalized("Wrap search"); +#endif + + wrap_checkbox = XtVaCreateManagedWidget("backwards_checkbox", + CHECKBOX_WIDGET, + options_left_form, +#ifdef MOTIF + XmNlabelString, str, + XmNindicatorType, XmN_OF_MANY, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, backwards_checkbox, + XmNleftAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, +#else + XtNlabel, "Wrap search", + XtNfromVert, backwards_checkbox, + XtNborderWidth, 0, + XtNisRadio, False, + XtNhighlightThickness, 1, + HORIZONTAL_RESIZING_NO, + VERTICAL_RESIZING_NO, +#endif + NULL); + + XtAddCallback(wrap_checkbox, VALUE_CALLBACK_NAME, cb_wrap_search, settings); + #ifdef MOTIF XmStringFree(str); str = XmStringCreateLocalized("Case sensitive"); @@ -930,19 +1266,6 @@ create_search_window(struct search_settings *settings) XtAddCallback(cancel_button, ACTIVATE_CALLBACK_NAME, cb_search_cancel, settings); XtAddCallback(find_button, ACTIVATE_CALLBACK_NAME, cb_search_get_term_button, settings); - translation_str = get_string_va( -#ifdef MOTIF - "osfCancel:cancel-search(%p)\n" -#else - "Escape:cancel-search(%p)\n" -#endif - "Return:do-search(%p)\n" - "Ctrlg:find-next()", - (void *)settings, (void *)settings); - - xlats = XtParseTranslationTable(translation_str); - free(translation_str); - XtOverrideTranslations(searchbox_form, xlats); XtOverrideTranslations(options_left_form, xlats); XtOverrideTranslations(options_right_form, xlats); @@ -978,7 +1301,7 @@ create_search_window(struct search_settings *settings) #ifdef MOTIF XmProcessTraversal(searchbox_input, XmTRAVERSE_CURRENT); -/* XmProcessTraversal(find_button, XmTRAVERSE_CURRENT); */ + /* XmProcessTraversal(find_button, XmTRAVERSE_CURRENT); */ #endif XSetWMProtocols(XtDisplay(top_level_shell), XtWindow(top_level_shell), &WM_DELETE_WINDOW, 1); @@ -991,6 +1314,8 @@ create_search_window(struct search_settings *settings) XtVaSetValues(backwards_checkbox, CHECKBUTTON_IS_SET, True, NULL); if (resource.search_window_defaults & SETTINGS_IGNORE_LINEBREAKS_FLAG) XtVaSetValues(linebreaks_checkbox, CHECKBUTTON_IS_SET, True, NULL); + if (resource.search_window_defaults & SETTINGS_WRAP_FLAG) + XtVaSetValues(wrap_checkbox, CHECKBUTTON_IS_SET, True, NULL); /* initialize `settings' values according to the checkbox states (in case user has assigned values via X defaults): */ @@ -998,6 +1323,8 @@ create_search_window(struct search_settings *settings) settings->use_regexp = curr_state; XtVaGetValues(matchcase_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); settings->case_sensitive = curr_state; + XtVaGetValues(wrap_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); + settings->wrap = curr_state; XtVaGetValues(backwards_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); settings->direction = curr_state ? SEARCH_UP : SEARCH_DOWN; XtVaGetValues(linebreaks_checkbox, CHECKBUTTON_IS_SET, &curr_state, NULL); @@ -1020,15 +1347,18 @@ dvi_find_string(const char *str, Boolean find_next) * Also pops up the find dialog, to make it easier for user to * edit options, change direction etc. */ Widget find_popup; - if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { + if (!get_widget_by_name(&find_popup, globals.widgets.top_level, "find_popup", False)) { static struct search_settings settings; - static struct search_info searchinfo = { False, False, False, 0, 0, 0, 0 }; + static struct search_info searchinfo = { False, False, False, 0, 0, 0, 0 }; settings.term = str; settings.use_regexp = False; settings.case_sensitive = False; settings.direction = SEARCH_DOWN; settings.ignore_hyphens = False; settings.ignore_linebreaks = False; + settings.wrap = False; + settings.isearchterm = NULL; + settings.wrapcnt = 0; settings.x_pos = -1; settings.y_pos = -1; settings.searchinfo = &searchinfo; @@ -1041,10 +1371,8 @@ dvi_find_string(const char *str, Boolean find_next) } else if (str != NULL) { /* change the search term */ Widget searchbox_input; - if ((searchbox_input = XtNameToWidget(find_popup, "*searchbox_input")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"searchbox_input\" widget!")); + if (!get_widget_by_name(&searchbox_input, find_popup, "searchbox_input", True)) return; - } XtVaSetValues(searchbox_input, #ifdef MOTIF XmNvalue, diff --git a/Build/source/texk/xdvik/gui/search-dialog.h b/Build/source/texk/xdvik/gui/search-dialog.h index c272658d021..6c9f2ec5287 100644 --- a/Build/source/texk/xdvik/gui/search-dialog.h +++ b/Build/source/texk/xdvik/gui/search-dialog.h @@ -52,12 +52,15 @@ struct search_settings { Boolean case_sensitive; Boolean ignore_hyphens; Boolean ignore_linebreaks; + Boolean wrap; + int wrapcnt; /* > 0 if search has wrapped */ + char *isearchterm; /* non-NULL when doing isearch */ searchDirectionT direction; struct search_info *searchinfo; /* internal state management */ int x_pos, y_pos; /* position of the search popup window */ int from_page; /* page to start search from */ - int curr_page; /* current page of search search from */ + int curr_page; /* current page of search */ int to_page; /* highest page already scanned */ int hyphen_delta; /* difference in offsets when hyphenation is removed */ Widget message_window; /* warning popup, or NULL if it doesn't exist */ diff --git a/Build/source/texk/xdvik/gui/selection.c b/Build/source/texk/xdvik/gui/selection.c index e0bef1e5f1e..8fb2347c0d2 100644 --- a/Build/source/texk/xdvik/gui/selection.c +++ b/Build/source/texk/xdvik/gui/selection.c @@ -124,13 +124,13 @@ deliver_selection_cb(Widget w, if (*target == targets) { /* TARGETS handling copied from xclipboard.c */ Atom* targetP; - Atom* std_targets; + XPointer std_targets; /* was: Atom* */ unsigned long std_length; XSelectionRequestEvent* req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); TRACE_GUI((stderr, "Selection type: targets")); XmuConvertStandardSelection(w, req->time, selection, - target, type, (XPointer*)&std_targets, &std_length, format); + target, type, &std_targets, &std_length, format); *value = XtMalloc(sizeof(Atom)*(std_length + 2)); targetP = *(Atom**)value; *length = std_length + 2; @@ -144,74 +144,76 @@ deliver_selection_cb(Widget w, } else #endif - if (*target == utf8_string) { - TRACE_GUI((stderr, "Selection type: UTF8_STRING")); - *type = *target; - *value = (XtPointer)XtNewString(m_selection_text); - /* *value = (XtPointer)m_selection_text; */ - *length = strlen(m_selection_text); - *format = 8; - return True; - } - else if (*target == XA_STRING) { - char *ptr = utf8_to_native_encoding(m_selection_text); - TRACE_GUI((stderr, "Selection type: XA_STRING")); - strncpy(m_cvt_selection_text, ptr, m_selection_size); - m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ - free(ptr); - *type = *target; - *value = (XtPointer)XtNewString(m_cvt_selection_text); - /* *value = (XtPointer)m_selection_text; */ - *length = strlen(m_cvt_selection_text); - *format = 8; - return True; - } + { + if (*target == utf8_string) { + TRACE_GUI((stderr, "Selection type: UTF8_STRING")); + *type = *target; + *value = (XtPointer)XtNewString(m_selection_text); + /* *value = (XtPointer)m_selection_text; */ + *length = strlen(m_selection_text); + *format = 8; + return True; + } + else if (*target == XA_STRING) { + char *ptr = utf8_to_native_encoding(m_selection_text); + TRACE_GUI((stderr, "Selection type: XA_STRING")); + strncpy(m_cvt_selection_text, ptr, m_selection_size); + m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ + free(ptr); + *type = *target; + *value = (XtPointer)XtNewString(m_cvt_selection_text); + /* *value = (XtPointer)m_selection_text; */ + *length = strlen(m_cvt_selection_text); + *format = 8; + return True; + } #if HAVE_X11_XMU_XMU_H - else if (*target == XA_COMPOUND_TEXT(DISP) || *target == XA_TEXT(DISP)) { - const char *cl[1]; - char *ptr; - int retval; + else if (*target == XA_COMPOUND_TEXT(DISP) || *target == XA_TEXT(DISP)) { + const char *cl[1]; + char *ptr; + int retval; - XTextProperty ct; - XICCEncodingStyle style = XStdICCTextStyle; + XTextProperty ct; + XICCEncodingStyle style = XStdICCTextStyle; - TRACE_GUI((stderr, "Selection type: XA_COMPOUND_TEXT")); - ptr = utf8_to_native_encoding(m_selection_text); - strncpy(m_cvt_selection_text, ptr, m_selection_size); - m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ - cl[0] = m_cvt_selection_text; + TRACE_GUI((stderr, "Selection type: XA_COMPOUND_TEXT")); + ptr = utf8_to_native_encoding(m_selection_text); + strncpy(m_cvt_selection_text, ptr, m_selection_size); + m_cvt_selection_text[m_selection_size - 1] = '\0'; /* ensure termination */ + cl[0] = m_cvt_selection_text; - *type = *target; - retval = XmbTextListToTextProperty(DISP, (char **)cl, 1, style, &ct); + *type = *target; + retval = XmbTextListToTextProperty(DISP, (char **)cl, 1, style, &ct); - if (retval == XNoMemory || retval == XLocaleNotSupported || retval == XConverterNotFound) { - statusline_print(STATUS_MEDIUM, "XmbTextListToTextProperty failed: %d", retval); - return False; - } + if (retval == XNoMemory || retval == XLocaleNotSupported || retval == XConverterNotFound) { + statusline_info(STATUS_MEDIUM, "XmbTextListToTextProperty failed: %d", retval); + return False; + } - *value = ct.value; - *length = ct.nitems; - *format = 8; - return True; - } -#endif - else { -#if HAVE_X11_XMU_XMU_H - TRACE_GUI((stderr, "Selection type: standard selection")); - if (XmuConvertStandardSelection(w, CurrentTime, selection, - target, type, (XPointer *)value, length, format)) + *value = ct.value; + *length = ct.nitems; + *format = 8; return True; + } +#endif else { +#if HAVE_X11_XMU_XMU_H + TRACE_GUI((stderr, "Selection type: standard selection")); + if (XmuConvertStandardSelection(w, CurrentTime, selection, + target, type, (XPointer *)value, length, format)) + return True; + else { #endif - TRACE_GUI((stderr, "Selection type unsupported: %lu (%s)", - (unsigned long)*target, XGetAtomName(DISP, *target))); - statusline_print(STATUS_MEDIUM, - "X client asked for an unsupported selection target type: %lu (%s)", - (unsigned long)*target, XGetAtomName(DISP, *target)); - return False ; + TRACE_GUI((stderr, "Selection type unsupported: %lu (%s)", + (unsigned long)*target, XGetAtomName(DISP, *target))); + statusline_error(STATUS_MEDIUM, + "X client asked for an unsupported selection target type: %lu (%s)", + (unsigned long)*target, XGetAtomName(DISP, *target)); + return False ; #if HAVE_X11_XMU_XMU_H - } + } #endif + } } } diff --git a/Build/source/texk/xdvik/gui/sfDraw.c b/Build/source/texk/xdvik/gui/sfDraw.c index 7a3ddd8cf06..4d693c8c4cf 100644 --- a/Build/source/texk/xdvik/gui/sfDraw.c +++ b/Build/source/texk/xdvik/gui/sfDraw.c @@ -108,10 +108,10 @@ SFcreateGC(void) XGCValues gcValues; XRectangle rectangles[1]; -/* XtVaGetValues(selFileLists[0], */ -/* XtNforeground, &(gcValues.foreground), */ -/* XtNbackground, &(gcValues.background), */ -/* NULL); */ + /* XtVaGetValues(selFileLists[0], */ + /* XtNforeground, &(gcValues.foreground), */ + /* XtNbackground, &(gcValues.background), */ + /* NULL); */ gcValues.foreground = SFfore; SFlineGC = XtGetGC(selFileLists[0], (XtGCMask) @@ -121,7 +121,7 @@ SFcreateGC(void) 0, &gcValues); gcValues.function = GXinvert; -/* gcValues.plane_mask = (gcValues.foreground ^ gcValues.background); */ + /* gcValues.plane_mask = (gcValues.foreground ^ gcValues.background); */ gcValues.plane_mask = (SFfore ^ SFback); SFinvertGC = XtGetGC(selFileLists[0], (XtGCMask) @@ -264,7 +264,7 @@ SFstatAndCheck(SFDir *dir, SFEntry *entry) len = strlen(shown); entry->shown = XtMalloc((unsigned)(len + 2) - ); + ); (void)strcpy(entry->shown, shown); SFwriteStatChar(entry->shown, len, &statBuf); entry->shown[len + 1] = 0; @@ -364,7 +364,7 @@ SFdrawList(int n, int doScroll) SFtextX - dir->hOrigin * SFcharWidth, SFlineToTextV + SFaboveAndBelowText + SFcharAscent, dir->dir, strlen(dir->dir) - ); + ); SFdrawStrings(w, dir, 0, SFlistSize - 1); } } @@ -480,7 +480,7 @@ SFnewInvertEntry(int n, XMotionEvent *event) return -1; } else if ((x >= 0) && (x <= SFupperX) && (y >= SFlowerY) && (y <= SFupperY) - ) { + ) { SFDir *dir = &(SFdirs[SFdirPtr + n]); if (SFscrollTimerAdded) { diff --git a/Build/source/texk/xdvik/gui/sfPath.c b/Build/source/texk/xdvik/gui/sfPath.c index 3349919391b..278f5dc9327 100644 --- a/Build/source/texk/xdvik/gui/sfPath.c +++ b/Build/source/texk/xdvik/gui/sfPath.c @@ -206,12 +206,12 @@ SFreplaceText(SFDir *dir, char *str) else { (void)strncat(SFcurrentPath, str, len - 1); } -/* if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) { */ -/* SFsetText(SFcurrentPath); */ -/* } */ -/* else { */ -/* SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); */ -/* } */ + /* if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) { */ + /* SFsetText(SFcurrentPath); */ + /* } */ + /* else { */ + /* SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); */ + /* } */ SFsetText(SFcurrentPath); SFtextChanged(); @@ -433,7 +433,7 @@ SFgetHomeDirs(void) SFlogins = (SFLogin *) XtRealloc((char *)SFlogins, (unsigned)(alloc * sizeof(SFLogin)) - ); + ); } len = strlen(pw->pw_name); entries[i].real = XtMalloc((unsigned)(len + 3)); @@ -599,7 +599,7 @@ SFupdatePath(void) (char *)SFdirs, (unsigned)((alloc *= 2) * sizeof(SFDir)) - ); + ); for (j = alloc / 2; j < alloc; j++) { SFdirs[j].dir = NULL; } @@ -844,8 +844,6 @@ SFdirModTimer(XtPointer cl, XtIntervalId *id) UNUSED(cl); UNUSED(id); - fprintf(stderr, "sfdirmodtimer called!\n"); - if ((!SFtwiddle) && (SFdirPtr < SFdirEnd)) { n++; if ((n > 2) || (SFdirPtr + n >= SFdirEnd)) { diff --git a/Build/source/texk/xdvik/gui/sfSelFile.c b/Build/source/texk/xdvik/gui/sfSelFile.c index 9964c69ad37..4980362ec86 100644 --- a/Build/source/texk/xdvik/gui/sfSelFile.c +++ b/Build/source/texk/xdvik/gui/sfSelFile.c @@ -39,6 +39,8 @@ #include "sfDraw.h" #include "sfSelFile.h" #include "util.h" +#include "xlwradio.h" +#include "x_util.h" #include #include "kpathsea/c-fopen.h" @@ -46,7 +48,6 @@ #if !defined(MOTIF) /* entire file */ - #include #ifdef X_NOT_STDC_ENV @@ -130,8 +131,8 @@ static char fileMask[MASKWIDTH + 2] = "*.dvi"; static Atom SFwmDeleteWindow; static char *oneLineTextEditTranslations = - "Return: redraw-display()\n" - "CtrlM: redraw-display()\n"; +"Return: redraw-display()\n" +"CtrlM: redraw-display()\n"; #if !defined (HAVE_STRERROR) && !defined (strerror) static char * @@ -145,8 +146,10 @@ strerror(int errnum) void raise_file_selector(void) { - if (selFile != 0) { + if (selFile != NULL && XtIsManaged(selFile)) { + XBell(DISP, 10); XRaiseWindow(DISP, XtWindow(selFile)); + return; } } @@ -163,6 +166,24 @@ SFexposeList(Widget w, XtPointer n, XEvent *event, Boolean *cont) SFdrawList((int)n, SF_DO_NOT_SCROLL); } + +static void +cb_open_new_window(Widget w, XtPointer client_data, XtPointer call_data) +{ + Boolean set; + + UNUSED(client_data); + UNUSED(call_data); + + XtVaGetValues(w, XtNstate, &set, NULL); + + if (set) + resource.filesel_open_new_window = True; + else + resource.filesel_open_new_window = False; + store_preference(NULL, "fileselOpenNewWindow", "%d", resource.filesel_open_new_window); +} + static void SFmodVerifyCallback(Widget w, XtPointer client_data, XEvent *event, Boolean *cont) { @@ -329,8 +350,9 @@ hideFiles(Widget w, XtPointer client_data, XtPointer call_data) static Widget -SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char *ok, const char *cancel) +SFcreateWidgets(Widget parent, struct filesel_callback *callback) { + Widget open_menu = NULL; Cardinal i, n; int listWidth, listHeight; int listSpacing = 10; @@ -342,9 +364,8 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char Widget paned, box; i = 0; - XtSetArg(arglist[i], XtNtransientFor, parent); - XtSetArg(arglist[i], XtNtitle, title); - i++; + XtSetArg(arglist[i], XtNtransientFor, parent); i++; + XtSetArg(arglist[i], XtNtitle, callback->title); i++; selFile = XtAppCreateShell("xdviSelFile", "XdviSelFile", transientShellWidgetClass, SFdisplay, @@ -357,39 +378,31 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char XtParseTranslationTable(wmDeleteWindowTranslation)); paned = XtVaCreateManagedWidget("paned", panedWidgetClass, selFile, NULL); + i = 0; - XtSetArg(arglist[i], XtNdefaultDistance, 6); - i++; + XtSetArg(arglist[i], XtNdefaultDistance, 6); i++; + selFileForm = XtCreateManagedWidget("selFileForm", formWidgetClass, paned, arglist, i); i = 0; - XtSetArg(arglist[i], XtNlabel, prompt); - i++; - XtSetArg(arglist[i], XtNresizable, True); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNborderWidth, 0); - i++; - XtSetArg(arglist[i], XtNvertDistance, 20); - i++; + XtSetArg(arglist[i], XtNlabel, callback->prompt); i++; + XtSetArg(arglist[i], XtNresizable, True); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + XtSetArg(arglist[i], XtNborderWidth, 0); i++; + XtSetArg(arglist[i], XtNvertDistance, 20); i++; + selFilePrompt = XtCreateManagedWidget("selFilePrompt", labelWidgetClass, selFileForm, arglist, i); #if 1 i = 0; - XtSetArg(arglist[i], XtNforeground, &SFfore); - i++; - XtSetArg(arglist[i], XtNbackground, &SFback); - i++; + XtSetArg(arglist[i], XtNforeground, &SFfore); i++; + XtSetArg(arglist[i], XtNbackground, &SFback); i++; XtGetValues(selFilePrompt, arglist, i); #endif @@ -439,74 +452,43 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char SFlineToTextH + SFentryWidth - 1; i = 0; -/* XtSetArg(arglist[i], XtNwidth, 3 * listWidth + 2 * listSpacing + 4 - w - 10); */ - XtSetArg(arglist[i], XtNwidth, 3 * listWidth + 2 * listSpacing + 4); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - -/* XtSetArg(arglist[i], XtNfromHoriz, selFilePrompt); */ -/* i++; */ -/* XtSetArg(arglist[i], XtNhorizDistance, 10); */ - XtSetArg(arglist[i], XtNfromVert, selFilePrompt); - i++; -/* XtSetArg(arglist[i], XtNvertDistance, 0); */ -/* i++; */ - XtSetArg(arglist[i], XtNresizable, True); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNstring, SFtextBuffer); - i++; - XtSetArg(arglist[i], XtNlength, MAXPATHLEN); - i++; - XtSetArg(arglist[i], XtNeditType, XawtextEdit); - i++; - XtSetArg(arglist[i], XtNwrap, XawtextWrapWord); - i++; - XtSetArg(arglist[i], XtNresize, XawtextResizeHeight); - i++; - XtSetArg(arglist[i], XtNuseStringInPlace, True); - i++; - XtSetArg(arglist[i], XtNvertDistance, 5); - i++; + XtSetArg(arglist[i], XtNwidth, + 3 * listWidth + 2 * listSpacing + 4); i++; + XtSetArg(arglist[i], XtNfromVert, selFilePrompt); i++; + XtSetArg(arglist[i], XtNresizable, True); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + XtSetArg(arglist[i], XtNstring, SFtextBuffer); i++; + XtSetArg(arglist[i], XtNlength, MAXPATHLEN); i++; + XtSetArg(arglist[i], XtNeditType, XawtextEdit); i++; + XtSetArg(arglist[i], XtNwrap, XawtextWrapWord); i++; + XtSetArg(arglist[i], XtNresize, XawtextResizeHeight); i++; + XtSetArg(arglist[i], XtNuseStringInPlace, True); i++; + XtSetArg(arglist[i], XtNvertDistance, 5); i++; + selFileField = XtCreateManagedWidget("selFileField", - asciiTextWidgetClass, selFileForm, - arglist, i); + asciiTextWidgetClass, selFileForm, + arglist, i); XtOverrideTranslations(selFileField, XtParseTranslationTable (oneLineTextEditTranslations)); -/* XtSetKeyboardFocus(selFileForm, selFileField); + /* XtSetKeyboardFocus(selFileForm, selFileField); need focus for selFileMask widget to set the filter */ i = 0; - XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); - i++; - XtSetArg(arglist[i], XtNwidth, SFpathScrollWidth); - i++; - XtSetArg(arglist[i], XtNheight, scrollThickness); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromVert, selFileField); - i++; - XtSetArg(arglist[i], XtNvertDistance, 30); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); i++; + XtSetArg(arglist[i], XtNwidth, SFpathScrollWidth); i++; + XtSetArg(arglist[i], XtNheight, scrollThickness); i++; + XtSetArg(arglist[i], XtNfromVert, selFileField); i++; + XtSetArg(arglist[i], XtNvertDistance, 30); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileHScroll = XtCreateManagedWidget("selFileHScroll", scrollbarWidgetClass, selFileForm, arglist, i); @@ -517,78 +499,47 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char (XtCallbackProc)SFpathAreaSelectedCallback, (XtPointer) NULL); i = 0; - XtSetArg(arglist[i], XtNwidth, listWidth); - i++; - XtSetArg(arglist[i], XtNheight, listHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromVert, selFileHScroll); - i++; - XtSetArg(arglist[i], XtNvertDistance, 10); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNwidth, listWidth); i++; + XtSetArg(arglist[i], XtNheight, listHeight); i++; + XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; + XtSetArg(arglist[i], XtNvertDistance, 10); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileLists[0] = XtCreateManagedWidget("selFileList1", compositeWidgetClass, selFileForm, arglist, i); i = 0; - XtSetArg(arglist[i], XtNwidth, listWidth); - i++; - XtSetArg(arglist[i], XtNheight, listHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromHoriz, selFileLists[0]); - i++; - XtSetArg(arglist[i], XtNfromVert, selFileHScroll); - i++; - XtSetArg(arglist[i], XtNhorizDistance, listSpacing); - i++; - XtSetArg(arglist[i], XtNvertDistance, 10); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNwidth, listWidth); i++; + XtSetArg(arglist[i], XtNheight, listHeight); i++; + XtSetArg(arglist[i], XtNfromHoriz, selFileLists[0]); i++; + XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; + XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++; + XtSetArg(arglist[i], XtNvertDistance, 10); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileLists[1] = XtCreateManagedWidget("selFileList2", compositeWidgetClass, selFileForm, arglist, i); i = 0; - XtSetArg(arglist[i], XtNwidth, listWidth); - i++; - XtSetArg(arglist[i], XtNheight, listHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ - XtSetArg(arglist[i], XtNfromHoriz, selFileLists[1]); - i++; - XtSetArg(arglist[i], XtNfromVert, selFileHScroll); - i++; - XtSetArg(arglist[i], XtNhorizDistance, listSpacing); - i++; - XtSetArg(arglist[i], XtNvertDistance, 10); - i++; - XtSetArg(arglist[i], XtNtop, XtChainTop); - i++; - XtSetArg(arglist[i], XtNbottom, XtChainTop); - i++; - XtSetArg(arglist[i], XtNleft, XtChainLeft); - i++; - XtSetArg(arglist[i], XtNright, XtChainLeft); - i++; + XtSetArg(arglist[i], XtNwidth, listWidth); i++; + XtSetArg(arglist[i], XtNheight, listHeight); i++; + XtSetArg(arglist[i], XtNfromHoriz, selFileLists[1]); i++; + XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; + XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++; + XtSetArg(arglist[i], XtNvertDistance, 10); i++; + XtSetArg(arglist[i], XtNtop, XtChainTop); i++; + XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; + XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; + XtSetArg(arglist[i], XtNright, XtChainLeft); i++; + selFileLists[2] = XtCreateManagedWidget("selFileList3", compositeWidgetClass, selFileForm, arglist, i); @@ -596,16 +547,11 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char for (n = 0; n < 3; n++) { i = 0; - XtSetArg(arglist[i], XtNx, vScrollX); - i++; - XtSetArg(arglist[i], XtNy, vScrollY); - i++; - XtSetArg(arglist[i], XtNwidth, scrollThickness); - i++; - XtSetArg(arglist[i], XtNheight, SFvScrollHeight); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ + XtSetArg(arglist[i], XtNx, vScrollX); i++; + XtSetArg(arglist[i], XtNy, vScrollY); i++; + XtSetArg(arglist[i], XtNwidth, scrollThickness); i++; + XtSetArg(arglist[i], XtNheight, SFvScrollHeight); i++; + selFileVScrolls[n] = XtCreateManagedWidget("selFileVScroll", scrollbarWidgetClass, selFileLists[n], arglist, i); @@ -616,19 +562,12 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char (XtCallbackProc)SFvAreaSelectedCallback, (XtPointer) n); i = 0; + XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); i++; + XtSetArg(arglist[i], XtNx, hScrollX); i++; + XtSetArg(arglist[i], XtNy, hScrollY); i++; + XtSetArg(arglist[i], XtNwidth, SFhScrollWidth); i++; + XtSetArg(arglist[i], XtNheight, scrollThickness); i++; - XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); - i++; - XtSetArg(arglist[i], XtNx, hScrollX); - i++; - XtSetArg(arglist[i], XtNy, hScrollY); - i++; - XtSetArg(arglist[i], XtNwidth, SFhScrollWidth); - i++; - XtSetArg(arglist[i], XtNheight, scrollThickness); - i++; -/* XtSetArg(arglist[i], XtNborderColor, SFfore); */ -/* i++; */ selFileHScrolls[n] = XtCreateManagedWidget("selFileHScroll", scrollbarWidgetClass, selFileLists[n], arglist, i); @@ -639,13 +578,35 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char (XtCallbackProc)SFhAreaSelectedCallback, (XtPointer) n); } + /* When opening a DVI file, offer to open in new window */ + if (callback->must_exist) { + open_menu = XtVaCreateManagedWidget(Xdvi_NEW_WINDOW_RADIO_NAME, +#ifdef XAW + radioWidgetClass, +#else + toggleWidgetClass, +#endif + selFileForm, +#ifdef XAW + XtNisRadio, False, +#endif + XtNfromVert, selFileLists[0], + XtNvertDistance, 30, + XtNhighlightThickness, 1, + XtNborderWidth, 0, + XtNlabel, "Open file in new window", + XtNstate, resource.filesel_open_new_window, + NULL); + XtAddCallback(open_menu, XtNcallback, cb_open_new_window, (XtPointer)NULL); + } + /* Do the file filter stuff. */ selFileLabel = XtVaCreateManagedWidget("selFileLabel", labelWidgetClass, selFileForm, - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, -/* XtNfromHoriz, selFileCancel, */ -/* XtNhorizDistance, 60, */ + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, + /* XtNfromHoriz, selFileCancel, */ + /* XtNhorizDistance, 60, */ XtNlabel, "File Mask:", XtNborderWidth, 0, XtNtop, XtChainTop, @@ -654,8 +615,8 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char selFileMask = XtVaCreateManagedWidget("selFileMask", asciiTextWidgetClass, selFileForm, XtNwidth, MASKWIDTH / 2 * SFcharWidth, - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, XtNfromHoriz, selFileLabel, XtNhorizDistance, 0, XtNtop, XtChainTop, @@ -678,8 +639,8 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char selFileLabel = XtVaCreateManagedWidget("selFileLabel", labelWidgetClass, selFileForm, - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, XtNfromHoriz, selFileMask, XtNhorizDistance, 40, XtNlabel, "Dot files are:", @@ -689,15 +650,15 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char selFileHide = XtVaCreateManagedWidget("selFileHide", commandWidgetClass, selFileForm, -/* XtNwidth, 7 * SFcharWidth, */ - XtNfromVert, selFileLists[0], - XtNvertDistance, 30, + /* XtNwidth, 7 * SFcharWidth, */ + XtNfromVert, callback->must_exist ? open_menu : selFileLists[0], + XtNvertDistance, callback->must_exist ? 10 : 30, XtNfromHoriz, selFileLabel, XtNhorizDistance, 2, XtNlabel, hideFlag ? "hidden" : "shown", -/* XtNborderWidth, 1, */ + /* XtNborderWidth, 1, */ XtNtop, XtChainTop, -/* XtNjustify, XtJustifyLeft, */ + /* XtNjustify, XtJustifyLeft, */ XtNbottom, XtChainTop, NULL); XtAddCallback(selFileHide, XtNcallback, (XtCallbackProc)hideFiles, NULL); @@ -710,19 +671,19 @@ SFcreateWidgets(Widget parent, const char *title, const char *prompt, const char XtNaccelerators, G_accels_cr, NULL); selFileOK = XtVaCreateManagedWidget("selFileOK", commandWidgetClass, - box, - XtNlabel, ok, - XtNcallback, SFokSelect, - XtNtop, XtChainTop, - XtNbottom, XtChainBottom, - XtNleft, XtChainLeft, - XtNright, XtChainLeft, - NULL); + box, + XtNlabel, callback->ok, + XtNcallback, SFokSelect, + XtNtop, XtChainTop, + XtNbottom, XtChainBottom, + XtNleft, XtChainLeft, + XtNright, XtChainLeft, + NULL); selFileCancel = XtVaCreateManagedWidget("selFileCancel", commandWidgetClass, box, - XtNlabel, cancel, + XtNlabel, callback->cancel, XtNcallback, SFcancelSelect, -/* XtNborderColor, SFfore, */ + /* XtNborderColor, SFfore, */ XtNfromHoriz, selFileOK, XtNbottom, XtChainBottom, XtNleft, XtChainRight, @@ -878,58 +839,57 @@ SFprepareToReturn(void) } } -void +Widget XsraSelFile(Widget parent, struct filesel_callback *callback) -/* const char *title, const char *prompt, */ -/* const char *ok, const char *cancel, */ -/* const char *init_path, */ -/* const char *mask, */ -/* Boolean must_exist, */ -/* Widget *ret_widget */ { - static Boolean firstTime = True; - Widget w; + SFdisplay = XtDisplay(parent); + return SFcreateWidgets(parent, callback); +} + +void +XsraSelFilePopup(struct filesel_callback *callback) +{ Cardinal i; Arg arglist[20]; XEvent event; - if (!callback->prompt) { - callback->prompt = "Pathname:"; + if (XtIsManaged(callback->shell)) { + XBell(DISP, 10); + XRaiseWindow(DISP, XtWindow(callback->shell)); + return; } - if (!callback->title) { - callback->title = "Xdvi: select filename"; - } + if (!callback->prompt) + callback->prompt = "Pathname:"; + + if (!callback->title) + callback->title = "xdvik: select filename"; - if (!callback->ok) { + if (!callback->ok) callback->ok = "OK"; - } - if (!callback->cancel) { + if (!callback->cancel) callback->cancel = "Cancel"; - } - if (firstTime) { - firstTime = False; - SFdisplay = XtDisplay(parent); - w = SFcreateWidgets(parent, callback->title, callback->prompt, callback->ok, callback->cancel); - } - else { - i = 0; - XtSetArg(arglist[i], XtNlabel, callback->prompt); - i++; - XtSetValues(selFilePrompt, arglist, i); + /* if (!callback->browse_fname) */ + /* callback->browse_fname = xt_strdup(xgetcwd()); */ + + i = 0; + XtSetArg(arglist[i], XtNlabel, callback->prompt); i++; + XtSetValues(selFilePrompt, arglist, i); - i = 0; - XtSetArg(arglist[i], XtNlabel, callback->ok); - i++; - XtSetValues(selFileOK, arglist, i); + i = 0; + XtSetArg(arglist[i], XtNlabel, callback->ok); i++; + XtSetValues(selFileOK, arglist, i); - i = 0; - XtSetArg(arglist[i], XtNlabel, callback->cancel); - i++; - XtSetValues(selFileCancel, arglist, i); - } + i = 0; + XtSetArg(arglist[i], XtNtitle, callback->title); i++; + XtSetValues(selFile, arglist, i); + + i = 0; + XtSetArg(arglist[i], XtNlabel, callback->cancel); i++; + XtSetValues(selFileCancel, arglist, i); + SFpositionWidget(selFile); XtMapWidget(selFile); @@ -988,8 +948,8 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) XtAppNextEvent(SFapp, &event); switch (event.type) { Widget w; -#if 0 /* don't do this, it may send the X server into a busy loop if the File selector - is positioned over a window that is `on top' by default */ +#if 0 /* DON'T do this, it may send the X server into a busy loop if the File selector + is positioned over a window that is `on top' by default */ case Expose: if (!raise_message_windows()) raise_file_selector(); @@ -997,7 +957,7 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) #endif case KeyPress: case ButtonPress: - /* beep if keypress was inside main window */ + /* ignore keypress inside the main window (and beep to warn) */ w = XtWindowToWidget(DISP, event.xany.window); while ((w != NULL) && (w != selFile)) { /* exception: message windows */ @@ -1007,6 +967,7 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) } if (w == NULL || w == globals.widgets.top_level) { XBell(DISP, 0); + continue; } break; } @@ -1044,21 +1005,21 @@ XsraSelFile(Widget parent, struct filesel_callback *callback) SFprepareToReturn(); callback->func_ptr(SFtextBuffer, callback->data); return; -/* return xstrdup(SFtextBuffer); */ + /* return xstrdup(SFtextBuffer); */ } } else { SFprepareToReturn(); callback->func_ptr(SFtextBuffer, callback->data); return; -/* return xstrdup(SFtextBuffer); */ + /* return xstrdup(SFtextBuffer); */ } case SEL_FILE_CANCEL: SFprepareToReturn(); if (callback->exit_on_cancel) exit(0); return; -/* return NULL; */ + /* return NULL; */ case SEL_FILE_NULL: break; } diff --git a/Build/source/texk/xdvik/gui/sfSelFile.h b/Build/source/texk/xdvik/gui/sfSelFile.h index 298d15ea45a..cdda4d7d323 100644 --- a/Build/source/texk/xdvik/gui/sfSelFile.h +++ b/Build/source/texk/xdvik/gui/sfSelFile.h @@ -25,6 +25,8 @@ #define SFSELFILE_H_ struct filesel_callback { + Widget shell; + char *browse_fname; const char *title; const char *prompt; const char *ok; @@ -37,10 +39,13 @@ struct filesel_callback { void *data; }; +#define Xdvi_NEW_WINDOW_RADIO_NAME "new_window_radio" + extern void SFpositionWidget(Widget w); extern FILE *SFopenFile(const char *name, const char *mode, const char *prompt, const char *failed); extern void SFtextChanged(void); -extern void XsraSelFile(Widget parent, struct filesel_callback *callback); +extern Widget XsraSelFile(Widget parent, struct filesel_callback *callback); +extern void XsraSelFilePopup(struct filesel_callback *callback); void raise_file_selector(void); #endif /* SF_SEL_FILE_H_ */ diff --git a/Build/source/texk/xdvik/gui/sfinternal.h b/Build/source/texk/xdvik/gui/sfinternal.h index c776bfc6c97..05a194d8686 100644 --- a/Build/source/texk/xdvik/gui/sfinternal.h +++ b/Build/source/texk/xdvik/gui/sfinternal.h @@ -1,5 +1,6 @@ /* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan + * Copyright 2004 the Xdvik development team * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided @@ -39,6 +40,16 @@ #define SF_DO_SCROLL 1 #define SF_DO_NOT_SCROLL 0 +/* Widget names for get_widget_by_name() */ +#define SfSelFile_FIELD_NAME "selFileField" +#define SfSelFile_FORM_NAME "selFileForm" +#define SfSelFile_HSCROLL_BIG_NAME "selFileHScrollBig" +#define SfSelFile_VSCROLL_BASE_NAME "selFileVScroll" +#define SfSelFile_HSCROLL_BASE_NAME "selFileHScroll" +#define SfSelFile_LIST_BASE_NAME "selFileList" +#define SfSelFile_LIST1_NAME "selFileList1" +#define SfSelFile_LIST2_NAME "selFileList2" +#define SfSelFile_LIST3_NAME "selFileList3" extern void SFenterList(), diff --git a/Build/source/texk/xdvik/gui/statusline.c b/Build/source/texk/xdvik/gui/statusline.c index 16715283cf4..67a5e370041 100644 --- a/Build/source/texk/xdvik/gui/statusline.c +++ b/Build/source/texk/xdvik/gui/statusline.c @@ -65,19 +65,25 @@ static Boolean initialized = False; */ static char g_string_savebuf[MAX_LEN + 2]; -int global_statusline_h = 20; +static int m_statusline_h = 20; + +/* access method */ +int get_statusline_height(void) +{ + return m_statusline_h; +} #if MOTIF static void handle_statusline_event(Widget w, XtPointer client_data, XEvent *ev, Boolean *cont) { -/* const char *text = (const char *)client_data; */ + /* const char *text = (const char *)client_data; */ UNUSED(w); UNUSED(client_data); UNUSED(cont); -/* fprintf(stderr, "text: |%s|; event: %p\n", text, ev); */ + /* fprintf(stderr, "text: |%s|; event: %p\n", text, ev); */ /* only used to do this if page history was already active, but it's probably nicer to be able to get the history by clicking on the statusline ... */ @@ -85,7 +91,7 @@ handle_statusline_event(Widget w, XtPointer client_data, XmTextPosition pos = XmTextGetCursorPosition(statusline); char *ptr1, *ptr2; int diff = 0; -/* fprintf(stderr, "pos: %d\n", pos); */ + /* fprintf(stderr, "pos: %d\n", pos); */ if (pos == 0) { /* just display the page history */ page_history_move(0); return; @@ -96,7 +102,7 @@ handle_statusline_event(Widget w, XtPointer client_data, page_history_move(0); return; } -/* fprintf(stderr, "ptr1: |%s|; ptr2: |%s|\n", ptr1, ptr2); */ + /* fprintf(stderr, "ptr1: |%s|; ptr2: |%s|\n", ptr1, ptr2); */ while (ptr1 < ptr2) { if (*ptr1 == ' ' && *(ptr1 + 1) != '-') /* separator */ diff--; @@ -108,7 +114,7 @@ handle_statusline_event(Widget w, XtPointer client_data, diff++; ptr1--; } -/* fprintf(stderr, "diff: %d\n", diff); */ + /* fprintf(stderr, "diff: %d\n", diff); */ page_history_move(diff); } } @@ -119,7 +125,7 @@ handle_statusline_event(Widget w, XtPointer client_data, * of the program, and when expert mode is switched off. * * Side effects: - * sets to the height of the statusline in pixels. + * sets to the height of the statusline in pixels. */ Widget @@ -156,7 +162,7 @@ create_statusline( XtNlabel, (XtArgVal) "test", NULL); XtVaGetValues(statusline, XtNheight, &my_h, NULL); - global_statusline_h = my_h; + m_statusline_h = my_h; XtDestroyWidget(statusline); #endif initialized = True; @@ -245,11 +251,7 @@ toggle_statusline(void) else XtManageChild(statusline); -#if defined(NEW_MENU_CREATION) || defined(MOTIF) set_menu(&resource.expert_mode, Act_set_expert_mode, check_resource_expert); -#else - set_show_statusline_option(); -#endif #else static Boolean initialized = False; static Boolean statusline_mapped = False; @@ -329,29 +331,29 @@ handle_statusline_resize(void) #if 0 /* - BROKEN Position vport_h, clip_x, clip_w; - BROKEN static Position my_h = 0; - BROKEN - BROKEN XtVaGetValues(globals.widgets.clip_widget, - BROKEN XtNx, &clip_x, - BROKEN XtNwidth, &clip_w, - BROKEN NULL); - BROKEN XtVaGetValues(globals.widgets.vport_widget, - BROKEN XtNheight, &vport_h, - BROKEN NULL); - BROKEN - BROKEN XtUnmanageChild(statusline); - BROKEN XtVaSetValues(statusline, - BROKEN XtNlabel, (XtArgVal) "", - BROKEN XtNwidth, clip_w, - BROKEN XtNx, clip_x - 1, - BROKEN XtNy, vport_h - my_h, - BROKEN XtNborderWidth, 1, - BROKEN XtNjustify, XtJustifyLeft, - BROKEN XtNborder, (XtArgVal) resource.fore_Pixel, - BROKEN NULL); - BROKEN XtManageChild(statusline); - BROKEN XFlush(DISP); + BROKEN Position vport_h, clip_x, clip_w; + BROKEN static Position my_h = 0; + BROKEN + BROKEN XtVaGetValues(globals.widgets.clip_widget, + BROKEN XtNx, &clip_x, + BROKEN XtNwidth, &clip_w, + BROKEN NULL); + BROKEN XtVaGetValues(globals.widgets.vport_widget, + BROKEN XtNheight, &vport_h, + BROKEN NULL); + BROKEN + BROKEN XtUnmanageChild(statusline); + BROKEN XtVaSetValues(statusline, + BROKEN XtNlabel, (XtArgVal) "", + BROKEN XtNwidth, clip_w, + BROKEN XtNx, clip_x - 1, + BROKEN XtNy, vport_h - my_h, + BROKEN XtNborderWidth, 1, + BROKEN XtNjustify, XtJustifyLeft, + BROKEN XtNborder, (XtArgVal) resource.fore_Pixel, + BROKEN NULL); + BROKEN XtManageChild(statusline); + BROKEN XFlush(DISP); */ #endif @@ -425,9 +427,20 @@ clear_statusline_timer_proc(XtPointer client_data, XtIntervalId *id) } static void -internal_print_statusline(statusTimerT timeout, const char *old_content, const char *fmt, va_list argp) +internal_print_statusline(Boolean error, + statusTimerT timeout, + const char *old_content, + const char *fmt, + va_list argp) { - if (!XtIsRealized(globals.widgets.top_level) || !initialized || (resource.expert_mode & XPRT_SHOW_STATUSLINE) == 0) { + if (!XtIsRealized(globals.widgets.top_level) + || !initialized + || (resource.expert_mode & XPRT_SHOW_STATUSLINE) == 0) { + + /* only print errors to stdout */ + if (!error) + return; + if (!resource.hush_stdout && strlen(fmt) > 0) { /* check for strlen since sometimes we clear the statusline by printing "" to it, and we don't want that on stdout */ fprintf(stdout, "xdvi: "); @@ -463,17 +476,17 @@ internal_print_statusline(statusTimerT timeout, const char *old_content, const c #else XtVaSetValues(statusline, XtNlabel, buf, NULL); #endif -/* fprintf(stderr, "timeout: %d, id: %ld\n", timeout, clear_timeout_id); */ + /* fprintf(stderr, "timeout: %d, id: %ld\n", timeout, clear_timeout_id); */ if (timeout > 0) { timeout *= 1000; /* convert to miliseconds */ if (clear_timeout_id) { -/* fprintf(stderr, "clearing!\n"); */ + /* fprintf(stderr, "clearing!\n"); */ if (globals.debug & DBG_EVENT) fprintf(stderr, "%s:%d: removing timeout %ld\n", __FILE__, __LINE__, clear_timeout_id); XtRemoveTimeOut(clear_timeout_id); } - clear_timeout_id = XtAppAddTimeOut(app, timeout, + clear_timeout_id = XtAppAddTimeOut(globals.app, timeout, clear_statusline_timer_proc, (XtPointer) NULL); } } @@ -506,7 +519,7 @@ statusline_append(statusTimerT timeout, const char *pattern, const char *fmt, .. if (buf != NULL && memcmp(buf, pattern, strlen(pattern)) == 0) { buf = NULL; } - internal_print_statusline(timeout, buf, fmt, argp); + internal_print_statusline(false, timeout, buf, fmt, argp); va_end(argp); } @@ -516,16 +529,52 @@ statusline_append(statusTimerT timeout, const char *pattern, const char *fmt, .. */ void -statusline_print(statusTimerT timeout, const char *fmt, ...) +statusline_info(statusTimerT timeout, const char *fmt, ...) { va_list argp; va_start(argp, fmt); - internal_print_statusline(timeout, NULL, fmt, argp); + /* for the time being, we don't differentiate between info/error + * wrt. printing to stdout/stderr. We could probably at some point + * remove the printing to stdout altogether (it's a bit un-GUIsh), + * but then there's already an option 'hushstdout' to suppress it ... + */ + internal_print_statusline(True, timeout, NULL, fmt, argp); + va_end(argp); +} + +void +statusline_error(statusTimerT timeout, const char *fmt, ...) +{ + va_list argp; + va_start(argp, fmt); + internal_print_statusline(True, timeout, NULL, fmt, argp); va_end(argp); } void statusline_clear(void) { - statusline_print(STATUS_SHORT, ""); + statusline_info(STATUS_SHORT, ""); +} + +/* + * Erase the contents of the statusline if it starts with 'pattern'. + */ +void +statusline_erase(const char *pattern) +{ + const char *buf = NULL; + if (XtIsRealized(globals.widgets.top_level) && initialized && (resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0) { + /* get current statusline contents */ +#ifdef MOTIF + XtVaGetValues(statusline, XmNvalue, &buf, NULL); +#else + XtVaGetValues(statusline, XtNlabel, &buf, NULL); +#endif + + if (strncmp(buf, pattern, strlen(pattern)) == 0) { + statusline_clear(); + } + } } + diff --git a/Build/source/texk/xdvik/gui/statusline.h b/Build/source/texk/xdvik/gui/statusline.h index 5f9f5dcd10c..79cd65feb84 100644 --- a/Build/source/texk/xdvik/gui/statusline.h +++ b/Build/source/texk/xdvik/gui/statusline.h @@ -31,13 +31,17 @@ */ typedef enum statusTimerT_ { STATUS_FOREVER = 0, + STATUS_VERYSHORT = 1, STATUS_SHORT = 5, STATUS_MEDIUM = 10, STATUS_LONG = 30 } statusTimerT; +extern int get_statusline_height(void); extern void statusline_clear(void); -extern void statusline_print(statusTimerT timeout, const char *fmt, ...); +extern void statusline_erase(const char *pattern); +extern void statusline_info(statusTimerT timeout, const char *fmt, ...); +extern void statusline_error(statusTimerT timeout, const char *fmt, ...); extern void statusline_append(statusTimerT timeout, const char *pattern, const char *fmt, ...); #ifdef MOTIF extern Widget create_statusline(Widget parent); diff --git a/Build/source/texk/xdvik/gui/topic-window.c b/Build/source/texk/xdvik/gui/topic-window.c index 7a87a03b5c8..6e987d2b0f6 100644 --- a/Build/source/texk/xdvik/gui/topic-window.c +++ b/Build/source/texk/xdvik/gui/topic-window.c @@ -270,7 +270,7 @@ select_topic(struct topic_info *info, size_t idx) } else { /* Note: doesn't matter if not managed yet */ -/* XtUnmanageChild(info->items[0].widget); */ + /* XtUnmanageChild(info->items[0].widget); */ } XtManageChild(info->items[idx].widget); diff --git a/Build/source/texk/xdvik/gui/xaw_bitmaps.c b/Build/source/texk/xdvik/gui/xaw_bitmaps.c index 6b45ca60a74..4222f9dfe13 100644 --- a/Build/source/texk/xdvik/gui/xaw_bitmaps.c +++ b/Build/source/texk/xdvik/gui/xaw_bitmaps.c @@ -19,15 +19,15 @@ unsigned char button_check_off_bits[] = { /* radiobuttons: round and filled with dot if on, empty else */ unsigned char button_radio_on_bits[] = { -/* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x72, 0x02, 0xf9, 0x04, 0xf9, 0x04, */ -/* 0xf9, 0x04, 0x72, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ + /* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x72, 0x02, 0xf9, 0x04, 0xf9, 0x04, */ + /* 0xf9, 0x04, 0x72, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ 0x00,0x00,0x00,0x00,0xc0,0x03,0x30,0x0c,0x08,0x10,0xc8,0x13,0xe4,0x27,0xe4, 0x27,0xe4,0x27,0xe4,0x27,0xc8,0x13,0x08,0x10,0x30,0x0c,0xc0,0x03,0x00,0x00, 0x00,0x00 }; unsigned char button_radio_off_bits[] = { -/* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x04, 0x01, 0x04, */ -/* 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ + /* 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x04, 0x01, 0x04, */ + /* 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00 */ 0x00,0x00,0x00,0x00,0xc0,0x03,0x30,0x0c,0x08,0x10,0x08,0x10,0x04,0x20,0x04, 0x20,0x04,0x20,0x04,0x20,0x08,0x10,0x08,0x10,0x30,0x0c,0xc0,0x03,0x00,0x00, 0x00,0x00 @@ -63,14 +63,14 @@ unsigned char menu_radio_off_bits[] = { /* arrow for Xaw submenus */ unsigned char menu_arrow_bits[] = { -/* 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, */ -/* 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00 */ + /* 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, */ + /* 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00 */ 0x00, 0x00, 0x20, 0x00, 0x60, 0x00, 0xe0, 0x00, 0xe0, 0x01, 0xe0, 0x03, 0xe0, 0x01, 0xe0, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00 -/* 0x00, 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, */ -/* 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00 */ -/* 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00 */ + /* 0x00, 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, */ + /* 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00 */ + /* 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00 */ }; diff --git a/Build/source/texk/xdvik/gui/xaw_menu.c b/Build/source/texk/xdvik/gui/xaw_menu.c index ef9b387f8c1..9cc3700f4bd 100644 --- a/Build/source/texk/xdvik/gui/xaw_menu.c +++ b/Build/source/texk/xdvik/gui/xaw_menu.c @@ -39,9 +39,7 @@ #include "message-window.h" #include "my-snprintf.h" #include "filehist.h" -#ifdef NEW_MENU_CREATION #include "menu.h" -#endif /* NEW_MENU_CREATION */ #ifndef MOTIF /* entire file */ @@ -69,55 +67,27 @@ #endif -#ifndef NEW_MENU_CREATION -#define SEP_CHAR ':' /* character separating entries in translations lines */ -#endif - -/* needed to count the callbacks */ -static int destroy_count = 0; +static Widget line_widget, panel_widget; /* width of button panel */ -static int my_panel_width = 0; +static int m_panel_width = 0; + +/* used for communication with the pagelist in xaw_create_pagelist */ +static int m_y_pos; + /* access method for panel width */ int get_panel_width(void) { - int retval = 0; - if (resource.expert_mode & XPRT_SHOW_BUTTONS) - retval = my_panel_width; - TRACE_GUI((stderr, "get_panel_width: %d", retval)); - return retval; + /* int retval = 0; */ + /* if (resource.expert_mode & XPRT_SHOW_BUTTONS) */ + /* retval = m_panel_width; */ + /* TRACE_GUI((stderr, "get_panel_width: %d", retval)); */ + /* return retval; */ + return m_panel_width; } -#ifndef NEW_MENU_CREATION -typedef enum { INVALID, /* some error */ - NONE, /* no new button created */ - MENU_SEPARATOR, MENU_BUTTON, MENU_ENTRY, COMMAND_BUTTON } buttonTypeT; - -struct button_info { - struct button_info *next; - char *label; - struct xdvi_action *action; - Widget widget; - buttonTypeT type; -}; - -static Widget panner = 0; -static struct button_info *b_head = NULL; - -#define MAX_MENU_NUM 128 -#define MAX_BUTTON_NUM 128 - -static struct menu_list_ { - char *name; - Widget button_widget; - Widget popup_widget; -} menu_list[MAX_MENU_NUM]; - -#endif /* not NEW_MENU_CREATION */ - -#ifdef NEW_MENU_CREATION /* ================================================================================ Pixmaps indicating the state of menu buttons (radiobutton/checkbox @@ -130,12 +100,6 @@ static Pixmap menu_check_off_bitmap; static Pixmap menu_radio_on_bitmap; static Pixmap menu_radio_off_bitmap; static Pixmap menu_arrow_bitmap; -#else -#include "xaw_bitmaps.h" -/* lifted from menu.c, check_bits in xterm */ -static Pixmap menu_check_bitmap; -static Pixmap menu_arrow_bitmap; -#endif /* NEW_MENU_CREATION */ /* ============================================================ @@ -159,8 +123,6 @@ static XtActionsRec menu_actions[] = { { "popdown-submenus", ActPopdownSubmenus } }; -static XtAccelerators menu_accels; - struct pullright_position_info { Position y; Dimension w; @@ -170,7 +132,6 @@ struct pullright_position_info { }; -#ifdef NEW_MENU_CREATION /* * Set all pixmaps indicating the state of the wigdet pointed to by `elems'. */ @@ -224,120 +185,183 @@ xaw_initialize_menu_bitmaps(void) } } -#else -/* toggle `checked' symbol on xaw menu w */ void -toggle_tick(Boolean val, Widget w) +xaw_create_pagelist(void) { - static Arg args = { XtNleftBitmap, (XtArgVal) 0 }; - if (val) - args.value = (XtArgVal) menu_check_bitmap; - else - args.value = None; - XtSetValues(w, &args, 1); + Dimension height, width; + + XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); + XtVaGetValues(panel_widget, XtNwidth, &width, NULL); + + width = MAX(width - 2 * (resource.btn_side_spacing + resource.btn_border_width), + xaw_get_pagelist_size()); + height -= resource.btn_top_spacing + resource.btn_border_width + m_y_pos; + xaw_create_pagelist_widgets(height, width, m_y_pos, panel_widget); } + +static XtCallbackRec command_call[] = { + {handle_command, NULL}, + {NULL, NULL}, +}; + +#ifdef USE_PANNER void -toggle_menu(int val, XtActionProc proc) +scroll_x_panner(int x) { - struct button_info *bp; - - for (bp = b_head; bp != NULL; bp = bp->next) { - if (bp->action != NULL && bp->action->proc == proc && bp->action->param != NULL) { - TRACE_GUI((stderr, "found proc; param: |%s|", bp->action->param)); - if (strcmp(bp->action->param, "toggle") == 0) { - if (val != 0) - toggle_tick(True, bp->widget); - else - toggle_tick(False, bp->widget); - } - else if (strcmp(bp->action->param, "a") == 0) { - if (val == shrink_to_fit()) - toggle_tick(True, bp->widget); - else - toggle_tick(False, bp->widget); - } - else { - int testval = strtoul(bp->action->param, (char **)NULL, 10); - if (testval == val) { - TRACE_GUI((stderr, "enabling param |%s|", bp->action->param)); - toggle_tick(True, bp->widget); - } - else - toggle_tick(False, bp->widget); - } - } + static int old_x = 0; + if (panner != 0 && ABS(x - old_x) > 8) { + XtVaSetValues(panner, XtNsliderX, x, NULL); + old_x = x; } } -/* initialize `checked' symbol on xaw menu w */ -static void -initialize_tick_marks(void) +void +scroll_y_panner(int y) { - int use_gs; - if (menu_check_bitmap == None) { - int check_width = 9; - int check_height = 8; - unsigned char check_bits[] = { - 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x60, 0x00, - 0x31, 0x00, 0x1b, 0x00, 0x0e, 0x00, 0x04, 0x00 - }; - - menu_check_bitmap = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), - RootWindowOfScreen(XtScreen(globals.widgets.top_level)), - (char *)check_bits, check_width, check_height); + static int old_y = 0; + if (panner != 0 && ABS(y - old_y) > 8) { + XtVaSetValues(panner, XtNsliderY, y, NULL); + old_y = y; } +} + +static void +panner_cb(Widget widget, XtPointer closure, XtPointer report_ptr) +{ + XawPannerReport *report = (XawPannerReport *)report_ptr; + static int orig_x = 0, orig_y = 0; + int x = report->slider_x; + int y = report->slider_y; + static Dimension w, h; + static Arg arg_wh_clip[] = { + {XtNwidth, (XtArgVal) &w}, + {XtNheight, (XtArgVal) &h}, + }; + + UNUSED(closure); - /* initialize tickmarks for all possible actions */ - use_gs = resource.postscript; -#ifdef PS_GS - if (!resource.useGS) - use_gs = 0; -#endif + XtGetValues(globals.widgets.clip_widget, arg_wh_clip, XtNumber(arg_wh_clip)); + + fprintf(stderr, "w: %d, h: %d, globals.page.w: %d, globals.page.h: %d\n", + w, h, globals.page.w, globals.page.h); + XtVaSetValues(widget, + XtNsliderWidth, w, XtNsliderHeight, h, + XtNcanvasWidth, globals.page.w, XtNcanvasHeight, globals.page.h, + NULL); - toggle_menu(use_gs, Act_set_ps); - toggle_menu(resource.gs_alpha, Act_set_gs_alpha); - toggle_menu(resource.keep_flag, Act_set_keep_flag); - toggle_menu(resource.pixels_per_inch / mane.shrinkfactor, Act_shrink_to_dpi); - toggle_menu(mane.shrinkfactor, Act_set_shrink_factor); - toggle_menu(resource.use_tex_pages, Act_use_tex_pages); - toggle_menu(resource.mouse_mode, Act_switch_mode); + fprintf(stderr, "panner moved: %d, %d\n", report->slider_x, report->slider_y); + if (globals.widgets.x_bar != NULL) + XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer)(x - orig_x)); + if (globals.widgets.y_bar != NULL) + XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer)(y - orig_y)); + orig_x = x; + orig_y = y; } -#endif /* NEW_MENU_CREATION */ +#endif /* USE_PANNER */ -/* ================================================================================ - ================================================================================ -*/ -static Widget line_widget, panel_widget; +static void +create_menu_entries(struct button_info *item, Widget parent) +{ + size_t i; -/* used for communication with the pagelist in xaw_create_pagelist */ -static int my_y_pos; + /* add our own popdown-submenus() action to the default translations of this menu */ + XtAccelerators menu_accels = XtParseAcceleratorTable(":MenuPopdown()notify()unhighlight()popdown-submenus()"); + + for (i = 0; item != NULL && i < item->size; i++) { + Widget w; + + if (item->elems[i].submenu != NULL) { /* another submenu */ + XDVI_ERROR((stderr, "Xaw menus don't support nested pulldown menus (ignoring)")); + continue; + } + + if (item->elems[i].type == BT_SEP) { /* separator */ + w = XtCreateManagedWidget(item->elems[i].title, smeLineObjectClass, parent, NULL, 0); + } + else if (item->elems[i].action != NULL && item->elems[i].action->proc == Act_recent_files) { + /* special case: submenu with recent files */ + w = XtVaCreateManagedWidget(item->elems[i].title, smeBSBObjectClass, parent, + XtNlabel, item->elems[i].title, + XtNleftMargin, 20, + XtNrightMargin, 16, + XtNrightBitmap, menu_arrow_bitmap, + NULL); + m_submenu = w; + XtOverrideTranslations(parent, menu_accels); + } + else { /* normal menu entry */ + w = XtVaCreateManagedWidget(item->elems[i].title, smeBSBObjectClass, parent, + XtNlabel, item->elems[i].title, + XtNleftMargin, 20, + NULL); + XtAddCallback(w, XtNcallback, handle_command, item->elems[i].action); + } + item->elems[i].widget = w; + } +} -/* access function: panel, height of buttons etc. */ void -xaw_create_pagelist(void) +xaw_create_menu(struct button_info *item, Widget parent, int *ret_width) { - Dimension height, width; - int button_width = get_panel_width() - 2 * (resource.btn_side_spacing + resource.btn_border_width); - - XtVaGetValues(globals.widgets.clip_widget, XtNheight, &height, NULL); - width = MAX(button_width, xaw_get_pagelist_size()); - height -= resource.btn_top_spacing + resource.btn_border_width + my_y_pos; - xaw_create_pagelist_widgets(height, width, my_y_pos, panel_widget); -} + Dimension y_pos = resource.btn_top_spacing; + size_t i; + XtAppAddActions(XtWidgetToApplicationContext(globals.widgets.form_widget), menu_actions, XtNumber(menu_actions)); -static XtCallbackRec command_call[] = { - {handle_command, NULL}, - {NULL, NULL}, -}; + for (i = 0; item != NULL && i < item->size; i++) { + Widget button; + Dimension w, h; -#ifdef NEW_MENU_CREATION -void xaw_create_menu(struct button_info *items, Widget parent, int menu_depth, int *ret_width) -{ + if (item->elems[i].type == BT_SEP) { /* separator */ + XDVI_ERROR((stderr, "Cannot have a separator on a toplevel Xaw menu (ignoring)")); + /* y_pos += resource.btn_between_extra; */ + continue; + } + else if (item->elems[i].submenu != NULL) { /* menu button, create a pulldown menu */ + Widget shell; + + button = XtVaCreateWidget("button", menuButtonWidgetClass, parent, + XtNmenuName, item->elems[i].title, + XtNlabel, item->elems[i].title, + XtNx, resource.btn_side_spacing, + XtNy, y_pos, + XtNborderWidth, resource.btn_border_width, + NULL); + shell = XtCreatePopupShell(item->elems[i].title, simpleMenuWidgetClass, button, NULL, 0); + + create_menu_entries(item->elems[i].submenu, shell); + } + else { /* command button */ + command_call[0].closure = (XtPointer)item->elems[i].action; + button = XtVaCreateWidget(item->elems[i].title, commandWidgetClass, parent, + XtNlabel, item->elems[i].title, + XtNx, resource.btn_side_spacing, + XtNy, y_pos, + XtNborderWidth, resource.btn_border_width, + XtNcallback, (XtArgVal)command_call, + NULL); + } + XtVaGetValues(button, XtNwidth, &w, XtNheight, &h, NULL); + y_pos += h + resource.btn_between_spacing + 2 * resource.btn_border_width; + if (w > m_panel_width) + m_panel_width = w; + item->elems[i].widget = button; + } + + /* adjust button sizes, and manage buttons (managing them earlier may result + in `parent has no geometry manager' error) */ + for (i = 0; item != NULL && i < item->size; i++) { + XtVaSetValues(item->elems[i].widget, XtNwidth, m_panel_width, NULL); + XtManageChild(item->elems[i].widget); + } + m_y_pos = y_pos - resource.btn_between_spacing + resource.btn_top_spacing + 2 * resource.btn_border_width; + m_panel_width += 2 * resource.btn_side_spacing + resource.btn_border_width; + XtVaSetValues(panel_widget, XtNwidth, m_panel_width, NULL); + *ret_width = m_panel_width; } Widget @@ -346,6 +370,8 @@ xaw_create_menu_widgets(Widget parent) /* hack to disable the magnifier in the panel: */ XtTranslations panel_translations = XtParseTranslationTable("#augment :"); + XtAppAddActions(XtWidgetToApplicationContext(parent), menu_actions, XtNumber(menu_actions)); + line_widget = XtVaCreateWidget("line", widgetClass, parent, XtNbackground, (XtArgVal)resource.fore_Pixel, XtNwidth, (XtArgVal)1, @@ -368,9 +394,6 @@ xaw_create_menu_widgets(Widget parent) return panel_widget; } -#else /* NEW_MENU_CREATION */ - - static void filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) { @@ -505,7 +528,6 @@ filehist_insert_submenu(int idx, const char *filename, int pageno, void *data) XtAddCallback(w, XtNcallback, filehist_select_cb, NULL); } - /* ============================================================ Hack for pullright menus part II: callbacks and functions @@ -582,7 +604,7 @@ popup_pullright(XtPointer client_data, XtIntervalId *id) /* * This event handler (to be called by read_events(), the main event handling loop) * creates a timeout for the pullright to pop up. -*/ + */ void SubMenuHandleEvent(XtAppContext app, XEvent *event) { @@ -599,13 +621,13 @@ SubMenuHandleEvent(XtAppContext app, XEvent *event) || event->type == LeaveNotify || event->type == ButtonPress) { -/* fprintf(stderr, "SubMenuHandleEvent: 0x%lx, 0x%lx\n", event->xany.window, XtWindow(m_submenu)); */ + /* fprintf(stderr, "SubMenuHandleEvent: 0x%lx, 0x%lx\n", event->xany.window, XtWindow(m_submenu)); */ /* Could also loop through a list of windows here ... We need to check for the parent of the menu item, since smeBSBObject is not a real window, and then manually check whether the pointer is inside the menu item. - */ + */ if (XtParent(m_submenu) != NULL && event->xany.window == XtWindow(XtParent(m_submenu))) { /* don't need to check for x coordinates since we already @@ -627,7 +649,7 @@ SubMenuHandleEvent(XtAppContext app, XEvent *event) /* Create a timeout of 200ms to pop up the menu, so that it doesn't pop up always when the cursor is only moved over the pulldown menu. I think this is about the same delay as the one used by Motif. - */ + */ flag = 1; TRACE_GUI((stderr, "ENTER: %d, %d, %d; %d, %d", info.y, info.w, info.h, event->xbutton.x, event->xbutton.y)); @@ -649,611 +671,18 @@ SubMenuHandleEvent(XtAppContext app, XEvent *event) } } -static Widget -create_pulldown_entry(const char *menu_name, - Widget parent, - const char *item_name, - const char *accelerator, /* accelerator, or NULL */ - struct xdvi_action *action, - buttonTypeT *type) -{ - Widget w; - char buf[1024]; - char *m_name = xstrdup(menu_name); - m_name = xstrcat(m_name, item_name); - -#ifdef SHOW_ACCELERATORS - if (accelerator != NULL && *accelerator != '\0') - SNPRINTF(buf, 1024, "%s [%s]", item_name, accelerator); - else - strncpy(buf, item_name, 1024); -#else - UNUSED(accelerator); - strncpy(buf, item_name, 1024); -#endif - -/* fprintf(stderr, "creating pulldown for parent %p: `%s', `%s'\n", */ -/* (void *)parent, menu_name, item_name); */ - - if (strcmp(item_name, "SEP") == 0) { /* it's a separator */ - *type = MENU_SEPARATOR; - w = XtCreateManagedWidget(m_name, smeLineObjectClass, parent, NULL, 0); - } - else if (action->proc != NULL && action->proc == Act_recent_files) { /* special case: submenu with recent files */ -/* w = recent_files_submenu(m_name, parent, buf); */ -/* *type = MENU_ENTRY; */ - w = XtVaCreateManagedWidget(m_name, smeBSBObjectClass, parent, - XtNlabel, buf, - XtNleftMargin, 20, - XtNrightMargin, 16, - XtNrightBitmap, menu_arrow_bitmap, - NULL); - m_submenu = w; - /* fprintf(stderr, "setting translations for %p\n", (void *)XtParent(parent)); */ - XtOverrideTranslations(parent, menu_accels); - /* XtOverrideTranslations(XtParent(parent), menu_accels); */ - - *type = MENU_ENTRY; - } - else { /* normal menu item */ - w = XtVaCreateManagedWidget(m_name, smeBSBObjectClass, parent, - XtNlabel, buf, - XtNleftMargin, 20, - NULL); - *type = MENU_ENTRY; - XtAddCallback(w, XtNcallback, handle_command, action); - } - free(m_name); - return w; -} - -static Widget -create_pulldown_menu(const char *menu_name, - Dimension *width, - int *index, - Dimension *y_pos, - buttonTypeT *type, - int *menu_number) -{ - int i; - - /* check whether a pulldown menu with this name already exists, - and if yes, return its position in index: */ - for (i = 0; i < *menu_number; i++) { - if (menu_list[i].name != NULL && (strcmp(menu_list[i].name, menu_name)) == 0) { - *index = i; - break; - } - } - if (i == *menu_number) { /* doesn't exist, create one */ - Dimension w, h; - Widget n_button_widget, n_popup_widget; - char *button_widget_name = NULL; - - (*menu_number)++; - if (*menu_number > MAX_MENU_NUM) { - XDVI_WARNING((stderr, "Too many menus (max=%d), skipping all from \"%s\"", - MAX_MENU_NUM, menu_name)); - *type = INVALID; - return 0; - } - - /* save menu_name to list for later comparison */ - menu_list[i].name = xrealloc(menu_list[i].name, strlen(menu_name) + 1); - strcpy(menu_list[i].name, menu_name); - - button_widget_name = xstrdup(menu_name); - button_widget_name = xstrcat(button_widget_name, "B"); /* make it unique */ - - if (globals.debug & DBG_ALL) { - fprintf(stderr, "ypos: %d; h: %d; between: %d; border: %d\n", - *y_pos, - h, - resource.btn_between_spacing, - resource.btn_border_width); - } - - n_button_widget = XtVaCreateWidget(menu_list[i].name, menuButtonWidgetClass, panel_widget, - XtNmenuName, button_widget_name, - XtNx, resource.btn_side_spacing, - XtNy, *y_pos, - XtNborderWidth, resource.btn_border_width, - NULL); - n_popup_widget = XtVaCreatePopupShell(button_widget_name, simpleMenuWidgetClass, n_button_widget, - NULL); - /* Mustn't free this one?? */ -/* free(button_widget_name); */ - menu_list[i].button_widget = n_button_widget; - menu_list[i].popup_widget = n_popup_widget; - XtVaGetValues(n_button_widget, XtNwidth, &w, XtNheight, &h, NULL); - *width = w; - *index = i; - *y_pos += h + resource.btn_between_spacing + 2 * resource.btn_border_width; - *type = MENU_BUTTON; - return n_button_widget; - } - *type = NONE; - return 0; -} - -static struct button_info * -create_button_info(const char *label, struct xdvi_action *action, Widget w, buttonTypeT type) -{ - struct button_info *info = xmalloc(sizeof *info); - info->label = xstrdup(label); - info->action = action; - info->widget = w; - info->type = type; - return info; -} - -typedef enum shrinkArgT_ { NO_SHRINK_ARG, HASH, PERCENT, UNDERSCORE } shrinkArgT; - -static shrinkArgT -test_for_shrink_arg(const char *item, int *idx) -{ - const char *ptr = item; - size_t i; - for (i = 0; ptr[i] != '\0'; i++) { - if (ptr[i] == '$') { - i++; - if (ptr[i] == '#') { - *idx = i; - return HASH; - } - else if (ptr[i] == '%') { - *idx = i; - return PERCENT; - } - else if (ptr[i] == '_') { - *idx = i; - return UNDERSCORE; - } - } - } - *idx = 0; - return NO_SHRINK_ARG; -} - -static Boolean -create_shrink_button(char **label, int offset, shrinkArgT type, struct xdvi_action *action) -{ - int shrink_arg = 0; -#define TEMPSTR_LEN 128 /* enough for printing a number into */ - char tempstr[TEMPSTR_LEN]; - char *new_label = NULL; - - for (;; action = action->next) { - if (action == NULL) { - return False; - } - if (action->proc == Act_set_shrink_factor || action->proc == Act_shrink_to_dpi) { - /* NOTE: the shrinkbutton[] resource isn't implemented. It probably makes - less sense with the pulldown menu resources?? - */ - if (action->num_params > 0) { - shrink_arg = atoi(action->param); - if (action->proc == Act_shrink_to_dpi) - shrink_arg = (double)resource.pixels_per_inch / shrink_arg + 0.5; - if (shrink_arg < 1) - shrink_arg = 1; - else if (shrink_arg > 99) - shrink_arg = 99; - } - break; /* found shrink action */ - } - } - - if (type == HASH) - SNPRINTF(tempstr, TEMPSTR_LEN, "%d", shrink_arg); - else if (type == PERCENT) { - if (shrink_arg <= 15) - SNPRINTF(tempstr, TEMPSTR_LEN, "%d", (int)(100.0 / shrink_arg + .5)); - else - SNPRINTF(tempstr, TEMPSTR_LEN, "%.2f", 100.0 / shrink_arg); - } - /* NOTE: I think UNDERSCORE is related to the shrinkbutton[] resource, - which is not implemented */ - - /* return resized label */ - new_label = xmalloc(offset - 1 + strlen(tempstr) + strlen(*label + offset + 1) + 1); - memcpy(new_label, *label, offset - 1); - strcpy(new_label + offset - 1, tempstr); /* now it's null-terminated */ - strcat(new_label, *label + offset + 1); - free(*label); - *label = new_label; - -#undef TEMPSTR_LEN - return True; -} - -static Dimension -create_button(int button_number, /* number of this button */ - int *menu_num, /* number of submenus in this button */ - char **items, /* description of label and action strings */ - size_t item_count, /* number of items in description */ - Widget parent, /* parent of widget to create */ - struct button_info ***bipp, /* button info to insert new button into */ - Dimension *y_pos, /* vertical position after creating button */ - const char *c_ptr, /* entire rest of resource string, for error messages */ - size_t len) /* length of current line in resource string, for error messages*/ -{ - int menu_idx = -1, label_idx = -1, accelerator_idx = -1, action_idx = -1; -#define NAME_LEN 16 - char name[NAME_LEN]; - struct button_info *bp; - shrinkArgT shrink_arg_type; - struct xdvi_action *action; - Widget widget; - buttonTypeT b_type; -/* static int menu_num = 0; /\* count number of created menus *\/ */ - Dimension width = 0; - - ASSERT(item_count >= 2, "Too few items"); - - if (item_count == 4) { /* submenu for a button */ - menu_idx = 0; - label_idx = 1; - accelerator_idx = 2; - action_idx = 3; - } - else if (item_count == 3) { /* command button */ - label_idx = 0; - accelerator_idx = 1; - action_idx = 2; - } - else { /* separator */ - if (strcmp(items[1], "SEP") == 0) { /* separator */ - menu_idx = 0; - label_idx = 1; - } - else { - XDVI_WARNING((stderr, "Wrong number of items (%d) in translations line:\n\"%.*s\" (skipping this line).", - item_count, (int)len, c_ptr)); - return 0; - } - } - - if (action_idx != -1) { - int offset; - shrink_arg_type = test_for_shrink_arg(items[label_idx], &offset); - -/* fprintf(stderr, "compiling action: |%s|\n", items[action_idx]); */ - if ((action = compile_action(items[action_idx])) == NULL) { - XDVI_WARNING((stderr, "Invalid action \"%s\" in translations line:\n\"%.*s\" (skipping this line).", - items[action_idx], (int)len, c_ptr)); - return 0; - } - - if (shrink_arg_type != NO_SHRINK_ARG) { /* search for corresponding shrink action */ - if (!create_shrink_button(&(items[label_idx]), offset, shrink_arg_type, action)) { - XDVI_WARNING((stderr, "Non-existent shrink action \"%s\" in translations line:\n\"%.*s\"", - items[action_idx], (int)len, c_ptr)); - return 0; - } - } - } - else { - action = NULL; - } - - command_call[0].closure = (XtPointer) action; - SNPRINTF(name, NAME_LEN, "button%d", button_number); - - if (menu_idx != -1) { /* it's a pulldown menu */ - int index; - - /* create a new pulldown menu if it doesn't exist yet */ - widget = create_pulldown_menu(items[menu_idx], &width, &index, y_pos, &b_type, menu_num); - if (b_type == INVALID) - return 0; - if (b_type != NONE) { /* it didn't exist yet */ - bp = create_button_info(items[label_idx], NULL, widget, b_type); - **bipp = bp; - *bipp = &bp->next; - } - - /* create an entry for this item */ - widget = create_pulldown_entry(menu_list[index].name, - menu_list[index].popup_widget, - items[label_idx], - accelerator_idx > 0 ? items[accelerator_idx] : NULL, - action, - &b_type); - bp = create_button_info(items[label_idx], action, widget, b_type); - **bipp = bp; - *bipp = &bp->next; - } - else { /* not a pulldown menu, but a simple command button */ - command_call[0].closure = (XtPointer) action; - widget = XtVaCreateWidget(name, commandWidgetClass, parent, - XtNlabel, (XtArgVal)items[label_idx], - XtNx, resource.btn_side_spacing, - XtNy, (XtArgVal)*y_pos, - XtNborderWidth, resource.btn_border_width, - XtNcallback, (XtArgVal)command_call, - NULL); - bp = create_button_info(items[label_idx], action, widget, COMMAND_BUTTON); - **bipp = bp; - *bipp = &bp->next; - } -#undef NAME_LEN - return width; -} - -void -scroll_x_panner(int x) -{ - static int old_x = 0; - if (panner != 0 && ABS(x - old_x) > 8) { - XtVaSetValues(panner, XtNsliderX, x, NULL); - old_x = x; - } -} - -void -scroll_y_panner(int y) -{ - static int old_y = 0; - if (panner != 0 && ABS(y - old_y) > 8) { - XtVaSetValues(panner, XtNsliderY, y, NULL); - old_y = y; - } -} - -#ifdef USE_PANNER -static void -panner_cb(Widget widget, XtPointer closure, XtPointer report_ptr) -{ - XawPannerReport *report = (XawPannerReport *)report_ptr; - static int orig_x = 0, orig_y = 0; - int x = report->slider_x; - int y = report->slider_y; - static Dimension w, h; - static Arg arg_wh_clip[] = { - {XtNwidth, (XtArgVal) &w}, - {XtNheight, (XtArgVal) &h}, - }; - - UNUSED(closure); - - XtGetValues(globals.widgets.clip_widget, arg_wh_clip, XtNumber(arg_wh_clip)); - - fprintf(stderr, "w: %d, h: %d, globals.page.w: %d, globals.page.h: %d\n", - w, h, globals.page.w, globals.page.h); - XtVaSetValues(widget, - XtNsliderWidth, w, XtNsliderHeight, h, - XtNcanvasWidth, globals.page.w, XtNcanvasHeight, globals.page.h, - NULL); - - fprintf(stderr, "panner moved: %d, %d\n", report->slider_x, report->slider_y); - if (globals.widgets.x_bar != NULL) - XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer)(x - orig_x)); - if (globals.widgets.y_bar != NULL) - XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer)(y - orig_y)); - orig_x = x; - orig_y = y; -} -#endif /* USE_PANNER */ - void -create_menu_buttons(Widget form, int *ret_panel_width) +realize_button_panel(XtArgVal h) { - Dimension max_button_width = 0, curr_width; - Dimension y_pos; - struct button_info **bipp; - struct button_info *bp; - const char *c_ptr, *e_ptr; - int max_size; - int button_number = 0; - int menu_number = 0; /* number of menus created; passed through to create_pulldown_menu */ - - /* disable the magnifier in the panel: */ - XtTranslations panel_translations = XtParseTranslationTable("#augment :"); - - XtAppAddActions(XtWidgetToApplicationContext(form), menu_actions, XtNumber(menu_actions)); - /* add our own popdown-submenus() action to the default translations of this menu */ - menu_accels = XtParseAcceleratorTable(":MenuPopdown()notify()unhighlight()popdown-submenus()"); - - line_widget = XtVaCreateWidget("line", widgetClass, form, - XtNbackground, (XtArgVal)resource.fore_Pixel, - XtNwidth, (XtArgVal) 1, - XtNfromHoriz, (XtArgVal)globals.widgets.vport_widget, - XtNborderWidth, (XtArgVal)0, - XtNtop, (XtArgVal)XtChainTop, - XtNbottom, (XtArgVal)XtChainBottom, - XtNleft, (XtArgVal)XtChainRight, - XtNright, (XtArgVal)XtChainRight, - NULL); - panel_widget = XtVaCreateWidget("panel", compositeWidgetClass, form, - XtNborderWidth, (XtArgVal)0, - XtNfromHoriz, (XtArgVal)line_widget, - XtNtranslations, (XtArgVal)panel_translations, - XtNtop, (XtArgVal)XtChainTop, - XtNbottom, (XtArgVal)XtChainBottom, - XtNleft, (XtArgVal)XtChainRight, - XtNright, (XtArgVal)XtChainRight, - NULL); - menu_arrow_bitmap - = XCreateBitmapFromData(XtDisplay(globals.widgets.top_level), - RootWindowOfScreen(XtScreen(globals.widgets.top_level)), - (char *)menu_arrow_bits, MENU_ARROW_W, MENU_ARROW_H); - - b_head = NULL; - bipp = &b_head; - - *ret_panel_width = 0; - y_pos = resource.btn_top_spacing; - -#define FREE_LINE_ITEMS do { \ - for (curr = 0; curr < item_count; curr++) { \ - free(line_items[curr]); \ - } \ - free(line_items); \ - } while (0) - - for (c_ptr = resource.menu_translations; - c_ptr != NULL && *c_ptr != '\0'; - c_ptr = e_ptr + 1) { - e_ptr = strchr(c_ptr, '\n'); - if (e_ptr != NULL) { - char **line_items = NULL; - size_t len, curr, item_count = 0; - - if (e_ptr == c_ptr) { /* single '\n' marks additional space between buttons */ - y_pos += resource.btn_between_extra; - continue; - } - len = e_ptr - c_ptr; - - if (++button_number > MAX_BUTTON_NUM) { - XDVI_WARNING((stderr, "Too many buttons (max=%d), skipping all from:\n\"%.*s\"", - MAX_BUTTON_NUM, (int)len, c_ptr)); - break; - } - - line_items = split_line(c_ptr, SEP_CHAR, 0, len, &item_count); - if (item_count < 3 && !(item_count > 1 && strcmp(line_items[1], "SEP") == 0)) { - XDVI_WARNING((stderr, "Too few separators \"%c\" in translations line:\n\"%.*s\" (skipping this line).\n", - SEP_CHAR, (int)len, c_ptr)); - FREE_LINE_ITEMS; - continue; - } - curr_width = create_button(button_number, - &menu_number, - line_items, - item_count, - panel_widget, - &bipp, - &y_pos, - c_ptr, len); - if (curr_width == 0) { /* no button created */ - FREE_LINE_ITEMS; - continue; - } - /* adjust max_button_width to this new entry */ - if (curr_width > max_button_width) - max_button_width = curr_width; - - FREE_LINE_ITEMS; - } - } - -#undef FREE_LINE_ITEMS - - /* null-terminate button info */ - *bipp = NULL; - - max_size = xaw_get_pagelist_size(); - if (max_size > max_button_width) { - max_button_width = max_size; - } - - *ret_panel_width = max_button_width + 2 * (resource.btn_side_spacing + resource.btn_border_width); - TRACE_GUI((stderr, "panel_widget: w: %d", *ret_panel_width)); - XtVaSetValues(panel_widget, XtNwidth, (XtArgVal)*ret_panel_width, NULL); - ++(*ret_panel_width); - my_panel_width = *ret_panel_width; /* make it available */ - - for (bp = b_head; bp != NULL; bp = bp->next) { - if (bp->type == MENU_BUTTON || bp->type == COMMAND_BUTTON) { - TRACE_GUI((stderr, "bp->widget: w: %d", max_button_width)); - XtVaSetValues(bp->widget, XtNwidth, (XtArgVal)max_button_width, NULL); - XtManageChild(bp->widget); - } - } - - my_y_pos = y_pos - resource.btn_between_spacing + resource.btn_top_spacing + 2 * resource.btn_border_width; - initialize_tick_marks(); -#ifdef USE_PANNER - { - static Dimension w, h; - static Arg arg_wh_clip[] = { - {XtNwidth, (XtArgVal) &w}, - {XtNheight, (XtArgVal) &h}, - }; - XtGetValues(globals.widgets.clip_widget, arg_wh_clip, XtNumber(arg_wh_clip)); - - fprintf(stderr, "w: %d, h: %d, globals.page.w: %d, globals.page.h: %d\n", - w, h, globals.page.w, globals.page.h); - if (w == 0) - w = globals.page.w - 2; - if (h == 0) - h = globals.page.h - 2; - panner = XtVaCreateManagedWidget("panner", pannerWidgetClass, panel_widget, - XtNx, resource.btn_side_spacing, - XtNy, my_y_pos, - XtNheight, 60, - XtNwidth, max_button_width, - XtNshadowThickness, 0, - XtNsliderWidth, w, - XtNsliderHeight, h, - XtNcanvasWidth, globals.page.w, - XtNcanvasHeight, globals.page.h, - XtNsliderX, 5, - XtNsliderY, 7, - XtNinternalSpace, 0, - NULL); - } - my_y_pos += 60 + resource.btn_top_spacing + 2 * resource.btn_border_width; - XtAddCallback(panner, XtNreportCallback, panner_cb, (XtPointer)NULL); - -#endif /* USE_PANNER */ - -} -#endif /* NEW_MENU_CREATION */ - - -void -set_button_panel_height(XtArgVal h) -{ - TRACE_GUI((stderr, "line_widget: h %d", (int)h)); XtVaSetValues(line_widget, XtNheight, h, NULL); - XtManageChild(line_widget); - XtVaSetValues(panel_widget, XtNheight, h, NULL); - XtManageChild(panel_widget); -} - -/**************************************************************************** - * Action handling code. - */ - - -static void -handle_destroy_buttons(Widget widget, XtPointer client_data, XtPointer call_data) -{ - int panel_width; - Dimension window_w, window_h; - UNUSED(widget); - UNUSED(client_data); - UNUSED(call_data); - - if (--destroy_count != 0) { - return; - } - XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)True, NULL); - XtVaGetValues(globals.widgets.form_widget, - XtNwidth, &window_w, - XtNheight, &window_h, - NULL); - - if ((resource.expert_mode & XPRT_SHOW_BUTTONS) == 0) { - /* destroy buttons */ - TRACE_GUI((stderr, "globals.widgets.vport_widget: h %d, w %d", window_w, window_h)); - XtVaSetValues(globals.widgets.vport_widget, XtNwidth, window_w, XtNheight, window_h, NULL); - } - else { - create_menu_buttons(globals.widgets.form_widget, &panel_width); - window_w -= panel_width; - TRACE_GUI((stderr, "globals.widgets.vport_widget: h %d, w %d", window_h, window_w)); - XtVaSetValues(globals.widgets.vport_widget, XtNwidth, window_w, XtNheight, window_h, NULL); - set_button_panel_height((XtArgVal) window_h); + if ((resource.expert_mode & XPRT_SHOW_BUTTONS) != 0) { + XtManageChild(line_widget); + XtManageChild(panel_widget); } } - static void reconfig_window(void) { Dimension x_top, y_top, h_top, w_top; @@ -1364,82 +793,27 @@ toggle_scrollbars(void) void toggle_buttons(void) { - static Boolean buttons_active = False; - static Boolean initialized = False; - Dimension window_w, window_h; - - - Boolean make_buttons_visible = False; - Boolean make_buttons_invisible = False; - - int panel_width; - - if (!initialized) { - buttons_active = (resource.expert_mode & XPRT_SHOW_BUTTONS) != 0; - initialized = True; - } - - if ((resource.expert_mode & XPRT_SHOW_BUTTONS) == 0) { - if (buttons_active) - make_buttons_invisible = True; - } - else { - if (!buttons_active) - make_buttons_visible = True; - } + static Dimension panel_width = 0; + Dimension w; - if (make_buttons_visible) { - if (destroy_count != 0) { - return; - } + if (panel_width == 0) /* initialize */ + XtVaGetValues(panel_widget, XtNwidth, &panel_width, NULL); + + /* need to get current width of form in case user has resized the window */ + XtVaGetValues(globals.widgets.form_widget, XtNwidth, &w, NULL); + XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)True, NULL); - create_menu_buttons(globals.widgets.form_widget, &panel_width); - XtVaGetValues(globals.widgets.form_widget, - XtNwidth, &window_w, - XtNheight, &window_h, + if (resource.expert_mode & XPRT_SHOW_BUTTONS) { /* show buttons */ + XtManageChild(panel_widget); + XtManageChild(line_widget); + XtVaSetValues(globals.widgets.vport_widget, + XtNwidth, w - panel_width - 1, /* -1 for line_widget */ NULL); - XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)True, NULL); - window_w -= panel_width; - TRACE_GUI((stderr, "globals.widgets.vport_widget: w: %d, h: %d", window_w, window_h)); - XtVaSetValues(globals.widgets.vport_widget, XtNwidth, window_w, XtNheight, window_h, NULL); - set_button_panel_height((XtArgVal) window_h); - buttons_active = True; } - else if (make_buttons_invisible) { - if (destroy_count != 0) { - return; - } - /* this counts the callback calls; 1 for the panel, 1 for the line */ - destroy_count = 2; - - XtAddCallback(panel_widget, XtNdestroyCallback, - handle_destroy_buttons, (XtPointer)0); - XtAddCallback(panel_widget, XtNdestroyCallback, - handle_destroy_pagelist, (XtPointer)0); - XtAddCallback(line_widget, XtNdestroyCallback, - handle_destroy_buttons, (XtPointer)0); - XtDestroyWidget(panel_widget); - XtDestroyWidget(line_widget); - buttons_active = False; -/* window_w += get_panel_width(); */ - - while (b_head != NULL) { - struct button_info *bp = b_head; - struct xdvi_action *action; - - b_head = bp->next; - free(bp->label); - /* free bp->action */ - for (action = bp->action; action != NULL;) { - struct xdvi_action *act2 = action; - action = act2->next; - if (act2->num_params > 0) { - free(act2->param); - } - free(act2); - } - free(bp); - } + else { /* hide buttons */ + XtUnmanageChild(panel_widget); + XtUnmanageChild(line_widget); + XtVaSetValues(globals.widgets.vport_widget, XtNwidth, w, NULL); } } diff --git a/Build/source/texk/xdvik/gui/xaw_menu.h b/Build/source/texk/xdvik/gui/xaw_menu.h index 750f79cfeb5..693273c5ed9 100644 --- a/Build/source/texk/xdvik/gui/xaw_menu.h +++ b/Build/source/texk/xdvik/gui/xaw_menu.h @@ -24,39 +24,29 @@ #ifndef XAW_MENU_H_ #define XAW_MENU_H_ -#ifdef NEW_MENU_CREATION #include "menu.h" -#endif /* NEW_MENU_CREATION */ #ifndef MOTIF -#ifdef NEW_MENU_CREATION extern void xaw_set_button_state(struct button_elems *elems, Boolean on); extern void xaw_initialize_menu_bitmaps(void); extern Widget xaw_create_menu_widgets(Widget parent); extern void xaw_create_menu(struct button_info *items, Widget parent, int *ret_width); -extern void xaw_set_button_state(struct button_elems *elems, Boolean on); - -extern Pixmap menu_check_bitmap; -extern Pixmap menu_uncheck_bitmap; -#else -extern void create_menu_buttons(Widget menu_bar, int *ret_panel_width); -extern void toggle_menu(int val, XtActionProc proc); -#endif /* NEW_MENU_CREATION */ extern void SubMenuHandleEvent(XtAppContext app, XEvent *event); extern void filehist_menu_add_entry(const char *filename); extern int get_panel_width(void); -extern void toggle_tick(Boolean val, Widget w); -extern void set_button_panel_height(XtArgVal); +extern void realize_button_panel(XtArgVal height); extern void filehist_menu_refresh(void); extern void xaw_create_pagelist(void); extern void toggle_scrollbars(void); extern void toggle_buttons(void); +#ifdef USE_PANNER extern void scroll_y_panner(int y); extern void scroll_x_panner(int x); +#endif #endif /* not MOTIF */ #endif /* XAW_MENU_H_ */ diff --git a/Build/source/texk/xdvik/gui/xlwradio.c b/Build/source/texk/xdvik/gui/xlwradio.c index 27bb14c3eb2..94240d25b33 100644 --- a/Build/source/texk/xdvik/gui/xlwradio.c +++ b/Build/source/texk/xdvik/gui/xlwradio.c @@ -11,11 +11,11 @@ myWidget = XtVaCreateManagedWidget("foo", #ifdef XAW - radioWidgetClass, + radioWidgetClass, #else - toggleWidgetClass, + toggleWidgetClass, #endif - ... arglist ...); + ... arglist ...); Feel free to submit patches if you want this implemented. @@ -25,22 +25,22 @@ /* Radio Widget for XEmacs. Copyright (C) 1999 Edward A. Falk -This file is part of XEmacs. + This file is part of XEmacs. -XEmacs 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, or (at your option) any -later version. + XEmacs 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, or (at your option) any + later version. -XEmacs 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. + XEmacs 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 XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with XEmacs; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* Synched up with: Radio.c 1.1 */ @@ -154,90 +154,90 @@ static void RadioSize (RadioWidget, Dimension *, Dimension *); */ static XtActionsRec actionsList[] = -{ - {"highlight", RadioHighlight}, - {"unhighlight", RadioUnhighlight}, -}; + { + {"highlight", RadioHighlight}, + {"unhighlight", RadioUnhighlight}, + }; #define offset(field) XtOffset(RadioWidget, radio.field) static XtResource resources[] = { - {XtNisRadio, XtCIsRadio, XtRBoolean, sizeof(Boolean), - offset(isRadio), XtRImmediate, (XtPointer)True }, + {XtNisRadio, XtCIsRadio, XtRBoolean, sizeof(Boolean), + offset(isRadio), XtRImmediate, (XtPointer)True }, }; #undef offset #define SuperClass ((ToggleWidgetClass)&toggleClassRec) RadioClassRec radioClassRec = { - { - (WidgetClass) SuperClass, /* superclass */ - "Radio", /* class_name */ - sizeof(RadioRec), /* size */ - RadioClassInit, /* class_initialize */ - RadioClassPartInit, /* class_part_initialize */ - FALSE, /* class_inited */ - RadioInit, /* initialize */ - NULL, /* initialize_hook */ - XtInheritRealize, /* realize */ - actionsList, /* actions */ - XtNumber(actionsList), /* num_actions */ - resources, /* resources */ - XtNumber(resources), /* resource_count */ - NULLQUARK, /* xrm_class */ - TRUE, /* compress_motion */ - TRUE, /* compress_exposure */ - TRUE, /* compress_enterleave */ - FALSE, /* visible_interest */ - RadioDestroy, /* destroy */ - RadioResize, /* resize */ - RadioExpose, /* expose */ - RadioSetValues, /* set_values */ - NULL, /* set_values_hook */ - XtInheritSetValuesAlmost, /* set_values_almost */ - NULL, /* get_values_hook */ - NULL, /* accept_focus */ - XtVersion, /* version */ - NULL, /* callback_private */ - XtInheritTranslations, /* tm_table */ - RadioQueryGeometry, /* query_geometry */ - XtInheritDisplayAccelerator, /* display_accelerator */ - NULL /* extension */ - }, /* CoreClass fields initialization */ - { - XtInheritChangeSensitive /* change_sensitive */ + { + (WidgetClass) SuperClass, /* superclass */ + "Radio", /* class_name */ + sizeof(RadioRec), /* size */ + RadioClassInit, /* class_initialize */ + RadioClassPartInit, /* class_part_initialize */ + FALSE, /* class_inited */ + RadioInit, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* resource_count */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + RadioDestroy, /* destroy */ + RadioResize, /* resize */ + RadioExpose, /* expose */ + RadioSetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + XtInheritTranslations, /* tm_table */ + RadioQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + }, /* CoreClass fields initialization */ + { + XtInheritChangeSensitive /* change_sensitive */ #ifndef HAVE_OLD_XAW - , NULL + , NULL #endif - }, /* SimpleClass fields initialization */ + }, /* SimpleClass fields initialization */ #ifdef _ThreeDP_h - { - XtInheritXaw3dShadowDraw /* field not used */ - }, /* ThreeDClass fields initialization */ + { + XtInheritXaw3dShadowDraw /* field not used */ + }, /* ThreeDClass fields initialization */ #endif - { - 0 /* field not used */ - }, /* LabelClass fields initialization */ - { - 0 /* field not used */ - }, /* CommandClass fields initialization */ - { - RadioSet, /* Set Procedure. */ - RadioUnset, /* Unset Procedure. */ - NULL /* extension. */ - }, /* ToggleClass fields initialization */ - { - BOX_SIZE, - DrawDiamond, /* draw procedure */ - None, /* selected radiobutton */ - None, /* unselected radiobutton */ - None, /* selected menubutton */ - None, /* unselected menubutton */ - NULL /* extension. */ - } /* RadioClass fields initialization */ + { + 0 /* field not used */ + }, /* LabelClass fields initialization */ + { + 0 /* field not used */ + }, /* CommandClass fields initialization */ + { + RadioSet, /* Set Procedure. */ + RadioUnset, /* Unset Procedure. */ + NULL /* extension. */ + }, /* ToggleClass fields initialization */ + { + BOX_SIZE, + DrawDiamond, /* draw procedure */ + None, /* selected radiobutton */ + None, /* unselected radiobutton */ + None, /* selected menubutton */ + None, /* unselected menubutton */ + NULL /* extension. */ + } /* RadioClass fields initialization */ }; - /* for public consumption */ +/* for public consumption */ WidgetClass radioWidgetClass = (WidgetClass) &radioClassRec; @@ -254,20 +254,20 @@ WidgetClass radioWidgetClass = (WidgetClass) &radioClassRec; static void RadioClassInit (void) { - XawInitializeWidgetSet(); + XawInitializeWidgetSet(); } static void RadioClassPartInit (WidgetClass class) { - RadioWidgetClass c = (RadioWidgetClass) class; - RadioWidgetClass super = (RadioWidgetClass)c->core_class.superclass; + RadioWidgetClass c = (RadioWidgetClass) class; + RadioWidgetClass super = (RadioWidgetClass)c->core_class.superclass; - if( c->radio_class.drawDiamond == NULL || - c->radio_class.drawDiamond == XtInheritDrawDiamond ) - { - c->radio_class.drawDiamond = super->radio_class.drawDiamond; - } + if( c->radio_class.drawDiamond == NULL || + c->radio_class.drawDiamond == XtInheritDrawDiamond ) + { + c->radio_class.drawDiamond = super->radio_class.drawDiamond; + } } @@ -351,13 +351,13 @@ RadioResize (Widget w) /* override label offset */ switch( rw->label.justify ) { - case XtJustifyLeft: + case XtJustifyLeft: rw->label.label_x += (bs(rw) + rw->label.internal_width); break; - case XtJustifyRight: + case XtJustifyRight: break; - case XtJustifyCenter: - default: + case XtJustifyCenter: + default: rw->label.label_x += (bs(rw) + rw->label.internal_width)/2; break; } @@ -373,49 +373,49 @@ RadioExpose (Widget w, XEvent *event, Region region) { - RadioWidget rw = (RadioWidget) w; - Display *dpy = XtDisplay(w); - Window win = XtWindow(w); - GC gc; - Pixmap left_bitmap; - extern WidgetClass labelWidgetClass; - - /* Note: the Label widget examines the region to decide if anything - * needs to be drawn. I'm not sure that this is worth the effort, - * but it bears thinking on. - */ - - /* Command widget may sometimes override the label GC in order - * to draw inverse video. We don't use inverse video, so we need - * to restore the label's normal GC. - */ - rw->label.normal_GC = rw->command.normal_GC; - - - /* Let label widget draw the label. If there was an lbm_x - * field, we could let Label draw the bitmap too. But there - * isn't, so we need to temporarily remove the bitmap and - * draw it ourself later. - */ - left_bitmap = rw->label.left_bitmap; - rw->label.left_bitmap = None; - labelWidgetClass->core_class.expose(w,event,region); - rw->label.left_bitmap = left_bitmap; - - /* now manually draw the left bitmap. TODO: 3-d look, xaw-xpm */ - gc = XtIsSensitive(w) ? rw->label.normal_GC : rw->label.gray_GC; - if( left_bitmap != None && rw->label.lbm_width > 0 ) - { - /* TODO: handle pixmaps */ - XCopyPlane(dpy, left_bitmap, win, gc, - 0,0, rw->label.lbm_width, rw->label.lbm_height, - (int) rw->label.internal_width*2 + bs(rw), - (int) rw->label.internal_height + rw->label.lbm_y, - 1UL); - } - DrawDiamond(w); - /* Finally, the button itself */ - ((RadioWidgetClass)(w->core.widget_class))->radio_class.drawDiamond(w); + RadioWidget rw = (RadioWidget) w; + Display *dpy = XtDisplay(w); + Window win = XtWindow(w); + GC gc; + Pixmap left_bitmap; + extern WidgetClass labelWidgetClass; + + /* Note: the Label widget examines the region to decide if anything + * needs to be drawn. I'm not sure that this is worth the effort, + * but it bears thinking on. + */ + + /* Command widget may sometimes override the label GC in order + * to draw inverse video. We don't use inverse video, so we need + * to restore the label's normal GC. + */ + rw->label.normal_GC = rw->command.normal_GC; + + + /* Let label widget draw the label. If there was an lbm_x + * field, we could let Label draw the bitmap too. But there + * isn't, so we need to temporarily remove the bitmap and + * draw it ourself later. + */ + left_bitmap = rw->label.left_bitmap; + rw->label.left_bitmap = None; + labelWidgetClass->core_class.expose(w,event,region); + rw->label.left_bitmap = left_bitmap; + + /* now manually draw the left bitmap. TODO: 3-d look, xaw-xpm */ + gc = XtIsSensitive(w) ? rw->label.normal_GC : rw->label.gray_GC; + if( left_bitmap != None && rw->label.lbm_width > 0 ) + { + /* TODO: handle pixmaps */ + XCopyPlane(dpy, left_bitmap, win, gc, + 0,0, rw->label.lbm_width, rw->label.lbm_height, + (int) rw->label.internal_width*2 + bs(rw), + (int) rw->label.internal_height + rw->label.lbm_y, + 1UL); + } + DrawDiamond(w); + /* Finally, the button itself */ + ((RadioWidgetClass)(w->core.widget_class))->radio_class.drawDiamond(w); } @@ -456,7 +456,7 @@ RadioSetValues (Widget current, newrw->core.height != oldrw->core.height || newrw->core.border_width != oldrw->core.border_width ) ) { - RadioSize(newrw, &newrw->core.width, &newrw->core.height); + RadioSize(newrw, &newrw->core.width, &newrw->core.height); } /* The label set values routine can resize the widget. We need to @@ -464,7 +464,7 @@ RadioSetValues (Widget current, */ if (newrw->label.label_x != oldrw->label.label_x) { - RadioResize (new); + RadioResize (new); } return FALSE; } @@ -480,7 +480,7 @@ RadioQueryGeometry (Widget w, RadioSize(rw, &preferred->width, &preferred->height); if ( ((intended->request_mode & (CWWidth | CWHeight)) - == (CWWidth | CWHeight)) && + == (CWWidth | CWHeight)) && intended->width == preferred->width && intended->height == preferred->height) return XtGeometryYes; @@ -511,27 +511,27 @@ static void DrawHighlight (Widget w, GC gc) { - RadioWidget rw = (RadioWidget)w; - XRectangle rects[4]; - Dimension ht = rw->command.highlight_thickness; - - if( ht <= 0 || - ht > rw->core.width/2 || - ht > rw->core.height/2 ) - return; - - if( ! XtIsRealized(w) ) - return; - - rects[0].x = 0; rects[0].y = 0; - rects[0].width = rw->core.width; rects[0].height = ht; - rects[1].x = 0; rects[1].y = rw->core.height - ht; - rects[1].width = rw->core.width; rects[1].height = ht; - rects[2].x = 0; rects[2].y = ht; - rects[2].width = ht; rects[2].height = rw->core.height - ht*2; - rects[3].x = rw->core.width - ht; rects[3].y = ht; - rects[3].width = ht; rects[3].height = rw->core.height - ht*2; - XFillRectangles( XtDisplay(w), XtWindow(w), gc, rects, 4); + RadioWidget rw = (RadioWidget)w; + XRectangle rects[4]; + Dimension ht = rw->command.highlight_thickness; + + if( ht <= 0 || + ht > rw->core.width/2 || + ht > rw->core.height/2 ) + return; + + if( ! XtIsRealized(w) ) + return; + + rects[0].x = 0; rects[0].y = 0; + rects[0].width = rw->core.width; rects[0].height = ht; + rects[1].x = 0; rects[1].y = rw->core.height - ht; + rects[1].width = rw->core.width; rects[1].height = ht; + rects[2].x = 0; rects[2].y = ht; + rects[2].width = ht; rects[2].height = rw->core.height - ht*2; + rects[3].x = rw->core.width - ht; rects[3].y = ht; + rects[3].width = ht; rects[3].height = rw->core.height - ht*2; + XFillRectangles( XtDisplay(w), XtWindow(w), gc, rects, 4); } static void @@ -578,11 +578,11 @@ RadioSet (Widget w, UNUSED(num_params); if( rw->command.set ) - return; + return; rw->command.set = TRUE; if( XtIsRealized(w) ) - class->radio_class.drawDiamond(w); + class->radio_class.drawDiamond(w); } @@ -600,11 +600,11 @@ RadioUnset (Widget w, UNUSED(num_params); if( ! rw->command.set ) - return; + return; rw->command.set = FALSE; if( XtIsRealized(w) ) - class->radio_class.drawDiamond(w); + class->radio_class.drawDiamond(w); } @@ -627,10 +627,10 @@ RadioSize (RadioWidget rw, Dimension *w, Dimension *h) { - *w = rw->label.label_width + bs(rw) + LEFT_OFFSET(rw) + - 3 * rw->label.internal_width; - *h = MAX( rw->label.label_height, bs(rw) ) + - 2 * rw->label.internal_width; + *w = rw->label.label_width + bs(rw) + LEFT_OFFSET(rw) + + 3 * rw->label.internal_width; + *h = MAX( rw->label.label_height, bs(rw) ) + + 2 * rw->label.internal_width; } diff --git a/Build/source/texk/xdvik/gui/xm_colorsel.c b/Build/source/texk/xdvik/gui/xm_colorsel.c index 9b91e2c76fd..f48bcbc7d03 100644 --- a/Build/source/texk/xdvik/gui/xm_colorsel.c +++ b/Build/source/texk/xdvik/gui/xm_colorsel.c @@ -117,12 +117,26 @@ popdown_cb(Widget widget, XtPointer client_data, XtPointer call_data) ASSERT(prefs != NULL, "user_data in popdown_cb musn't be NULL!"); if (get_widget_by_name(&dialog, widget, Xdvi_COLOR_DIALOG_NAME, True)) { -/* fprintf(stderr, "popdown!\n"); */ + /* fprintf(stderr, "popdown!\n"); */ remove_from_deplist(prefs, dialog); XtUnmanageChild(dialog); } } +static void +h_update_sliders(struct color_info *cinfo) +{ + unsigned r, g, b; + + r = cinfo->new_color.red >> 8; + g = cinfo->new_color.green >> 8; + b = cinfo->new_color.blue >> 8; + + XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); + XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); + XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); +} + static void popdown_apply_cb(Widget widget, XtPointer client_data, XtPointer call_data) { @@ -199,14 +213,14 @@ popdown_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { struct prefs_choice *prefs = (struct prefs_choice *)client_data; -/* fprintf(stderr, "popdown cancel; call_data: %p!\n", call_data); */ + /* fprintf(stderr, "popdown cancel; call_data: %p!\n", call_data); */ if (call_data != NULL) { -/* fprintf(stderr, "removing from deplist: %p!!!\n", prefs); */ + /* fprintf(stderr, "removing from deplist: %p!!!\n", prefs); */ remove_from_deplist(prefs, widget); } XtUnmanageChild(widget); -/* XtPopdown(XtParent(widget)); */ + /* XtPopdown(XtParent(widget)); */ } static void @@ -214,7 +228,6 @@ revert_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) { struct color_info *cinfo = (struct color_info *)client_data; Pixel pix; - unsigned r, g, b; UNUSED(call_data); @@ -233,16 +246,7 @@ revert_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) /* update sliders */ XFreeColors(DISP, G_colormap, &(cinfo->new_color.pixel), 1, 0); pixel_to_color(pix, &(cinfo->new_color), DISP, G_colormap); - - r = cinfo->new_color.red >> 8; - g = cinfo->new_color.green >> 8; - b = cinfo->new_color.blue >> 8; - -/* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ - - XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); - XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); - XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); + h_update_sliders(cinfo); } static void @@ -250,11 +254,10 @@ show_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) { struct color_info *cinfo = (struct color_info *)client_data; Pixel pix; - unsigned r, g, b; UNUSED(call_data); XtVaGetValues(widget, XmNbackground, &pix, NULL); -/* fprintf(stderr, "Color: 0x%.6lx\n", pix); */ + /* fprintf(stderr, "Color: 0x%.6lx\n", pix); */ /* use this instead of XtVaSetValues on XmNbackground so that the foreground color gets also changed appropriately. */ @@ -267,16 +270,7 @@ show_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) /* update sliders */ XFreeColors(DISP, G_colormap, &(cinfo->new_color.pixel), 1, 0); pixel_to_color(pix, &(cinfo->new_color), DISP, G_colormap); - - r = cinfo->new_color.red >> 8; - g = cinfo->new_color.green >> 8; - b = cinfo->new_color.blue >> 8; - -/* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ - - XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); - XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); - XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); + h_update_sliders(cinfo); } static void @@ -285,7 +279,7 @@ slider_cb(Widget widget, XtPointer client_data, XtPointer call_data) struct color_info *cinfo = (struct color_info *)client_data; XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *)call_data; -/* fprintf(stderr, "Pixel1 : 0x%.6lx\n", cinfo->new_color.pixel); */ + /* fprintf(stderr, "Pixel1 : 0x%.6lx\n", cinfo->new_color.pixel); */ /* reuse cinfo->new_color */ XFreeColors(DISP, G_colormap, &(cinfo->new_color.pixel), 1, 0); @@ -303,7 +297,7 @@ slider_cb(Widget widget, XtPointer client_data, XtPointer call_data) XDVI_ERROR((stderr, "Couldn't XAllocColor\n")); return; } -/* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ + /* fprintf(stderr, "Pixel: 0x%.6lx\n", cinfo->new_color.pixel); */ #if XmVersion >= 1002 /* if avaliable, use this so that the foreground color also @@ -314,20 +308,6 @@ slider_cb(Widget widget, XtPointer client_data, XtPointer call_data) #endif } -static void -h_init_sliders(struct color_info *cinfo) -{ - unsigned r, g, b; - - r = cinfo->new_color.red >> 8; - g = cinfo->new_color.green >> 8; - b = cinfo->new_color.blue >> 8; - - XtVaSetValues(cinfo->r_scale, XmNvalue, r, NULL); - XtVaSetValues(cinfo->g_scale, XmNvalue, g, NULL); - XtVaSetValues(cinfo->b_scale, XmNvalue, b, NULL); -} - static Widget h_create_color_matrix(Widget parent, Widget top, struct color_info *cinfo) { @@ -486,7 +466,7 @@ h_create_sliders(Widget parent, Widget top, struct color_info *cinfo) XtManageChild(g_scale); XtManageChild(b_scale); - h_init_sliders(cinfo); + h_update_sliders(cinfo); } @@ -510,15 +490,15 @@ h_create_shell(Widget parent, struct color_info *cinfo) struct color_button_info *binfo = cinfo->button_info; struct topic_info *tinfo = binfo->tinfo; struct prefs_choice *prefs = (struct prefs_choice *)tinfo->data; -/* struct prefs_choice *prefs; */ + /* struct prefs_choice *prefs; */ n = 0; XtSetArg(args[n], XmNuserData, cinfo); n++; -/* XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++; */ -/* XtSetArg(args[n], XmNnoResize, True); n++; */ -/* XtSetArg(args[n], XmNmwmFunctions, functions); n++; */ -/* XtSetArg(args[n], XmNmwmDecorations, decoration); n++; */ + /* XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++; */ + /* XtSetArg(args[n], XmNnoResize, True); n++; */ + /* XtSetArg(args[n], XmNmwmFunctions, functions); n++; */ + /* XtSetArg(args[n], XmNmwmDecorations, decoration); n++; */ XtSetArg(args[n], XtNtitle, "Xdvik: Select Color"); n++; dialog = XmCreatePromptDialog(parent, Xdvi_COLOR_DIALOG_NAME, args, n); @@ -586,11 +566,10 @@ h_create_shell(Widget parent, struct color_info *cinfo) XmNshadowThickness, 1, NULL); XmStringFree(str); + /* disable clicking on the new_sample button */ XtInsertEventHandler(new_sample, KeyPressMask | KeyReleaseMask | - ButtonPressMask | ButtonReleaseMask | - PointerMotionMask| PointerMotionHintMask | - ButtonMotionMask | FocusChangeMask, + ButtonPressMask | ButtonReleaseMask, True, block_event_callback, (XtPointer)0, 0); cinfo->new_sample = new_sample; @@ -608,13 +587,8 @@ h_create_shell(Widget parent, struct color_info *cinfo) add_to_deplist(prefs, dialog); -/* h_create_commands(shell, color_globals.widgets.paned, "OK", "Cancel", cinfo); */ - -/* XtManageChild(color_globals.widgets.paned); */ - -/* XtRealizeWidget(shell); */ - TipAddWidget(tip_shell, old_sample, "Click to revert to old color"); + TipAddWidget(tip_shell, new_sample, "Preview of new color"); /* TipAddWidget(tip_shell, color_matrix, "Select color"); */ WM_DELETE_WINDOW = XmInternAtom(DISP, "WM_DELETE_WINDOW", False); diff --git a/Build/source/texk/xdvik/gui/xm_filesel.c b/Build/source/texk/xdvik/gui/xm_filesel.c index e5475f0bbe5..09495a8487e 100644 --- a/Build/source/texk/xdvik/gui/xm_filesel.c +++ b/Build/source/texk/xdvik/gui/xm_filesel.c @@ -35,13 +35,16 @@ #include "events.h" #include "message-window.h" #include "dvi-init.h" /* for dviErrFlagT */ +#include "x_util.h" #if defined(MOTIF) /* entire file */ #include +#include +#include -static Widget dialog = NULL; -static char *browse_fname = NULL; +/* static Widget dialog = NULL; */ +/* static char *browse_fname = NULL; */ /* * Process callback from Dialog cancel actions. @@ -58,14 +61,14 @@ cancel_callback(Widget w, #if 0 /* DON'T reset browse_fname, so that user gets the current value as default next time when he cancels now */ - if (browse_fname != NULL) + if (callback->browse_fname != NULL) { - XtFree(browse_fname); - browse_fname = NULL; + XtFree(callback->browse_fname); + callback->browse_fname = NULL; } #endif - XtUnmanageChild(dialog); + XtUnmanageChild(callback->shell); if (callback->exit_on_cancel) { exit(0); } @@ -88,31 +91,34 @@ accept_callback(Widget w, ASSERT(client_data != NULL, "struct filesel_callback pointer expected in client data"); callback = (struct filesel_callback *)client_data; - if (browse_fname != NULL) { - XtFree(browse_fname); - browse_fname = NULL; - } - fcb = (XmFileSelectionBoxCallbackStruct *)call_data; - /* get the filename from the file selection box */ - XmStringGetLtoR(fcb->value, G_charset, &browse_fname); + fcb = (XmFileSelectionBoxCallbackStruct *)call_data; + if (callback->browse_fname != NULL) { + XtFree(callback->browse_fname); + callback->browse_fname = NULL; + } + XmStringGetLtoR(fcb->value, G_charset, &callback->browse_fname); - if (callback->must_exist) { - FILE *tmp_fp = XFOPEN(browse_fname, "r"); + if (0 && callback->must_exist) { + FILE *tmp_fp = XFOPEN(callback->browse_fname, "r"); dviErrFlagT errflag = NO_ERROR; if (tmp_fp == NULL) { - popup_message(XtParent(dialog), + popup_message(XtParent(callback->shell), MSG_ERR, NULL, "Could not open %s: %s.\n", - browse_fname, strerror(errno)); + callback->browse_fname, strerror(errno)); /* leave file selection box open */ return; } else if (!process_preamble(tmp_fp, &errflag) || !find_postamble(tmp_fp, &errflag) - || !read_postamble(tmp_fp, &errflag, True)) { - popup_message(XtParent(dialog), + || !read_postamble(tmp_fp, &errflag, True +#if DELAYED_MKTEXPK + , False +#endif + )) { + popup_message(XtParent(callback->shell), MSG_ERR, NULL, "Error opening %s:\n%s.", - browse_fname, get_dvi_error(errflag)); + callback->browse_fname, get_dvi_error(errflag)); fclose(tmp_fp); /* leave file selection box open */ return; @@ -123,8 +129,21 @@ accept_callback(Widget w, } /* success; close dialog, and call our callback */ - XtUnmanageChild(dialog); - callback->func_ptr(browse_fname, callback->data); + XtUnmanageChild(callback->shell); + callback->func_ptr(callback->browse_fname, callback->data); +} + +static void +cb_open_new_window(Widget w, XtPointer client_data, XtPointer call_data) +{ + UNUSED(client_data); + UNUSED(call_data); + + if (XmToggleButtonGadgetGetState(w)) + resource.filesel_open_new_window = True; + else + resource.filesel_open_new_window = False; + store_preference(NULL, "fileselOpenNewWindow", "%d", resource.filesel_open_new_window); } void raise_file_selector(void) @@ -134,59 +153,80 @@ void raise_file_selector(void) } void -XsraSelFile(Widget parent, struct filesel_callback *callback) +XsraSelFilePopup(struct filesel_callback *callback) { -#define ARG_CNT 4 - XmString filemask = NULL; - XmString directory = NULL; - Arg args[ARG_CNT]; - int i = 0; - - if (dialog == NULL) { - dialog = XmCreateFileSelectionDialog(parent, "file", NULL, 0); - /* Set ret_dialog to the DialogShell parent, not the command widget - returned by the Motif routines. We need the DialogShell, otherwise - Motif will crash if ret_dialog is used as parent for popup_message() - windows!!! - */ - XtVaSetValues(XtParent(dialog), XmNtitle, callback->title, NULL); - - /* my_must_exist = must_exist; */ - /* XtAddCallback(dialog, XmNokCallback, accept_callback, (XtPointer)&my_must_exist); */ - XtAddCallback(dialog, XmNokCallback, accept_callback, (XtPointer)callback); - XtAddCallback(dialog, XmNcancelCallback, cancel_callback, (XtPointer)callback); - /* We have no help in this window, so hide help button */ - XtUnmanageChild(XmFileSelectionBoxGetChild(dialog, (unsigned char)XmDIALOG_HELP_BUTTON)); - } - else if (XtIsManaged(dialog)) { + if (XtIsManaged(callback->shell)) { XBell(DISP, 10); - XRaiseWindow(DISP, XtWindow(dialog)); + XRaiseWindow(DISP, XtWindow(callback->shell)); return; } - - /* only show files matching our mask */ - filemask = XmStringCreateLtoR((char *)callback->filemask, G_charset); - XtSetArg(args[i], XmNpattern, filemask); i++; - - /* set directory to last directory used */ - if (browse_fname != NULL) { - char *path = xstrdup(browse_fname); - char *ptr = strrchr(path, '/'); + else { +#define ARG_CNT 4 + XmString filemask = NULL; + XmString directory = NULL; + Arg args[ARG_CNT]; + int i = 0; + char *path, *ptr; + + /* only show files matching our mask */ + filemask = XmStringCreateLtoR((char *)callback->filemask, G_charset); + XtSetArg(args[i], XmNpattern, filemask); i++; + + /* set directory to last directory used */ + if (callback->browse_fname == NULL) { + ASSERT(callback->init_path != NULL, "callback->init_path mustn't be NULL!"); + callback->browse_fname = xt_strdup(callback->init_path); + } + path = xstrdup(callback->browse_fname); + ptr = strrchr(path, '/'); if (ptr != NULL) *ptr = '\0'; directory = XmStringCreateLtoR(path, G_charset); XtSetArg(args[i], XmNdirectory, directory); i++; free(path); - } + - ASSERT(i < ARG_CNT, "args list too short"); - XtSetValues(dialog, args, (Cardinal)i); + ASSERT(i < ARG_CNT, "args list too short"); + XtSetValues(callback->shell, args, (Cardinal)i); - free(filemask); - free(directory); + free(filemask); + free(directory); - XtManageChild(dialog); + XtManageChild(callback->shell); #undef ARG_CNT + } +} + +Widget +XsraSelFile(Widget parent, struct filesel_callback *callback) +{ + Widget dialog = XmCreateFileSelectionDialog(parent, "file", NULL, 0); + + XtVaSetValues(XtParent(dialog), XmNtitle, callback->title, NULL); + + XtAddCallback(dialog, XmNokCallback, accept_callback, (XtPointer)callback); + XtAddCallback(dialog, XmNcancelCallback, cancel_callback, (XtPointer)callback); + + /* When opening a DVI file, offer to open in new window */ + if (callback->must_exist) { + Widget form, button; + XmString test; + form = XtVaCreateManagedWidget("new_window_form", xmFormWidgetClass, dialog, NULL); + test = XmStringCreateLocalized("Open file in new window"); + button = XtVaCreateManagedWidget(Xdvi_NEW_WINDOW_RADIO_NAME, xmToggleButtonGadgetClass, form, + XmNlabelString, test, + XmNindicatorType, XmN_OF_MANY, + XmNset, resource.filesel_open_new_window, + NULL); + XmStringFree(test); + XtAddCallback(button, XmNvalueChangedCallback, cb_open_new_window, (XtPointer)NULL); + } + + + /* We have no help in this window, so hide help button */ + XtUnmanageChild(XmFileSelectionBoxGetChild(dialog, (unsigned char)XmDIALOG_HELP_BUTTON)); + + return dialog; } #else diff --git a/Build/source/texk/xdvik/gui/xm_menu.c b/Build/source/texk/xdvik/gui/xm_menu.c index 51a2bedbd53..6b5d766852a 100644 --- a/Build/source/texk/xdvik/gui/xm_menu.c +++ b/Build/source/texk/xdvik/gui/xm_menu.c @@ -107,7 +107,7 @@ update_menu_labels(Widget menu) XmNchildren, &children, NULL); -/* for (i = 0; i < num_children; i++) { */ + /* for (i = 0; i < num_children; i++) { */ for (i = 0; i < (int)file_history_size(); i++) { int dummy_page; char *filename; @@ -152,7 +152,7 @@ filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) char *fname; int idx; -/* UNUSED(w); */ + /* UNUSED(w); */ UNUSED(call_data); UNUSED(client_data); @@ -172,7 +172,7 @@ filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) return; } if ((fname = file_history_get_elem(idx, &pageno)) == NULL) { - statusline_print(STATUS_MEDIUM, "Error accessing file %d of history", idx); + statusline_error(STATUS_MEDIUM, "Error accessing file %d of history", idx); return; } @@ -242,7 +242,7 @@ filehist_submenu(int idx, const char *filename, int pageno, void *data) sprintf(buf, "%d %s", idx + 1, filename); TRACE_GUI((stderr, "Creating menu `%s'", buf)); w = XtVaCreateManagedWidget(buf, xmPushButtonGadgetClass, menu, -/* XmNmnemonic, buf[0], */ + /* XmNmnemonic, buf[0], */ XmNuserData, menu, NULL); if (idx + 1 < 10) { diff --git a/Build/source/texk/xdvik/gui/xm_prefs.c b/Build/source/texk/xdvik/gui/xm_prefs.c index 388ef07ac12..4c389259b45 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs.c +++ b/Build/source/texk/xdvik/gui/xm_prefs.c @@ -81,7 +81,7 @@ h_attach_below(Widget x, Widget y) { XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, y, XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, NULL); } } @@ -268,7 +268,7 @@ revert_resources(void) /* save some old values */ int save_shrink = resource.shrinkfactor; - reload_app_resources(); + load_app_resources(True); /* revert from saved values */ resource.use_color = globals.curr_use_color; @@ -327,7 +327,7 @@ revert_resources(void) need_redraw |= revert_colors(curr_fg, curr_bg, curr_hl); -/* if (need_redraw) */ + /* if (need_redraw) */ /* just reload it always, there's too many exceptions ... redraw isn't always sufficient if file has colors. */ globals.ev.flags |= EV_RELOAD; @@ -413,10 +413,10 @@ apply_prefs_cb(XtPointer arg) free(globals.curr_browser); if (resource.browser != NULL) - globals.curr_browser = xstrdup(resource.browser); + globals.curr_browser = xstrdup(resource.browser); -/* fprintf(stderr, "set curr_browser to: |%s|\n", globals.curr_browser); */ -/* fprintf(stderr, "set curr_editor to: |%s|\n", globals.curr_editor); */ + /* fprintf(stderr, "set curr_browser to: |%s|\n", globals.curr_browser); */ + /* fprintf(stderr, "set curr_editor to: |%s|\n", globals.curr_editor); */ if (get_xdvi_window_id(False, NULL) && save_user_preferences(False)) { /* if other instances of xdvi are running, make them reread the @@ -487,11 +487,11 @@ close_prefs_exit(Widget w, XtPointer arg) { struct topic_info *info = (struct topic_info *)arg; struct prefs_choice *prefs = (struct prefs_choice *)info->data; -/* Widget dialog; */ -/* if (get_widget_by_name(&dialog, w, Xdvi_MESSAGE_DIALOG_NAME, True)) { */ -/* fprintf(stderr, "!!!!!!!!! removing window from deplist!\n"); */ -/* remove_from_deplist(prefs, dialog); */ -/* } */ + /* Widget dialog; */ + /* if (get_widget_by_name(&dialog, w, Xdvi_MESSAGE_DIALOG_NAME, True)) { */ + /* fprintf(stderr, "!!!!!!!!! removing window from deplist!\n"); */ + /* remove_from_deplist(prefs, dialog); */ + /* } */ remove_from_deplist(prefs, w); @@ -545,17 +545,17 @@ popup_preferences_dialog(Widget parent, int arg) info.ok_callback = apply_prefs_cb; info.cancel_callback = revert_prefs_cb; info.items = items; -/* info.items_size = NUM_PREFS_TOPICS; */ + /* info.items_size = NUM_PREFS_TOPICS; */ prefs = xmalloc(sizeof *prefs); prefs->depwin_cnt = 0; prefs->depwin = NULL; -/* prefs->orig = orig_prefs; */ + /* prefs->orig = orig_prefs; */ /* apply_prefs_cb/revert_prefs_cb are responsible for copying the changed preferences into the current preferences as appropriate, and free()ing prefs.changed */ -/* prefs->changed = xmalloc(sizeof *(prefs->changed)); */ -/* copy_resources(orig_prefs, prefs->changed); */ + /* prefs->changed = xmalloc(sizeof *(prefs->changed)); */ + /* copy_resources(orig_prefs, prefs->changed); */ prefs->db = NULL; /* XrmGetStringDatabase(""); */ info.data = prefs; diff --git a/Build/source/texk/xdvik/gui/xm_prefsP.h b/Build/source/texk/xdvik/gui/xm_prefsP.h index 3ec65ef9607..530373af241 100644 --- a/Build/source/texk/xdvik/gui/xm_prefsP.h +++ b/Build/source/texk/xdvik/gui/xm_prefsP.h @@ -96,9 +96,14 @@ #define Xdvi_APPLY_STR "Apply" #define Xdvi_PREFS_BROWSER_DEFAULTS \ - "mozilla -remote 'openURL(%s,new-window)'\n" \ - "netscape -raise -remote 'openURL(%s,new-window)'\n" \ + "xdg-open %s\n" \ + "htmlview %s\n" \ + "firefox -remote \"openURL(%s,new-window)\"\n" \ + "mozilla -remote \"openURL(%s,new-window)\"\n" \ + "netscape -raise -remote \"openURL(%s,new-window)\"\n" \ + "xterm -e w3m %s\n" \ "xterm -e lynx %s\n" \ + "xterm -e wget %s\n" \ Xdvi_ADD_COMMAND_STR #define Xdvi_PREFS_EDITOR_DEFAULTS \ "gnuclient -q +%l %f\n" \ diff --git a/Build/source/texk/xdvik/gui/xm_prefs_appearance.c b/Build/source/texk/xdvik/gui/xm_prefs_appearance.c index b7f966059d5..e65f84cbf2f 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_appearance.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_appearance.c @@ -215,31 +215,31 @@ void update_preferences_expert(void) void update_preferences_tooltips(void) { - Widget shell; - Widget statusline_b, popup_b, label1, text, label2; + Widget shell; + Widget statusline_b, popup_b, label1, text, label2; - if (resource.toolbar_unusable) - return; + if (resource.toolbar_unusable) + return; - if (get_widget_by_name(&shell, globals.widgets.top_level, Xdvi_PREFS_DIALOG_NAME, True) - && get_widget_by_name(&statusline_b, shell, Xdvi_TIPS_STATUSLINE, True) - && get_widget_by_name(&popup_b, shell, Xdvi_TIPS_POPUPS, True) - && get_widget_by_name(&label1, shell, Xdvi_TIPS_DELAY_LABEL1, True) - && get_widget_by_name(&text, shell, Xdvi_TIPS_DELAY_TEXT, True) - && get_widget_by_name(&label2, shell, Xdvi_TIPS_DELAY_LABEL2, True)) { + if (get_widget_by_name(&shell, globals.widgets.top_level, Xdvi_PREFS_DIALOG_NAME, True) + && get_widget_by_name(&statusline_b, shell, Xdvi_TIPS_STATUSLINE, True) + && get_widget_by_name(&popup_b, shell, Xdvi_TIPS_POPUPS, True) + && get_widget_by_name(&label1, shell, Xdvi_TIPS_DELAY_LABEL1, True) + && get_widget_by_name(&text, shell, Xdvi_TIPS_DELAY_TEXT, True) + && get_widget_by_name(&label2, shell, Xdvi_TIPS_DELAY_LABEL2, True)) { - char buf[LENGTH_OF_INT]; + char buf[LENGTH_OF_INT]; - SNPRINTF(buf, LENGTH_OF_INT, "%d", ABS(resource.tooltips_wait_period)); - XtVaSetValues(text, XmNvalue, buf, NULL); + SNPRINTF(buf, LENGTH_OF_INT, "%d", ABS(resource.tooltips_wait_period)); + XtVaSetValues(text, XmNvalue, buf, NULL); - XmToggleButtonGadgetSetState(statusline_b, resource.tooltips_in_statusline, False); - XmToggleButtonGadgetSetState(popup_b, resource.show_tooltips, False); + XmToggleButtonGadgetSetState(statusline_b, resource.tooltips_in_statusline, False); + XmToggleButtonGadgetSetState(popup_b, resource.show_tooltips, False); - XtSetSensitive(label1, resource.show_tooltips); - XtSetSensitive(text, resource.show_tooltips); - XtSetSensitive(label2, resource.show_tooltips); - } + XtSetSensitive(label1, resource.show_tooltips); + XtSetSensitive(text, resource.show_tooltips); + XtSetSensitive(label2, resource.show_tooltips); + } } void update_preferences_search(void) diff --git a/Build/source/texk/xdvik/gui/xm_prefs_fonts.c b/Build/source/texk/xdvik/gui/xm_prefs_fonts.c index bf25734bc50..a79658b3d5f 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_fonts.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_fonts.c @@ -58,12 +58,8 @@ #include #include -#if XmVersion >= 2000 && !defined(LESSTIF_VERSION) -/* spinbox only available with Motif 2.0; the lesstif version (as of 0.93) looks like shit */ +#if USE_SPINBOX #include -#define USE_SPINBOX 1 -#else -#define USE_SPINBOX 0 #endif /* @@ -106,7 +102,7 @@ colorspecial_toggle_cb(Widget w, XtPointer client_data, XtPointer call_data) struct prefs_choice *prefs; UNUSED(w); -/* UNUSED(client_data); */ + /* UNUSED(client_data); */ UNUSED(call_data); ASSERT(tinfo != NULL, "struct topic_info * in colorspecial_toggle_cb mustn't be NULL!"); @@ -416,7 +412,7 @@ h_create_fonts_frame(Widget top, struct topic_info *info) #endif } -/* XtManageChild(darkness_form); */ + /* XtManageChild(darkness_form); */ return darkness_form; } @@ -566,7 +562,7 @@ h_create_colors_form(Widget top, struct topic_info *info) NULL); XtManageChild(underline_toggle); -/* if (res->link_style & 1) */ + /* if (res->link_style & 1) */ if (resource.link_style & 1) XmToggleButtonGadgetSetState(underline_toggle, True, False); else diff --git a/Build/source/texk/xdvik/gui/xm_prefs_helpers.c b/Build/source/texk/xdvik/gui/xm_prefs_helpers.c index 493e061827f..03975ee478f 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_helpers.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_helpers.c @@ -33,6 +33,7 @@ #include "topic-window.h" #include "util.h" #include "string-utils.h" +#include "string_list.h" #include "message-window.h" #include "events.h" #include "xm_menu.h" @@ -73,74 +74,16 @@ struct choice_dialog_info { static char **m_browser_list = NULL; static char **m_editor_list = NULL; -/* "mozilla -remote 'openURL(%s,new-window)'", */ -/* "netscape -raise -remote 'openURL(%s,new-window)'", */ -/* "xterm -e lynx %s", */ -/* Xdvi_ADD_COMMAND_STR, */ -/* NULL /\* terminate *\/ */ -/* }; */ - -/* static const char *editor_list[] = { */ -/* "gnuclient -q +%l %f", */ -/* "emacsclient --no-wait +%l %f", */ -/* "gvim --servername xdvi --remote +%l %f", */ -/* "nc -noask +%l %f", */ -/* "xterm -e vi +%l %f", */ -/* Xdvi_ADD_COMMAND_STR, */ -/* NULL /\* terminate *\/ */ -/* }; */ - -/* combo box only available with Motif 2.0; - * the lesstif version is incomplete - */ -#if XmVersion >= 2000 && !defined(LESSTIF_VERSION) +#if USE_COMBOBOX #include #include -#define USE_COMBOBOX 1 #else #include -#define USE_COMBOBOX 0 #endif static void select_browser_cb(Widget w, XtPointer client_data, XtPointer call_data); static void select_editor_cb(Widget w, XtPointer client_data, XtPointer call_data); -/* - * Helper functions - */ -static char * -flatten_list(char **list, const char *sep) -{ - char *result = xstrdup(""); - int i; - - for (i = 0; list[i] != NULL; i++) { - result = xstrcat(result, list[i]); - result = xstrcat(result, sep); - } - return result; -} - -static char ** -add_to_list(char **list, const char *str) -{ - int i, k; - /* reallocate with larger capacity */ - for (i = 0; list[i] != NULL; i++) { ; } - i++; - list = xrealloc(list, (i + 1) * sizeof *list); - - /* shift old contents down */ - for (k = i; k > 0; k--) { - list[k] = list[k - 1]; - } - /* add new element at beginning */ - list[0] = xstrdup(str); - - return list; -} - - /* * User clicked on `Help' in browser text input prompt */ @@ -190,7 +133,7 @@ help_editor_dialog_cb(Widget w, XtPointer client_data, XtPointer call_data) static void destroy_dialog_cb(Widget w, XtPointer client_data, XtPointer call_data) { -/* Widget browser_combo = (Widget)client_data; */ + /* Widget browser_combo = (Widget)client_data; */ struct choice_dialog_info *info = (struct choice_dialog_info *)client_data; Widget browser_combo = NULL; Widget help_popup; @@ -251,7 +194,7 @@ destroy_dialog_cb(Widget w, XtPointer client_data, XtPointer call_data) * Since `help_popup' is the top-level xmDialogShellWidget, we need to get its * xmMessageBoxWidget child (by name ...). Don't report an error if it doesn't * exist in case the help window has already been closed. - */ + */ if (help_popup != NULL) { static Widget message; if (get_widget_by_name(&message, help_popup, Xdvi_MESSAGE_DIALOG_NAME, False)) @@ -272,7 +215,7 @@ static void h_get_input_wrapper(const char *listbox_name, Widget w, XtPointer client_data, XtPointer call_data) { -/* Widget combobox = (Widget)client_data; */ + /* Widget combobox = (Widget)client_data; */ struct choice_dialog_info *info = (struct choice_dialog_info *)client_data; struct topic_info *tinfo = info->tinfo; struct prefs_choice *prefs = (struct prefs_choice *)tinfo->data; @@ -321,13 +264,13 @@ h_get_input_wrapper(const char *listbox_name, fprintf(stderr, "list %d: |%s|\n", i, m_browser_list[i]); } #endif - m_browser_list = add_to_list(m_browser_list, ptr); + m_browser_list = string_list_prepend(m_browser_list, ptr); #if 0 for (i = 0; m_browser_list[i] != NULL; i++) { fprintf(stderr, "NEW list %d: |%s|\n", i, m_browser_list[i]); } #endif - tmp_list = flatten_list(m_browser_list, "\n"); + tmp_list = string_list_to_str(m_browser_list, "\n"); #if 0 fprintf(stderr, "TMP LIST: |%s|\n", tmp_list); #endif /* 0 */ @@ -344,8 +287,8 @@ h_get_input_wrapper(const char *listbox_name, editor_choice = xstrdup(ptr); resource.editor = editor_choice; - m_editor_list = add_to_list(m_editor_list, ptr); - tmp_list = flatten_list(m_editor_list, "\n"); + m_editor_list = string_list_prepend(m_editor_list, ptr); + tmp_list = string_list_to_str(m_editor_list, "\n"); store_preference(&(prefs->db), "prefsEditorList", "%s", tmp_list); free(tmp_list); @@ -362,6 +305,11 @@ h_get_input_wrapper(const char *listbox_name, /* add user input to the combo box list, and make it current */ XmComboBoxAddItem(combobox, cbs->value, 1, True); XmComboBoxSelectItem(combobox, cbs->value); + { /* if more than 9 items, add scrollbar */ + size_t n; + XtVaGetValues(combobox, XmNitemCount, &n, NULL); + XtVaSetValues(combobox, XmNvisibleItemCount, n > 10 ? 10 : n, NULL); + } #else { Widget new_menu, parent, grandparent, rowcol; @@ -461,7 +409,7 @@ h_selector(const char *prompt_name, XtParent(w), #endif (char *)prompt_name, args, n); -/* XmStringFree(label); */ + /* XmStringFree(label); */ add_to_deplist(prefs, prompt_widget); @@ -551,7 +499,7 @@ static void select_browser_cb(Widget w, XtPointer client_data, XtPointer call_data) { h_selector(Xdvi_BROWSER_POPUP_NAME, - "Xdvi: Add Browser Command", + "xdvik: Add Browser Command", "Browser Command (optional `%s' is replaced by URL): ", get_browser_text_cb, destroy_dialog_cb, help_browser_dialog_cb, w, client_data, call_data); @@ -565,7 +513,7 @@ select_editor_cb(Widget w, XtPointer client_data, XtPointer call_data) { UNUSED(client_data); h_selector(Xdvi_EDITOR_POPUP_NAME, - "Xdvi: Add Editor Command", + "xdvik: Add Editor Command", "Editor Command (optional: `%l' = line number, `%f' = file name): ", get_editor_text_cb, destroy_dialog_cb, help_editor_dialog_cb, w, client_data, call_data); @@ -667,7 +615,7 @@ update_preferences_helpers(void) XtVaGetValues(buttons[i], XmNlabelString, &str, NULL); XmStringGetLtoR(str, G_charset, &ptr); -/* fprintf(stderr, "kid %d: %s\n", i, ptr); */ + /* fprintf(stderr, "kid %d: %s\n", i, ptr); */ if (globals.curr_browser != NULL) { /* if this is set, ignore browser setting */ if (strcmp(globals.curr_browser, ptr) == 0) { break; @@ -693,7 +641,7 @@ update_preferences_helpers(void) XtVaGetValues(buttons[i], XmNlabelString, &str, NULL); XmStringGetLtoR(str, G_charset, &ptr); -/* fprintf(stderr, "kid %d: %s\n", i, ptr); */ + /* fprintf(stderr, "kid %d: %s\n", i, ptr); */ if (globals.curr_editor != NULL) { /* if this is set, ignore editor setting */ if (strcmp(globals.curr_editor, ptr) == 0) { break; @@ -713,16 +661,16 @@ update_preferences_helpers(void) #endif /* for browser/editor, try: - Widget menu; - int num_buttons; - WidgetList buttons; + Widget menu; + int num_buttons; + WidgetList buttons; - XtVaGetValues( simple_option_widget, XmNsubMenuId, &menu, NULL); + XtVaGetValues( simple_option_widget, XmNsubMenuId, &menu, NULL); - XtVaGetValues( menu, XmNnumChildren, &num_buttons, - XmNchildren, &buttons, NULL ) ; + XtVaGetValues( menu, XmNnumChildren, &num_buttons, + XmNchildren, &buttons, NULL ) ; - */ + */ } } @@ -767,7 +715,7 @@ h_create_command(const char *name, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, top, XmNleftAttachment, XmATTACH_FORM, -/* XmNrightAttachment, XmATTACH_FORM, */ + /* XmNrightAttachment, XmATTACH_FORM, */ NULL); /* count elements in command_list */ @@ -794,14 +742,16 @@ h_create_command(const char *name, combo_box = XtVaCreateWidget(name, xmComboBoxWidgetClass, parent, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, top, /* if top == NULL, this used XmATTACH_FORM */ + XmNtopWidget, top, /* if top == NULL, this uses XmATTACH_FORM */ XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, text_label, XmNrightAttachment, XmATTACH_FORM, XmNcomboBoxType, XmDROP_DOWN_LIST, XmNitems, str_list, XmNitemCount, num, + XmNvisibleItemCount, num > 10 ? 10 : num, XmNuserData, curr_index, + XmNarrowSize, Xdvi_COMBO_BOX_ARROW_SIZE, NULL); if (top != NULL) /* FIXME: This assumes we only have 2 items ... */ XtVaSetValues(combo_box, @@ -836,12 +786,12 @@ h_create_command(const char *name, return combo_box; #else menu = XmCreatePulldownMenu(parent, (char *)menu_name, NULL, 0); -/* XtVaSetValues(menu, */ -/* XmNtopAttachment, XmATTACH_WIDGET, */ -/* XmNtopWidget, top, */ -/* XmNleftAttachment, XmATTACH_FORM, */ -/* XmNrightAttachment, XmATTACH_FORM, */ -/* NULL); */ + /* XtVaSetValues(menu, */ + /* XmNtopAttachment, XmATTACH_WIDGET, */ + /* XmNtopWidget, top, */ + /* XmNleftAttachment, XmATTACH_FORM, */ + /* XmNrightAttachment, XmATTACH_FORM, */ + /* NULL); */ str = XmStringCreateLocalized((char *)label); n = 0; @@ -871,8 +821,8 @@ h_create_command(const char *name, for (i = 0; command_list[i] != NULL; i++) { item = XtVaCreateManagedWidget(command_list[i], xmPushButtonGadgetClass, menu, - XmNuserData, tinfo, - NULL); + XmNuserData, tinfo, + NULL); XtAddCallback(item, XmNactivateCallback, select_cb, menu); } XtManageChild(cascade); @@ -883,13 +833,13 @@ h_create_command(const char *name, Widget prefs_helpers(struct topic_info *tinfo) { -/* struct prefs_choice *prefs = (struct prefs_choice *)info->data; */ + /* struct prefs_choice *prefs = (struct prefs_choice *)info->data; */ Widget form, /* frame, */ form1; Widget browser_command, editor_command; form = XmCreateForm(tinfo->right_form, "helpers_form", NULL, 0); -/* frame = XmCreateFrame(form, "commands_frame", NULL, 0); */ + /* frame = XmCreateFrame(form, "commands_frame", NULL, 0); */ form1 = XtVaCreateWidget("commands_form", xmFormWidgetClass, form, @@ -919,22 +869,22 @@ prefs_helpers(struct topic_info *tinfo) m_editor_list, select_editor_cb, tinfo); -/* #if PS_GS */ -/* Widget b2 = XmCreateLabelGadget(rowcol, "[x] Use Ghostscript to interpret PS specials", NULL, 0); */ + /* #if PS_GS */ + /* Widget b2 = XmCreateLabelGadget(rowcol, "[x] Use Ghostscript to interpret PS specials", NULL, 0); */ /* TODO: don't need this??? Similar: ps2pdf, dvips conversion?? */ /* Widget b3 = XmCreateLabelGadget(rowcol, "Path to Ghostscript: ____________", NULL, 0); */ -/* #endif */ -/* Widget b4 = XmCreateLabelGadget(rowcol, "Editor for source specials: [Other ...]", NULL, 0); */ -/* XtManageChild(b1); */ -/* XtManageChild(b2); */ -/* XtManageChild(b3); */ -/* XtManageChild(b4); */ -/* XtManageChild(rowcol); */ + /* #endif */ + /* Widget b4 = XmCreateLabelGadget(rowcol, "Editor for source specials: [Other ...]", NULL, 0); */ + /* XtManageChild(b1); */ + /* XtManageChild(b2); */ + /* XtManageChild(b3); */ + /* XtManageChild(b4); */ + /* XtManageChild(rowcol); */ XtManageChild(form1); -/* XtManageChild(frame); */ + /* XtManageChild(frame); */ return form; } diff --git a/Build/source/texk/xdvik/gui/xm_prefs_page.c b/Build/source/texk/xdvik/gui/xm_prefs_page.c index b40f1f63132..cbff7b3c065 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_page.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_page.c @@ -60,12 +60,8 @@ #include #include -#if XmVersion >= 2000 && !defined(LESSTIF_VERSION) -/* spinbox only available with Motif 2.0; the lesstif version (as of 0.93) looks like shit */ +#if USE_SPINBOX #include -#define USE_SPINBOX 1 -#else -#define USE_SPINBOX 0 #endif /* @@ -180,9 +176,9 @@ landscape_cb(Widget w, XtPointer client_data, XtPointer call_data) landscape = is_set; } -/* fprintf(stderr, "++++++++ CALLBACK: setting portrait to %s, landscape to %s\n", */ -/* landscape ? "False" : "True", */ -/* landscape ? "True" : "False"); */ + /* fprintf(stderr, "++++++++ CALLBACK: setting portrait to %s, landscape to %s\n", */ + /* landscape ? "False" : "True", */ + /* landscape ? "True" : "False"); */ XmToggleButtonGadgetSetState(portrait_b, !landscape, False); XmToggleButtonGadgetSetState(landscape_b, landscape, False); @@ -274,22 +270,22 @@ update_preferences_paper(void) #endif /* 0 */ /* - Apparently there's a bug in Motif (OpenMotif 2.1) in that the button - is not properly updated in all cases. - - To reproduce: - - Open Preferences dialog, change `landscape' option, click - `OK'. Now open the dialog again, change the option again, - but click `Cancel'. This correctly reverts the visible - state of the buttons, but when opening the dialog again, - the button's internal state is not consistent with the - visual appearance: when clicking on the unset button, its - ValueChanged callback is not invoked, so nothing happens; - but after clicking on another(!) button in the preferences - dialog, it works again. - - As a workaround, we destroy the buttons and re-create them from scratch - yuck! + Apparently there's a bug in Motif (OpenMotif 2.1) in that the button + is not properly updated in all cases. + + To reproduce: + + Open Preferences dialog, change `landscape' option, click + `OK'. Now open the dialog again, change the option again, + but click `Cancel'. This correctly reverts the visible + state of the buttons, but when opening the dialog again, + the button's internal state is not consistent with the + visual appearance: when clicking on the unset button, its + ValueChanged callback is not invoked, so nothing happens; + but after clicking on another(!) button in the preferences + dialog, it works again. + + As a workaround, we destroy the buttons and re-create them from scratch - yuck! */ { Widget form = XtParent(portrait_button); @@ -353,7 +349,7 @@ static void shrinkfactor_spinbox_cb(Widget w, XtPointer client_data, XtPointer call_data) { int val; -/* static Boolean first_time = True; */ + /* static Boolean first_time = True; */ struct topic_info *info = (struct topic_info *)client_data; struct prefs_choice *prefs = (struct prefs_choice *)(info->data); UNUSED(call_data); @@ -363,9 +359,9 @@ shrinkfactor_spinbox_cb(Widget w, XtPointer client_data, XtPointer call_data) /* return if value not changed yet; else the first invocation of the window may actually reset the shrink factor to the default. */ -/* if (val != resource.shrinkfactor) { */ -/* first_time = False; */ -/* } */ + /* if (val != resource.shrinkfactor) { */ + /* first_time = False; */ + /* } */ if (XtIsRealized(w)) { /* don't set the resource.shrinkfactor here so that we can revert it from there if needed */ @@ -395,7 +391,7 @@ set_shrinkfactor_cb(Widget w, XtPointer client_data, XtPointer call_data) ASSERT(text_field != 0, "Expected text field in XmNuserData, set_shrinkfactor_cb()"); XtVaGetValues(text_field, XmNvalue, &text, NULL); val = strtol(text, (char **)NULL, 10); -/* fprintf(stderr, "spinbox value: |%s|\n", text); */ + /* fprintf(stderr, "spinbox value: |%s|\n", text); */ #endif if (!XtIsRealized(w)) @@ -404,9 +400,9 @@ set_shrinkfactor_cb(Widget w, XtPointer client_data, XtPointer call_data) /* verify values in case of direct text input */ if (val > 100 || val <= 0) { if (val > 100) - statusline_print(STATUS_MEDIUM, "Shrink factor larger than maximum 100"); + statusline_info(STATUS_MEDIUM, "Shrink factor larger than maximum 100"); else if (val <= 0) - statusline_print(STATUS_MEDIUM, "Shrink factor smaller than minimum 1"); + statusline_info(STATUS_MEDIUM, "Shrink factor smaller than minimum 1"); return; } #if USE_SPINBOX @@ -431,8 +427,8 @@ h_create_shrink_frame(Widget top, struct topic_info *info) shrink_form = XmCreateForm(top, "shrink_form", NULL, 0); XtVaSetValues(shrink_form, -/* XmNverticalSpacing, 10, */ -/* XmNhorizontalSpacing, 10, */ + /* XmNverticalSpacing, 10, */ + /* XmNhorizontalSpacing, 10, */ NULL); @@ -506,7 +502,7 @@ h_create_shrink_frame(Widget top, struct topic_info *info) #endif } -/* XtManageChild(shrink_form); */ + /* XtManageChild(shrink_form); */ return shrink_form; } @@ -581,11 +577,11 @@ h_create_papersize_form(Widget parent, struct topic_info *info) XmNleftOffset, 10, XmNuserData, (XtPointer)info, NULL); -/* adjust_heights(landscape_option, menu, cascade, NULL); */ + /* adjust_heights(landscape_option, menu, cascade, NULL); */ XtAddCallback(portrait_option, XmNvalueChangedCallback, landscape_cb, (XtPointer)info); XtAddCallback(landscape_option, XmNvalueChangedCallback, landscape_cb, (XtPointer)info); -/* XtAddCallback(portrait_option, XmNarmCallback, test_cb, (XtPointer)info); */ -/* XtAddCallback(landscape_option, XmNarmCallback, test_cb, (XtPointer)info); */ + /* XtAddCallback(portrait_option, XmNarmCallback, test_cb, (XtPointer)info); */ + /* XtAddCallback(landscape_option, XmNarmCallback, test_cb, (XtPointer)info); */ XtManageChild(portrait_option); XtManageChild(landscape_option); @@ -594,7 +590,7 @@ h_create_papersize_form(Widget parent, struct topic_info *info) Widget w = XtVaCreateManagedWidget(papersizes[i].format, xmPushButtonGadgetClass, menu, XmNuserData, landscape_option, NULL); -/* fprintf(stderr, "Created button: %p for %s\n", w, papersizes[i].format); */ + /* fprintf(stderr, "Created button: %p for %s\n", w, papersizes[i].format); */ /* select default value */ if (strncmp(resource.paper, diff --git a/Build/source/texk/xdvik/gui/xm_prefs_scroll.c b/Build/source/texk/xdvik/gui/xm_prefs_scroll.c index fda08dd33dd..0e33793f93e 100644 --- a/Build/source/texk/xdvik/gui/xm_prefs_scroll.c +++ b/Build/source/texk/xdvik/gui/xm_prefs_scroll.c @@ -345,7 +345,7 @@ h_create_scrolling(Widget parent, struct topic_info *info) XmNleftWidget, x_off_label, XmNbottomAttachment, XmATTACH_FORM, XmNvalue, x_buf, -/* XmNvalue, buf, */ + /* XmNvalue, buf, */ NULL); y_off_label = XmCreateLabelGadget(form1, Xdvi_HOME_POSITION_Y_STR, NULL, 0); XtVaSetValues(y_off_label, diff --git a/Build/source/texk/xdvik/gui/xm_toolbar.c b/Build/source/texk/xdvik/gui/xm_toolbar.c index c1bc76286a1..514a84a5126 100644 --- a/Build/source/texk/xdvik/gui/xm_toolbar.c +++ b/Build/source/texk/xdvik/gui/xm_toolbar.c @@ -117,11 +117,11 @@ void toggle_toolbar(void) { #if !HAVE_XPM - statusline_print(STATUS_LONG, + statusline_error(STATUS_LONG, "Compiled without XPM support; no toolbar available."); #else if (resource.toolbar_unusable) { - statusline_print(STATUS_LONG, + statusline_error(STATUS_LONG, "Toolbar pixmap file not found; toolbar is disabled."); return; } @@ -626,7 +626,7 @@ enter_leave(Widget w, XtPointer closure, XEvent *event, Boolean *cont) } entered = True; if (resource.tooltips_in_statusline) { - statusline_print(STATUS_SHORT, tooltip); + statusline_info(STATUS_SHORT, tooltip); } } else if (ev->type == LeaveNotify && !resource.toolbar_buttons_raised) { @@ -748,6 +748,7 @@ create_toolbar(Widget parent, Widget menu_bar) } else if (item_count == 4) { Pixmap sens, insens; + sens = insens = 0; /* make compiler happy ... */ int idx = strtoul(line_items[0], (char **)NULL, 10); struct xdvi_action *action; diff --git a/Build/source/texk/xdvik/hypertex.c b/Build/source/texk/xdvik/hypertex.c index 7db7f69527f..d164917df0c 100644 --- a/Build/source/texk/xdvik/hypertex.c +++ b/Build/source/texk/xdvik/hypertex.c @@ -1,3 +1,4 @@ + /* * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -16,7 +17,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ /* * Original copyright: @@ -52,16 +53,16 @@ /* TODO: - - implement popup with list of visited links, as specified in - http://xdvi.sourceforge.net/gui.html#navigation-openLinks - (maybe this should be a simple menu list, not a popup window). - */ +- implement popup with list of visited links, as specified in +http://xdvi.sourceforge.net/gui.html#navigation-openLinks +(maybe this should be a simple menu list, not a popup window). +*/ #define COPY_TMP_FILE 0 /* see comments below */ -/* #define DEBUG */ + /* #define DEBUG */ -/* #define DEBUG_MEMORY_HANDLING */ + /* #define DEBUG_MEMORY_HANDLING */ #include "alloc-debug.h" #include "xdvi-config.h" @@ -78,6 +79,7 @@ #include "dvi-init.h" #include "message-window.h" #include "util.h" +#include "dl_list.h" #include "x_util.h" #include "mime.h" #include "mag.h" @@ -91,9 +93,9 @@ #include "my-snprintf.h" #include "pagehist.h" -/* globals */ -/* rgb specifications to translate resource.{visited_}link_color into */ -char *g_link_color_rgb = NULL; + /* globals */ + /* rgb specifications to translate resource.{visited_}link_color into */ + char *g_link_color_rgb = NULL; char *g_visited_link_color_rgb = NULL; char *g_anchor_pos = NULL; size_t g_anchor_len = 0; @@ -343,8 +345,8 @@ htex_prescan_special(const char *cp, int cp_len, struct htex_prescan_data *data) m_prescan_info.pagelist[data->pageno] = anchor; } else if ((ptr = strstr(cp1 + 2, "/URI")) != NULL /* external file */ - && (ptr = strchr(ptr, '(')) != NULL - && (pptr = strchr(ptr + 1, '(')) != NULL) { + && (ptr = strchr(ptr, '(')) != NULL + && (pptr = strchr(ptr + 1, '(')) != NULL) { anchor = xmalloc(pptr - ptr); memcpy(anchor, ptr + 1, pptr - ptr - 1); anchor[pptr - ptr - 1] = '\0'; @@ -439,7 +441,12 @@ htex_prescan_carry_over(int old_page, int new_page) } free(m_prescan_info.pagelist[new_page]); /* don't share pointers here */ - m_prescan_info.pagelist[new_page] = xstrdup(m_prescan_info.pagelist[old_page]); + if (m_prescan_info.pagelist[old_page] != NULL) { + m_prescan_info.pagelist[new_page] = xstrdup(m_prescan_info.pagelist[old_page]); + } + else { + m_prescan_info.pagelist[new_page] = NULL; + } } size_t @@ -477,8 +484,8 @@ struct anchor_info { /* bounding box info for this anchor */ int lrx, lry; /* lower-right corner */ int ulx, uly; /* upper-left corner */ -/* int refpage; /\* page in DVI file for stack of visited anchors *\/ */ -/* char *filename; /\* name of file in which this anchor is located, for visited anchors *\/ */ + /* int refpage; /\* page in DVI file for stack of visited anchors *\/ */ + /* char *filename; /\* name of file in which this anchor is located, for visited anchors *\/ */ int prev_wrapped; /* index of prev elem, for wrapped hrefs, or -1 */ int next_wrapped; /* index of next elem, for wrapped hrefs, or -1 */ }; @@ -500,7 +507,7 @@ static struct htex_page_info htex_page_info = { NULL, 0, 0, -1, -1 }; /* double linked list with history of clicked links, for htex_forward/htex_back - */ +*/ static struct dl_list *htex_history = NULL; /* current list insertion point */ struct htex_anchor_stack_elem { @@ -597,10 +604,10 @@ resize_info_if_needed(struct htex_page_info *info) } info->anchors = XREALLOC(info->anchors, info->tot_cnt * sizeof *(info->anchors)); for (i = info->curr_cnt; i < info->tot_cnt; i++) { -/* fprintf(stderr, "initializing info at index %d\n", i); */ + /* fprintf(stderr, "initializing info at index %d\n", i); */ info->anchors[i].a_href = NULL; info->anchors[i].a_name = NULL; -/* info->anchors[i].filename = NULL; */ + /* info->anchors[i].filename = NULL; */ info->anchors[i].ulx = INT_MAX; info->anchors[i].uly = INT_MAX; info->anchors[i].lrx = 0; @@ -825,7 +832,7 @@ is_local_file(const char *filename) absolute path starts with `//' (as required by RFC2396, but in the past most browsers/applications didn't support this). - */ + */ if (memicmp(filename, "//localhost", strlen("//localhost")) == 0) { filename += strlen("//localhost"); } @@ -986,7 +993,7 @@ enlarge_anchor_size(struct htex_page_info *info, int index, ASSERT(info->anchors != NULL, "info->anchors should have been allocated before"); ASSERT(index < info->curr_cnt, "info too small"); -/* fprintf(stderr, "enlarging anchor at index %d; %s\n", index, info->anchors[index].a_href); */ + /* fprintf(stderr, "enlarging anchor at index %d; %s\n", index, info->anchors[index].a_href); */ anchor = &(info->anchors[index]); if (ulx < anchor->ulx) { @@ -1000,7 +1007,7 @@ enlarge_anchor_size(struct htex_page_info *info, int index, } /* set lry only for first character, since this will be used to position underline */ -/* if (lry > anchor->lry && anchor->lry == 0) { */ + /* if (lry > anchor->lry && anchor->lry == 0) { */ if (lry > anchor->lry) { anchor->lry = lry; } @@ -1071,7 +1078,7 @@ htex_initpage(Boolean new_dvi_file, Boolean size_changed, int pageno) pageno, NULL); htex_page_info.curr_cnt++; MYTRACE((stderr, "++++++++++ mismatched anchor text (at %d): |%s|", - htex_page_info.curr_cnt - 1, m_prescan_info.pagelist[pageno - 1])); + htex_page_info.curr_cnt - 1, m_prescan_info.pagelist[pageno - 1])); /* x_pos_bak = y_pos_bak = INT_MAX; */ x_pos_bak = y_pos_bak = INT_MAX; set_anchor_size(&htex_page_info, htex_page_info.curr_cnt - 1, 0, 0, 1, 1); @@ -1079,18 +1086,88 @@ htex_initpage(Boolean new_dvi_file, Boolean size_changed, int pageno) if (bg_current != NULL) { /* only if it has been initialized by redraw_page in events.c */ push_colorspecial(); } -/* else { */ -/* fprintf(stderr, "----------------------- NOT pushing color, waiting ...\n"); */ -/* } */ + /* else { */ + /* fprintf(stderr, "----------------------- NOT pushing color, waiting ...\n"); */ + /* } */ push_stack(&stack, A_HREF, htex_page_info.curr_cnt - 1); } } +/* Returns a PostScript literal text string inside parentheses. The + scanner works according to "PostScript language reference, third + edition" - Sec. 3.2.2. The specification is implemented completely: + balanced parentheses and all escape sequences are considered. + + The argument STR is expected to be a pointer to the first character + after the opening parenthesis. The function returns NULL if the + text string is malformed. Otherwise the return value points to + an allocated string which should be freed by the calling function. +*/ +static char * +scan_ps_literal_text_string(const char *str) +{ + const char *s; + char *cp, *c; + int count = 1; + + /* Search end of string by considering balanced parentheses. */ + for (s = str; *s; s++) + if (*s == '\\' && *(s+1)) + s++; + else if (*s == '(') + count++; + else if (*s == ')') + if (! --count) + break; + + if (!*s) + return NULL; + + + if ((cp = malloc((s - str + 1) * sizeof(*cp))) == NULL) { + XDVI_ERROR((stderr, "Not enough memory")); + return NULL; + } + + /* copy string while translating escape sequences */ + for (c = cp; str < s; str++) { + if (*str == '\\') { + switch (*++str) { + case 'n': *c++ = '\n'; break; + case 'r': *c++ = '\r'; break; + case 't': *c++ = '\t'; break; + case 'b': *c++ = '\b'; break; + case 'f': *c++ = '\f'; break; + case '\n': break; + case '\r': if (*(str + 1) == '\n') str++; break; + default: + if (isdigit(*str)) { + char number[] = "xxx"; + char *end; + strncpy(number, str, 3); + *c++ = strtoul(number, &end, 8); + str += end - number - 1; + } + else { + *c++ = *str; /* ignore \ if followed by another char, + including ( and ) and \ */ + } + } + } + else { + *c++ = *str; + } + } + *c = '\0'; + + return cp; +} + static void hdvips_add_anchor(struct htex_page_info *info, htexAnchorT type, const char *str) { char *ptr; - if ((ptr = strchr(str, ')')) != NULL) { + if ((ptr = scan_ps_literal_text_string(str)) != NULL) { int curr_cnt_bak = info->curr_cnt; /* overwrite previously created dummy/wrapped anchors */ ASSERT(info->curr_cnt > 0, "hdvips_add_anchor must be called after add_anchor()!"); @@ -1103,9 +1180,10 @@ hdvips_add_anchor(struct htex_page_info *info, htexAnchorT type, const char *str free(info->anchors[info->curr_cnt].a_href); free(info->anchors[info->curr_cnt].a_name); info->anchors[info->curr_cnt].a_href = info->anchors[info->curr_cnt].a_name = NULL; - add_anchor(info, type, str, ptr - str, 0, NULL); + add_anchor(info, type, ptr, strlen(ptr), 0, NULL); } info->curr_cnt = curr_cnt_bak; + free(ptr); } else { MYTRACE((stderr, "Xdvi warning: skipping malformed hdvips link `%s'", str)); @@ -1161,7 +1239,7 @@ htex_scan_anchor(const char *cp, size_t len) push_colorspecial(); x_pos_bak = PXL_H; y_pos_bak = PXL_V; -/* set_anchor_size(&htex_page_info, htex_page_info.curr_cnt - 1, PXL_H, PXL_V, PXL_H + 10, PXL_V + 10); */ + /* set_anchor_size(&htex_page_info, htex_page_info.curr_cnt - 1, PXL_H, PXL_V, PXL_H + 10, PXL_V + 10); */ } else { XDVI_WARNING((stderr, "Skipping unimplemented htex special `%s'", cp)); @@ -1197,7 +1275,7 @@ htex_scan_anchor(const char *cp, size_t len) } /* add anchor texts for hdvips links */ else if (memcmp(cp, "/A", 2) == 0) { /* possibly an hdvips external link */ -/* fprintf(stderr, "+++++ EXT: |%s|\n", cp); */ + /* fprintf(stderr, "+++++ EXT: |%s|\n", cp); */ if ((ptr = strstr(cp + 2, "/GoToR")) != NULL /* external file */ && (ptr = strchr(ptr, '(')) != NULL) { hdvips_add_anchor(&htex_page_info, A_HREF_FILE, ptr + 1); @@ -1222,8 +1300,11 @@ htex_scan_anchor(const char *cp, size_t len) } return False; } - else { /* not a start tag */ - MYTRACE((stderr, "Xdvi warning: skipping malformed hyperref special `%s'", cp)); + else { /* unrecognized tag */ + if (globals.warn_spec_now) { + XDVI_WARNING((stderr, "Ignoring unknown hyperref special `%s'", cp)); + } + return False; } return get_href_depth(&stack); } @@ -1250,11 +1331,11 @@ htex_record_position(int ulx, int uly, int w, int h) int idx, prev, curr; /* get anchor index of topmost stack item, to find the matching open tag */ if ((type = peek_stack(&stack, &idx)) == A_NONE) { -/* fprintf(stderr, "!!!!!!!!!!!! couldn't find opening tag for this wrapped link!"); */ + /* fprintf(stderr, "!!!!!!!!!!!! couldn't find opening tag for this wrapped link!"); */ return; } ASSERT(idx >= 0, "Index out of range"); -/* fprintf(stderr, "wrapped link: index %d, type %d\n", idx, type); */ + /* fprintf(stderr, "wrapped link: index %d, type %d\n", idx, type); */ /* get correct idx */ if (m_href_type == HYPERTEX_LINK) { while (htex_page_info.anchors[idx].a_href == NULL && idx > 0) { @@ -1286,7 +1367,7 @@ htex_record_position(int ulx, int uly, int w, int h) curr = htex_page_info.curr_cnt - 1; ASSERT(prev >= 0, "Index out of range"); -/* fprintf(stderr, "setting prev to %d, curr to %d\n", prev, curr); */ + /* fprintf(stderr, "setting prev to %d, curr to %d\n", prev, curr); */ htex_page_info.anchors[prev].next_wrapped = curr; htex_page_info.anchors[curr].prev_wrapped = prev; /* initialize it to cover current character */ @@ -1327,7 +1408,7 @@ show_history(void) /* check for names like foo/bar.dvi#link, return copy of link truncated at the `#' if found (NULL else), and save `link' into resource.anchor_pos for later use. - */ +*/ static char * check_relative_name(const char *link) { @@ -1369,15 +1450,15 @@ htex_back(void) struct history_info *info; if (htex_history == NULL) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Hyperref history is empty"); + xdvi_bell(); + statusline_info(STATUS_SHORT, "Hyperref history is empty"); return; } info = htex_history->item; if (htex_history->prev == NULL) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "At begin of history"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "At begin of history"); */ htex_update_toolbar_navigation(); return; } @@ -1390,14 +1471,14 @@ htex_back(void) &tried_dvi_ext, False)) == NULL) { - statusline_print(STATUS_MEDIUM, "Re-opening file \"%s\" failed!\n", info->filename); + statusline_error(STATUS_MEDIUM, "Re-opening file \"%s\" failed!\n", info->filename); return; } else { set_dvi_name(new_dvi_name); globals.ev.flags |= EV_NEWDOC; globals.ev.flags |= EV_PAGEHIST_INSERT; -/* statusline_print(STATUS_MEDIUM, "Back to file: \"%s\"", globals.dvi_name); */ + /* statusline_info(STATUS_MEDIUM, "Back to file: \"%s\"", globals.dvi_name); */ } } else { @@ -1433,13 +1514,13 @@ htex_forward(void) char *link; if (htex_history == NULL) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "Hyperref history is empty"); + xdvi_bell(); + statusline_info(STATUS_SHORT, "Hyperref history is empty"); return; } if (htex_history->next == NULL) { - XBell(DISP, 0); - statusline_print(STATUS_SHORT, "At end of history"); + xdvi_bell(); +/* statusline_info(STATUS_SHORT, "At end of history"); */ return; } @@ -1464,7 +1545,7 @@ htex_forward(void) if ((new_dvi_name = open_dvi_file_wrapper(link, False, False, &tried_dvi_ext, False)) == NULL) { - statusline_print(STATUS_MEDIUM, "Re-opening file \"%s\" failed!\n", info->filename); + statusline_error(STATUS_MEDIUM, "Re-opening file \"%s\" failed!\n", info->filename); free(new_linkname); return; } @@ -1478,7 +1559,7 @@ htex_forward(void) if (g_anchor_pos != NULL) globals.ev.flags |= EV_ANCHOR; -/* statusline_print(STATUS_MEDIUM, "Loaded file: \"%s\"", globals.dvi_name); */ + /* statusline_info(STATUS_MEDIUM, "Loaded file: \"%s\"", globals.dvi_name); */ free(new_linkname); } } @@ -1524,7 +1605,7 @@ history_save_anchor(const char *anchor, int current_page, const char *dvi_name) /* * Return anchor string at coordinates x, y, and anchor count in 3rd argument, * or NULL if there's no anchor at these coordinates. -*/ + */ static char * get_anchor_at_index(int x, int y, int *count) { @@ -1532,7 +1613,7 @@ get_anchor_at_index(int x, int y, int *count) for (i = 0; i < htex_page_info.curr_cnt; i++) { struct anchor_info anchor = htex_page_info.anchors[i]; -/* fprintf(stderr, "getting anchor at index %d; %s\n", i, anchor.a_href); */ + /* fprintf(stderr, "getting anchor at index %d; %s\n", i, anchor.a_href); */ if (anchor.a_href == NULL) { continue; } @@ -1566,7 +1647,7 @@ redraw_anchors(int idx) wouldn't be set correctly. Redrawing the entire page ensures this (but it's ugly). Currently this hack overrides the algorithm below for all anchors that have a `prev_wrapped' pointer. - */ + */ if (htex_page_info.anchors[i].prev_wrapped != -1) { globals.ev.flags |= EV_NEWPAGE; XSync(DISP, False); @@ -1606,7 +1687,7 @@ htex_handleref(int x, int y, Boolean newwindow) char *link; int link_num; -/* fprintf(stderr, "---------- htex_handleref!\n"); */ + /* fprintf(stderr, "---------- htex_handleref!\n"); */ if (!(globals.cursor.flags & CURSOR_LINK)) /* When no link cursor is shown, clicking shouldn't jump to link */ return False; @@ -1655,7 +1736,7 @@ htex_handleref(int x, int y, Boolean newwindow) MYTRACE((stderr, "NEW FILE: |%s|", globals.dvi_name)); if (g_anchor_pos != NULL) globals.ev.flags |= EV_ANCHOR; -/* statusline_print(STATUS_MEDIUM, "Loaded file: \"%s\"", dvi_name); */ + /* statusline_info(STATUS_MEDIUM, "Loaded file: \"%s\"", dvi_name); */ } else { redraw_anchors(link_num); @@ -1681,7 +1762,7 @@ htex_displayanchor(int x, int y) anchor_text = get_anchor_at_index(x, y, &id_curr); if (anchor_text != NULL) { /* found an anchor */ - if (!(globals.cursor.flags & CURSOR_LINK) && !dragging_text_selection()) { + if (!(globals.cursor.flags & CURSOR_LINK) && !(globals.cursor.flags & CURSOR_TEXT)) { globals.cursor.flags |= CURSOR_LINK; globals.ev.flags |= EV_CURSOR; } @@ -1689,7 +1770,7 @@ htex_displayanchor(int x, int y) i.e. when it either has a different ID or is on a different page: */ if ((resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0 && (id_curr != id_bak || current_page != pageno_bak)) { - statusline_print(STATUS_FOREVER, "%s", anchor_text); + statusline_info(STATUS_FOREVER, "%s", anchor_text); id_bak = id_curr; pageno_bak = current_page; } @@ -1710,7 +1791,7 @@ htex_displayanchor(int x, int y) /* * Invoked from all commands that change the shrink factor; * forces re-computation of the anchor markers. -*/ + */ void htex_resize_page(void) { @@ -1721,7 +1802,7 @@ htex_resize_page(void) * Invoked from all commands that reread the DVI file; * resets all link infos. * Note: visited_links and anchor stack data - * are preserved over files, so we don't need to free() them. + * are preserved across multiple files, so we don't need to free() them. */ void htex_reinit(void) @@ -1735,7 +1816,7 @@ htex_reinit(void) Since this is done after the entire page is parsed, we can't use the checks for fg_current and do_color_change(), but need to use a separate GC instead. - */ +*/ void htex_draw_anchormarkers(void) { @@ -1786,7 +1867,7 @@ htex_draw_anchormarkers(void) */ MYTRACE((stderr, "UNDERLINE: checking if %d is visited: %d!", i, visited)); -/* if (clip_region_to_rect(&rect)) { */ + /* if (clip_region_to_rect(&rect)) { */ if (anchor.object_type == HTEX_IMG) { rect.x = anchor.ulx - 1; rect.y = anchor.uly - 1; @@ -1820,7 +1901,7 @@ launch_xdvi(const char *filename, const char *anchor_name) { #define ARG_LEN 32 int i = 0; - char *argv[ARG_LEN]; + const char *argv[ARG_LEN]; char *shrink_arg = NULL; ASSERT(filename != NULL, "filename argument to launch_xdvi() mustn't be NULL"); @@ -1843,15 +1924,13 @@ launch_xdvi(const char *filename, const char *anchor_name) /* start the new instance with the same debug flags as the current instance */ if (globals.debug != 0) { - char debug_flag[128]; - SNPRINTF(debug_flag, 128, "%lu", globals.debug); argv[i++] = "-debug"; - argv[i++] = debug_flag; + argv[i++] = resource.debug_arg; } if (anchor_name != NULL) { argv[i++] = "-anchorposition"; - argv[i++] = (char *)anchor_name; + argv[i++] = anchor_name; } argv[i++] = "-s"; @@ -1859,7 +1938,7 @@ launch_xdvi(const char *filename, const char *anchor_name) sprintf(shrink_arg, "%d", currwin.shrinkfactor); argv[i++] = shrink_arg; - argv[i++] = (char *)filename; /* FIXME */ + argv[i++] = filename; /* FIXME */ argv[i++] = NULL; ASSERT(i <= ARG_LEN, "Too few elements in argv[]"); @@ -1884,8 +1963,8 @@ launch_xdvi(const char *filename, const char *anchor_name) case -1: perror("fork"); case 0: - execvp(argv[0], argv); - MYTRACE((stderr, "%s: Execution of %s failed.", globals.program_name, argv[0])); + execvp(argv[0], (char **)argv); + XDVI_ERROR((stderr, "%s: Execution of %s failed.", globals.program_name, argv[0])); _exit(EXIT_FAILURE); default: FREE(shrink_arg); @@ -1984,7 +2063,7 @@ launch_program(const char *filename) char *errmsg = xstrdup("Please assign an application to the MIME type `"); errmsg = xstrcat(errmsg, content_type); errmsg = xstrcat(errmsg, "' in your ~/.mailcap file. " - "E.g. if you want to view the file with netscape, add the following line to your ~/.mailcap:\n"); + "E.g. if you want to view the file with netscape, add the following line to your ~/.mailcap:\n"); errmsg = xstrcat(errmsg, content_type); errmsg = xstrcat(errmsg, "; netscape -raise -remote 'openURL(%%s,new-window)'\n\n"); #endif @@ -2055,7 +2134,7 @@ launch_program(const char *filename) - xdvi doesn't hang if the process doesn't return; - we can still catch the return value if `sh -c' exits with an error - (e.g. if the viewer command is not found). + (e.g. if the viewer command is not found). Note however that this doesn't mimick most of POSIX's system() semantics. */ @@ -2089,14 +2168,14 @@ htex_set_anchormarker(int y) XtRemoveTimeOut(m_href_timeout_id); htex_erase_anchormarker(NULL, NULL); XFlush(DISP); - + XtVaGetValues(globals.widgets.draw_widget, XtNx, &drawing_x, NULL); g_anchormarker.page = current_page; free(g_anchormarker.filename); g_anchormarker.filename = xstrdup(globals.dvi_name); g_anchormarker.y_pos = y; g_anchormarker.x_pos = DEFAULT_MARKER_X_OFFSET + -drawing_x; - m_href_timeout_id = XtAppAddTimeOut(app, STATUS_SHORT * 1000, htex_erase_anchormarker, (XtPointer)NULL); + m_href_timeout_id = XtAppAddTimeOut(globals.app, STATUS_SHORT * 1000, htex_erase_anchormarker, (XtPointer)NULL); } static void @@ -2131,7 +2210,7 @@ htex_draw_anchormarker(int y) /* -1 indicates that no horizontal scrolling is wanted, since the anchormarker will always be horizontally positioned inside the visible area. - */ + */ scroll_page_if_needed(-1, -1, y + 3, y - 3); } diff --git a/Build/source/texk/xdvik/image-magick.c b/Build/source/texk/xdvik/image-magick.c index 50bf201956a..3e546c6d522 100644 --- a/Build/source/texk/xdvik/image-magick.c +++ b/Build/source/texk/xdvik/image-magick.c @@ -24,28 +24,28 @@ TODO: 1. Specials other than 'psfile=' and 'em:graph' which include - image files. + image files. - [ NOTE SU: I consider this more or less done now with the backtick - parsing ;-) ] + [ NOTE SU: I consider this more or less done now with the backtick + parsing ;-) ] 2. Use an XtWorkProc or similar to do some background pre-processing - of image files before they are displayed. + of image files before they are displayed. 3. Replace popen() by fork and explicit pipes, and make the - use of xdvi_temp_fd safer. + use of xdvi_temp_fd safer. 4. PS figs are always clipped to the bbox defined in the special - string, which is not what we want when clip=false. - The problem can be partly solved by increasing the value of - the PSBW macro, or we may get the correct bbox by reading the - '%%BoundingBox' or '%%HiresBoundingBox' lines in the PS file - and set the image geometry accordingly. + string, which is not what we want when clip=false. + The problem can be partly solved by increasing the value of + the PSBW macro, or we may get the correct bbox by reading the + '%%BoundingBox' or '%%HiresBoundingBox' lines in the PS file + and set the image geometry accordingly. 5. The code only(?) works with true color displays. 6. There's also work to do to respond to window events in - load_image() and display_image() functions. + load_image() and display_image() functions. */ #include @@ -60,6 +60,10 @@ #ifdef MAGICK /* entire file */ +#ifndef MAGICK_RENDER_PS +# define MAGICK_RENDER_PS 0 +#endif + #include "magick/api.h" #if MAGICK_VER_MAJOR > 5 || MAGICK_VER_MINOR >= 4 # include "magick/xwindow.h" /* IM >= 5.4 */ @@ -554,19 +558,18 @@ load_image(XDviImageInfo *info) { static ExceptionInfo exception; static ImageInfo *image_info; - static XResourceInfo resource_info; static XVisualInfo visual_info; static XStandardColormap map_info; - static XPixelInfo pixel_info; - static XWindowInfo window_info; static Boolean initialized = False; static Boolean disabled = False; static XDviImage img = { {False, 0, 0, 0, 0, 0, 0, 0, ""}, NULL, 0, 0, 0 }; Image *image, *tmp_image; + PixelPacket *pp; double xscale, yscale, xdpi, ydpi; int n; + unsigned int x, y; unsigned long columns, rows; char density[40]; size_t size; @@ -633,17 +636,12 @@ load_image(XDviImageInfo *info) GetExceptionInfo(&exception); image_info = CloneImageInfo((ImageInfo *) NULL); - XGetResourceInfo(XrmGetStringDatabase(""), "xdvi", &resource_info); - /* resource_info.debug = 1; */ if (!XMatchVisualInfo(DISP, XScreenNumberOfScreen(SCRN), G_depth, G_visual->class, &visual_info)) { fprintf(stderr, "Magick: can't get visual info, image disabled.\n"); disabled = True; return NULL; } - XGetMapInfo(&visual_info, G_colormap, &map_info); - XGetWindowInfo(DISP, &visual_info, &map_info, &pixel_info, - (XFontStruct *) NULL, &resource_info, &window_info); if (resource.magick_cache != NULL) { cache_limit = parse_cache_setting(resource.magick_cache); @@ -663,7 +661,7 @@ load_image(XDviImageInfo *info) rows = ROUND(DPI * info->rhi * 0.1 / 72); if (globals.debug & DBG_PS) fprintf(stderr, "\tscale=%0.2fx%0.2f, dpi=%0.2fx%0.2f, size=%ldx%ld\n", - xscale, yscale, xdpi, ydpi, columns, rows); + xscale, yscale, xdpi, ydpi, columns, rows); /* expand and canonicalize path name */ path = find_file(fn, &statbuf, kpse_pict_format); @@ -720,11 +718,11 @@ load_image(XDviImageInfo *info) if (globals.debug & DBG_PS) { int i = image->units; fprintf(stderr, "\t image size = %ldx%ld\n", - image->columns, image->rows); + image->columns, image->rows); fprintf(stderr, "\t image resolution = %0.2fx%0.2f (units=%s)\n", - image->x_resolution, image->y_resolution, - i == UndefinedResolution ? "???" : - i == PixelsPerInchResolution ? "PPI" : "PPCM"); + image->x_resolution, image->y_resolution, + i == UndefinedResolution ? "???" : + i == PixelsPerInchResolution ? "PPI" : "PPCM"); } if (fullpath != magick_tmp) { /* non PS image */ @@ -746,7 +744,7 @@ load_image(XDviImageInfo *info) /* Scale image */ if (globals.debug & DBG_PS) { fprintf(stderr, "\t scaling image %ldx%ld -> %ldx%ld\n", - image->columns, image->rows, columns, rows); + image->columns, image->rows, columns, rows); } showtime("ScaleImage:"); tmp_image = ScaleImage(image, columns, rows, &exception); @@ -774,43 +772,18 @@ load_image(XDviImageInfo *info) (((color).blue * map.blue_max + (1L << (dx - 1L))) / ((1L << dx) - 1L)) * map.blue_mult) img.bgpixel = XStandardPixel(map_info, image->background_color, 16); +#undef XStandardPixel if (img.ximage != NULL) { free_ximage(img.ximage); img.ximage = NULL; } -#undef XStandardPixel /* Transform to XImage */ - window_info.id = mane.win; - window_info.annotate_context = globals.gc.copy; - /* - FIXME: If this isn't set to false, running on a remote display may - lead to `Badaccess (no permission to access private resource)' X - errors (only with ImageMagick >= 5.4 - zlb has emailed the - developers about this). - Setting it to false always might slightly hurt performance - how - to check for remoteness? Parse the DISPLAY variable? - */ - window_info.shared_memory = False; - showtime("XMakeImage:"); - XGetPixelPacket(DISP, &visual_info, &map_info, - &resource_info, image, &pixel_info); - n = XMakeImage(DISP, &resource_info, &window_info, image, - image->columns, image->rows); - - /* Since XDestroyImage doesn't know how to free window_info.ximage->data, - * we simply copy window_info.ximage. The next call of XMakeImage - * will free both window_info.ximage->data and window_info.ximage. - */ - DestroyImage(image); - if (!n) - return NULL; + pp = GetImagePixels(image, 0, 0, image->columns, image->rows); img.ximage = XCreateImage(DISP, G_visual, G_depth, ZPixmap, 0, NULL, - window_info.ximage->width, - window_info.ximage->height, BMBITS, 0); + image->columns, image->rows, BMBITS, 0); if (img.ximage == NULL) return NULL; - *img.ximage = *(window_info.ximage); size = img.ximage->bytes_per_line * img.ximage->height; img.ximage->data = malloc(size ? size : 1); /* NOTE: no xmalloc! */ if (img.ximage->data == NULL) { @@ -819,8 +792,16 @@ load_image(XDviImageInfo *info) img.ximage = NULL; return NULL; } - if (size) - memcpy(img.ximage->data, window_info.ximage->data, size); + for (y = 0; y < image->rows; y++) { + for (x = 0; x < image->columns; x++, pp++) { + struct rgb color; + color.r = USHRT_MAX * pp->red / MaxRGB; + color.g = USHRT_MAX * pp->green / MaxRGB; + color.b = USHRT_MAX * pp->blue / MaxRGB; + XPutPixel(img.ximage, x, y, alloc_color(&color, img.bgpixel)); + } + } + DestroyImage(image); size += sizeof(XDviImage) + sizeof(XImage); if (cache_size + size > cache_limit) { @@ -843,7 +824,7 @@ load_image(XDviImageInfo *info) if (globals.debug & DBG_PS) fprintf(stderr, " image cached (cache_size=%uKB, limit=%uKB).\n", - cache_size / 1024, cache_limit / 1024); + cache_size / 1024, cache_limit / 1024); #if 0 DestroyImageInfo(image_info); DestroyExceptionInfo(&exception); @@ -867,7 +848,7 @@ display_image(XDviImage * img, int xul, int yul, #if 0 XPutImage(DISP, mane.win, globals.gc.copy, img->ximage, 0, 0, xul, yul - img->ximage.height + 1, - img->ximage.width, img->ximage.height); + img->ximage->width, img->ximage->height); #else /* Try to make background pixels transparent */ { @@ -1009,7 +990,7 @@ render_image_file(XDviImageInfo *info, int x, int y) if (globals.debug & DBG_PS) fprintf(stderr, "Magick: render_image_file: box=%dx%d+%d+%d\n", - w, h, x, y - h + 1); + w, h, x, y - h + 1); if (!info->angle) { XDrawRectangle(DISP, currwin.win, globals.gc.high, x, y - h + 1, w, h); @@ -1034,19 +1015,44 @@ render_image_file(XDviImageInfo *info, int x, int y) d = -cos_a * (h-1); XDrawLine(DISP, currwin.win, globals.gc.high, - x, y, x + ROUND(a), y + ROUND(b)); + x, y, x + ROUND(a), y + ROUND(b)); XDrawLine(DISP, currwin.win, globals.gc.high, - x + ROUND(a), y + ROUND(b), - x + ROUND(a + c), y + ROUND(b + d)); + x + ROUND(a), y + ROUND(b), + x + ROUND(a + c), y + ROUND(b + d)); XDrawLine(DISP, currwin.win, globals.gc.high, - x + ROUND(a + c), y + ROUND(b + d), - x + ROUND(c), y + ROUND(d)); + x + ROUND(a + c), y + ROUND(b + d), + x + ROUND(c), y + ROUND(d)); XDrawLine(DISP, currwin.win, globals.gc.high, - x + ROUND(c), y + ROUND(d), x, y); + x + ROUND(c), y + ROUND(d), x, y); #endif } } +#if !MAGICK_RENDER_PS +static Boolean +is_ps(char *fn) +{ + int l; + char *p; + + if (strchr(fn, '`') != NULL) + return False; + + l = strlen(fn); + p = fn + l - 1; + while (p > fn && *p != '.' && *p != '/') + p--; + l -= p - fn; + if (*p == '.' && ((l >= 3 && !memicmp(p, ".ps", 3)) || + (l >= 4 && !memicmp(p, ".eps", 4)))) { + if (globals.debug & DBG_PS) + fprintf(stderr, "Magick: passing PS/EPS file to psgs.c\n"); + return True; + } + return False; +} +#endif + /* Process EPSF specials */ static Boolean @@ -1059,12 +1065,12 @@ epsf_special(char *cp) unsigned long flags = 0, u; double rwi, rhi; enum { LLX, LLY, - URX, URY, - RWI, RHI, - HSIZE, VSIZE, - HOFFSET, VOFFSET, - HSCALE, VSCALE, - ANGLE + URX, URY, + RWI, RHI, + HSIZE, VSIZE, + HOFFSET, VOFFSET, + HSCALE, VSCALE, + ANGLE }; XDviImageInfo info; @@ -1116,7 +1122,12 @@ epsf_special(char *cp) if (globals.debug & DBG_PS) fprintf(stderr, "Magick: epsf_special: filename = '%s'\n", - info.filename); + info.filename); + +#if !MAGICK_RENDER_PS + if (is_ps(info.filename)) + return False; +#endif /* Scan for EPSF keywords */ while (*cp != '\0') { @@ -1185,9 +1196,9 @@ epsf_special(char *cp) key_info[HOFFSET].mask | key_info[VOFFSET].mask | key_info[HSCALE].mask | key_info[VSCALE].mask | key_info[ANGLE].mask)) - fprintf(stderr, "Magick: warning: EPSF keywords '[hv]size', " - "'[hv]offset', '[hv]scale', and 'angle' are not " - "implemented.\n"); + fprintf(stderr, "Magick: warning: EPSF keywords '[hv]size', " + "'[hv]offset', '[hv]scale', and 'angle' are not " + "implemented.\n"); info.urx = key_info[URX].val; info.ury = key_info[URY].val; @@ -1198,7 +1209,7 @@ epsf_special(char *cp) if (globals.debug & DBG_PS) fprintf(stderr, "Magick: epsf_special: llx=%0.2f, lly=%0.2f, " - "urx=%0.2f, ury=%0.2f\n", + "urx=%0.2f, ury=%0.2f\n", info.llx, info.lly, info.urx, info.ury); if (info.urx - info.llx < 1 || info.ury - info.lly < 1) @@ -1336,6 +1347,15 @@ emgraph_special(char *cp) } memcpy(info.filename, cp, p - cp); /* no need to terminate because of memset(...) above */ + if (globals.debug & DBG_PS) + fprintf(stderr, "Magick: emgraph_special: filename = '%s'\n", + info.filename); + +#if !MAGICK_RENDER_PS + if (is_ps(info.filename)) + return False; +#endif + cp = p; /* get width */ @@ -1358,7 +1378,7 @@ emgraph_special(char *cp) if (globals.debug & DBG_PS) fprintf(stderr, "Magick: filename=\"%s\", width=%0.2f, height=%0.2f\n", - info.filename, w, h); + info.filename, w, h); info.llx = info.lly = 0; info.urx = w; diff --git a/Build/source/texk/xdvik/kpathsea.ac b/Build/source/texk/xdvik/kpathsea.ac new file mode 100644 index 00000000000..d59113f1219 --- /dev/null +++ b/Build/source/texk/xdvik/kpathsea.ac @@ -0,0 +1,58 @@ +dnl Check if we want to compile against an installed kpathsea library + +EXTRA_LIBKPATHSEA_INCLUDE= +EXTRA_LIBKPATHSEA_LIBDIR= + +if test "$with_system_kpathsea" = yes; then + if test "x$with_kpathsea_libdir" != x; then + EXTRA_LIBKPATHSEA_LIBDIR="-L$with_kpathsea_libdir" + fi + if test "x$with_kpathsea_include" != x; then + EXTRA_LIBKPATHSEA_INCLUDE="-I$with_kpathsea_include" + fi +fi + +if test "$with_system_kpathsea" = yes; then + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_CPPFLAGS=$CPPFLAGS + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBKPATHSEA_LIBDIR" + CPP="$CPP $EXTRA_LIBKPATHSEA_INCLUDE" + CPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE" + + AC_MSG_CHECKING(whether kpathsea defines kpse_enc_format) + AC_TRY_COMPILE([#include "kpathsea/kpathsea.h" + ], [kpse_file_format_type mytype = kpse_enc_format; + ], have_good_kpathsea=yes, have_good_kpathsea=no) + if test $have_good_kpathsea = no; then + AC_MSG_RESULT(no) + AC_MSG_WARN(kpathsea library is not recent enough; will compile my own) + with_system_kpathsea=no + else + AC_MSG_RESULT(yes) + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + CPPFLAGS=$OLD_CPPFLAGS + LIBS=$OLD_LIBS +fi + +if test "$with_system_kpathsea" = yes; then + LIBKPATHSEACPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE" + LDLIBKPATHSEA="$EXTRA_LIBKPATHSEA_LIBDIR -lkpathsea" + LIBKPATHSEADEP= + using_system_kpathsea=yes +else + LIBKPATHSEACPPFLAGS='-I$(kpathsea_parent)' + LDLIBKPATHSEA='$(kpathsea_dir)/libkpathsea.la' + LIBKPATHSEADEP='$(kpathsea_dir)/libkpathsea.la' + using_system_kpathsea=no +fi + + +AC_SUBST(LIBKPATHSEACPPFLAGS) +AC_SUBST(LDLIBKPATHSEA) +AC_SUBST(LIBKPATHSEADEP) diff --git a/Build/source/texk/xdvik/kpathsea.ac.orig b/Build/source/texk/xdvik/kpathsea.ac.orig new file mode 100644 index 00000000000..3163f9d4111 --- /dev/null +++ b/Build/source/texk/xdvik/kpathsea.ac.orig @@ -0,0 +1,58 @@ +dnl Check if we want to compile against an installed kpathsea library + +EXTRA_LIBKPATHSEA_INCLUDE= +EXTRA_LIBKPATHSEA_LIBDIR= + +if test "$with_system_kpathsea" = yes; then + if test "x$with_kpathsea_libdir" != x; then + EXTRA_LIBKPATHSEA_LIBDIR="-L$with_kpathsea_libdir" + fi + if test "x$with_kpathsea_include" != x; then + EXTRA_LIBKPATHSEA_INCLUDE="-I$with_kpathsea_include" + fi +fi + +if test "$with_system_kpathsea" = yes; then + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_CPPFLAGS=$CPPFLAGS + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBKPATHSEA_LIBDIR" + CPP="$CPP $EXTRA_LIBKPATHSEA_INCLUDE" + CPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE" + + AC_MSG_CHECKING(whether kpathsea defines kpse_enc_format) + AC_TRY_COMPILE([#include "kpathsea/kpathsea.h" + ], [kpse_file_format_type mytype = kpse_enc_format; + ], have_good_kpathsea=yes, have_good_kpathsea=no) + if test $have_good_kpathsea = no; then + AC_MSG_RESULT(no) + AC_MSG_WARN(kpathsea library is not recent enough; will compile my own) + with_system_kpathsea=no + else + AC_MSG_RESULT(yes) + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + CPPFLAGS=$OLD_CPPFLAGS + LIBS=$OLD_LIBS +fi + +if test "$with_system_kpathsea" = yes; then + LIBKPATHSEACPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE" + LDLIBKPATHSEA="$EXTRA_LIBKPATHSEA_LIBDIR -lkpathsea" + LIBKPATHSEADEP= + using_system_kpathsea=yes +else + LIBKPATHSEACPPFLAGS='-I$(kpathsea_dir)' + LDLIBKPATHSEA='$(kpathsea_dir)/libkpathsea.la' + LIBKPATHSEADEP='$(kpathsea_dir)/libkpathsea.la' + using_system_kpathsea=no +fi + + +AC_SUBST(LIBKPATHSEACPPFLAGS) +AC_SUBST(LDLIBKPATHSEA) +AC_SUBST(LIBKPATHSEADEP) diff --git a/Build/source/texk/xdvik/main.c b/Build/source/texk/xdvik/main.c new file mode 100644 index 00000000000..9154b507fa0 --- /dev/null +++ b/Build/source/texk/xdvik/main.c @@ -0,0 +1,1274 @@ +#include "xdvi-config.h" + +#include + +#include + +#include "kpathsea/proginit.h" +#include "kpathsea/expand.h" + +#include "xdvi.h" +#include "util.h" +#include "x_util.h" +#include "sfSelFile.h" +#include "my-snprintf.h" +#include "dvi-init.h" +#include "filehist.h" +#include "mag.h" +#include "message-window.h" + +#ifdef T1LIB +#include "t1lib.h" +#endif /* T1LIB */ + +static char XtRBool3[] = "Bool3"; /* resource for Bool3 */ + +/* get these before setting `application_resources' */ +static XtResource xdvirc_resources[] = { + {"noInitFile", "NoInitFile", XtRBoolean, sizeof(Boolean), + XtOffsetOf(struct x_resources, no_init_file), XtRString, "false"}, +}; + + +static XrmOptionDescRec options[] = { + {"-q", ".noInitFile", XrmoptionNoArg, (XPointer)"on" }, + {"+q", ".noInitFile", XrmoptionNoArg, (XPointer)"off" }, + {"-geometry", ".geometry", XrmoptionSepArg, (XPointer)NULL }, +#ifdef MOTIF + /* to make `-font' and `-fn' options work, make them an alias for `fontList' */ + { "-font", "*fontList", XrmoptionSepArg, (XPointer)NULL }, + { "-fn", "*fontList", XrmoptionSepArg, (XPointer)NULL }, +#endif + {"-s", ".shrinkFactor", XrmoptionSepArg, (XPointer)NULL }, +#ifndef VMS + {"-S", ".densityPercent", XrmoptionSepArg, (XPointer)NULL }, +#endif + {"-density", ".densityPercent", XrmoptionSepArg, (XPointer)NULL }, + {"-noomega", ".omega", XrmoptionNoArg, (XPointer)"off" }, + {"+noomega", ".omega", XrmoptionNoArg, (XPointer)"on" }, +#if COLOR + {"-nocolor", ".color", XrmoptionNoArg, (XPointer)"off" }, + {"+nocolor", ".color", XrmoptionNoArg, (XPointer)"on" }, +#endif +#ifdef GREY + {"-nogrey", ".grey", XrmoptionNoArg, (XPointer)"off" }, + {"+nogrey", ".grey", XrmoptionNoArg, (XPointer)"on" }, + {"-gamma", ".gamma", XrmoptionSepArg, (XPointer)NULL }, + {"-nomatchinverted",".matchInverted", XrmoptionNoArg, (XPointer)"off" }, + {"+nomatchinverted",".matchInverted", XrmoptionNoArg, (XPointer)"on" }, + /* {"-invertedfactor", ".invertedFactor", XrmoptionSepArg, (XPointer)NULL }, */ + {"-install", ".install", XrmoptionNoArg, (XPointer)"on" }, + {"-noinstall", ".install", XrmoptionNoArg, (XPointer)"off" }, +#endif + {"-rulecolor", ".ruleColor", XrmoptionSepArg, (XPointer)NULL }, + {"-p", ".pixelsPerInch", XrmoptionSepArg, (XPointer)NULL }, + {"-margins", ".Margin", XrmoptionSepArg, (XPointer)NULL }, + {"-sidemargin", ".sideMargin", XrmoptionSepArg, (XPointer)NULL }, + {"-topmargin", ".topMargin", XrmoptionSepArg, (XPointer)NULL }, + {"-offsets", ".Offset", XrmoptionSepArg, (XPointer)NULL }, + {"-xoffset", ".xOffset", XrmoptionSepArg, (XPointer)NULL }, + {"-yoffset", ".yOffset", XrmoptionSepArg, (XPointer)NULL }, + {"-paper", ".paper", XrmoptionSepArg, (XPointer)NULL }, + {"-altfont", ".altFont", XrmoptionSepArg, (XPointer)NULL }, +#ifdef MKTEXPK + {"-nomakepk", ".makePk", XrmoptionNoArg, (XPointer)"off" }, + {"+nomakepk", ".makePk", XrmoptionNoArg, (XPointer)"on" }, +#endif + {"-mfmode", ".mfMode", XrmoptionSepArg, (XPointer)NULL }, + {"-editor", ".editor", XrmoptionSepArg, (XPointer)NULL }, +#ifdef T1LIB + {"-not1lib", ".t1lib", XrmoptionNoArg, (XPointer)"off" }, + {"+not1lib", ".t1lib", XrmoptionNoArg, (XPointer)"on" }, +#endif + {"-sourceposition", ".sourcePosition", XrmoptionSepArg, (XPointer)NULL }, + {"-findstring", ".findString", XrmoptionSepArg, (XPointer)NULL }, + {"-text-encoding", ".textEncoding", XrmoptionSepArg, (XPointer)NULL }, + {"-unique", ".unique", XrmoptionNoArg, (XPointer)"on" }, + {"+unique", ".unique", XrmoptionNoArg, (XPointer)"off" }, + {"-nofork", ".fork", XrmoptionNoArg, (XPointer)"off" }, + {"+nofork", ".fork", XrmoptionNoArg, (XPointer)"on" }, +#ifdef RGB_ANTI_ALIASING + {"-subpixels", ".subPixels", XrmoptionSepArg, (XPointer)NULL }, +#endif + {"-l", ".listFonts", XrmoptionNoArg, (XPointer)"on" }, + {"+l", ".listFonts", XrmoptionNoArg, (XPointer)"off" }, + {"-watchfile", ".watchFile", XrmoptionSepArg, (XPointer)NULL }, + {"-expertmode", ".expertMode", XrmoptionSepArg, (XPointer)NULL }, + {"-expert", ".expert", XrmoptionNoArg, (XPointer)"on" }, + {"+expert", ".expert", XrmoptionNoArg, (XPointer)"off" }, + {"+statusline", ".statusline", XrmoptionNoArg, (XPointer)"off" }, + {"-statusline", ".statusline", XrmoptionNoArg, (XPointer)"on" }, + {"+useTeXpages", ".useTeXPages", XrmoptionNoArg, (XPointer)"off" }, + {"-useTeXpages", ".useTeXPages", XrmoptionNoArg, (XPointer)"on" }, + {"-mgs", ".magnifierSize1", XrmoptionSepArg, (XPointer)NULL }, + {"-mgs1", ".magnifierSize1", XrmoptionSepArg, (XPointer)NULL }, + {"-mgs2", ".magnifierSize2", XrmoptionSepArg, (XPointer)NULL }, + {"-mgs3", ".magnifierSize3", XrmoptionSepArg, (XPointer)NULL }, + {"-mgs4", ".magnifierSize4", XrmoptionSepArg, (XPointer)NULL }, + {"-mgs5", ".magnifierSize5", XrmoptionSepArg, (XPointer)NULL }, + {"-warnspecials", ".warnSpecials", XrmoptionNoArg, (XPointer)"on" }, + {"+warnspecials", ".warnSpecials", XrmoptionNoArg, (XPointer)"off" }, + {"-hush", ".Hush", XrmoptionNoArg, (XPointer)"on" }, + {"+hush", ".Hush", XrmoptionNoArg, (XPointer)"off" }, + {"-hushchars", ".hushLostChars", XrmoptionNoArg, (XPointer)"on" }, + {"+hushchars", ".hushLostChars", XrmoptionNoArg, (XPointer)"off" }, + {"-hushchecksums", ".hushChecksums", XrmoptionNoArg, (XPointer)"on" }, + {"+hushchecksums", ".hushChecksums", XrmoptionNoArg, (XPointer)"off" }, + {"-hushstdout", ".hushStdout", XrmoptionNoArg, (XPointer)"on" }, + {"+hushstdout", ".hushStdout", XrmoptionNoArg, (XPointer)"off" }, + {"-hushbell", ".hushBell", XrmoptionNoArg, (XPointer)"on" }, + {"+hushbell", ".hushBell", XrmoptionNoArg, (XPointer)"off" }, + {"-safer", ".safer", XrmoptionNoArg, (XPointer)"on" }, + {"+safer", ".safer", XrmoptionNoArg, (XPointer)"off" }, + {"-fg", ".foreground", XrmoptionSepArg, (XPointer)NULL }, + {"-foreground", ".foreground", XrmoptionSepArg, (XPointer)NULL }, + {"-bg", ".background", XrmoptionSepArg, (XPointer)NULL }, + {"-background", ".background", XrmoptionSepArg, (XPointer)NULL }, + {"-hl", ".highlight", XrmoptionSepArg, (XPointer)NULL }, + {"-cr", ".cursorColor", XrmoptionSepArg, (XPointer)NULL }, + {"-icongeometry", ".iconGeometry", XrmoptionSepArg, (XPointer)NULL }, + {"-keep", ".keepPosition", XrmoptionNoArg, (XPointer)"on" }, + {"+keep", ".keepPosition", XrmoptionNoArg, (XPointer)"off" }, + {"-copy", ".copy", XrmoptionNoArg, (XPointer)"on" }, + {"+copy", ".copy", XrmoptionNoArg, (XPointer)"off" }, + {"-thorough", ".thorough", XrmoptionNoArg, (XPointer)"on" }, + {"+thorough", ".thorough", XrmoptionNoArg, (XPointer)"off" }, + {"-fullscreen", ".fullscreen", XrmoptionNoArg, (XPointer)"on" }, + {"+fullscreen", ".fullscreen", XrmoptionNoArg, (XPointer)"off" }, + {"-pause", ".pause", XrmoptionNoArg, (XPointer)"on" }, + {"+pause", ".pause", XrmoptionNoArg, (XPointer)"off" }, + {"-pausespecial", ".pauseSpecial", XrmoptionSepArg, (XPointer)NULL }, + {"-wheelunit", ".wheelUnit", XrmoptionSepArg, (XPointer)NULL }, + {"-mousemode", ".mouseMode", XrmoptionSepArg, (XPointer)NULL }, +#ifdef PS + {"-postscript", ".postscript", XrmoptionSepArg, (XPointer)NULL }, + {"-allowshell", ".allowShell", XrmoptionNoArg, (XPointer)"on" }, + {"+allowshell", ".allowShell", XrmoptionNoArg, (XPointer)"off" }, +# ifdef PS_DPS + {"-nodps", ".dps", XrmoptionNoArg, (XPointer)"off" }, + {"+nodps", ".dps", XrmoptionNoArg, (XPointer)"on" }, +# endif +# ifdef PS_NEWS + {"-nonews", ".news", XrmoptionNoArg, (XPointer)"off" }, + {"+nonews", ".news", XrmoptionNoArg, (XPointer)"on" }, +# endif +# ifdef PS_GS + {"-noghostscript", ".ghostscript", XrmoptionNoArg, (XPointer)"off" }, + {"+noghostscript", ".ghostscript", XrmoptionNoArg, (XPointer)"on" }, + {"-nogssafer", ".gsSafer", XrmoptionNoArg, (XPointer)"off" }, + {"+nogssafer", ".gsSafer", XrmoptionNoArg, (XPointer)"on" }, + {"-gsalpha", ".gsAlpha", XrmoptionNoArg, (XPointer)"on" }, + {"+gsalpha", ".gsAlpha", XrmoptionNoArg, (XPointer)"off" }, + {"-interpreter", ".interpreter", XrmoptionSepArg, (XPointer)NULL }, + {"-gspalette", ".palette", XrmoptionSepArg, (XPointer)NULL }, +# endif +# ifdef MAGICK + {"-magick", ".ImageMagick", XrmoptionNoArg, (XPointer)"on" }, + {"+magick", ".ImageMagick", XrmoptionNoArg, (XPointer)"off" }, + {"-magick_cache", ".MagickCache", XrmoptionSepArg, (XPointer)NULL }, +# endif +#endif /* PS */ + {"-noscan", ".prescan", XrmoptionNoArg, (XPointer)"off" }, + {"+noscan", ".prescan", XrmoptionNoArg, (XPointer)"on" }, + {"-notempfile", ".tempFile", XrmoptionNoArg, (XPointer)"off" }, + {"+notempfile", ".tempFile", XrmoptionNoArg, (XPointer)"on" }, + {"-dvipspath", ".dvipsPath", XrmoptionSepArg, (XPointer)NULL }, + {"-ps2pdfpath", ".ps2pdfPath", XrmoptionSepArg, (XPointer)NULL }, + {"-debug", ".debugLevel", XrmoptionSepArg, (XPointer)NULL }, + {"-linkstyle", ".linkStyle", XrmoptionSepArg, (XPointer)NULL }, + {"-linkcolor", ".linkColor", XrmoptionSepArg, (XPointer)NULL }, + {"-visitedlinkcolor",".visitedLinkColor", XrmoptionSepArg, (XPointer)NULL }, + {"-browser", ".wwwBrowser", XrmoptionSepArg, (XPointer)NULL }, + {"-anchorposition", ".anchorPosition", XrmoptionSepArg, (XPointer)NULL }, +}; + +/* + * Data for options processing. + */ +static const char SILENT[] = " "; /* flag value for usage() */ +static const char SUBST[] = "x"; /* another flag value */ +static const char USAGESTR_END_MARKER[] = "__USAGE_END_MARKER__"; /* end marker */ + +/* Here, list usage values for options that have `XrmoptionSepArg' set. + TODO: what does the `^' stand for? +*/ +static const char *usagestr[] = { + /* geometry */ SILENT, +#ifdef MOTIF + /* font */ SILENT, + /* f */ SILENT, +#endif + /* shrinkFactor */ "shrink", +#ifndef VMS + /* S */ "density", + /* density */ SILENT, +#else + /* density */ "density", +#endif +#ifdef GREY + /* gamma */ "float", +#endif + /* rulecolor */ "color", + /* p */ "pixels", + /* margins */ "dimen", + /* sidemargin */ "dimen", + /* topmargin */ "dimen", + /* offsets */ "dimen", + /* xoffset */ "dimen", + /* yoffset */ "dimen", + /* paper */ "papertype", + /* altfont */ "font", + /* mfmode */ "mode-def", + /* editor */ "editor", + /* sourceposition */ "linenumber[ ]*filename", + /* findstring */ "string", + /* textencoding */ "charset", +#ifdef RGB_ANTI_ALIASING + /* subpixels */ "{rgb,bgr}[ i1 i2 i3]", +#endif + /* rv */ "^-l", "-rv", + /* watchfile */ "secs", + /* expertmode */ "flag", + /* mgs */ SUBST, + /* mgs1 */ SILENT, + /* mgs2 */ SILENT, + /* mgs3 */ SILENT, + /* mgs4 */ SILENT, + /* mgs5 */ SILENT, + /* fg */ "color", + /* foreground */ SILENT, + /* bg */ "color", + /* background */ SILENT, + /* hl */ "color", + /* cr */ "color", +#ifndef VMS + /* display */ "^-cr", "-display ", +#else + /* display */ "^-cr", "-display ", +#endif + /* geometry */ "^-cr", "-geometry ", + /* icongeometry */ "geometry", + /* iconic */ "^-icongeometry", "-iconic", + /* font */ "^-icongeometry", "-font ", + /* pausespecial */ "string", + /* wheelunit */ "pixels", + /* mousemode */ "0|1|2", +#ifdef PS + /* postscript */ "0|1|2", +# ifdef PS_GS + /* interpreter */ "path", + /* gspalette */ "monochrome|grayscale|color", +# endif +# ifdef MAGICK + /* magick_cache */ "size[k|K|m|M|g|G]", +# endif +#endif + /* dvipspath */ "path", + /* ps2pdfpath */ "path", + /* debug */ "bitmask|string[,string ...]", + /* linkstyle */ "0|1|2|3", + /* linkcolor */ "color", + /* visitedlinkcolor */ "color", + /* browser */ "WWWbrowser", + /* anchorposition */ "anchor", + /* [end marker] */ USAGESTR_END_MARKER +}; + +static const char *SUBST_VAL[] = { "-mgs[n] " }; + +static int +compare_strings(const void *s, const void *t) +{ + const char **ss = (const char**)s; + const char **tt = (const char**)t; + + return memicmp(*ss, *tt, strlen(*tt) + 1); /* also check for final 0 */ +} + +static void +usage(int exitval) +{ + XrmOptionDescRec *opt; + const char **usageptr = usagestr; + const char **sv = SUBST_VAL; + const char *str1; + const char *str2; + const char *sorted_options[XtNumber(options)]; + char buf[256]; + char *s; + int col, n; + size_t nopt = 0, k; + + for (opt = options; opt < options + XtNumber(options); ++opt) { + str1 = opt->option; + if (*str1 != '-') + continue; + + ASSERT(*usageptr != USAGESTR_END_MARKER, "Too few elements in usageptr[]"); + + str2 = NULL; + if (opt->argKind != XrmoptionNoArg) { + str2 = *usageptr++; + if (str2 == SILENT) + continue; + if (str2 == SUBST) { + str1 = *sv++; + str2 = NULL; + } + } +#if 0 + fprintf(stderr, "str1: %s, str2: %s\n", str1, str2); +#endif + for (;;) { + if (str2 == NULL) + sprintf(buf, "[%.80s]", str1); + else + sprintf(buf, "[%.80s <%.80s>]", str1, str2); + + /* fprintf(stderr, "number of options: %d; len of usagestr: %d\n", */ + /* XtNumber(options), XtNumber(usagestr)); */ + ASSERT(nopt < XtNumber(options), "index out of range"); + /* fprintf(stderr, "sorted: %d=%s\n", nopt, buf); */ + sorted_options[nopt++] = xstrdup(buf); + + if (**usageptr != '^' || strcmp(*usageptr + 1, opt->option) != 0) + break; + ++usageptr; + str1 = *usageptr++; + str2 = NULL; + } + } + + ASSERT(*usageptr == USAGESTR_END_MARKER, "Too many elements in usageptr[]"); + + /* fprintf(stderr, "elems in sorted options: %d\n", nopt); */ + qsort((void*)sorted_options, + nopt, + sizeof(sorted_options[0]), + compare_strings); + + s = xstrdup("Usage: "); + s = xstrcat(s, XDVI_PROGNAME); /* use `xdvi' here, not `xdvik' or `xdvi-xaw.bin' or ... */ + s = xstrcat(s, " [+[]] [-h | --help] [-v | --version] [-license]"); + + col = strlen(s); + fputs(s, stdout); + + for (k = 0; k < nopt; ++k) { + n = strlen(sorted_options[k]); + if (col + n < 80) + putc(' ', stdout); + else { + fputs("\n\t", stdout); + col = 8 - 1; + } + fputs(sorted_options[k], stdout); + col += n + 1; + } + + /* put this in an extra line, to emphasize that it must come last */ + fputs("\n\t[dvi_file]\n", stdout); + + xdvi_exit(exitval); +} + + +static void +display_bug_reporting_info(void) +{ + printf("Please send bug reports, feature requests etc. to one of:\n" + " http://sourceforge.net/tracker/?group_id=23164&atid=377580\n" + " tex-k@tug.org (http://tug.org/mailman/listinfo/tex-k)\n\n" + "\n"); +} + +static void +display_licensing_info(void) +{ + fputs("Licenses: X Consortium license, GNU Library General Public\n" + "License, GNU General Public License (use option `-license'\n" + "for more details). There is NO WARRANTY of anything.\n\n", stdout); +} + +static void +display_long_licensing_info(void) +{ + fputs("The major parts of Xdvik are licensed under the X Consortium license.\n" + "Parts (encoding.c) are licensed under the GNU General Public License.\n" + "Xdvik uses the following libraries:\n" + "- The kpathsea library, licensed in part under the GNU General Public\n" + " License, in part under the GNU Library General Public License.\n" + "- t1lib, licensed in parts under the GNU Library General Public License,\n" + " in parts under the X Consortium license.\n" + "There is NO WARRANTY of anything.\n\n", stdout); +} + +static char * +is_good_dvi_file(const char *filename, Boolean from_history) +{ + static char canonical_path[MAXPATHLEN + 1]; + Boolean tried_dvi_extension = False; + /* following allocates real_filename */ + char *real_filename = find_dvi_file(filename, &tried_dvi_extension, from_history); + char *ret; + FILE *f = NULL; + dviErrFlagT errflag; + + if (real_filename == NULL) + return NULL; + + if ((ret = REALPATH(real_filename, canonical_path)) == NULL) { + /* REALPATH failed, use real_filename */ + strncpy(canonical_path, real_filename, MAXPATHLEN); + canonical_path[MAXPATHLEN] = '\0'; + ret = canonical_path; + } + free(real_filename); + + /* check for correct DVI files */ + if ((f = XFOPEN(ret, OPEN_MODE)) != NULL) { + TRACE_EVENTS((stderr, "watching: new file opened successfully.")); + if (process_preamble(f, &errflag) + && find_postamble(f, &errflag) + && read_postamble(f, &errflag, False +#if DELAYED_MKTEXPK + , False +#endif + )) { + fclose(f); + return ret; + } + fclose(f); + if (!from_history) + XDVI_FATAL((stderr, "%s: %s.", filename, get_dvi_error(errflag))); + return NULL; + } + else { + if (!from_history) + XDVI_FATAL((stderr, "Could not open `%s': %s.", filename, strerror(errno))); + return NULL; + } +} + + +static char * +get_filename_from_history(int *pageno) +{ + size_t i; + /* loop through history, trying to get a good file */ + for (i = 0; i < file_history_size(); i++) { + char *ret, *test; + + if ((test = file_history_get_elem(i, pageno)) == NULL) + return NULL; + TRACE_FILES((stderr, "HISTORY %lu: |%s|", (unsigned long)i, test)); + if ((ret = is_good_dvi_file(test, True)) != NULL) { + TRACE_FILES((stderr, "SUCCESS: |%s|", test)); + return ret; + } + } + return NULL; +} + +static void +warn_about_prerelease_versions(void) +{ + int unstable_version = 0; + if (strstr(XDVI_VERSION_INFO, "-cvs") != NULL) + unstable_version = 1; + else if (strstr(XDVI_VERSION_INFO, "-beta") != NULL) + unstable_version = 2; + + if (unstable_version > 0) { + printf("\n**********************************************************************\n"); + printf("%s version %s,\n%s version.\n\n", XDVIK_PROGNAME, XDVI_VERSION_INFO, + unstable_version == 1 ? "an unstable development" : "a beta testing"); + printf("Want a stable version instead?\n" + " -> please visit one of:\n" + " http://xdvi.sourceforge.net/cvs-upgrade.html\n" + " http://sourceforge.net/project/showfiles.php?group_id=23164\n\n" + "Found a bug?\n" + " -> please report it to:\n" + " http://sourceforge.net/tracker/?group_id=23164&atid=377580\n\n" + "Thanks for your support!\n"); + printf("**********************************************************************\n"); + } +} + +/* + Initialize internal data (most of them global ...) according to the values + of resources/command-line arguments, warning user about illegal values + etc. +*/ +static void +init_check_resources(void) +{ + size_t i; + + if (resource.mfmode != NULL) { + char *p; + + p = strrchr(resource.mfmode, ':'); + if (p != NULL) { + unsigned int len; + char *p1; + + ++p; + len = p - resource.mfmode; + p1 = xmalloc(len); + memcpy(p1, resource.mfmode, len - 1); + p1[len - 1] = '\0'; + resource.mfmode = p1; + resource.pixels_per_inch = atoi(p); + } + } + if (currwin.shrinkfactor < 0) { + XDVI_ERROR((stderr, "Invalid shrink factor: %d.", currwin.shrinkfactor)); + usage(EXIT_FAILURE); + } + if (resource.density <= 0) { + XDVI_ERROR((stderr, "Invalid shrink density: %d.", resource.density)); + usage(EXIT_FAILURE); + } + if (resource.pixels_per_inch <= 0) { + XDVI_ERROR((stderr, "Invalid dpi value: %d.", resource.pixels_per_inch)); + usage(EXIT_FAILURE); + } + if (resource.link_style < 0 || resource.link_style > 3) { + XDVI_ERROR((stderr, "Unrecognized value %d for resource \"linkstyle\" (valid range is 0 - 3); assuming 3.", + resource.link_style)); + resource.link_style = 3; + } + if (currwin.shrinkfactor > 1) { + mane.shrinkfactor = currwin.shrinkfactor; /* otherwise it's 1 */ + } + +#ifdef RGB_ANTI_ALIASING +#warning Note: RGB Anti-aliasing enabled + /* subpixel rendering */ + resource.subpixel_order = SUBPIXEL_NONE; + if (resource.sub_pixels != NULL) { + int sum; + + if (memicmp(resource.sub_pixels, "rgb", 3) == 0) + resource.subpixel_order = SUBPIXEL_RGB; + else if (memicmp(resource.sub_pixels, "bgr", 3) == 0) + resource.subpixel_order = SUBPIXEL_BGR; + else if (memicmp(resource.sub_pixels, "none", 3) == 0) + resource.subpixel_order = SUBPIXEL_NONE; + else { + XDVI_ERROR((stderr, + "Unrecognized value \"%s\" for resource subpixels\n" + "(possible values are: \"rgb\" or \"bgr\").", + resource.sub_pixels)); + xdvi_exit(EXIT_FAILURE); + } + /* get the energy distribution */ + if (resource.subpixel_order == SUBPIXEL_RGB || resource.subpixel_order == SUBPIXEL_BGR) { + const char *ptr = resource.sub_pixels + 3; + while (isspace(*ptr)) + ptr++; + fprintf(stderr, "ptr: |%s|\n", ptr); + resource.subpixel_energy[0] = 33.333; + resource.subpixel_energy[1] = 33.333; + resource.subpixel_energy[2] = 0.0; + if (*ptr != '\0') { + if (sscanf(ptr, "%f %f %f", + &(resource.subpixel_energy[0]), + &(resource.subpixel_energy[1]), + &(resource.subpixel_energy[2])) + != 3) { + XDVI_ERROR((stderr, + "Illegal color mask `%s' for resource subpixels (should be: `n n n')\n", + ptr)); + } + } + + sum = (int)(resource.subpixel_energy[0] + + 2 * resource.subpixel_energy[1] + + 2 * resource.subpixel_energy[2]); + if (sum < 99 || sum > 100) { + XDVI_WARNING((stderr, "energy values %f + 2 * %f + 2 * %f don't sum up to 100%%!\n", + resource.subpixel_energy[0], resource.subpixel_energy[1], resource.subpixel_energy[2])); + exit(1); + } + + resource.subpixel_energy[0] /= 100.0; + resource.subpixel_energy[1] /= 100.0; + resource.subpixel_energy[2] /= 100.0; + fprintf(stderr, "subpixel order: %s = %d; [%f %f %f]\n", + resource.sub_pixels, resource.subpixel_order, + resource.subpixel_energy[0], resource.subpixel_energy[1], resource.subpixel_energy[2]); + } + } +#endif + + /* margins */ + if (resource.sidemargin) + resource.sidemargin_int = atopix(resource.sidemargin, False); + if (resource.topmargin) + resource.topmargin_int = atopix(resource.topmargin, False); + resource.xoffset_int = resource.xoffset ? atopix(resource.xoffset, True) + : resource.pixels_per_inch; + resource.yoffset_int = resource.yoffset ? atopix(resource.yoffset, True) + : resource.pixels_per_inch; + + /* paper type */ + if (!set_paper_type(resource.paper)) { + const char **p; + char *helpmsg = xstrdup("Possible paper types are:\n "); + const char **paper_types = get_paper_types(); + for (p = paper_types; p < paper_types + get_paper_types_size(); p += 2) { + if (**p == '\0') { /* next line of list */ + helpmsg = xstrcat(helpmsg, "\n "); + } + else { + helpmsg = xstrcat(helpmsg, *p); + helpmsg = xstrcat(helpmsg, " "); + } + } + helpmsg = xstrcat(helpmsg, + "\n(the names ending with `r' are `rotated' or `landscape' variants).\n" + "Alternatively, you can specify the dimensions as `WIDTHxHEIGHT', followed " + "by a dimension unit (one of: pt pc in bp cm mm dd cc sp)."); + /* also dump it to stderr ... */ + fprintf(stderr, + "Unrecognized value `%s' for paper type option; using %s instead.\n%s\n", + resource.paper, DEFAULT_PAPER, helpmsg); + + popup_message(globals.widgets.top_level, + MSG_WARN, helpmsg, + "Unrecognized value `%s' for paper type option; using a4 instead.", resource.paper); + set_paper_type(DEFAULT_PAPER); + } + + /* magnifier sizes */ + for (i = 0; i < get_magglass_items(); ++i) { + if (resource.mg_arg[i] != NULL) { + char *s; + + int n = atoi(resource.mg_arg[i]); + set_magglass_widht(i, n); + set_magglass_height(i, n); + s = strchr(resource.mg_arg[i], 'x'); + if (s != NULL) { + set_magglass_height(i, atoi(s + 1)); + if (get_magglass_height(i) <= 0) + set_magglass_widht(i, 0); + } + } + } + +#ifdef PS + if (resource.safer) { + resource.allow_shell = False; +# ifdef PS_GS + resource.gs_safer = True; +# endif /* PS_GS */ + } +# ifdef PS_GS + { + const char *CGMcgm = "CGMcgm"; + const char *cgmp; + + cgmp = strchr(CGMcgm, resource.gs_palette[0]); + if (cgmp == NULL) + XDVI_FATAL((stderr, "Invalid value %s for gs palette option", resource.gs_palette)); + if (cgmp >= CGMcgm + 3) { + static char gsp[] = "x"; + + gsp[0] = *(cgmp - 3); + resource.gs_palette = gsp; + } + } +# endif /* PS_GS */ +#endif /* PS */ + + /* The old `-expert' flag overrides resource.expert_mode, `+expert' (or not + setting it) just uses expert_mode. + */ + if (resource.expert) + resource.expert_mode = XPRT_SHOW_NONE; + /* fprintf(stderr, "++++++++ initializing resource.expert_mode: %d\n", resource.expert_mode); */ + update_expert_mode(); + + if (resource.hush) { + resource.hush_chars = resource.hush_chk = resource.hush_stdout = resource.hush_bell = True; + } +} + +/* + a custom error handler that makes it easier to catch X errors in the debugger + (by setting a breakpoint to this function, plus using the -sync option). + Also, Motif sometimes gives non-fatal errors that we want to ignore ... +*/ +static int +x_error_handler(Display *display, XErrorEvent *error) +{ + char buf[1024], req_buf[1024]; + + if (error->request_code < 128) { + char num[LENGTH_OF_INT]; + sprintf(num, "%d", error->request_code); + XGetErrorDatabaseText(display, "XRequest", num, "", req_buf, 1024); + } + else { + req_buf[0] = '\0'; + } + + XGetErrorText(display, error->error_code, buf, sizeof buf); + /* XtCloseDisplay(DISP); */ + if (error->error_code == BadWindow + || error->error_code == BadPixmap + || error->error_code == BadCursor + || error->error_code == BadFont + || error->error_code == BadDrawable + || error->error_code == BadColor + || error->error_code == BadGC + || error->error_code == BadIDChoice + || error->error_code == BadValue + || error->error_code == BadAtom) { + XDVI_WARNING((stderr, "X protocol error: %s\n X Request %d (%s), Value=0x%x.", + buf, error->request_code, req_buf, (unsigned int)error->resourceid)); + } + else { + XDVI_WARNING((stderr, "X protocol error: %s\n X Request %d (%s).", + buf, error->request_code, req_buf)); + } + return 0; +} + +static void +display_version_info(void) +{ + printf("%s version %s ", XDVIK_PROGNAME, XDVI_VERSION); +#ifdef MOTIF + printf("(%s, runtime version %d.%d)\n", + /* XmVERSION, XmREVISION, XmUPDATE_LEVEL, */ + XmVERSION_STRING, + xmUseVersion / 1000, xmUseVersion % 1000); +#else + printf("%s\n", XDVI_GUI); +#endif + printf("Libraries: %s, T1lib version %s\n", kpathsea_version_string, T1LIB_VERSIONSTRING); +} + + +static void +check_early_arguments(int argc, char **argv) +{ + /* This checks arguments that need to work before the X machinery is + * started (e.g. if no display is available, or for information that is + * needed before the X defaults are evaluated), so the `options' structure + * can't be used for them. + * + * We need to loop through all arguments in case xdvi is aliased, + * or called via a shell script (like in teTeX) that adds things + * like `-name' at the beginning of the arglist. + */ + int i; + Boolean install_err_handler = True; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-help") == 0 + || strcmp(argv[i], "-h") == 0 + || strcmp(argv[i], "+help") == 0 + || strcmp(argv[i], "--help") == 0) { + printf("%s version %s\n", XDVIK_PROGNAME, XDVI_VERSION_INFO); + printf("A DVI file previewer for the X window system.\n\n"); + display_licensing_info(); + display_bug_reporting_info(); + usage(0); + } + else if (strcmp(argv[i], "-license") == 0) { + display_long_licensing_info(); + xdvi_exit(EXIT_SUCCESS); + } + else if (strcmp(argv[i], "--version") == 0 + || strcmp(argv[i], "-version") == 0 + || strcmp(argv[i], "-v") == 0) { + display_version_info(); + xdvi_exit(EXIT_SUCCESS); + } + else if (strcmp(argv[i], "--default-xerr-handler") == 0) { /* hook to disable custom handler */ + install_err_handler = False; + } + } + + if (install_err_handler) { + (void)XSetErrorHandler(x_error_handler); + } +} + +/* initialize global variables with default values. */ +static void +init_globals(void) { + globals.program_name = NULL; + globals.dvi_name = NULL; + globals.cwd = xgetcwd(); + globals.orig_locale = NULL; + globals.debug = 0L; + globals.pageno_correct = 1; + + globals.curr_paper = NULL; + globals.curr_editor = NULL; + globals.curr_browser = NULL; + + globals.ev.flags = EV_IDLE; + globals.ev.ctr = 0; + + globals.pausing.num = 0; + globals.pausing.num_save = NULL; + globals.pausing.flag = False; + + globals.win_expose.min_x = 0; + globals.win_expose.max_x = 0; + globals.win_expose.min_y = 0; + globals.win_expose.max_y = 0; + + globals.gc.rule = NULL; + globals.gc.fore = NULL; + globals.gc.inverted = NULL; + globals.gc.high = NULL; + globals.gc.linkcolor = NULL; + globals.gc.visited_linkcolor = NULL; + globals.gc.fore2 = NULL; + globals.gc.fore2_bak = NULL; + globals.gc.fore2_bak1 = NULL; + globals.gc.copy = NULL; + globals.gc.ruler = NULL; + + globals.gc.do_copy = False; + + globals.cursor.flags = 0; + + globals.src.fwd_box_page = -1; /* -1 means no box */ + globals.src.fwd_string = NULL; + + globals.widgets.top_level = 0; + globals.widgets.draw_widget = 0; + globals.widgets.draw_background = 0; + globals.widgets.clip_widget = 0; + globals.widgets.x_bar = 0; + globals.widgets.y_bar = 0; +#ifdef MOTIF + globals.widgets.main_window = 0; + globals.widgets.main_row = 0; + globals.widgets.tool_bar = 0; + globals.widgets.top_row = 0; + globals.widgets.menu_bar = 0; +#else + globals.widgets.vport_widget = 0; + globals.widgets.form_widget = 0; + globals.widgets.paned = 0; +#endif + + globals.page.w = 0; + globals.page.h = 0; + globals.page.unshrunk_w = 0; + globals.page.unshrunk_h = 0; + + globals.dvi_file.dirname = NULL; + globals.dvi_file.dirlen = 0; + globals.dvi_file.bak_fp = NULL; + globals.dvi_file.time = 0; + +#if defined(LESSTIF_VERSION) + globals.broken_motif_event_handling = True; +#elif defined(MOTIF) /* was: && XmVersion <= 1002 - better use runtime information:*/ + if (xmUseVersion <= 1002) + globals.broken_motif_event_handling = True; + else + globals.broken_motif_event_handling = False; +#else + globals.broken_motif_event_handling = False; +#endif + +} + + +#ifdef GREY +/* + * Convert string to yes/no/maybe. Adapted from the X toolkit. + */ + +static Boolean +XdviCvtStringToBool3(Display *dpy, + XrmValuePtr args, Cardinal *num_args, + XrmValuePtr fromVal, XrmValuePtr toVal, + XtPointer *closure_ret) +{ + String str = (String) fromVal->addr; + static Bool3 value; + + UNUSED(args); + UNUSED(num_args); + UNUSED(closure_ret); + + if (memicmp(str, "true", 5) == 0 + || memicmp(str, "yes", 4) == 0 + || memicmp(str, "on", 3) == 0 || memicmp(str, "1", 2) == 0) + value = True; + + else if (memicmp(str, "false", 6) == 0 + || memicmp(str, "no", 3) == 0 + || memicmp(str, "off", 4) == 0 || memicmp(str, "0", 2) == 0) + value = False; + + else if (memicmp(str, "maybe", 6) == 0) + value = Maybe; + + else { + XtDisplayStringConversionWarning(dpy, str, XtRBoolean); + return False; + } + + if (toVal->addr != NULL) { + if (toVal->size < sizeof(Bool3)) { + toVal->size = sizeof(Bool3); + return False; + } + *(Bool3 *) (toVal->addr) = value; + } + else + toVal->addr = (XPointer) & value; + + toVal->size = sizeof(Bool3); + return True; +} +#endif + +/* +************************************************************ +************************************************************ +main routine +************************************************************ +************************************************************ +*/ + +int +main(int argc, char **argv) +{ + int i; + static struct startup_info info; + const char *file_name = NULL; + const char *file_name2 = NULL; + + /* Hack to have command-line options override ~/.xdvirc stuff: + * Parse and merge them again from argv_bak, a copy of the command-line options, + * via XrmParseCommand(). I think the only alternative would be to merge in all + * resources manually instead of using XtInitialize(), similar to what's done in gv, + * but that looks like too much trouble. + */ +#define COMMANDLINE_OVERRIDE_HACK 1 + +#if COMMANDLINE_OVERRIDE_HACK + int argc_bak; + char **argv_bak; +#endif + + setup_signal_handlers(True); /* catch USR1 early */ + + info.file_idx = 0; + info.page_arg = NULL; + + /* BEGIN_TIMER_LOOP; */ + + init_globals(); + + /* + * Step 1: Process command-line options and resources. + */ + + globals.program_name = xstrdup(argv[0]); + { /* get filename from program_name if it contains a path */ + char sep; + char *ptr; +#ifdef VMS + sep = ']'; +#else + sep = '/'; +#endif + if ((ptr = strrchr(globals.program_name, sep)) != NULL) { + globals.program_name = ++ptr; + } +#ifdef VMS + if ((ptr = strchr(globals.program_name, '.')) != NULL) + *ptr = '\0'; +#endif + } + +#if COMMANDLINE_OVERRIDE_HACK + /* create a copy of argv[] */ + argc_bak = argc; + argv_bak = xmalloc((1 + argc_bak) * sizeof *argv_bak); + for (i = 0; i < argc_bak; i++) { + argv_bak[i] = xstrdup(argv[i]); + } + argv_bak[i] = NULL; +#endif + + /* + Arguments that need to be checked early, like `help', `version' and `sync'. + The former don't even require an X connection. + */ + check_early_arguments(argc, argv); + + warn_about_prerelease_versions(); + + /* We need to set up SIGALRM before calling XtAppAddTimeOut() (inside sfSelFile, or + called from XtInitialize() in Motif), otherwise we'll die with the error message + `Alarm clock'. However, we mustn't install SIGPOLL before the forking is done + below, otherwise xdvi may hang forever waiting for input. So the signal handler setup + is split in 2 parts: setup_sigalarm(), and setup_signal_handlers() below. + */ + setup_sigalarm(); + + /* get the debug value (if any) from the environment + (it's too early to get it from the command line) */ + globals.debug = parse_debugging_option(getenv("XDVIDEBUG")); + + /* to make input of non-latin characters work */ + XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); + + globals.widgets.top_level = XtInitialize(globals.program_name, "XDvi", options, XtNumber(options), + &argc, argv); + + globals.app = XtWidgetToApplicationContext(globals.widgets.top_level); + + XtAppAddActions(globals.app, get_actions(), get_num_actions()); + + /* create_magnifier(); */ + + if ((globals.orig_locale = setlocale(LC_ALL, "")) != NULL) + globals.orig_locale = xstrdup(globals.orig_locale); /* note: never free'd */ + else /* fallback */ + globals.orig_locale = xstrdup(setlocale(LC_ALL, NULL)); + + /* Override LC_NUMERIC, otherwise sscanf(), strtod() etc. won't work for floats + inside specials for locales like LANG=de_DE which uses `,' instead of `.' as + decimal separator. (Strangely, using + LC_CTYPE | LC_COLLATE + doesn't work?) + Regression: + xdvik/regression/special-pics/pictest.dvi + */ + setlocale(LC_NUMERIC, "C"); + + /* at this point, all known options will have been consumed; so the + only ones remaining should be: +pageno, and the dvi name. Exit with + usage message if this is not the case. The convention is that the last + argument is always treated as filename (even if it starts with '-'), + so we throw an error if there's more than one unknown argument at the end. + */ + for (i = 1; i < argc; i++) { /* skip argv[0] */ + if (*(argv[i]) == '+') { + if (info.page_arg != NULL) { + XDVI_ERROR((stderr, "Unrecognized option `%s'.", argv[i])); + usage(EXIT_FAILURE); + } + else { + info.page_arg = argv[i] + 1; + } + } + else if (file_name == NULL) { + file_name = xstrdup(argv[i]); /* leaks, but never mind ... */ + } + else { + /* we had already seen a filename */ + XDVI_ERROR((stderr, "Unrecognized option `%s'.", argv[i - 1])); /* safe because we started at argv[1] */ + usage(EXIT_FAILURE); + } + } + + DISP = XtDisplay(globals.widgets.top_level); + SCRN = XtScreen(globals.widgets.top_level); + +#ifdef GREY + XtSetTypeConverter(XtRString, XtRBool3, XdviCvtStringToBool3, + NULL, 0, XtCacheNone, NULL); +#endif + +#ifdef MOTIF + /* we'll take care of that ourselves */ + XtVaSetValues(globals.widgets.top_level, XmNdeleteResponse, XmDO_NOTHING, NULL); + + { + /* Hack to work around #884290 (drag&drop freezes file selector, see comment + in xm_filesel.c): Disable drag&drop altogether (we don't need it). + Could also be done via Xdefaults as follows: + XDvi*dragInitiatorProtocolStyle: XmDRAG_NONE + XDvi*dragReceiverProtocolStyle: XmDRAG_NONE + */ + Widget display = XmGetXmDisplay(DISP); + XtVaSetValues(display, + XmNdragInitiatorProtocolStyle, XmDRAG_NONE, + XmNdragReceiverProtocolStyle, XmDRAG_NONE, + NULL); + } +#else + G_accels_cr = XtParseAcceleratorTable("Return:set()notify()unset()\n" + "q:set()notify()unset()\n" + "Escape: set()notify()unset()"); +#endif + + /* get the no_init_file resource first: This needs to be done + * before the call to XtGetApplicationResources() below, which populates + * the `resource' struct with the actual application resources (which + * may be merged from ~/.xdvirc). */ + XtGetApplicationResources(globals.widgets.top_level, (XtPointer)&resource, + xdvirc_resources, XtNumber(xdvirc_resources), + (ArgList)NULL, 0); + + if (!resource.no_init_file) { /* Read user preferences from ~/.xdvirc. */ + read_user_preferences(globals.widgets.top_level, ".xdvirc"); + } + +#if COMMANDLINE_OVERRIDE_HACK /* see above */ + { + XrmDatabase cmdline_db = XrmGetDatabase(DISP); + XrmParseCommand(&cmdline_db, options, XtNumber(options), + "xdvi", &argc_bak, argv_bak); + + for (i = 0; i < argc_bak; i++) { + free(argv_bak[i]); + } + free(argv_bak); + argc_bak = 0; + } +#endif /* COMMANDLINE_OVERRIDE_HACK */ + + load_app_resources(False); + + /* musn't do this, 0 is 'fit to window' (bug #1454648) */ + /* if (resource.shrinkfactor == 0) /\* protect against division by 0 *\/ */ + /* resource.shrinkfactor = 1; */ + currwin.shrinkfactor = resource.shrinkfactor; + globals.curr_use_color = resource.use_color; + globals.curr_gamma = resource.gamma; + globals.curr_paper = xstrdup(resource.paper); /* never free()d */ + globals.curr_editor = NULL; + globals.curr_browser = NULL; + globals.curr_mode = NO_MODE_ACTIVE; + + /* Initialize `globals.debug' as early as possible. Note: earlier + * calls to TRACE_* or tests for `if (globals.debug)' will only work if the + * XDVIDEBUG environment variable is set! + */ + globals.debug |= parse_debugging_option(resource.debug_arg); + kpathsea_debug = globals.debug / DBG_STAT; + + if (globals.debug) + fprintf(stderr, "KPATHSEA_DEBUG = %d\n", kpathsea_debug); + + kpse_init_prog("XDVI", resource.pixels_per_inch, resource.mfmode, resource.alt_font); + + kpse_set_program_name(argv[0], "xdvi"); + + + if (globals.debug & DBG_EXPAND) { + const char *texmfcnf = kpse_path_expand("$TEXMFCNF"); + const char *texmfmain = kpse_path_expand("$TEXMFMAIN"); + fprintf(stderr, "\n%s:%d: KPATHSEA variables:\n", __FILE__, __LINE__); + fprintf(stderr, "%s:%d: SELFAUTOLOC=\"%s\"\n", __FILE__, __LINE__, getenv("SELFAUTOLOC")); + fprintf(stderr, "%s:%d: SELFAUTODIR=\"%s\"\n", __FILE__, __LINE__, getenv("SELFAUTODIR")); + fprintf(stderr, "%s:%d: SELFAUTOPARENT=\"%s\"\n", __FILE__, __LINE__, getenv("SELFAUTOPARENT")); + fprintf(stderr, "%s:%d: TEXMFCNF=\"%s\"\n", __FILE__, __LINE__, texmfcnf); + fprintf(stderr, "%s:%d: TEXMFMAIN=\"%s\"\n\n", __FILE__, __LINE__, texmfmain); + } + + if (resource.regression) { + /* currently it just turns on everything; what we'd like here is + output that's usable for automatic diffs (e.g. independent + of window manager state) */ + globals.debug = DBG_ALL; + } + + /* Check early for whether to pass off to a different xdvi process + * (-sourceposition argument for reverse source special lookup). + */ + property_initialize(); + +#if 0 /* def RGB_ANTI_ALIASING */ + /* error checking and setting of resources according to command line arguments */ + if (resource.sub_pixels != NULL && memicmp(resource.sub_pixels, "unknown", 4) == 0) { +#ifdef __GNUC__ +#warning TODO: implement callbacks +#endif + choice_dialog_sized(globals.widgets.top_level, + MSG_QUESTION, + SIZE_MEDIUM, + NULL, +#ifndef MOTIF + NULL, /* TODO: xaw ret_action_str */ +#endif + NULL, NULL, /* pre callback */ + "Enable", NULL, NULL, + "Disable", NULL, NULL, + "This version of xdvi can optimize the anti-aliased font display " + "when running on an LCD monitor, such as a notebook screen or a TFT flat screen." + "\n\n" + "If you are using such a monitor, click `Enable' to enable optimized display; otherwise click `Disable'." + "\n\n" + "You can change this setting later via the Menu `Options -> Anti-Aliasing'."); + /* enter event loop */ + do_pages(); + } + else { +#endif + init_check_resources(); + + TRACE_FILES((stderr, "file history: |%s|", resource.file_history)); + file_history_init(); + +#if !DELAYED_MKTEXPK + /* Notify users that fonts might be created. This is just a hack + and no replacement for true asynchronous font creation since it + doesn't give details (is just invoked if startup takes somewhat + longer) and freezes during font creation. + */ +/* register_font_popup(); */ +#endif + + if (file_name == NULL) { /* no filename argument */ + + if (resource.no_file_arg_use_history) { + static char buf[LENGTH_OF_INT]; /* so that we can pass its address */ + int pageno; + if ((file_name = get_filename_from_history(&pageno)) != NULL) { + SNPRINTF(buf, LENGTH_OF_INT, "%d", pageno + 1); /* pageno is 0-based */ + info.page_arg = buf; + } + } + + TRACE_FILES((stderr, "got from history: |%s|", file_name)); + + if (file_name != NULL) { + run_dvi_file(file_name, &info); + } + else { /* get filename from file selector */ + /* static so that we can pass its address */ + static struct filesel_callback cb = { + NULL, NULL, "Xdvi: Open file", "Open file:", "OK", "Cancel", + NULL, "*.dvi", True, True, NULL, NULL + }; + cb.func_ptr = run_dvi_file; + cb.data = &info; + cb.browse_fname = xt_strdup(globals.cwd); + + if (cb.shell == NULL) + cb.shell = XsraSelFile(globals.widgets.top_level, &cb); + XsraSelFilePopup(&cb); + /* enter event loop */ + do_pages(); + } + } + else if ((file_name2 = is_good_dvi_file(file_name, False)) != NULL) { + run_dvi_file(file_name2, &info); + } +#if 0 /* def RGB_ANTI_ALIASING */ + } +#endif + /* notreached */ + return 0; +} diff --git a/Build/source/texk/xdvik/mime.c b/Build/source/texk/xdvik/mime.c index 1f1e13ee282..60655f8a6eb 100644 --- a/Build/source/texk/xdvik/mime.c +++ b/Build/source/texk/xdvik/mime.c @@ -16,23 +16,23 @@ Rewritten by Stefan Ulrich on 2003/03/25 for better RFC 1343 conformance. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @@ -54,10 +54,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* default settings if $EXTENSIONMAPS and $MAILCAPS is not set */ static const char *const DEFAULT_EXTENSIONMAPS = - "$HOME/.mime.types:/etc/mime.types:/usr/etc/mime.types:/usr/local/etc/mimetypes"; +"$HOME/.mime.types:/etc/mime.types:/usr/etc/mime.types:/usr/local/etc/mimetypes"; static const char *const DEFAULT_MAILCAPS = - "$HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"; +"$HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"; struct mime_map { char *content_type; @@ -444,7 +444,7 @@ parsemimes(void) Currently not implemented: - specifiers %t, %{xyz}, %n, %F - realplayer's %u is treated as %s (couldn't find any documentation on %u) - */ +*/ static void parsemailcap(void) { diff --git a/Build/source/texk/xdvik/my-snprintf.c b/Build/source/texk/xdvik/my-snprintf.c index be70b4b8ef1..5fa9ac96798 100644 --- a/Build/source/texk/xdvik/my-snprintf.c +++ b/Build/source/texk/xdvik/my-snprintf.c @@ -47,13 +47,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *------------------------------------------------------------*/ int my_snprintf(char *str, size_t size, const char *format, ...) { - va_list args; - int retVal; + va_list args; + int retVal; - va_start(args, format); - retVal = VSNPRINTF(str, size, format, args); - va_end(args); + va_start(args, format); + retVal = VSNPRINTF(str, size, format, args); + va_end(args); - return retVal; + return retVal; } #endif diff --git a/Build/source/texk/xdvik/my-vsnprintf.c b/Build/source/texk/xdvik/my-vsnprintf.c index dc2b9b7603c..b5db0dfb83e 100644 --- a/Build/source/texk/xdvik/my-vsnprintf.c +++ b/Build/source/texk/xdvik/my-vsnprintf.c @@ -51,7 +51,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *------------------------------------------------------------*/ int -my_vsnprintf(char *buf, int len, const char *format, va_list argp) +my_vsnprintf(char *buf, size_t len, const char *format, va_list argp) { int pipe_fd[2]; FILE *fd; @@ -59,7 +59,9 @@ my_vsnprintf(char *buf, int len, const char *format, va_list argp) #ifdef DEBUG printf("=============my_vsnprintf called!\n"); #endif - len--; /* for the trailing '\0' */ + if (len > 0) { + len--; /* for the trailing '\0' */ + } /* create a pipe for reading/writing */ if (xpipe(pipe_fd) == -1) { @@ -70,17 +72,23 @@ my_vsnprintf(char *buf, int len, const char *format, va_list argp) perror("my_vsnprintf: fdopen"); xdvi_exit(EXIT_FAILURE); } - /* instead of setting fd to non-buffering, flush it explicitly: */ - /* setvbuf(fd, NULL, _IONBF, BUFSIZ); */ + /* instead of setting fd to non-buffering: + setvbuf(fd, NULL, _IONBF, BUFSIZ); + flush it explicitly: */ size = vfprintf(fd, format, argp); fflush(fd); - /* wrote less characters than len -> adjust len for the subsequent read */ - if (size < len) { - len = size; + /* according to C99, buf may be NULL, in which case + just return correct number of chars. Also, don't + write anything if there had been an output error. */ + if (buf != NULL && size >= 0) { + /* wrote less characters than len -> adjust len for the subsequent read */ + if ((size_t)size < len) { + len = size; + } + read(pipe_fd[0], buf, len); + buf[len] = '\0'; /* always null-terminate */ } - read(pipe_fd[0], buf, len); - buf[len] = '\0'; /* always null-terminate */ fclose(fd); close(pipe_fd[0]); diff --git a/Build/source/texk/xdvik/my-vsnprintf.h b/Build/source/texk/xdvik/my-vsnprintf.h index a68ce8a9746..f25b277c0bf 100644 --- a/Build/source/texk/xdvik/my-vsnprintf.h +++ b/Build/source/texk/xdvik/my-vsnprintf.h @@ -37,7 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include /* for pipe() */ #include "util.h" /* for xpipe() etc. */ -extern int my_vsnprintf(char *, int, const char *, va_list); +extern int my_vsnprintf(char *, size_t, const char *, va_list); #define VSNPRINTF(buf, len, format, args) my_vsnprintf(buf, len, format, args) #endif /* HAVE_VSNPRINTF && HAVE_GOOD_VSNPRINTF */ diff --git a/Build/source/texk/xdvik/pagehist.c b/Build/source/texk/xdvik/pagehist.c index e3ba0e7e0de..399cb7c16f4 100644 --- a/Build/source/texk/xdvik/pagehist.c +++ b/Build/source/texk/xdvik/pagehist.c @@ -18,7 +18,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ /* Very simple page history (i.e. stack of visited pages) for xdvik @@ -27,6 +27,7 @@ #include "xdvi-config.h" #include "xdvi.h" #include "util.h" +#include "dl_list.h" #include "string-utils.h" #include "events.h" #include "dvi-init.h" @@ -118,6 +119,11 @@ page_history_show_statusline(struct dl_list *head, #if DEBUG fprintf(stderr, "tot_len: %d, curr_pos: %d\n", tot_len, curr_pos); #endif + + if (!(resource.expert_mode & XPRT_SHOW_STATUSLINE)) { + /* too distracting for stdout */ + return; + } if (head == NULL){ strcpy(ptr, "Page history empty."); @@ -133,7 +139,7 @@ page_history_show_statusline(struct dl_list *head, /* need to truncate, try to make first and second chunk around current position of same length */ int good_pos = HISTORY_MAX_CONTEXT / 2.0 + 0.5; while (curr_pos > good_pos /* && */ -/* m_page_history_length - m_page_history_currpos > good_pos */) { + /* m_page_history_length - m_page_history_currpos > good_pos */) { #if DEBUG fprintf(stderr, "%d > %d; %d > %d\n", curr_pos, good_pos, m_page_history_length - m_page_history_currpos, good_pos); @@ -198,7 +204,9 @@ page_history_show_statusline(struct dl_list *head, } if (head == curr) { - ASSERT(m_page_history_currpos == n + 1, "Consistency check for pagelist position failed!"); + xdvi_assert(XDVI_VERSION_INFO, __FILE__, __LINE__, + m_page_history_currpos == n + 1, + "%d == %d + 1", m_page_history_currpos, n); sprintf(ptr, " [%d]", item->pageno + 1); ptr += 3 + length_of_int(item->pageno + 1); } @@ -210,15 +218,15 @@ page_history_show_statusline(struct dl_list *head, #if DEBUG fprintf(stderr, "Statusline string: |%s|; printed len: %d\n", history, printed_len); #endif - statusline_print(STATUS_LONG, "%s %s", history, msg ? msg : ""); + statusline_info(STATUS_MEDIUM, "%s %s", history, msg ? msg : ""); #undef HIST_LEN } static void -goto_location(const char *filename, int pageno) +goto_location(const char *filename) { #if DEBUG - fprintf(stderr, "going to page %d of file %s\n", pageno, filename); + fprintf(stderr, "going to file %s\n", filename); #endif if (strcmp(globals.dvi_name, filename) != 0) { /* it's a different file */ Boolean tried_dvi_ext = True; @@ -239,10 +247,15 @@ goto_location(const char *filename, int pageno) } else { dviErrFlagT errflag; - if (load_dvi_file(True, &errflag)) { + if (load_dvi_file( +#if !DELAYED_MKTEXPK + True, +#endif + &errflag)) { set_dvi_name(new_dvi_name); globals.ev.flags |= EV_NEWDOC; + globals.ev.flags |= EV_PAGEHIST_GOTO_PAGE; #if DEBUG fprintf(stderr, "Back to file: \"%s\"\n", globals.dvi_name); #endif @@ -255,7 +268,11 @@ goto_location(const char *filename, int pageno) /* "Removing this file from the history." */, globals.dvi_name, get_dvi_error(errflag)); - if (!internal_open_dvi(globals.dvi_name, &errflag, True)) { + if (!internal_open_dvi(globals.dvi_name, &errflag, True +#if DELAYED_MKTEXPK + , True +#endif + )) { popup_message(globals.widgets.top_level, MSG_ERR, NULL, @@ -270,15 +287,8 @@ goto_location(const char *filename, int pageno) } } } - if (pageno != current_page) { - if (pageno < total_pages) { - goto_page(pageno, resource.keep_flag ? NULL : home, False); - } - else { - XDVI_WARNING((stderr, "Could not go to page %d (file has shrunken)", pageno)); - statusline_print(STATUS_MEDIUM, - "Could not go to page %d (file has shrunken)", pageno); - } + else { + globals.ev.flags |= EV_PAGEHIST_GOTO_PAGE; } } @@ -311,7 +321,7 @@ void page_history_move(int n) if (m_page_history != NULL) pos = m_page_history->prev; if (pos == NULL) { - XBell(DISP, 0); + xdvi_bell(); msg = " - at begin of page history."; break; } @@ -326,7 +336,7 @@ void page_history_move(int n) if (m_page_history != NULL) pos = m_page_history->next; if (pos == NULL) { - XBell(DISP, 0); + xdvi_bell(); msg = " - at end of page history."; break; } @@ -340,7 +350,7 @@ void page_history_move(int n) #if DEBUG fprintf(stderr, "going to page %d\n", item->pageno); #endif - goto_location(m_filename_list[item->file_idx], item->pageno); + goto_location(m_filename_list[item->file_idx]); #if defined(MOTIF) && HAVE_XPM tb_set_pagehist_back_sensitivity(m_page_history->prev != NULL); @@ -352,6 +362,12 @@ void page_history_move(int n) page_history_update_toolbar_navigation(); } +int +page_history_get_page(void) +{ + return ((struct page_history *)m_page_history->item)->pageno; +} + /* add page n to the page history */ void page_history_insert(int n) { @@ -451,13 +467,13 @@ page_history_clear() page_history_show_statusline(m_page_history_head, m_page_history, NULL); } -/* for (curr = m_page_history; curr != NULL && curr->next != NULL; curr = pos) { */ -/* pos = curr->next; */ -/* free(curr->item); */ -/* (void)dl_list_remove_item(&curr); */ -/* m_page_history_length--; */ -/* page_history_show(m_page_history_head, m_page_history); */ -/* } */ + /* for (curr = m_page_history; curr != NULL && curr->next != NULL; curr = pos) { */ + /* pos = curr->next; */ + /* free(curr->item); */ + /* (void)dl_list_remove_item(&curr); */ + /* m_page_history_length--; */ + /* page_history_show(m_page_history_head, m_page_history); */ + /* } */ } @@ -498,7 +514,7 @@ void page_history_delete(int n) if (m_page_history != NULL) pos = m_page_history->prev; if (pos == NULL) { - XBell(DISP, 0); + xdvi_bell(); msg = " - at begin of page history."; break; } @@ -517,7 +533,7 @@ void page_history_delete(int n) if (m_page_history != NULL) pos = m_page_history->next; if (pos == NULL) { - XBell(DISP, 0); + xdvi_bell(); msg = " - at end of page history."; break; } @@ -540,7 +556,7 @@ void page_history_delete(int n) #if DEBUG fprintf(stderr, "going to page %d\n", item->pageno); #endif - goto_location(m_filename_list[item->file_idx], item->pageno); + goto_location(m_filename_list[item->file_idx]); page_history_show(m_page_history_head, m_page_history); page_history_show_statusline(m_page_history_head, m_page_history, msg); } diff --git a/Build/source/texk/xdvik/pagehist.h b/Build/source/texk/xdvik/pagehist.h index 2b23b1a4261..ee21eaaf48a 100644 --- a/Build/source/texk/xdvik/pagehist.h +++ b/Build/source/texk/xdvik/pagehist.h @@ -28,6 +28,7 @@ extern void page_history_insert(int n); extern void page_history_delete(int n); extern void page_history_update_toolbar_navigation(void); extern void page_history_clear(void); +extern int page_history_get_page(void); #endif /* PAGEHIST_H_ */ diff --git a/Build/source/texk/xdvik/pk.c b/Build/source/texk/xdvik/pk.c index 4ef0170ae48..b43d51c5c99 100644 --- a/Build/source/texk/xdvik/pk.c +++ b/Build/source/texk/xdvik/pk.c @@ -21,8 +21,8 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTE: - xdvi is based on prior work, as noted in the modification history - in xdvi.c. +xdvi is based on prior work, as noted in the modification history +in xdvi.c. \*========================================================================*/ diff --git a/Build/source/texk/xdvik/print-internal.c b/Build/source/texk/xdvik/print-internal.c index c47ab73ed84..e20c266dc9f 100644 --- a/Build/source/texk/xdvik/print-internal.c +++ b/Build/source/texk/xdvik/print-internal.c @@ -35,7 +35,7 @@ * the caller may be executed *before* the child has finished. (Note * e.g. how unlink()ing the temporary PS file is done inside * ps2pdf_exited() and not in the callers). This is the reason why we - * often need to pass information to the subprocess (via a data `void *'). + * often need to pass information to the subprocess via a data pointer. */ #include "xdvi-config.h" @@ -83,17 +83,20 @@ static struct xchild print_child = {NULL, 0, True, "dvips", NULL, NULL, NULL }; -static char *read_from_dvips(int); +static char *read_from_dvips(int, void *); + static struct xio print_xio = { NULL, 0, XIO_IN, #if HAVE_POLL NULL, #endif read_from_dvips, - NULL /* write proc - not needed */ + NULL, /* write proc - not needed */ + NULL /* data */ }; -static void dvips_alarm(struct xtimer *); -static struct xtimer dvips_timer = {NULL, {0, 0}, XTM_DEFAULT, dvips_alarm +static void dvips_alarm(struct xtimer *this, void *data); + +static struct xtimer dvips_timer = {NULL, {0, 0}, XTM_DEFAULT, dvips_alarm, NULL #if XDVI_XT_TIMER_HACK , NULL, NULL #endif @@ -119,36 +122,42 @@ static const int DVIPS_STAT_WAIT = 2; */ static void -fork_dvips(char **argv, const struct select_pages_info *pinfo, childProcT proc) +fork_dvips(char **argv, struct save_or_print_info *info, childProcT proc) { int print_io[2]; int i; - const struct file_info *finfo = pinfo->finfo; + struct file_info *finfo = info->finfo; /* printlog_append(argv[0], strlen(argv[0])); */ FILE *fout = NULL; - if (finfo->ps_out.fname != NULL) { - /* printing to PS file, open file for writing */ - if ((fout = XFOPEN(finfo->ps_out.fname, "w")) == NULL) { + if (info->act == FILE_SAVE || info->print_target == TO_FILE) { /* printing to PS file, open file for writing */ + const char *out_file; + + if (info->print_target == TO_FILE || info->fmt == FMT_PS) + out_file = finfo->out_file; + else + out_file = finfo->tmp_ps_file; + + if ((fout = XFOPEN(out_file, "w")) == NULL) { popup_message(globals.widgets.top_level, MSG_ERR, NULL, "Could not open %s for writing: %s.", - finfo->ps_out.fname, + out_file, strerror(errno)); return; } } - printlog_popup(); + printlog_popup(info); - printlog_append_str("Calling: `"); - printlog_append_str(argv[0]); + printlog_append_str(info, "Calling: `"); + printlog_append_str(info, argv[0]); for (i = 1; argv[i] != NULL; i++) { - printlog_append_str(" "); - printlog_append_str(argv[i]); + printlog_append_str(info, " "); + printlog_append_str(info, argv[i]); } - printlog_append_str("'\n"); + printlog_append_str(info, "'\n"); if (xpipe(print_io) != 0) { perror("[xdvi] pipe"); @@ -165,7 +174,7 @@ fork_dvips(char **argv, const struct select_pages_info *pinfo, childProcT proc) print_child.name = xstrdup(argv[0]); print_child.proc = proc; - print_child.data = (void *)pinfo; + print_child.data = info; print_child.pid = fork(); if (print_child.pid == 0) { /* if child */ /* change into dir of DVI file so that included image files etc. are found */ @@ -174,16 +183,16 @@ fork_dvips(char **argv, const struct select_pages_info *pinfo, childProcT proc) if (globals.debug & DBG_FILES) { char path[MAXPATHLEN]; getcwd(path, MAXPATHLEN); - fprintf(stderr, "Directory of running `%s': `%s'\n", - argv[0], path); + /* fprintf(stderr, "Directory of running `%s': `%s'\n", argv[0], path); */ } /* make the input file pointer the STDIN of the dvips process */ - if (finfo->dvi_tmp.fp != NULL) { /* printing selected pages from temporary file */ - (void)dup2(fileno(finfo->dvi_tmp.fp), STDIN_FILENO); + if (info->page_selection == PAGE_MARKED) { /* printing selected pages from temporary file */ + ASSERT(finfo->tmp_dvi_fp != NULL, "tmp fp mustn't be NULL!"); + (void)dup2(fileno(finfo->tmp_dvi_fp), STDIN_FILENO); } else { /* printing from main or backup file */ - (void)dup2(fileno(finfo->dvi_in.fp), STDIN_FILENO); + (void)dup2(fileno(finfo->in_fp), STDIN_FILENO); } (void)lseek(0, 0, SEEK_SET); @@ -230,24 +239,27 @@ fork_dvips(char **argv, const struct select_pages_info *pinfo, childProcT proc) /* Set up file descriptor for non-blocking I/O */ prep_fd(print_io[0], True); print_xio.fd = print_io[0]; + print_xio.data = info; set_io(&print_xio); dvips_status = DVIPS_STAT_RUN; /* running */ } /* - * Create an argument list for dvips, using information from pinfo + * Create an argument list for dvips, using information from info * and X resources. Returns the result list in freshly allocated * memory. */ static char ** -create_dvips_argv(const struct select_pages_info *pinfo, Boolean do_pdf, printOrSaveActionT act) +create_dvips_argv(const struct save_or_print_info *info, Boolean do_pdf) { + const struct select_pages_info *pinfo = info->pinfo; + size_t argv_len = 128; /* should be ample ... */ char **argv = xmalloc(argv_len * sizeof *argv); size_t idx = 0; - const char *printer_options = get_printer_options(); - char *dvips_options = get_dvips_options(act); + const char *printer_options = info->printer_options; + const char *dvips_options = info->dvips_options; char from_page[LENGTH_OF_INT]; char to_page[LENGTH_OF_INT]; @@ -269,7 +281,7 @@ create_dvips_argv(const struct select_pages_info *pinfo, Boolean do_pdf, printOr argv[idx++] = xstrdup("-f"); - if (printer_options != NULL && pinfo->finfo->ps_out.fname == NULL) { /* printing to printer */ + if (info->print_target == TO_PRINTER && printer_options != NULL) { /* printing to printer */ char **printer_args = get_separated_list(printer_options, " \t", True); /* this allocates printer_args */ int i; ASSERT(*printer_args != NULL, "args should contain at least the string \"lpr\""); @@ -286,7 +298,7 @@ create_dvips_argv(const struct select_pages_info *pinfo, Boolean do_pdf, printOr idx++; } - if (pinfo->callback == check_pagerange) { + if (info->page_selection == PAGE_RANGE) { /* convert back from 0-based to 1-based, also taking globals.pageno_correct into accout * (which is 1 by default, so we need to add 2) */ argv[idx] = xstrdup("-p="); @@ -306,17 +318,17 @@ create_dvips_argv(const struct select_pages_info *pinfo, Boolean do_pdf, printOr /* Check if selecting pages worked, report error else */ static Boolean -select_pages_report_error(const struct select_pages_info *pinfo) +select_pages_report_error(const struct save_or_print_info *info) { - if (pinfo->errflag == NO_ERROR) + if (info->pinfo->errflag == NO_ERROR) return False; popup_message(globals.widgets.top_level, MSG_INFO, NULL, "Could not save DVI file to %s: %s.", - pinfo->finfo->dvi_tmp.fname, - get_dvi_error(pinfo->errflag)); + info->finfo->tmp_dvi_file, + get_dvi_error(info->pinfo->errflag)); return True; } @@ -327,10 +339,11 @@ select_pages_report_error(const struct select_pages_info *pinfo) * the output, for later filtering. */ static char * -read_from_dvips(int ignored) +read_from_dvips(int ignored, void *data) { int bytes; char line[80]; + struct save_or_print_info *info = data; UNUSED(ignored); @@ -353,7 +366,7 @@ read_from_dvips(int ignored) #ifdef MOTIF line[bytes] = '\0'; #endif - printlog_append(line, bytes); + printlog_append(info, line, bytes); } } return NULL; /* TODO */ @@ -368,29 +381,35 @@ dvips_exited(int exitval, struct xchild *child) char str[128] = ""; int ms; - struct select_pages_info *pinfo = (struct select_pages_info *)child->data; + struct save_or_print_info *info = (struct save_or_print_info *)child->data; - read_from_dvips(0); + read_from_dvips(0, info); clear_io(&print_xio); (void)close(print_xio.fd); if (WIFEXITED(exitval)) { if (WEXITSTATUS(exitval) == 0) { - if (pinfo->finfo->ps_out.fname != NULL) { - printlog_append_str("\nCreated Postscript file "); - printlog_append_str(pinfo->finfo->ps_out.fname); - printlog_append_str(".\n"); + if (info->act == FILE_SAVE || info->print_target == TO_FILE) { + printlog_append_str(info, "\nCreated Postscript file "); + printlog_append_str(info, info->finfo->out_file); + printlog_append_str(info, ".\n"); } else { - printlog_append_str("Done.\n"); + printlog_append_str(info, "Done.\n"); } /* remove temporary DVI file if it exists */ - if (pinfo->finfo->dvi_tmp.fname != NULL) { + if (info->finfo->tmp_dvi_file != NULL) { if (globals.debug & DBG_GUI) - TRACE_GUI((stderr, "NOT removing temporary DVI file: |%s|", pinfo->finfo->dvi_tmp.fname)); - else - unlink(pinfo->finfo->dvi_tmp.fname); + TRACE_GUI((stderr, "NOT removing temporary DVI file: |%s|", info->finfo->tmp_dvi_file)); + else { + if (info->finfo->tmp_dvi_fp != NULL) { + fclose(info->finfo->tmp_dvi_fp); + info->finfo->tmp_dvi_fp = NULL; + } + unlink(info->finfo->tmp_dvi_file); + info->finfo->tmp_dvi_file = NULL; + } } } else @@ -403,12 +422,13 @@ dvips_exited(int exitval, struct xchild *child) ms = resource.dvips_hang; if (str[0] != '\0') { - XBell(DISP, 0); + xdvi_bell(); ms = resource.dvips_fail_hang; - printlog_append_str(str); + printlog_append_str(info, str); } if (ms > 0) { + dvips_timer.data = info; set_timer(&dvips_timer, ms); dvips_status = DVIPS_STAT_WAIT; } @@ -416,7 +436,7 @@ dvips_exited(int exitval, struct xchild *child) dvips_status = DVIPS_STAT_NONE; } - printlog_enable_closebutton(); + printlog_enable_closebutton(info); } /* @@ -427,39 +447,40 @@ ps2pdf_exited(int status, struct xchild *this) { char *err_msg = NULL; int ms = resource.dvips_hang; + struct save_or_print_info *info = (struct save_or_print_info *)this->data; + /* if child exited with error and xio struct is available for child, print error text */ if (this->io != NULL && (WIFEXITED(status) != 0)) { if ((WEXITSTATUS(status) != 0) - && (err_msg = (this->io->read_proc)(this->io->fd)) != NULL) { + && (err_msg = (this->io->read_proc)(this->io->fd, NULL)) != NULL) { char buf[LENGTH_OF_INT]; SNPRINTF(buf, LENGTH_OF_INT, "%d", WEXITSTATUS(status)); ms = resource.dvips_fail_hang; - XBell(DISP, 0); - printlog_append_str("\n\nError calling "); + xdvi_bell(); + printlog_append_str(info, "\n\nError calling "); if (this->name != NULL) { - printlog_append_str("\""); - printlog_append_str(this->name); - printlog_append_str("\" "); + printlog_append_str(info, "\""); + printlog_append_str(info, this->name); + printlog_append_str(info, "\" "); } - printlog_append_str("\nCommand exited with error code "); - printlog_append_str(buf); - printlog_append_str(":\n"); - printlog_append_str(err_msg); + printlog_append_str(info, "\nCommand exited with error code "); + printlog_append_str(info, buf); + printlog_append_str(info, ":\n"); + printlog_append_str(info, err_msg); free(err_msg); } else { - const struct select_pages_info *pinfo = (const struct select_pages_info *)this->data; int retval; - printlog_append_str("\nCreated PDF file "); - printlog_append_str(pinfo->finfo->pdf_out.fname); - printlog_append_str(".\n"); + printlog_append_str(info, "\nCreated PDF file "); + printlog_append_str(info, info->finfo->out_file); + printlog_append_str(info, ".\n"); TRACE_FILES((stderr, "Removing temporary PS file: `%s'", - pinfo->finfo->ps_out.fname)); - retval = unlink(pinfo->finfo->ps_out.fname); + info->finfo->tmp_ps_file)); + retval = unlink(info->finfo->tmp_ps_file); if (retval != 0) { fprintf(stderr, "Could not unlink `%s': %s.\n", - pinfo->finfo->ps_out.fname, strerror(errno)); + info->finfo->tmp_ps_file, strerror(errno)); } } } @@ -469,6 +490,7 @@ ps2pdf_exited(int status, struct xchild *this) "Internal error: ps2pdf_exited() called while child still running?"); } if (ms > 0) { + dvips_timer.data = info; set_timer(&dvips_timer, ms); dvips_status = DVIPS_STAT_WAIT; } @@ -476,7 +498,7 @@ ps2pdf_exited(int status, struct xchild *this) dvips_status = DVIPS_STAT_NONE; } - printlog_enable_closebutton(); + printlog_enable_closebutton(info); free(this->name); free(this->io); @@ -484,19 +506,19 @@ ps2pdf_exited(int status, struct xchild *this) } static void -call_ps2pdf(const char *path, const struct select_pages_info *pinfo) +call_ps2pdf(const char *path, const struct save_or_print_info *info) { const char *argv[5]; size_t idx = 0; argv[idx++] = path; - argv[idx++] = pinfo->finfo->ps_out.fname; - argv[idx++] = pinfo->finfo->pdf_out.fname; + argv[idx++] = info->finfo->tmp_ps_file; + argv[idx++] = info->finfo->out_file; argv[idx++] = NULL; /* need to run this in globals.xdvi_dir again, since the dvips conversion directory globals.dvi_file.dirname may not be writable! */ - if (!fork_process("ps2pdf", True, globals.xdvi_dir, ps2pdf_exited, (void *)pinfo, (char **)argv)) { + if (!fork_process("ps2pdf", True, globals.cwd, ps2pdf_exited, (void *)info, (char **)argv)) { popup_message(globals.widgets.top_level, MSG_ERR, NULL, "Couldn't fork %s process: %s\n", argv[0], strerror(errno)); @@ -508,29 +530,35 @@ dvips_ps2pdf(int exitval, struct xchild *child) { char str[128] = ""; int ms; - struct select_pages_info *pinfo = (struct select_pages_info *)child->data; + struct save_or_print_info *info = (struct save_or_print_info *)child->data; - read_from_dvips(0); + read_from_dvips(0, info); clear_io(&print_xio); (void)close(print_xio.fd); if (WIFEXITED(exitval)) { if (WEXITSTATUS(exitval) == 0) { /* dvips ended OK; call ps2pdf: */ - TRACE_GUI((stderr, "Created temporary PS file |%s|", pinfo->finfo->ps_out.fname)); - printlog_append_str("\nCalling "); - printlog_append_str(resource.ps2pdf_path); - printlog_append_str(" ..."); + TRACE_GUI((stderr, "Created temporary PS file |%s|", info->finfo->tmp_ps_file)); + printlog_append_str(info, "\nCalling "); + printlog_append_str(info, resource.ps2pdf_path); + printlog_append_str(info, " ..."); /* remove temporary DVI file if it exists */ - if (pinfo->finfo->dvi_tmp.fname != NULL) { + if (info->finfo->tmp_dvi_file != NULL) { if (globals.debug & DBG_GUI) - TRACE_GUI((stderr, "NOT removing temporary DVI file: |%s|", pinfo->finfo->dvi_tmp.fname)); - else - unlink(pinfo->finfo->dvi_tmp.fname); + TRACE_GUI((stderr, "NOT removing temporary DVI file: |%s|", info->finfo->tmp_dvi_file)); + else { + if (info->finfo->tmp_dvi_fp != NULL) { + fclose(info->finfo->tmp_dvi_fp); + info->finfo->tmp_dvi_fp = NULL; + } + unlink(info->finfo->tmp_dvi_file); + info->finfo->tmp_dvi_file = NULL; + } } /* invoke ps2pdf conversion */ - call_ps2pdf(resource.ps2pdf_path, pinfo); + call_ps2pdf(resource.ps2pdf_path, info); } else sprintf(str, "\nPrint process returned exit code %d.\n", @@ -546,11 +574,12 @@ dvips_ps2pdf(int exitval, struct xchild *child) /* enable close button only if dvips conversion already failed */ ms = resource.dvips_hang; if (str[0] != '\0') { - XBell(DISP, 0); + xdvi_bell(); ms = resource.dvips_fail_hang; - printlog_append_str(str); + printlog_append_str(info, str); if (ms > 0) { + dvips_timer.data = info; set_timer(&dvips_timer, ms); dvips_status = DVIPS_STAT_WAIT; } @@ -558,17 +587,18 @@ dvips_ps2pdf(int exitval, struct xchild *child) dvips_status = DVIPS_STAT_NONE; } - printlog_enable_closebutton(); + printlog_enable_closebutton(info); } } static void -dvips_alarm(struct xtimer *should_be_timer) +dvips_alarm(struct xtimer *this, void *data) { - UNUSED(should_be_timer); + struct save_or_print_info *info = (struct save_or_print_info *)data; + UNUSED(this); - printlog_popdown(False); + printlog_popdown(info, False); dvips_status = DVIPS_STAT_NONE; } @@ -576,7 +606,7 @@ dvips_alarm(struct xtimer *should_be_timer) static void -cb_dvips_unkeep(Widget w, XtPointer client_data, XtPointer call_data) +cb_dvips_keep(Widget w, XtPointer client_data, XtPointer call_data) { UNUSED(w); @@ -604,14 +634,15 @@ cb_dvips_unkeep(Widget w, XtPointer client_data, XtPointer call_data) static void cb_dvips_destroy(Widget w, XtPointer client_data, XtPointer call_data) { + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + UNUSED(w); - UNUSED(client_data); UNUSED(call_data); if (dvips_status == DVIPS_STAT_RUN) { kill(print_child.pid, dvips_sig); dvips_sig = SIGKILL; - printlog_append_str("^C"); + printlog_append_str(info, "^C"); } if (dvips_status == DVIPS_STAT_WAIT) { @@ -619,15 +650,16 @@ cb_dvips_destroy(Widget w, XtPointer client_data, XtPointer call_data) cancel_timer(&dvips_timer); } - printlog_reset(); - printlog_popdown(True); + printlog_reset(info); + printlog_popdown(info, True); } static void cb_dvips_cancel(Widget w, XtPointer client_data, XtPointer call_data) { + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + UNUSED(w); - UNUSED(client_data); UNUSED(call_data); if (dvips_status != DVIPS_STAT_RUN) @@ -635,14 +667,15 @@ cb_dvips_cancel(Widget w, XtPointer client_data, XtPointer call_data) kill(print_child.pid, dvips_sig); dvips_sig = SIGKILL; - printlog_append_str("^C"); + printlog_append_str(info, "^C"); } static void cb_dvips_close(Widget w, XtPointer client_data, XtPointer call_data) { + struct save_or_print_info *info = (struct save_or_print_info *)client_data; + UNUSED(w); - UNUSED(client_data); UNUSED(call_data); if (dvips_status == DVIPS_STAT_RUN) @@ -653,31 +686,37 @@ cb_dvips_close(Widget w, XtPointer client_data, XtPointer call_data) cancel_timer(&dvips_timer); } - printlog_popdown(True); + printlog_popdown(info, True); } void -internal_save(struct select_pages_info *pinfo, - outputFormatT output_format) +internal_save(struct save_or_print_info *info) { - struct file_info *finfo = pinfo->finfo; + struct file_info *finfo = info->finfo; + static struct callback_info cinfo = { + cb_dvips_close, cb_dvips_cancel, cb_dvips_destroy, cb_dvips_keep + }; int tmp_fd; char **argv = NULL; int i; childProcT dvips_exit_proc = dvips_exited; /* default procedure to call after fork_dvips() */ Boolean do_pdf = False; /* force `-Ppdf' for dvips? (used for ps2pdf conversion) */ - ASSERT(output_format != FMT_NONE, "No valid output format selected!"); + ASSERT(info->fmt != FMT_NONE, "No valid output format selected!"); + + /* fprintf(stderr, "INTERNAL SAVE - format: %d; selection: %d\n", info->fmt, info->page_selection); */ + + info->callbacks = &cinfo; - switch (output_format) { + switch (info->fmt) { case FMT_DVI: /* here we first create a temporary file, and if that succeeded, move it to the final position */ - select_pages(pinfo); + select_pages(info); - if (!select_pages_report_error(pinfo)) { + if (!select_pages_report_error(info)) { /* * ... else, move the temporary file to its final destination. For that, we * try the more efficient rename() first; if this fails, try copying the file @@ -685,21 +724,21 @@ internal_save(struct select_pages_info *pinfo, * system). We could perhaps examine errno after the renaming attempt to * find out whether we need to do the copy attempt in the first place, but * that'd be rather error-prone ... */ - ASSERT(finfo->dvi_tmp.fname != NULL, "filename mustn't be NULL"); - if (rename(finfo->dvi_tmp.fname, finfo->dvi_out.fname) != 0 - && !copy_file(finfo->dvi_tmp.fname, finfo->dvi_out.fname)) { + ASSERT(finfo->tmp_dvi_file != NULL, "filename mustn't be NULL"); + if (rename(finfo->tmp_dvi_file, finfo->out_file) != 0 + && !copy_file(finfo->tmp_dvi_file, finfo->out_file)) { popup_message(globals.widgets.top_level, MSG_ERR, NULL, "Creating %s failed: %s", - finfo->dvi_out.fname, strerror(errno)); + finfo->out_file, strerror(errno)); } else { /* moving worked */ - TRACE_GUI((stderr, "renamed %s to %s\n", finfo->dvi_tmp.fname, finfo->dvi_out.fname)); + TRACE_GUI((stderr, "renamed %s to %s\n", finfo->tmp_dvi_file, finfo->out_file)); - if (pinfo->warn_files.stack_len > 0) { /* do we need to warn user about referenced files? */ + if (info->pinfo->warn_files.stack_len > 0) { /* do we need to warn user about referenced files? */ char *warn_files = xstrdup(""); size_t i; - for (i = 0; i < pinfo->warn_files.stack_len; i++) { - warn_files = xstrcat(warn_files, pinfo->warn_files.items[i].content); + for (i = 0; i < info->pinfo->warn_files.stack_len; i++) { + warn_files = xstrcat(warn_files, info->pinfo->warn_files.items[i].content); warn_files = xstrcat(warn_files, "\n"); } popup_message(globals.widgets.top_level, @@ -714,22 +753,34 @@ internal_save(struct select_pages_info *pinfo, "Created %s.\n" "Please note that the following files are referenced by this file, " "and are needed for displaying or printing it correctly:\n%s\n", - finfo->dvi_out.fname, warn_files); + finfo->out_file, warn_files); free(warn_files); } else { +/* char *ptr = strrchr(finfo->out_file, '/'); */ +/* if (ptr == NULL) */ +/* ptr = finfo->out_file; */ +/* else */ +/* ptr++; */ popup_message(globals.widgets.top_level, MSG_INFO, NULL, - "Created DVI file: %s.", finfo->dvi_out.fname); + "Created DVI file:\n%s.", finfo->out_file); + } + if (info->finfo->tmp_dvi_fp != NULL) { + fclose(info->finfo->tmp_dvi_fp); + info->finfo->tmp_dvi_fp = NULL; } - unlink(finfo->dvi_tmp.fname); + unlink(finfo->tmp_dvi_file); + info->finfo->tmp_dvi_file = NULL; } } break; case FMT_PS2PDF: - tmp_fd = xdvi_temp_fd(&(finfo->ps_out.fname)); /* this allocates finfo->ps_out.fname */ + free(finfo->tmp_ps_file); + finfo->tmp_ps_file = NULL; + tmp_fd = xdvi_temp_fd(&(finfo->tmp_ps_file)); /* this allocates finfo->tmp_ps_file */ if (tmp_fd == -1) { popup_message(globals.widgets.top_level, MSG_ERR, NULL, @@ -738,25 +789,28 @@ internal_save(struct select_pages_info *pinfo, return; } else { - TRACE_GUI((stderr, "name of temporary PS file: |%s|", finfo->ps_out.fname)); + TRACE_GUI((stderr, "name of temporary PS file: |%s|", finfo->tmp_ps_file)); } dvips_exit_proc = dvips_ps2pdf; /* call ps2pdf conversion after dvips exited */ do_pdf = True; /* fall through */ case FMT_PS: - if (pinfo->callback == check_marked) { /* want to print selected pages? */ - ASSERT(finfo->dvi_tmp.fp != NULL, "Temporary file pointer musn't be NULL!"); - ASSERT(finfo->dvi_tmp.fname != NULL, "Temporary filename musn't be NULL!"); - select_pages(pinfo); + if (info->page_selection == PAGE_MARKED) { /* want to save selected pages? */ + ASSERT(info->pinfo->callback != NULL, "Callback musn't be NULL!"); + ASSERT(finfo->tmp_dvi_fp != NULL, "Temporary file pointer musn't be NULL!"); + ASSERT(finfo->tmp_dvi_file != NULL, "Temporary filename musn't be NULL!"); + select_pages(info); } - printlog_create("Xdvik: Saving", "Automatically close this window after file has been saved", - cb_dvips_close, cb_dvips_cancel, cb_dvips_destroy, cb_dvips_unkeep); + if (info->printlog == NULL) + printlog_create(info, "Xdvik: Saving", "Automatically close this window after file has been saved"); + else + printlog_enable_cancelbutton(info); - if ((argv = create_dvips_argv(pinfo, do_pdf, FILE_SAVE)) == NULL) { + if ((argv = create_dvips_argv(info, do_pdf)) == NULL) { /* something went *really* wrong; assume user has already been warned about it */ return; } - fork_dvips(argv, pinfo, dvips_exit_proc); + fork_dvips(argv, info, dvips_exit_proc); /* dellocate argv */ for (i = 0; argv[i] != NULL; i++) { @@ -767,11 +821,11 @@ internal_save(struct select_pages_info *pinfo, break; case FMT_ISO_8859_1: case FMT_UTF8: - if (search_extract_text(output_format, pinfo)) { + if (search_extract_text(info)) { popup_message(globals.widgets.top_level, MSG_INFO, NULL, - "Created text file %s.", finfo->txt_out.fname); + "Created text file %s.", finfo->out_file); } else { popup_message(globals.widgets.top_level, @@ -786,25 +840,33 @@ internal_save(struct select_pages_info *pinfo, } void -internal_print(struct select_pages_info *pinfo) +internal_print(struct save_or_print_info *info) { + static struct callback_info cinfo = { + cb_dvips_close, cb_dvips_cancel, cb_dvips_destroy, cb_dvips_keep + }; char **argv = NULL; int i; - if (pinfo->callback == check_marked) { /* want to print selected pages? */ - ASSERT(pinfo->finfo->dvi_tmp.fp != NULL, "Temporary file pointer musn't be NULL!"); - ASSERT(pinfo->finfo->dvi_tmp.fname != NULL, "Temporary filename musn't be NULL!"); - select_pages(pinfo); + info->callbacks = &cinfo; + + if (info->page_selection == PAGE_MARKED) { /* want to print selected pages? */ + ASSERT(info->pinfo->callback != NULL, "Callback musn't be NULL!"); + ASSERT(info->finfo->tmp_dvi_fp != NULL, "Temporary file pointer musn't be NULL!"); + ASSERT(info->finfo->tmp_dvi_file != NULL, "Temporary filename musn't be NULL!"); + select_pages(info); } - printlog_create("Xdvik: Printing", "Automatically close this window when printing finishes", - cb_dvips_close, cb_dvips_cancel, cb_dvips_destroy, cb_dvips_unkeep); + if (info->printlog == NULL) + printlog_create(info, "Xdvik: Printing", "Automatically close this window when printing finishes"); + else + printlog_enable_cancelbutton(info); - if ((argv = create_dvips_argv(pinfo, False, FILE_PRINT)) == NULL) { + if ((argv = create_dvips_argv(info, False)) == NULL) { /* something went *really* wrong; assume user has already been warned about it */ return; } - fork_dvips(argv, pinfo, dvips_exited); + fork_dvips(argv, info, dvips_exited); /* dellocate argv */ for (i = 0; argv[i] != NULL; i++) { diff --git a/Build/source/texk/xdvik/print-internal.h b/Build/source/texk/xdvik/print-internal.h index 4969c356396..078f38f1b02 100644 --- a/Build/source/texk/xdvik/print-internal.h +++ b/Build/source/texk/xdvik/print-internal.h @@ -25,24 +25,17 @@ #define PRINT_INTERNAL_H_ #include "dvi-init.h" -#include "print-dialog.h" typedef enum { FMT_PS, FMT_PS2PDF, FMT_DVI, FMT_ISO_8859_1, FMT_UTF8, FMT_NONE } outputFormatT; -/* file IO help struct */ -struct file_IO { - FILE *fp; - char *fname; -}; - /* collection of all file IOs used in printing/saving */ struct file_info { - struct file_IO dvi_in; - struct file_IO dvi_tmp; - struct file_IO dvi_out; - struct file_IO ps_out; - struct file_IO pdf_out; - struct file_IO txt_out; + char *tmp_dvi_file; /* temporary DVI file */ + FILE *tmp_dvi_fp; /* FILE * for temporary DVI file */ + char *tmp_ps_file; /* temporary PS file */ + char *out_file; /* final output file */ + /* FILE *out_fp; */ /* FILE * for final output file */ + FILE *in_fp; /* FILE * for input file */ }; /* stacks for communication with selection routines */ @@ -55,24 +48,64 @@ struct specials_stack { struct specials_stack_elem *items; }; +typedef enum printRadioT_ { + NO_PRINT_VAL = -1, + TO_PRINTER = 1, + TO_FILE +} printRadioT; + + +typedef enum pageRadioT_ { + NO_PAGE_VAL = -1, + PAGE_ALL = 1, + PAGE_MARKED, + PAGE_RANGE +} pageRadioT; -/* wrapper struct for all kinds of information about selected pages. */ +struct save_or_print_info; /* forward declaration */ + +/* wrapper struct which stores information about values the user has + selected in the dialog. +*/ struct select_pages_info { - printOrSaveActionT act; /* whether we're printing or saving */ int from; /* lower bound of page range to be selected */ int to; /* upper bound of page range to be selected */ - struct file_info *finfo; /* additional file info pointer */ +/* struct file_info *finfo; \/\* additional file info pointer \*\/ */ /* callback function that says whether a page should be selected or not; - will be passed a pointer to the current struct select_pages_info, + will be passed a pointer to the current struct save_or_print_info, and the current page */ - Boolean (*callback)(struct select_pages_info *info, int page); + Boolean (*callback)(struct save_or_print_info *info, int page); struct specials_stack warn_files; /* collect warnings about included files */ dviErrFlagT errflag; /* collect all kinds of errors that can happen while copying */ }; -extern void internal_print(struct select_pages_info *pinfo); -extern void internal_save(struct select_pages_info *pinfo, - outputFormatT output_format); +typedef enum { FILE_PRINT = 0, FILE_SAVE = 1 } printOrSaveActionT; + + +struct callback_info { + XtCallbackProc cb_close; + XtCallbackProc cb_cancel; + XtCallbackProc cb_destroy; + XtCallbackProc cb_keep; +}; + +struct save_or_print_info { + printOrSaveActionT act; /* whether we're printing or saving */ + outputFormatT fmt; /* DVI/PS/... */ + printRadioT print_target; /* to printer or to file */ + pageRadioT page_selection; /* which pages: all/marked/range */ + char *printer_options; /* printer name + options from text field */ + char *dvips_options; /* dvips options from text field */ + Widget shell; + Widget message_popup; + Widget printlog; + struct select_pages_info *pinfo; + struct callback_info *callbacks; + struct file_info *finfo; +}; + +extern void internal_print(struct save_or_print_info *info); +extern void internal_save(struct save_or_print_info *info); #endif /* PRINT_INTERNAL_H_ */ diff --git a/Build/source/texk/xdvik/psdps.c b/Build/source/texk/xdvik/psdps.c index a570a481f66..10a51263b60 100644 --- a/Build/source/texk/xdvik/psdps.c +++ b/Build/source/texk/xdvik/psdps.c @@ -21,11 +21,11 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTES: - This code was originally written by Ricardo Telichevesky - (ricardo@rle-vlsi-mit.edu) and Luis Miguel Silveira - (lms@rle-vlsi-mit.edu). - It was largely influenced by similar code in the SeeTeX/XTeX - package by Dirk Grunwald (grunwald@colorado.edu). +This code was originally written by Ricardo Telichevesky +(ricardo@rle-vlsi-mit.edu) and Luis Miguel Silveira +(lms@rle-vlsi-mit.edu). +It was largely influenced by similar code in the SeeTeX/XTeX +package by Dirk Grunwald (grunwald@colorado.edu). \*========================================================================*/ @@ -42,10 +42,12 @@ NOTES: #include #include "xdvi-config.h" +#include "special.h" +#include "util.h" #include "xdvi.h" #ifdef X_NOT_STDC_ENV -extern int errno; + extern int errno; #endif #if defined(sun) || defined(__sun) @@ -68,43 +70,43 @@ extern int errno; */ #if !SUNHACK static char preamble[] = - "/xdvi$line 81 string def " - "/xdvi$run {{$error null ne {$error /newerror false put}if " - " currentfile cvx stopped " - " $error null eq {false} {$error /newerror get} ifelse and " - " {handleerror} if} stopped pop} def " - "/xdvi$dslen countdictstack def " - "{currentfile read not {exit} if 72 eq " - " {xdvi$run} " - " {/xdvi$sav save def xdvi$run " - " clear countdictstack xdvi$dslen sub {end} repeat xdvi$sav restore} " - " ifelse " - " {(%%xdvimark) currentfile xdvi$line {readline} stopped " - " {clear} {pop eq {exit} if} ifelse }loop " - " (xdvi$Ack\n) print flush " - "}loop\nH"; +"/xdvi$line 81 string def " +"/xdvi$run {{$error null ne {$error /newerror false put}if " +" currentfile cvx stopped " +" $error null eq {false} {$error /newerror get} ifelse and " +" {handleerror} if} stopped pop} def " +"/xdvi$dslen countdictstack def " +"{currentfile read not {exit} if 72 eq " +" {xdvi$run} " +" {/xdvi$sav save def xdvi$run " +" clear countdictstack xdvi$dslen sub {end} repeat xdvi$sav restore} " +" ifelse " +" {(%%xdvimark) currentfile xdvi$line {readline} stopped " +" {clear} {pop eq {exit} if} ifelse }loop " +" (xdvi$Ack\n) print flush " +"}loop\nH"; #else /* SUNHACK */ static char preamble[] = - "/xdvi$line 81 string def " - "/xdvi$run {{$error null ne {$error /newerror false put}if " - "currentfile cvx stopped " - "$error null eq {false} {$error /newerror get} ifelse and " - "{handleerror} if} stopped pop} def " - "/xdvi$dslen countdictstack def " - "/xdvi$ack {{(%%xdvimark) currentfile xdvi$line {readline} stopped " - " {clear} {pop eq {exit} if} ifelse }loop " - " (xdvi$Ack\n) print flush} bind def " - "errordict begin /interrupt{(xdvi$Int\n) print flush stop}bind def " - "end " - "{{currentfile read not {exit} if 72 eq " - " {xdvi$run} " - " {/xdvi$sav save def xdvi$run " - " clear countdictstack xdvi$dslen sub {end} repeat xdvi$sav restore} " - " ifelse " - " xdvi$ack " - " }loop " - "xdvi$ack " - "}loop\nH"; +"/xdvi$line 81 string def " +"/xdvi$run {{$error null ne {$error /newerror false put}if " +"currentfile cvx stopped " +"$error null eq {false} {$error /newerror get} ifelse and " +"{handleerror} if} stopped pop} def " +"/xdvi$dslen countdictstack def " +"/xdvi$ack {{(%%xdvimark) currentfile xdvi$line {readline} stopped " +" {clear} {pop eq {exit} if} ifelse }loop " +" (xdvi$Ack\n) print flush} bind def " +"errordict begin /interrupt{(xdvi$Int\n) print flush stop}bind def " +"end " +"{{currentfile read not {exit} if 72 eq " +" {xdvi$run} " +" {/xdvi$sav save def xdvi$run " +" clear countdictstack xdvi$dslen sub {end} repeat xdvi$sav restore} " +" ifelse " +" xdvi$ack " +" }loop " +"xdvi$ack " +"}loop\nH"; #endif /* SUNHACK */ extern const char psheader[]; @@ -146,7 +148,7 @@ static struct psprocs dps_procs = { static DPSContext DPS_ctx = NULL; static DPSSpace DPS_space = NULL; -static int DPS_mag; /* magnification currently in use */ +static unsigned long DPS_mag; /* magnification currently in use */ static int DPS_shrink; /* shrink factor currently in use */ static Boolean DPS_active; /* if we've started a page */ static int DPS_pending; /* number of ack's we're expecting */ @@ -177,10 +179,12 @@ static char *linepos = line; static void TextProc(DPSContext ctxt, char *buf, unsigned long count) { - int i; + unsigned long i; char *p; char *p0; + UNUSED(ctxt); + while (count > 0) { i = line + BUFLEN - linepos; if (i > count) @@ -264,16 +268,23 @@ TextProc(DPSContext ctxt, char *buf, unsigned long count) Waits until the requisite number of acknowledgements has been received from the context. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ #if SUNHACK -static void DPS_alarm ARGS((struct xtimer *)); +static void DPS_alarm(struct xtimer *this, void *data); -static struct xtimer DPS_timer = {NULL, {0, 0}, DPS_alarm}; -static Boolean DPS_timer_set; +static struct xtimer DPS_timer = {NULL, {0, 0}, XTM_DEFAULT, DPS_alarm, NULL +#if XDVI_XT_TIMER_HACK + , NULL, NULL +#endif +}; -static void DPS_alarm(struct xtimer *arg) +static Boolean DPS_timer_set; + +static void DPS_alarm(struct xtimer *this, void *data) { + UNUSED(this); + UNUSED(data); if (globals.debug & DBG_PS) puts("Received DPS alarm"); @@ -296,7 +307,7 @@ waitack(void) if (globals.debug & DBG_PS) printf("Interrupting DPS in waitack(); code is now %d %x\n", - XDPSGetContextStatus(DPS_ctx), globals.ev.flags); + XDPSGetContextStatus(DPS_ctx), globals.ev.flags); DPS_active = DPS_in_header = DPS_in_doc = False; DPS_ev_mask = DPS_MASK_NORMAL; @@ -369,7 +380,7 @@ waitack(void) Initializes variables from the application main loop. Checks to see if a connection to the DPS server can be opened. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static int get_shift(Pixel mask) @@ -472,13 +483,13 @@ Boolean initDPS(void) Used to toggle the rendering of PostScript by the DPS server This routine may be called from within read_events(). -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void toggleDPS(int flag) { if (globals.debug & DBG_PS) - Puts("Toggling DPS to %d", flag); + fprintf(stderr, "Toggling DPS to %d", flag); switch (flag) { case 0: @@ -505,7 +516,7 @@ toggleDPS(int flag) Close the connection to the DPS server; used when rendering is terminated in any way. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void destroyDPS(void) @@ -534,7 +545,7 @@ destroyDPS(void) Close the connection to the DPS server; used when rendering is terminated because of an interruption in the viewing of the current page. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void interruptDPS(void) @@ -564,7 +575,7 @@ interruptDPS(void) Description: Should be called at the end of a page to end this chunk for the DPS server. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void endpageDPS(void) @@ -592,7 +603,7 @@ checkDPS(void) if (DPS_ctx == NULL) { DPS_ctx = XDPSCreateSimpleContext(DISP, mane.win, globals.gc.copy, 0, 0, - TextProc, DPSErrorProcHandler, DPS_space); + TextProc, DPSErrorProcHandler, DPS_space); if (DPS_ctx == NULL) { psp = no_ps_procs; draw_bbox(); @@ -614,10 +625,10 @@ checkDPS(void) drawbeginDPS () Arguments: xul, yul - coordinates of the upper left corner of the figure - cp - string with the bounding box line data + cp - string with the bounding box line data Returns: (void) Side-Effects: DPS_ctx is set is set and connection to DPS server is - opened. + opened. Description: Opens a connection to the DPS server and send in the preamble and the @@ -625,7 +636,7 @@ checkDPS(void) In case no rendering is to be done, outlines the figure. An outline is also generated whenever the a context cannot be allocated -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void drawbeginDPS(int xul, int yul, const char *cp) @@ -663,21 +674,21 @@ drawbeginDPS(int xul, int yul, const char *cp) static void drawbeginDPS_box(int xul, int yul, const char *cp) { - drawbeginDPS(int xul, int yul, const char *cp); + drawbeginDPS(xul, yul, cp); draw_bbox(); } /*---------------------------------------------------------------------------* - drawrawDPS() +drawrawDPS() - Arguments: cp - the raw string to be sent to the postscript interpreter - Returns: (void) - Side-Effects: (none) +Arguments: cp - the raw string to be sent to the postscript interpreter +Returns: (void) +Side-Effects: (none) - Description: - If there is a valid postscript context, just send the string to the - interpreter, else leave. +Description: +If there is a valid postscript context, just send the string to the +interpreter, else leave. +----------------------------------------------------------------------------*/ @@ -698,14 +709,14 @@ drawrawDPS(const char *cp) drawfileDPS() Arguments: cp - string with the postscript file pathname - psfile - opened file pointer + psfile - opened file pointer Returns: (void) Side-Effects: none Description: Postscript file containing the figure is opened and sent to the DPS server. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void drawfileDPS(const char *cp, FILE *psfile) @@ -746,7 +757,7 @@ drawfileDPS(const char *cp, FILE *psfile) Description: Sends the indication of end of the figure PostScript code. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void drawendDPS(const char *cp) @@ -769,7 +780,7 @@ drawendDPS(const char *cp) Description: Prepares the PostScript interpreter for receipt of header code. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void beginheaderDPS(void) @@ -809,7 +820,7 @@ beginheaderDPS(void) Description: Prepares the PostScript interpreter for receipt of header code. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void endheaderDPS(void) @@ -836,7 +847,7 @@ endheaderDPS(void) Description: Clears out headers stored from the previous document. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void newdocDPS(void) diff --git a/Build/source/texk/xdvik/psgs.c b/Build/source/texk/xdvik/psgs.c index e0d902848a4..9d929713b51 100644 --- a/Build/source/texk/xdvik/psgs.c +++ b/Build/source/texk/xdvik/psgs.c @@ -33,6 +33,7 @@ OTHER DEALINGS IN THE SOFTWARE. /* Condition for retrying a write */ #include +#include #include "xdvi-config.h" #include "xdvi.h" @@ -115,7 +116,7 @@ Pixmap bpixmap; #define GS_fd (std_io[0]) - /* some arguments are filled in later */ +/* some arguments are filled in later */ static char arg4[] = "-dDEVICEWIDTH=xxxxxxxxxx"; static char arg5[] = "-dDEVICEHEIGHT=xxxxxxxxxx"; @@ -162,14 +163,15 @@ static char oldstr[] = "\347\310\375"; static void gs_died(int, struct xchild *); -static char *read_from_gs(int); -static void write_to_gs(int); +static char *read_from_gs(int, void *); +static void write_to_gs(int, void *); static struct xio gs_xio = {NULL, 0, XIO_IN, #if HAVE_POLL - NULL, + NULL, #endif - read_from_gs, write_to_gs + read_from_gs, write_to_gs, + NULL /* data */ }; static struct xchild gs_child = { NULL, 0, True, NULL, NULL, NULL, gs_died }; @@ -183,12 +185,17 @@ static struct xchild gs_child = { NULL, 0, True, NULL, NULL, NULL, gs_died }; #if TIMER_PROBLEM_FIXED static XtIntervalId gs_timeout_id = 0; static void gs_timer_proc(XtPointer client_data, XtIntervalId * id); -static struct xtimer gs_timer = {NULL, {0, 0}, gs_timer_proc}; +static struct xtimer gs_timer = {NULL, {0, 0}, gs_timer_proc, NULL +#if XDVI_XT_TIMER_HACK + , NULL, NULL +#endif +}; + #else -static void gs_alarm(struct xtimer *timer); -static struct xtimer gs_timer = {NULL, {0, 0}, XTM_DEFAULT, gs_alarm +static void gs_alarm(struct xtimer *this, void *data); +static struct xtimer gs_timer = {NULL, {0, 0}, XTM_DEFAULT, gs_alarm, NULL #if XDVI_XT_TIMER_HACK - , NULL, NULL + , NULL, NULL #endif }; #endif @@ -211,12 +218,14 @@ showto(char *q) } static char * -read_from_gs(int fd) +read_from_gs(int fd, void *data) { int bytes; char *line_end = NULL; char *p; + UNUSED(data); + for (;;) { bytes = read(fd, linepos, line + LINELEN - linepos); @@ -275,8 +284,8 @@ read_from_gs(int fd) if (linepos >= line + LINELEN) { p = line + LINELEN; if ((*--p != '\347' && *--p != '\347' && *--p != '\347') - || (memcmp(p, ackstr, line + LINELEN - p) != 0 - && memcmp(p, oldstr, line + LINELEN - p) != 0)) + || (memcmp(p, ackstr, line + LINELEN - p) != 0 + && memcmp(p, oldstr, line + LINELEN - p) != 0)) p = line + LINELEN; *p = '\0'; printf("gs: %s\n", line); @@ -290,12 +299,13 @@ read_from_gs(int fd) } static void -write_to_gs(int fd) +write_to_gs(int fd, void *data) { char *send_end; int bytes; UNUSED(fd); + UNUSED(data); for (;;) { send_end = GS_outb_in; @@ -377,7 +387,7 @@ gs_send(const char *cp, size_t len) if (gs_xio.pfd != NULL) gs_xio.pfd->events = POLLIN | POLLOUT; #endif - write_to_gs(GS_fd); + write_to_gs(GS_fd, NULL); if (GS_outb_out != old_out) { if (cp == cp_end) break; @@ -438,10 +448,11 @@ static void #if TIMER_PROBLEM_FIXED gs_timer_proc(XtPointer client_data, XtIntervalId * id) #else -gs_alarm(struct xtimer *timer) + gs_alarm(struct xtimer *this, void *data) #endif { - UNUSED(timer); + UNUSED(this); + UNUSED(data); if (globals.debug & DBG_PS) puts("GS timeout expired"); @@ -468,7 +479,7 @@ waitack(void) GS_die_ack = EV_ACK; for (;;) { /* loop because there might be stray ACKs. */ -/* fprintf(stderr, "looping for stray ACKs, page %d\n", current_page); */ + /* fprintf(stderr, "looping for stray ACKs, page %d\n", current_page); */ (void) read_events(EV_GE_ACK); globals.ev.flags &= ~EV_ACK; @@ -486,7 +497,7 @@ waitack(void) #if TIMER_PROBLEM_FIXED if (gs_timeout_id) XtRemoveTimeOut(gs_timeout_id); - gs_timeout_id = XtAppAddTimeOut(app, resource.gs_timeout, + gs_timeout_id = XtAppAddTimeOut(globals.app, resource.gs_timeout, gs_timer_proc, (XtPointer) NULL); #else set_timer(&gs_timer, resource.gs_timeout); @@ -570,9 +581,9 @@ initGS(void) "stop\n%%xdvimark\n"; /* - * If we're prescanning *before* setting up the widgets (to get the - * page size, for example), then postpone starting up ghostscript. - */ + * If we're prescanning *before* setting up the widgets (to get the + * page size, for example), then postpone starting up ghostscript. + */ if (mane.win == (Window)0) { if (globals.debug & DBG_PS) puts("Hit PS header in early prescan; postponing."); @@ -735,7 +746,7 @@ gs_died(int status, struct xchild *child) if (globals.debug & DBG_PS) fprintf(stderr, "process %s died\n", child->name); GS_pid = 0; - (child->io->read_proc)(child->io->fd); + (child->io->read_proc)(child->io->fd, NULL); if (linepos > line) { *linepos = '\0'; printf("%s: %s\n", child->name, line); @@ -760,7 +771,7 @@ destroy_gs(void) perror("xdvik: destroy_gs"); GS_pid = 0; clear_chld(&gs_child); - read_from_gs(GS_fd); + read_from_gs(GS_fd, NULL); if (linepos > line) { *linepos = '\0'; printf("gs: %s\n", line); @@ -800,12 +811,12 @@ interrupt_gs(void) a file that should be reloaded. */ if (GS_pending == 0) { -/* fprintf(stderr, "+++++++++ 1st case; waitack: %d\n", globals.ev.flags & EV_ACK); */ + /* fprintf(stderr, "+++++++++ 1st case; waitack: %d\n", globals.ev.flags & EV_ACK); */ globals.ev.flags &= ~EV_ACK; return; } else if (GS_pending < 0) { -/* fprintf(stderr, "GS_pending: %d; waitack: %d\n", GS_pending, globals.ev.flags & EV_ACK); */ + /* fprintf(stderr, "GS_pending: %d; waitack: %d\n", GS_pending, globals.ev.flags & EV_ACK); */ return; /* nothing to do */ } @@ -916,7 +927,7 @@ drawbegin_gs(int xul, int yul, const char *cp) sprintf(buf, "%d %d moveto\n", xul, yul); gs_send(buf, strlen(buf)); -/* gs_send(clear_bg, strlen(clear_bg)); */ + /* gs_send(clear_bg, strlen(clear_bg)); */ if (globals.debug & DBG_PS) printf("drawbegin at %d,%d: sending `%s'\n", xul, yul, cp); @@ -928,7 +939,7 @@ drawbegin_gs(int xul, int yul, const char *cp) if (strstr(cp, "rotate") != NULL /* used by graphics.sty */ || strstr(cp, "RotBegin") != NULL /* used by pstricks */ ) { - statusline_print(STATUS_SHORT, + statusline_error(STATUS_SHORT, "Warning: PS code on page %d may contain rotation, " "which is not supported by xdvi", current_page + 1); } @@ -967,7 +978,7 @@ drawfile_gs(const char *cp, FILE *f) if (globals.debug & DBG_PS) printf("original path: |%s|\n", cp); -/* drawraw_gs("newpath 0 0 moveto 0 1000 rlineto 1000 0 rlineto 0 -1000 rlineto closepath 1 setgray fill"); */ + /* drawraw_gs("newpath 0 0 moveto 0 1000 rlineto 1000 0 rlineto 0 -1000 rlineto closepath 1 setgray fill"); */ #if 0 /* if expand_symlinks or remove_dots from kpathsea were public, we could use the following: */ @@ -987,10 +998,10 @@ drawfile_gs(const char *cp, FILE *f) gs_send("(", 1); gs_send(cp, strlen(cp)); gs_send(")run\n", 5); -/* { */ -/* char *clear_bg = "newpath 0 0 moveto 0 1000 rlineto 1000 0 rlineto 0 -1000 rlineto closepath .4 setgray fill\n"; */ -/* gs_send(clear_bg, strlen(clear_bg)); */ -/* } */ + /* { */ + /* char *clear_bg = "newpath 0 0 moveto 0 1000 rlineto 1000 0 rlineto 0 -1000 rlineto closepath .4 setgray fill\n"; */ + /* gs_send(clear_bg, strlen(clear_bg)); */ + /* } */ } static void @@ -1022,7 +1033,7 @@ beginheader_gs(void) } if (globals.ev.flags & GS_ev_mask) { -/* fprintf(stderr, "longjmp!"); */ + /* fprintf(stderr, "longjmp!"); */ longjmp(globals.ev.canit, 1); } diff --git a/Build/source/texk/xdvik/psnews.c b/Build/source/texk/xdvik/psnews.c index 27781095824..502f66f3084 100644 --- a/Build/source/texk/xdvik/psnews.c +++ b/Build/source/texk/xdvik/psnews.c @@ -21,20 +21,20 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTES: - This code was originally written by Ricardo Telichevesky - (ricardo@rle-vlsi-mit.edu) and Luis Miguel Silveira - (lms@rle-vlsi-mit.edu). - It was largely influenced by similar code in the SeeTeX/XTeX - package by Dirk Grunwald (grunwald@colorado.edu). +This code was originally written by Ricardo Telichevesky +(ricardo@rle-vlsi-mit.edu) and Luis Miguel Silveira +(lms@rle-vlsi-mit.edu). +It was largely influenced by similar code in the SeeTeX/XTeX +package by Dirk Grunwald (grunwald@colorado.edu). \*========================================================================*/ -/* ||| To do: - * ALWAYS_CLOSE_SERVER_CONNECTION? - * Is there some way of interrupting a process? - * fork - * extra bytes on input - */ + /* ||| To do: + * ALWAYS_CLOSE_SERVER_CONNECTION? + * Is there some way of interrupting a process? + * fork + * extra bytes on input + */ #ifdef PS_NEWS /* whole file */ @@ -46,7 +46,7 @@ NOTES: #include #include -/* Condition for retrying a write */ + /* Condition for retrying a write */ #include #include @@ -56,13 +56,13 @@ NOTES: #include "dvi-init.h" #include "dvi-draw.h" -/* if POSIX O_NONBLOCK is not available, use O_NDELAY */ + /* if POSIX O_NONBLOCK is not available, use O_NDELAY */ #if !defined(O_NONBLOCK) && defined(O_NDELAY) #define O_NONBLOCK O_NDELAY #endif #ifdef X_NOT_STDC_ENV -extern int errno; + extern int errno; #endif #ifdef EWOULDBLOCK @@ -102,18 +102,18 @@ char *strtok(char *, const char *); * Some setup code. */ static const char str0[] = - "/OW2? version cvi 2 eq def " - "OW2? " - "{ /setlinewidth { pop } def} " - "{ /NeWS 3 0 findpackage beginpackage " - " /X11 3 0 findpackage beginpackage} " - "ifelse " - "currentcanvas /Color get " - "currentcanvas /Colormap get getcubedescription null eq and " - " {8 {{currentcanvas /Colormap get 1 index dup dup dup newcube} stopped " - " {pop pop pop pop pop} {exit} ifelse " - " 2 div cvi dup 1 eq {exit} if} loop pop} " - "if\n"; +"/OW2? version cvi 2 eq def " +"OW2? " +"{ /setlinewidth { pop } def} " +"{ /NeWS 3 0 findpackage beginpackage " +" /X11 3 0 findpackage beginpackage} " +"ifelse " +"currentcanvas /Color get " +"currentcanvas /Colormap get getcubedescription null eq and " +" {8 {{currentcanvas /Colormap get 1 index dup dup dup newcube} stopped " +" {pop pop pop pop pop} {exit} ifelse " +" 2 div cvi dup 1 eq {exit} if} loop pop} " +"if\n"; /* * This string reads chunks (delimited by %%xdvimark). * The first character of a chunk tells whether a given chunk @@ -122,21 +122,21 @@ static const char str0[] = * header; i.e., no save/restore. */ static const char preamble[] = - "/xdvi$line 81 string def " - "/xdvi$run {$error null ne {$error /newerror false put} if " - " {currentfile cvx stopped " - " $error null eq {false} {$error /newerror get} ifelse and " - " {handleerror} if} stopped pop} def " - "/xdvi$dslen countdictstack def " - "{currentfile read not {exit} if 72 eq " - " {xdvi$run} " - " {/xdvi$sav save def xdvi$run " - " clear countdictstack xdvi$dslen sub {end} repeat xdvi$sav restore} " - " ifelse " - " {(%%xdvimark) currentfile xdvi$line {readline} stopped " - " {clear} {{eq {false exit} if} {true exit} ifelse} ifelse }loop {exit} if " - " 58 tagprint flush " - "}loop\nH"; +"/xdvi$line 81 string def " +"/xdvi$run {$error null ne {$error /newerror false put} if " +" {currentfile cvx stopped " +" $error null eq {false} {$error /newerror get} ifelse and " +" {handleerror} if} stopped pop} def " +"/xdvi$dslen countdictstack def " +"{currentfile read not {exit} if 72 eq " +" {xdvi$run} " +" {/xdvi$sav save def xdvi$run " +" clear countdictstack xdvi$dslen sub {end} repeat xdvi$sav restore} " +" ifelse " +" {(%%xdvimark) currentfile xdvi$line {readline} stopped " +" {clear} {{eq {false exit} if} {true exit} ifelse} ifelse }loop {exit} if " +" 58 tagprint flush " +"}loop\nH"; extern const char psheader[]; extern int psheaderlen; @@ -204,15 +204,15 @@ static void write_to_NeWS(void); static struct xio NeWS_xout = {NULL, 0, XIO_IN, #if HAVE_POLL - NULL, + NULL, #endif - read_from_NeWS, write_to_NeWS}; + read_from_NeWS, write_to_NeWS, NULL}; static struct xio NeWS_xin = {NULL, 0, XIO_IN, #if HAVE_POLL - NULL, + NULL, #endif - read_from_NeWS, NULL}; + read_from_NeWS, NULL, NULL}; /*---------------------------------------------------------------------------* @@ -227,12 +227,12 @@ static struct xio NeWS_xin = {NULL, 0, XIO_IN, to the NeWS server; this may be duer to some abnormal condition, or some hairy PostScript code containing commands not implemented by the server. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static Boolean sigpipe_error = False; static struct sigaction psio_sigpipe_handler_struct; - /* initialized to {psio_sigpipe_handler, (sigset_t) 0, 0} in initNeWS */ +/* initialized to {psio_sigpipe_handler, (sigset_t) 0, 0} in initNeWS */ static RETSIGTYPE psio_sigpipe_handler(int sig, int code, struct sigcontext *scp, char *addr) @@ -287,7 +287,7 @@ write_to_NeWS(void) for (;;) { bytes = write(PostScript->file, NeWS_send_byte, - NeWS_send_end - NeWS_send_byte); + NeWS_send_end - NeWS_send_byte); if (bytes < 0) { if (AGAIN_CONDITION) break; @@ -400,7 +400,7 @@ waitack(void) Description: Initializes variables for the application main loop. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ Boolean initNeWS() { @@ -417,7 +417,7 @@ Boolean initNeWS() if (fcntl(PostScript->file, F_SETOWN, getpid()) == -1) perror("xdvi: fcntl F_SETOWN"); if (fcntl(PostScript->file, F_SETFL, - fcntl(PostScript->file, F_GETFL, 0) | FASYNC) == -1) + fcntl(PostScript->file, F_GETFL, 0) | FASYNC) == -1) perror("xdvi: fcntl F_SETFL"); #endif /* not FLAKY_SIGPOLL */ if (PostScriptInput->file != PostScript->file) { @@ -425,7 +425,7 @@ Boolean initNeWS() if (fcntl(PostScriptInput->file, F_SETOWN, getpid()) == -1) perror("xdvi: fcntl F_SETOWN"); if (fcntl(PostScriptInput->file, F_SETFL, - fcntl(PostScriptInput->file, F_GETFL, 0) | FASYNC) == -1) + fcntl(PostScriptInput->file, F_GETFL, 0) | FASYNC) == -1) perror("xdvi: fcntl F_SETFL"); #endif /* not FLAKY_SIGPOLL */ NeWS_xout.xio_events &= ~XIO_IN; @@ -484,7 +484,7 @@ Boolean initNeWS() Used to toggle the rendering of PostScript by the NeWS server Callable from within read_events(). -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void toggleNeWS(int flag) @@ -517,7 +517,7 @@ toggleNeWS(int flag) Close the connection to the NeWS server; used when rendering is terminated in any way. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void destroyNeWS(void) @@ -541,7 +541,7 @@ destroyNeWS(void) (preferably by sending something along the X socket); then we could do better than just to wait. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void interruptNeWS(void) @@ -573,7 +573,7 @@ interruptNeWS(void) Description: Should be called at the end of a page to end this chunk for the NeWS server. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void endpageNeWS(void) @@ -592,7 +592,7 @@ endpageNeWS(void) drawbeginNeWS () Arguments: xul, yul - coordinates of the upper left corner of the figure - cp - string with the bounding box line data + cp - string with the bounding box line data Returns: (void) Description: @@ -602,7 +602,7 @@ endpageNeWS(void) also generated whenever the PostScript code is too hairy and generates a SIGPIPE signal. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void drawbeginNeWS(int xul, int yul, const char *cp) @@ -680,7 +680,7 @@ drawbeginNeWS_box(int xul, int yul, const char *cp) If there is a valid connection to the NeWS server, just send the string to the interpreter, else leave. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void drawrawNeWS(const char *origcp) @@ -781,7 +781,7 @@ drawrawNeWS(const char *origcp) drawfileNeWS() Arguments: cp - string with the postscript file pathname - psfile - file, already opened + psfile - file, already opened Returns: (void) Side-Effects: none @@ -789,7 +789,7 @@ drawrawNeWS(const char *origcp) Postscript file containing the figure is opened and sent to the NeWS server. Figure is outlined in case hairy code produces a SIGPIPE signal. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void drawfileNeWS(const char *cp, FILE *psfile) @@ -833,7 +833,7 @@ drawfileNeWS(const char *cp, FILE *psfile) Description: Sends the indication of end of the figure PostScript code. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void drawendNeWS(const char *cp) @@ -857,7 +857,7 @@ drawendNeWS(const char *cp) Description: Prepares the PostScript interpreter for receipt of header code. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void beginheaderNeWS(void) @@ -898,7 +898,7 @@ beginheaderNeWS(void) Description: Prepares the PostScript interpreter for receipt of header code. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void endheaderNeWS(void) @@ -928,7 +928,7 @@ endheaderNeWS(void) Description: Clears out headers stored from the previous document. -+----------------------------------------------------------------------------*/ + +----------------------------------------------------------------------------*/ static void newdocNeWS(void) diff --git a/Build/source/texk/xdvik/read-mapfile.c b/Build/source/texk/xdvik/read-mapfile.c index 043d4bb1309..f637f06f6ae 100644 --- a/Build/source/texk/xdvik/read-mapfile.c +++ b/Build/source/texk/xdvik/read-mapfile.c @@ -55,6 +55,8 @@ read_map_file(char *name) return False; } + TRACE_T1((stderr, "Map file: %s\n", fullname)); + while (fgets(inline_buf, INLINE_SIZE, fp) != NULL) { char *TeXname = NULL; char *PSname = NULL; diff --git a/Build/source/texk/xdvik/search-internal.c b/Build/source/texk/xdvik/search-internal.c index 5c8f806d263..719deaa3f00 100644 --- a/Build/source/texk/xdvik/search-internal.c +++ b/Build/source/texk/xdvik/search-internal.c @@ -24,42 +24,42 @@ How dvi search works: (1) Map the search string passed by the user from resource.text_encoding - to UTF-8 (currently only maps ISO_8859-1), and create a regexp from - the string if needed. + to UTF-8 (currently only maps ISO_8859-1), and create a regexp from + the string if needed. - If case-insensitive matching is activated and regexp search is not - active, the search string is converted to lowercase. For regexp - searches, the flag available with regcomp to ignore case is used. + If case-insensitive matching is activated and regexp search is not + active, the search string is converted to lowercase. For regexp + searches, the flag available with regcomp to ignore case is used. (2) Scan 2 adjacent pages (so that we can also find matches across page - boundaries), collecting the text into a char *buffer. - This involves the following steps: + boundaries), collecting the text into a char *buffer. + This involves the following steps: - - Map characters from wide_ubyte to uint32_t encoding (ucs-4), - using and Adobe names lookup table (for Postscript Type1 - fonts) or font-specific character info (for Metafont fonts). + - Map characters from wide_ubyte to uint32_t encoding (ucs-4), + using and Adobe names lookup table (for Postscript Type1 + fonts) or font-specific character info (for Metafont fonts). - This step also maps accented glyphs to composite glyphs, - expands ligatures to separate characters (e.g. `ffi' to - `f'`f'`i'), and tries to detect word boundaries and line - breaks. + This step also maps accented glyphs to composite glyphs, + expands ligatures to separate characters (e.g. `ffi' to + `f'`f'`i'), and tries to detect word boundaries and line + breaks. - If case-insensitive matching is activated, the characters are - also lowercased in this step. + If case-insensitive matching is activated, the characters are + also lowercased in this step. - Optionally, hyphenation can be removed in this step. + Optionally, hyphenation can be removed in this step. - Routine: do_char() in dvi-draw.c (must be in dvi_draw.c since - we need access to drawing-related stuff like `currinf' to get - information about the current font, position in the DVI file - etc.). + Routine: do_char() in dvi-draw.c (must be in dvi_draw.c since + we need access to drawing-related stuff like `currinf' to get + information about the current font, position in the DVI file + etc.). - - Save the uint32_t characters into a char *buffer, mapping to - utf-8. + - Save the uint32_t characters into a char *buffer, mapping to + utf-8. (3) Search the buffer from (2) for the string from (1). If a match - has been found, the page is scanned again to store the bounding - box information of the matched text for highlighting it. + has been found, the page is scanned again to store the bounding + box information of the matched text for highlighting it. */ @@ -85,6 +85,8 @@ #include +#include + #include "dvi-init.h" /* for total_pages */ #include "dvi-draw.h" #include "search-internal.h" @@ -101,6 +103,7 @@ #include "string-utils.h" #include "mag.h" #include "pagehist.h" +#include "translations.h" #define DEBUG_SEARCH 0 /* #define MATCH_HIGHLIGHT_INVERTED 1 */ @@ -226,8 +229,8 @@ draw_bboxes(const struct word_info *info) } else { values.foreground = WhitePixelOfScreen(SCRN) ^ BlackPixelOfScreen(SCRN); -/* fprintf(stderr, "foreground: 0x%lx, white pixel: 0x%lx, black pixel: 0x%lx\n", */ -/* values.foreground, WhitePixelOfScreen(SCRN), BlackPixelOfScreen(SCRN)); */ + /* fprintf(stderr, "foreground: 0x%lx, white pixel: 0x%lx, black pixel: 0x%lx\n", */ + /* values.foreground, WhitePixelOfScreen(SCRN), BlackPixelOfScreen(SCRN)); */ valuemask = GCFunction | GCForeground; } bboxGC = XCreateGC(DISP, XtWindow(globals.widgets.top_level), valuemask, &values); @@ -300,8 +303,8 @@ draw_bboxes(const struct word_info *info) Boolean search_have_match(int pageno) { -/* fprintf(stderr, "pageno: %d --- m_info: %p\n", pageno, m_info); */ -/* fprintf(stderr, "m_match_page: %d\n", m_match_page); */ + /* fprintf(stderr, "pageno: %d --- m_info: %p\n", pageno, m_info); */ + /* fprintf(stderr, "m_match_page: %d\n", m_match_page); */ return m_info != NULL && m_match_page == pageno; } @@ -624,7 +627,7 @@ report_regexp_error(int errcode, regex_t *regex, const char *term, int flag) size_t n = regerror(errcode, regex, NULL, 0); char *err_buf = xmalloc(n); regerror(errcode, regex, err_buf, n); - XBell(DISP, 0); + xdvi_bell(); popup_message(XtNameToWidget(globals.widgets.top_level, "*find_popup"), MSG_ERR, NULL, @@ -637,11 +640,11 @@ report_regexp_error(int errcode, regex_t *regex, const char *term, int flag) static void try_match(const struct word_info *info, - const struct search_settings *settings, - struct search_info *searchinfo) + const struct search_settings *settings) { char *res = NULL; size_t from_pos = 0; + struct search_info *searchinfo = settings->searchinfo; ASSERT(info->curr_buf_idx == strlen(info->txt_buf), ""); TRACE_FIND((stderr, "buffer index: %lu, len: %lu; from: %lu", @@ -693,14 +696,15 @@ try_match(const struct word_info *info, static Boolean try_regexp_match(regex_t *regex, const struct word_info *info, - const struct search_settings *settings, - struct search_info *searchinfo) + const struct search_settings *settings) { int have_match; regmatch_t re_match; size_t from_pos = 0; Boolean retval = True; + struct search_info *searchinfo = settings->searchinfo; + #if SWITCH_TO_UTF8 /* switch to UTF-8 encoding, as for regcomp() */ char *utf8_locale = locale_to_utf8(globals.orig_locale); @@ -720,7 +724,7 @@ try_regexp_match(regex_t *regex, searchinfo->have_match = False; search_again = False; -/* TRACE_FIND((stderr, "search string: |%s|, from_pos: %d", info->txt_buf + from_pos, from_pos)); */ + /* TRACE_FIND((stderr, "search string: |%s|, from_pos: %d", info->txt_buf + from_pos, from_pos)); */ have_match = regexec(regex, info->txt_buf + from_pos, 1, &re_match, 0); if (have_match == 0) { /* match */ @@ -887,17 +891,25 @@ highlight_match(struct search_settings *settings, } } else { + if (searchinfo->from_pos >= page_mapping[1].offset) { + XDVI_ERROR((stderr, "to_pos (%d) should be smaller than page_mapping[1].offset (%d)!", + searchinfo->from_pos, page_mapping[1].offset)); + } ASSERT(searchinfo->from_pos < page_mapping[1].offset, "to_pos should be smaller than page_mapping[1].offset!"); match_page = page_mapping[1].pageno; if (searchinfo->to_pos > page_mapping[1].offset) { match_wrapped = True; } } - if (match_wrapped) - statusline_print(STATUS_MEDIUM, "Match from page %d to %d", match_page + 1, match_page + 2); - else - statusline_print(STATUS_MEDIUM, "Match on page %d", match_page + 1); + if (!settings->isearchterm) { + if (match_wrapped) + statusline_info(STATUS_MEDIUM, "Match from page %d to %d", match_page + 1, match_page + 2); + else + statusline_info(STATUS_MEDIUM, "Match on page %d", match_page + 1); + if (settings->wrapcnt > 0) + statusline_append(STATUS_MEDIUM, " (wrapped)", " (wrapped)"); + } if (globals.debug & DBG_FIND) { fprintf(stderr, "*** match_page: %d, adding: %d\n", match_page, searchinfo->page_offset); @@ -926,7 +938,7 @@ highlight_match(struct search_settings *settings, if (match_page != current_page) { goto_page(match_page, resource.keep_flag ? NULL : home, False); page_history_insert(match_page); -/* globals.ev.flags |= EV_NEWPAGE; */ + /* globals.ev.flags |= EV_NEWPAGE; */ } /* don't raise the window - this can obscure the search popup */ /* XMapRaised(DISP, XtWindow(globals.widgets.top_level)); */ @@ -1063,27 +1075,26 @@ get_text_selection(int *len, int ulx, int uly, int lrx, int lry) } Boolean -search_extract_text(outputFormatT fmt, struct select_pages_info *pinfo) +search_extract_text(struct save_or_print_info *info) { int i; FILE *fp; - struct file_info *finfo = pinfo->finfo; - if ((fp = XFOPEN(finfo->txt_out.fname, "wb")) == NULL) { + if ((fp = XFOPEN(info->finfo->out_file, "wb")) == NULL) { popup_message(globals.widgets.top_level, MSG_ERR, NULL, "Could not open %s for writing: %s.", - finfo->txt_out.fname, + info->finfo->out_file, strerror(errno)); return False; } for (i = 0; i < total_pages; i++) { - if (pinfo->callback == NULL || pinfo->callback(pinfo, i)) { + if (info->pinfo->callback == NULL || info->pinfo->callback(info, i)) { struct word_info txt_info = { NULL, 0, 0, NULL, 0, 0, NULL, NULL, 0, False, False, False }; scan_page(globals.dvi_file.bak_fp, i, &txt_info); - dump_buffer(&txt_info, 0, fp, fmt); + dump_buffer(&txt_info, 0, fp, info->fmt); free(txt_info.txt_buf); @@ -1112,7 +1123,8 @@ message_search_ended(XtPointer arg) search_signal_page_changed(); settings->message_window = 0; /* statusline_append(STATUS_SHORT, " stopped."); */ - statusline_print(STATUS_SHORT, "Search stopped."); + if (!settings->isearchterm) + statusline_info(STATUS_SHORT, "Search stopped."); } @@ -1122,6 +1134,7 @@ search_restart(XtPointer arg) struct search_settings *settings = (struct search_settings *)arg; Widget popup, textfield; char *searchterm = NULL; + char *textfield_name = NULL; TRACE_FIND((stderr, "restart search!")); @@ -1130,8 +1143,14 @@ search_restart(XtPointer arg) from the toplevel widget since this method may be called from a different window (e.g. confirmation popup). */ - if (get_widget_by_name(&popup, globals.widgets.top_level, Xdvi_SEARCH_POPUP_NAME, True) - && get_widget_by_name(&textfield, popup, Xdvi_SEARCHBOX_INPUT_NAME, True)) { +#if defined(MOTIF) && USE_COMBOBOX + textfield_name = "Text"; +#else + textfield_name = Xdvi_SEARCHBOX_INPUT_NAME; +#endif /* defined(MOTIF) && USE_COMBOBOX */ + if (!settings->isearchterm + && get_widget_by_name(&popup, globals.widgets.top_level, Xdvi_SEARCH_POPUP_NAME, True) + && get_widget_by_name(&textfield, popup, textfield_name, True)) { XtVaGetValues(textfield, #ifdef MOTIF XmNvalue, @@ -1162,7 +1181,6 @@ search_restart(XtPointer arg) search_dvi((XtPointer)settings); } - static void normalize_newline(char *str) { @@ -1200,7 +1218,7 @@ reinit_searchterm(struct search_settings *settings, const char *encoding) int ret_len; char *ptr = xmalloc(conv_len); if ((ret_len = str_iso_8859_1_to_utf8(settings->term, ptr, conv_len)) < 0) { - XBell(DISP, 0); + xdvi_bell(); popup_message(XtNameToWidget(globals.widgets.top_level, "*find_popup"), MSG_ERR, NULL, @@ -1336,7 +1354,7 @@ do_recompile_regexp(struct search_settings *settings, static void warn_no_regex(void) { - XBell(DISP, 0); + xdvi_bell(); popup_message(XtNameToWidget(globals.widgets.top_level, "*find_popup"), MSG_WARN, NULL, @@ -1426,6 +1444,199 @@ scan_two_pages(struct search_settings *settings, return !cancelled; } +static void +search_over_pages(struct search_settings *settings, + struct page_mapping *page_mapping, + struct word_info *w_info, + int *from_pos_bak, + Boolean adjust_hyphen_offset +#if HAVE_REGEX_H + , regex_t *regex +#endif + ) +{ + int curr_page = settings->from_page; /* page on which we're currently on */ + + for (;;) { /* scan pages, try to match */ + if (settings->isearchterm) { + const char *prefix = ""; + if (settings->wrapcnt > 0) + prefix = "Wrapped "; + statusline_info(STATUS_FOREVER, "%sI-search (ESC to exit): %s", prefix, settings->isearchterm); + } + else { + if (resource.expert_mode & XPRT_SHOW_STATUSLINE) /* too distracting for stdout */ + statusline_info(STATUS_MEDIUM, "Searching on page %d", curr_page); + } + TRACE_FIND((stderr, "curr_page: %d, pageno 0: %d, pageno1: %d", + curr_page, page_mapping[0].pageno, page_mapping[1].pageno)); + + settings->hyphen_delta = 0; + /* scan_two_pages will return False if user cancelled */ + if (!scan_two_pages(settings, w_info, page_mapping, curr_page) + || (read_events(EV_NOWAIT) & EV_GE_FIND_CANCEL)) { + if (!settings->isearchterm) { + if (resource.expert_mode & XPRT_SHOW_STATUSLINE) /* too distracting for stdout */ + statusline_append(STATUS_SHORT, + "- cancelled.", + "- cancelled."); + } + settings->searchinfo->locked = False; + return; + + } + + TRACE_FIND((stderr, "page mapping:\n%d: %d\n%d: %d", + page_mapping[0].pageno, page_mapping[0].offset, + page_mapping[1].pageno, page_mapping[1].offset)); + + /* dump_buffer(w_info, 0, stderr, FMT_ISO_8859_1); */ + + /* If ignore_hyphens has changed (in which case adjust_hyphen_offset + is true), the buffer will contain settings->hyphen_delta fewer + or more characters than in the previous pass due to the removal + or addition of hyphens; adjust from_pos and to_pos accordingly: + */ + if (adjust_hyphen_offset) { + TRACE_FIND((stderr, "adjusting offset by %d", settings->hyphen_delta)); + if (settings->ignore_hyphens) { /* fewer characters */ + settings->searchinfo->from_pos -= settings->hyphen_delta; + settings->searchinfo->to_pos -= settings->hyphen_delta; + } + else { /* more characters */ + settings->searchinfo->from_pos += settings->hyphen_delta; + settings->searchinfo->to_pos += settings->hyphen_delta; + } + TRACE_FIND((stderr, "NEW from_pos: %d; to_pos: %d", + settings->searchinfo->from_pos, settings->searchinfo->to_pos)); + } + + + /* match the searchstring */ +#if HAVE_REGEX_H + if (settings->use_regexp) { + if (!try_regexp_match(regex, w_info, settings)) /* regexp error */ + return; + + } + else { +#endif + try_match(w_info, settings); +#if HAVE_REGEX_H + } +#endif + + /* again, check if user cancelled */ + if (read_events(EV_NOWAIT) & EV_GE_FIND_CANCEL) { /* user cancelled */ + if (!settings->isearchterm) + statusline_append(STATUS_SHORT, + "- cancelled.", + "- cancelled."); + settings->searchinfo->locked = False; + return; + + } + + if (settings->searchinfo->have_match) { /* match, highlight it */ + highlight_match(settings, w_info, page_mapping); + settings->searchinfo->locked = False; + if (settings->direction == SEARCH_DOWN && !settings->isearchterm) { + *from_pos_bak = settings->searchinfo->from_pos; + settings->searchinfo->from_pos = settings->searchinfo->to_pos; + } + break; + } + else if ((settings->direction == SEARCH_DOWN && curr_page + 1 < total_pages) + || (settings->direction == SEARCH_UP && curr_page > 0)) { + if (settings->direction == SEARCH_DOWN) + curr_page++; + else + curr_page--; + TRACE_FIND((stderr, "continuing on page %d", curr_page)); + erase_match_highlighting(m_info, True); + /* no match, and we have more pages; continue scanning */ + continue; + } + else { /* reached end of file */ + Widget find_popup; + + if (settings->isearchterm) { + const char *prefix = "Failed"; + fprintf(stderr, "reached end with wrapcnt: %d\n", settings->wrapcnt); + if (settings->wrapcnt > 0) + prefix = "Failed wrapped"; + xdvi_bell(); + statusline_info(STATUS_FOREVER, "%s I-search (ESC to exit, RET to restart): %s", prefix, settings->term); + settings->searchinfo->locked = False; + erase_match_highlighting(m_info, True); + settings->wrapcnt++; + return; + } + + if (settings->wrap) { + if (settings->wrapcnt > 0) { + positioned_popup_message(XtNameToWidget(globals.widgets.top_level, "*find_popup"), + MSG_INFO, + settings->x_pos, settings->y_pos, + NULL, "Pattern `%s' not found.", settings->term); + /* positioned_choice_dialog(XtNameToWidget(globals.widgets.top_level, "*find_popup"), */ + /* MSG_INFO, */ + /* settings->x_pos, settings->y_pos, */ + /* NULL, */ + /* #ifndef MOTIF */ + /* NULL, */ + /* #endif */ + /* NULL, NULL, /\* pre callback *\/ */ + /* "OK", message_search_ended, (XtPointer)settings, */ + /* NULL, NULL, NULL, */ + /* "Pattern `%s' not found.", settings->term); */ + settings->searchinfo->locked = False; + message_search_ended((XtPointer)settings); + return; + } + settings->wrapcnt++; + erase_match_highlighting(m_info, True); + settings->searchinfo->locked = False; + search_restart((XtPointer)settings); + return; + } + + if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { + XDVI_WARNING((stderr, "Couldn't find \"find_popup\" widget!")); + find_popup = globals.widgets.top_level; + } + + if (!settings->isearchterm) + statusline_append(STATUS_MEDIUM, + "... searched to end of file.", + "... searched to end of file."); + erase_match_highlighting(m_info, True); + settings->searchinfo->locked = False; + + settings->message_window = + positioned_choice_dialog(find_popup, + MSG_QUESTION, + settings->x_pos, settings->y_pos, + NULL, +#ifndef MOTIF + "do-search-restart", +#endif + NULL, NULL, /* no pre_callbacks */ + "Yes", search_restart, (XtPointer)settings, + "Cancel", message_search_ended, (XtPointer)settings, + "Searched %s of file without finding the pattern.\n" + "Start again from the %s of the file?", + settings->direction == SEARCH_DOWN + ? "to end" : "to beginning", + settings->direction == SEARCH_DOWN + ? "beginning" : "end"); + TRACE_GUI((stderr, "message_window: %p\n", (void *)settings->message_window)); + /* notreached */ + break; + } + } /* for(;;) */ +} + void search_dvi(XtPointer arg) { @@ -1456,7 +1667,7 @@ search_dvi(XtPointer arg) so we need the start of the current match again (and down search sets searchinfo->from_pos = searchinfo->to_pos) */ static int from_pos_bak = -1; - int curr_page = settings->from_page; + /* int curr_page; */ Boolean reinit = False; Boolean recompile_regexp = False; @@ -1490,6 +1701,11 @@ search_dvi(XtPointer arg) ASSERT(settings->term != NULL, "settings->term mustn't be NULL!"); if (strlen(settings->term) == 0) { + if (settings->isearchterm) { + settings->searchinfo->locked = False; + return; + } + positioned_popup_message(XtNameToWidget(globals.widgets.top_level, "*find_popup"), MSG_ERR, settings->x_pos, settings->y_pos, @@ -1608,127 +1824,253 @@ search_dvi(XtPointer arg) #endif /* HAVE_REGEX_H */ } - for (;;) { /* scan pages, try to match */ - statusline_print(STATUS_MEDIUM, "Searching on page %d", curr_page); - TRACE_FIND((stderr, "curr_page: %d, pageno 0: %d, pageno1: %d", - curr_page, page_mapping[0].pageno, page_mapping[1].pageno)); + /* do it */ + search_over_pages(settings, page_mapping, &w_info, &from_pos_bak, adjust_hyphen_offset +#if HAVE_REGEX_H + , ®ex +#endif + ); +} - settings->hyphen_delta = 0; - /* scan_two_pages will return False if user cancelled */ - if (!scan_two_pages(settings, &w_info, page_mapping, curr_page) - || (read_events(EV_NOWAIT) & EV_GE_FIND_CANCEL)) { - statusline_append(STATUS_SHORT, - "- cancelled.", - "- cancelled."); - settings->searchinfo->locked = False; - return; +static void cb_isearch(Widget w, XtPointer closure, XEvent *event, Boolean *cont); - } +static void +do_isearch_cancel(struct search_settings *settings) +{ + static const char default_key_translations[] = + "\"0\":digit(0)\n" + "\"1\":digit(1)\n" + "\"2\":digit(2)\n" + "\"3\":digit(3)\n" + "\"4\":digit(4)\n" + "\"5\":digit(5)\n" + "\"6\":digit(6)\n" + "\"7\":digit(7)\n" + "\"8\":digit(8)\n" + "\"9\":digit(9)\n" + /* "\"-\":minus()\n" */ + ":motion()\n"; + + static const char default_mouse_translations[] = + ":release()"; + + + statusline_info(STATUS_SHORT, "I-search stopped."); + + free(settings->isearchterm); + settings->isearchterm = NULL; + settings->searchinfo->from_pos = settings->searchinfo->to_pos = 0; + settings->from_page = current_page; + erase_match_highlighting(m_info, True); - TRACE_FIND((stderr, "page mapping:\n%d: %d\n%d: %d", - page_mapping[0].pageno, page_mapping[0].offset, - page_mapping[1].pageno, page_mapping[1].offset)); -/* dump_buffer(&w_info, 0, stderr, FMT_ISO_8859_1); */ - /* If ignore_hyphens has changed (in which case adjust_hyphen_offset - is true), the buffer will contain settings->hyphen_delta fewer - or more characters than in the previous pass due to the removal - or addition of hyphens; adjust from_pos and to_pos accordingly: - */ - if (adjust_hyphen_offset) { - TRACE_FIND((stderr, "adjusting offset by %d", settings->hyphen_delta)); - if (settings->ignore_hyphens) { /* fewer characters */ - settings->searchinfo->from_pos -= settings->hyphen_delta; - settings->searchinfo->to_pos -= settings->hyphen_delta; - } - else { /* more characters */ - settings->searchinfo->from_pos += settings->hyphen_delta; - settings->searchinfo->to_pos += settings->hyphen_delta; - } - TRACE_FIND((stderr, "NEW from_pos: %d; to_pos: %d", - settings->searchinfo->from_pos, settings->searchinfo->to_pos)); - } + /* restore translations */ + XtOverrideTranslations(globals.widgets.top_level, XtParseTranslationTable(base_key_translations)); + XtOverrideTranslations(globals.widgets.top_level, XtParseTranslationTable(default_key_translations)); + XtOverrideTranslations(globals.widgets.top_level, XtParseTranslationTable(base_mouse_translations)); + XtOverrideTranslations(globals.widgets.top_level, XtParseTranslationTable(default_mouse_translations)); + + XtOverrideTranslations(globals.widgets.draw_widget, XtParseTranslationTable(base_key_translations)); + XtOverrideTranslations(globals.widgets.draw_widget, XtParseTranslationTable(default_key_translations)); + XtOverrideTranslations(globals.widgets.draw_widget, XtParseTranslationTable(base_mouse_translations)); + XtOverrideTranslations(globals.widgets.draw_widget, XtParseTranslationTable(default_mouse_translations)); + + XtOverrideTranslations(globals.widgets.clip_widget, XtParseTranslationTable(base_key_translations)); + XtOverrideTranslations(globals.widgets.clip_widget, XtParseTranslationTable(default_key_translations)); + XtOverrideTranslations(globals.widgets.clip_widget, XtParseTranslationTable(base_mouse_translations)); + XtOverrideTranslations(globals.widgets.clip_widget, XtParseTranslationTable(default_mouse_translations)); + + if (resource.main_translations != NULL) { + XtOverrideTranslations(globals.widgets.draw_widget, XtParseTranslationTable(resource.main_translations)); + XtOverrideTranslations(globals.widgets.clip_widget, XtParseTranslationTable(resource.main_translations)); + } + + XtRemoveEventHandler(globals.widgets.top_level, KeyPressMask|KeyReleaseMask, False, + cb_isearch, (XtPointer)settings); + XtRemoveEventHandler(globals.widgets.draw_widget, KeyPressMask|KeyReleaseMask, False, + cb_isearch, (XtPointer)settings); + XtRemoveEventHandler(globals.widgets.clip_widget, KeyPressMask|KeyReleaseMask, False, + cb_isearch, (XtPointer)settings); +} +static void +cb_isearch(Widget w, XtPointer closure, XEvent *event, Boolean *cont) +{ + struct search_settings *settings = (struct search_settings *)closure; - /* match the searchstring */ -#if HAVE_REGEX_H - if (settings->use_regexp) { - if (!try_regexp_match(®ex, &w_info, settings, searchinfo)) /* regexp error */ - return; + UNUSED(w); + UNUSED(cont); - } - else { -#endif - try_match(&w_info, settings, searchinfo); -#if HAVE_REGEX_H - } -#endif - - /* again, check if user cancelled */ - if (read_events(EV_NOWAIT) & EV_GE_FIND_CANCEL) { /* user cancelled */ - statusline_append(STATUS_SHORT, - "- cancelled.", - "- cancelled."); - settings->searchinfo->locked = False; - return; - - } + if (settings->isearchterm == NULL) + settings->isearchterm = xstrdup(""); + + if (event->type == KeyPress) { + char buf[48]; + KeySym keysym; + int count; + /* temporarily disable control mask; this gives better results with XLookupString() */ + const unsigned int save_state = event->xkey.state; + /* event->xkey.state &= ~ControlMask; */ + count = XLookupString(&(event->xkey), buf, 48, &keysym, NULL); + event->xkey.state = save_state; + if (count > 0) { + /* Ctrl-g and Ctrl-f continue isearch and + switch to the search window, respectively */ + if (event->xkey.state & ControlMask) { + if (keysym == XK_g) { + settings->term = settings->isearchterm; + isearch_start(); /* restart search */ + return; + } + else if (keysym == XK_f) { + static char *str = NULL; + if (str != NULL) { + free(str); + } + str = xstrdup(settings->isearchterm); + do_isearch_cancel(settings); + TRACE_FIND((stderr, "restarting search: %s", str)); + dvi_find_string(str, False); + return; + } + } + if (keysym == XK_Escape) { + do_isearch_cancel(settings); + return; + } + if (keysym == XK_BackSpace || keysym == XK_Delete) { + size_t len = strlen(settings->isearchterm); + if (len > 0) { + settings->isearchterm = xrealloc(settings->isearchterm, len); + settings->isearchterm[len - 1] = '\0'; + /* statusline_info(STATUS_FOREVER, "I-search (ESC to exit): %s", settings->posix_term); */ + } + else { + xdvi_bell(); + } + } + else if (keysym >= XK_Shift_L && keysym <= XK_Hyper_R) { + fprintf(stderr, "keysym %ld: Modifier %s\n", keysym, XKeysymToString(keysym)); + } + else if (keysym == XK_Return || keysym == XK_KP_Enter || keysym == XK_Linefeed) { /* TODO */ + settings->term = settings->isearchterm; + isearch_start(); /* restart search */ + return; + /* statusline_info(STATUS_FOREVER, "I-search (ESC to exit): %s (next match)", settings->isearchterm); */ + } + else if ((keysym >= XK_KP_Space && keysym <= XK_KP_9) + || (keysym >= XK_space && keysym <= XK_asciitilde) + || (keysym >= XK_exclamdown && keysym <= XK_ydiaeresis) + || (keysym >= XK_F1 && keysym <= XK_F35)) { + settings->isearchterm = xstrcat(settings->isearchterm, buf); + /* statusline_info(STATUS_FOREVER, "I-search (ESC to exit): %s", settings->posix_term); */ + } + else { /* TODO: abort search? */ + xdvi_bell(); + TRACE_FIND((stderr, "keysym %ld: %s is not handled", keysym, XKeysymToString(keysym))); + } - if (searchinfo->have_match) { /* match, highlight it */ - highlight_match(settings, &w_info, page_mapping); - settings->searchinfo->locked = False; - if (settings->direction == SEARCH_DOWN) { - from_pos_bak = searchinfo->from_pos; - searchinfo->from_pos = searchinfo->to_pos; + if (settings->isearchterm[0] != '\0') { + /* const char *prefix = ""; */ + /* fprintf(stderr, "cb_isearch called!\n"); */ + /* if (settings->wrapcnt > 0) */ + /* prefix = "Wrapped "; */ + /* statusline_info(STATUS_FOREVER, "%sI-search (ESC to exit): %s", prefix, settings->isearchterm); */ + settings->from_page = current_page; + settings->message_window = 0; + /* settings->wrapcnt = 0; */ + settings->term = settings->isearchterm; + search_dvi((XtPointer)settings); } - break; - } - else if ((settings->direction == SEARCH_DOWN && curr_page + 1 < total_pages) - || (settings->direction == SEARCH_UP && curr_page > 0)) { - if (settings->direction == SEARCH_DOWN) - curr_page++; - else - curr_page--; - TRACE_FIND((stderr, "continuing on page %d", curr_page)); - erase_match_highlighting(m_info, True); - /* no match, and we have more pages; continue scanning */ - continue; } - else { /* reached end of file */ - Widget find_popup; + } - if ((find_popup = XtNameToWidget(globals.widgets.top_level, "*find_popup")) == 0) { - XDVI_WARNING((stderr, "Couldn't find \"find_popup\" widget!")); - find_popup = globals.widgets.top_level; - } - - statusline_append(STATUS_MEDIUM, - "... searched to end of file.", - "... searched to end of file."); - erase_match_highlighting(m_info, True); - settings->searchinfo->locked = False; +} - settings->message_window = - positioned_choice_dialog(find_popup, - MSG_QUESTION, - settings->x_pos, settings->y_pos, - NULL, -#ifndef MOTIF - "do-search-restart", +#ifdef MOTIF +#define XTranslations XmNtranslations +#else +#define XTranslations XtNtranslations #endif - NULL, NULL, /* no pre_callbacks */ - "Yes", search_restart, (XtPointer)settings, - "Cancel", message_search_ended, (XtPointer)settings, - "Searched %s of file without finding the pattern.\n" - "Start again from the %s of the file?", - settings->direction == SEARCH_DOWN - ? "forward to end" : "backward to beginning", - settings->direction == SEARCH_DOWN - ? "beginning" : "end"); - TRACE_GUI((stderr, "message_window: %p\n", (void *)settings->message_window)); - /* notreached */ - break; + +/* static void */ +/* isearch_cancel(Widget w, XEvent *event, String *params, Cardinal *num_params) */ +/* { */ +/* struct search_settings *settings = NULL; */ +/* void *ptr; */ + +/* UNUSED(w); */ +/* UNUSED(event); */ + +/* if (*num_params < 1) { */ +/* XDVI_WARNING((stderr, "Wrong argument number (%d) in callback!", *num_params)); */ +/* return; */ +/* } */ +/* sscanf(*params, "%p", &ptr); */ +/* settings = (struct search_settings *)ptr; */ +/* do_isearch_cancel(settings); */ +/* } */ + + +/* static XtActionsRec isearch_actions[] = { */ +/* {"CancelIsearch", isearch_cancel }, */ +/* }; */ + +void isearch_start(void) +{ + /* char *ptr = NULL; */ + XtTranslations empty_trans; + static struct search_settings settings = { + NULL, NULL, NULL, + False, False, False, False, + False, 0, + NULL, /* isearchterm */ + SEARCH_DOWN, NULL, + 0, 0, + 0, 0, 0, + 0, NULL + }; + static struct search_info searchinfo = { + False, False, False, + 0, 0, 0, 0 + }; + static int wrapcnt_bak = 0; + + settings.searchinfo = &searchinfo; + + if (settings.isearchterm) { /* already running a search, jump to next match */ + settings.searchinfo->from_pos = settings.searchinfo->to_pos; + if (settings.wrapcnt > wrapcnt_bak) { /* search wrapped */ + wrapcnt_bak = settings.wrapcnt; + search_restart((XtPointer)&settings); } - } /* for(;;) */ + else { + wrapcnt_bak = settings.wrapcnt; + search_dvi((XtPointer)&settings); + } + return; + } + + settings.wrapcnt = 0; + + /* ptr = get_string_va("osfCancel:CancelIsearch(%p)", (void *)&settings); */ + /* empty_trans = XtParseTranslationTable(ptr); */ + empty_trans = XtParseTranslationTable(""); + /* free(ptr); */ + /* XtAddActions(isearch_actions, XtNumber(isearch_actions)); */ + + statusline_info(STATUS_FOREVER, "I-search (ESC to exit): "); + XtVaSetValues(globals.widgets.top_level, XTranslations, empty_trans, NULL); + XtAddEventHandler(globals.widgets.top_level, KeyPressMask|KeyReleaseMask, False, + cb_isearch, (XtPointer)&settings); + + XtVaSetValues(globals.widgets.draw_widget, XTranslations, empty_trans, NULL); + XtAddEventHandler(globals.widgets.draw_widget, KeyPressMask|KeyReleaseMask, False, + cb_isearch, (XtPointer)&settings); + + XtVaSetValues(globals.widgets.clip_widget, XTranslations, empty_trans, NULL); + XtAddEventHandler(globals.widgets.clip_widget, KeyPressMask|KeyReleaseMask, False, + cb_isearch, (XtPointer)&settings); } + diff --git a/Build/source/texk/xdvik/search-internal.h b/Build/source/texk/xdvik/search-internal.h index a3cee01c99d..6f7f864f74c 100644 --- a/Build/source/texk/xdvik/search-internal.h +++ b/Build/source/texk/xdvik/search-internal.h @@ -62,9 +62,12 @@ struct word_info { Boolean text_selection_pass; /* whether we're scanning for text selection */ }; +struct save_or_print_info; /* forward declaration */ + +extern void isearch_start(void); extern void search_dvi(XtPointer settings); extern void search_restart(XtPointer settings); -extern Boolean search_extract_text(outputFormatT fmt, struct select_pages_info *pinfo); +extern Boolean search_extract_text(struct save_or_print_info *info); extern Boolean search_have_match(int pageno); extern int search_inside_bbox_match(int x, int y); extern void search_draw_inverted_regions(void); diff --git a/Build/source/texk/xdvik/special.c b/Build/source/texk/xdvik/special.c index ec770c89983..6c769dc0421 100644 --- a/Build/source/texk/xdvik/special.c +++ b/Build/source/texk/xdvik/special.c @@ -689,7 +689,7 @@ static size_t g_bbox_info_max_size = 0; /* Append the current coordinates to g_bbox_info, unless it already contains these coordinates. - */ +*/ static void append_bbox_info(int x, int y, int w, int h, int angle) @@ -775,7 +775,7 @@ draw_bbox0(int xcorner, int ycorner) /* Display the items in bbox_info. Invoked from draw_page() in dvi-draw.c. - */ +*/ void display_bboxes(void) { @@ -1068,7 +1068,7 @@ enable_specials_send_ps_file(XtPointer data) const char *filename = (const char *)data; resource.allow_shell = True; redraw_page(); /* to erase the bounding box */ - statusline_print(STATUS_MEDIUM, + statusline_info(STATUS_MEDIUM, "Shell specials enabled for this session.", filename); send_ps_file(filename, kpse_pict_format); @@ -1092,7 +1092,7 @@ try_open_tempname(int status, struct xchild *this) else { fprintf(stderr, "sending file: %s, %p\n", tikp->tempname, (void *)f); /* There's no point in invoking - psp.drawfile(tikp->tempname, f); + psp.drawfile(tikp->tempname, f); here, since usually it will be already too late (draw_part() which had called us via applicationDoSpecial() will already have terminated). So instead, we just close the file and force a redraw of the entire page. @@ -1177,7 +1177,7 @@ send_ps_file(const char *filename, kpse_file_format_type pathinfo) warned_about_shellescape = True; } else { - statusline_print(STATUS_MEDIUM, + statusline_error(STATUS_MEDIUM, "Info: Shell special \"%s\" disabled.", filename); } @@ -1218,6 +1218,7 @@ send_ps_file(const char *filename, kpse_file_format_type pathinfo) char *expanded_filename = NULL; struct stat statbuf; expanded_filename = find_file(filename, &statbuf, pathinfo); + if (expanded_filename == NULL && (pathinfo == kpse_enc_format || pathinfo == kpse_type1_format)) { /* in this case, we also kpathsea-search in the `old' place for @@ -1225,12 +1226,15 @@ send_ps_file(const char *filename, kpse_file_format_type pathinfo) for load_vector(), dvi-draw.c for details) */ expanded_filename = kpse_find_file(filename, kpse_tex_ps_header_format, True); } + if (expanded_filename == NULL) { + expanded_filename = kpse_find_file(filename, kpse_program_text_format, True); + } if (expanded_filename == NULL) { /* still no success, complain */ /* FIXME: this warning may be overwritten by warning about raw PS specials, so additinally dump to stderr. TODO: make statusline printing respect more important messages. */ XDVI_WARNING((stderr, "Could not find graphics file \"%s\"", filename)); - statusline_print(STATUS_MEDIUM, "Warning: Could not find graphics file \"%s\"", + statusline_info(STATUS_MEDIUM, "Warning: Could not find graphics file \"%s\"", filename); draw_bbox(); return; @@ -1246,8 +1250,15 @@ send_ps_file(const char *filename, kpse_file_format_type pathinfo) strcpy(ffline, expanded_filename); bufp = ffline; f = XFOPEN(expanded_filename, OPEN_MODE); + if (f == NULL) { + XDVI_WARNING((stderr, "Could not open graphics file \"%s\": %s", expanded_filename, strerror(errno))); + statusline_info(STATUS_MEDIUM, "Warning: Could not open graphics file \"%s\": %s", + expanded_filename, strerror(errno)); + free(expanded_filename); + draw_bbox(); + return; + } free(expanded_filename); - ASSERT(f != NULL, "Internal error opening file"); /* check for compressed files */ len = strlen(filename); @@ -1486,19 +1497,19 @@ psfig_special(char *cp) /* Keys for epsf specials */ static const char *keytab[] = { "clip", - "llx", - "lly", - "urx", - "ury", - "rwi", - "rhi", - "hsize", - "vsize", - "hoffset", - "voffset", - "hscale", - "vscale", - "angle" + "llx", + "lly", + "urx", + "ury", + "rwi", + "rhi", + "hsize", + "vsize", + "hoffset", + "voffset", + "hscale", + "vscale", + "angle" }; #define KEY_LLX keyval[0] @@ -1739,7 +1750,7 @@ parse_color(const char *cp0, const char *cp, Use a prime close to sizof colornames / sizeof colornames[0]. You might want to update this when extending the colornames array, and to check the filling factor and average chain length by uncommenting the - hash_print(colornames_hash, True); + hash_print(colornames_hash, True); below. I usually go for filling > 50% and avg. chain len < 2. The 68-elem array below results in: @@ -2205,13 +2216,13 @@ color_special(const char *cp) #if PS scanned_page_ps = scanned_page; #endif -/* fprintf(stderr, "forcing redraw!!!\n"); */ + /* fprintf(stderr, "forcing redraw!!!\n"); */ globals.ev.flags |= EV_NEWPAGE; /* force a redraw */ longjmp(globals.ev.canit, 1); } return; } -/* fprintf(stderr, "bot_size: %d\n", color_bot_size); */ + /* fprintf(stderr, "bot_size: %d\n", color_bot_size); */ set_fg_color(rcs_top != NULL ? &rcs_top->color : &color_bottom[color_bot_size - 1]); } @@ -2449,7 +2460,7 @@ applicationDoSpecial(char *cp, size_t len) #if COLOR if (memicmp(cp, "color ", 6) == 0) { -/* fprintf(stderr, "------------- color special\n"); */ + /* fprintf(stderr, "------------- color special\n"); */ if (resource.use_color) color_special(cp + 6); return; @@ -2481,7 +2492,7 @@ applicationDoSpecial(char *cp, size_t len) # if PS scanned_page_ps = scanned_page; # endif -/* fprintf(stderr, "forcing redraw!\n"); */ + /* fprintf(stderr, "forcing redraw!\n"); */ globals.ev.flags |= EV_NEWPAGE; /* force a redraw */ longjmp(globals.ev.canit, 1); } @@ -2631,32 +2642,32 @@ scan_special(char *cp, int cp_len, void *data) # if COLOR if (scanned_page_ps <= scanned_page) # endif - { - if (*cp == '!') { - scan_bang(cp); - return dummy_ret; - } - else if (memicmp(cp, "header", 6) == 0 && (p = endofcommand(cp + 6)) != NULL) { - scan_header(p); - return dummy_ret; - } + { + if (*cp == '!') { + scan_bang(cp); + return dummy_ret; } + else if (memicmp(cp, "header", 6) == 0 && (p = endofcommand(cp + 6)) != NULL) { + scan_header(p); + return dummy_ret; + } + } #endif /* PS */ #if COLOR # if PS if (scanned_page_color <= scanned_page) # endif - { - if (memicmp(cp, "background ", 11) == 0) { - scan_bg_color(cp); - return dummy_ret; - } - else if (memicmp(cp, "color ", 6) == 0) { - scan_color(cp); - return dummy_ret; - } + { + if (memicmp(cp, "background ", 11) == 0) { + scan_bg_color(cp); + return dummy_ret; } + else if (memicmp(cp, "color ", 6) == 0) { + scan_color(cp); + return dummy_ret; + } + } #endif /* COLOR */ if (memcmp(cp, "papersize", 9) == 0 && (p = endofcommand(cp + 9)) != NULL) { m_have_papersize_special = True; diff --git a/Build/source/texk/xdvik/squeeze.c b/Build/source/texk/xdvik/squeeze.c index 0f57e1d8615..2ba4f58f1ae 100644 --- a/Build/source/texk/xdvik/squeeze.c +++ b/Build/source/texk/xdvik/squeeze.c @@ -21,10 +21,10 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTE: - This routine is adapted from the squeeze.c that comes with dvips; - it bears the message: - This software is Copyright 1988 by Radical Eye Software. - Used with permission. +This routine is adapted from the squeeze.c that comes with dvips; +it bears the message: +This software is Copyright 1988 by Radical Eye Software. +Used with permission. \*========================================================================*/ diff --git a/Build/source/texk/xdvik/stamp-aclocal b/Build/source/texk/xdvik/stamp-aclocal index 3f5a872b7e1..e913836d02d 100644 --- a/Build/source/texk/xdvik/stamp-aclocal +++ b/Build/source/texk/xdvik/stamp-aclocal @@ -1 +1 @@ -Tue Mar 4 16:46:33 CET 2008 +Tue Jul 1 16:17:12 CEST 2008 diff --git a/Build/source/texk/xdvik/stamp-auto.in b/Build/source/texk/xdvik/stamp-auto.in index d2bc7d781f5..917edbc0d7c 100644 --- a/Build/source/texk/xdvik/stamp-auto.in +++ b/Build/source/texk/xdvik/stamp-auto.in @@ -1 +1 @@ -Tue Mar 4 16:57:11 CET 2008 +Tue Jul 1 16:17:13 CEST 2008 diff --git a/Build/source/texk/xdvik/stamp-configure b/Build/source/texk/xdvik/stamp-configure index b1dee1e9f81..42772f0c65d 100644 --- a/Build/source/texk/xdvik/stamp-configure +++ b/Build/source/texk/xdvik/stamp-configure @@ -1 +1 @@ -Tue Mar 4 16:56:57 CET 2008 +Tue Jul 1 16:17:14 CEST 2008 diff --git a/Build/source/texk/xdvik/string-utils.c b/Build/source/texk/xdvik/string-utils.c index 8ade715ed5d..3ee4bb2d8da 100644 --- a/Build/source/texk/xdvik/string-utils.c +++ b/Build/source/texk/xdvik/string-utils.c @@ -20,7 +20,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ /* #define MYDEBUG 1 */ @@ -104,28 +104,28 @@ str_is_suffix(const char *str1, const char *str2, Boolean case_sensitive) char * my_stristr(const char *haystack, const char *needle) { - const char *curr; - - for (curr = haystack; *curr != '\0'; curr++) { - const char *ptr1, *ptr2; - /* search for first character */ - for (; ((*curr != '\0') && (tolower((int)*curr) != *needle)); curr++) { ; } - - if (*curr == '\0') /* not found */ - return NULL; - - /* now compare other characters */ - ptr1 = needle; - ptr2 = curr; - while (tolower((int)*ptr2) == *ptr1) { - ptr2++; - ptr1++; - /* success if at end of needle */ - if (*ptr1 == '\0') - return (char *)curr; - } - } - return NULL; + const char *curr; + + for (curr = haystack; *curr != '\0'; curr++) { + const char *ptr1, *ptr2; + /* search for first character */ + for (; ((*curr != '\0') && (tolower((int)*curr) != *needle)); curr++) { ; } + + if (*curr == '\0') /* not found */ + return NULL; + + /* now compare other characters */ + ptr1 = needle; + ptr2 = curr; + while (tolower((int)*ptr2) == *ptr1) { + ptr2++; + ptr1++; + /* success if at end of needle */ + if (*ptr1 == '\0') + return (char *)curr; + } + } + return NULL; } /* @@ -193,7 +193,7 @@ filename_append_dvi(const char *filename) /* skip over `file:' prefix if present */ if (str_is_prefix("file:", filename, True)) { filename += strlen("file:"); - if (str_is_prefix("//", filename + strlen("file:"), True)) { /* is there a hostname following? */ + if (str_is_prefix("//", filename, True)) { /* is there a hostname following? */ char *tmp = strchr(filename+2, '/'); /* skip over host name */ if (tmp == NULL) { XDVI_WARNING((stderr, "Malformed hostname part in filename `%s'; not expanding file name", @@ -224,7 +224,7 @@ filename_append_dvi(const char *filename) /* Append ".dvi" extension if no extension is present. Only look at the filename part when trying to find a `.'. - */ + */ if ((p = strrchr(expanded_filename, '/')) == NULL) { p = expanded_filename; } @@ -263,6 +263,7 @@ format_arg(const char *fmt, const char *arg, int *match) } else { strcpy(tmp, fmt); + /* NOTE: don't reset *match to 0, leave that to caller */ } return tmp; } @@ -278,8 +279,8 @@ escape_format_arg(const char *arg) ptr = ret; while (*arg != '\0') { /* need to escape? */ - if (*arg == '%' && (ptr == ret - || (ptr > ret && *(arg - 1) != '%'))) { + if (*arg == '%') { /* && (ptr == ret + || (ptr > ret && *(arg - 1) != '%'))) { */ *ptr++ = '%'; } *ptr++ = *arg++; @@ -319,8 +320,9 @@ unquote_arg(const char *fmt, const char *arg, int *match, int *len) * least 1 element). The caller is responsible for free()ing the returned * list. * - * If `do_unquote' is True, separators inside the quotes will not be - * treated as boundaries; instead, the quotes surrounding the chunk are removed. + * If `do_unquote' is True, separators inside single or double quotation marks will not be + * treated as boundaries. The quotation marks surrounding the chunk will be removed + * as well in that case. */ char ** get_separated_list(const char *source, const char *sep, Boolean do_unquote) @@ -496,7 +498,7 @@ src_compare(const char *src, int src_len, const char *target, const char *dvi_pa while (i >= 0 && j >= 0) { int skip_dirs = 0; -/* fprintf(stderr, "check: %d[%c]\n", i, src[i]); */ + /* fprintf(stderr, "check: %d[%c]\n", i, src[i]); */ while (src[i] == '.' && src[i + 1] == '/') { /* normalize `../' and `./' */ MYTRACE((stderr, "check2: %d[%c]", i, src[i])); @@ -663,6 +665,34 @@ shell_escape_string(const char *str) return new_str; } +/* Get a pointer to the extension of the filename 'fname' + (ie. into the existing string), + or NULL if fname doens't have an extension. + */ +const char * +get_extension(const char *fname) +{ + char *sep, *tmp; + /* does filename have a directory component? + If so, be careful with dots within this component. + */ + if ((sep = strrchr(fname, '/')) != NULL) { + tmp = sep; + if ((sep = strrchr(tmp, '.')) != NULL) { + return sep; + } + else { + return NULL; + } + } + else if ((sep = strrchr(fname, '.')) != NULL) { + return sep; + } + else { + return NULL; + } +} + void replace_extension(const char *fname, const char *extension, char *buf, size_t buf_len) diff --git a/Build/source/texk/xdvik/string-utils.h b/Build/source/texk/xdvik/string-utils.h index 91909bcf42d..2439d56c5ea 100644 --- a/Build/source/texk/xdvik/string-utils.h +++ b/Build/source/texk/xdvik/string-utils.h @@ -16,7 +16,7 @@ typedef enum { USE_DVI_PATH, USE_CWD_PATH } expandPathTypeT; /* remove `file:[//localhost/]' prefix from filename, and append `.dvi' extension if no extension is present */ extern char *filename_append_dvi(const char *fname); -/* prepend a path of type `type' (either CVW, or directory of dvi file) +/* prepend a path of type `type' (either CWD, or directory of dvi file) to `fname' */ extern char *expand_filename(const char *fname, expandPathTypeT type); @@ -35,6 +35,7 @@ extern const char *find_format_str(const char *input, const char *fmt); extern Boolean src_compare(const char *src, int src_len, const char *target, const char *path, size_t path_len); extern char *shell_escape_string(const char *str); extern void replace_extension(const char *fname, const char *extension, char *buf, size_t name_len); +extern const char *get_extension(const char *fname); extern int length_of_int(int n); extern char *get_string_va(const char *fmt, ...); diff --git a/Build/source/texk/xdvik/string_list.c b/Build/source/texk/xdvik/string_list.c new file mode 100644 index 00000000000..7138c2a7b2f --- /dev/null +++ b/Build/source/texk/xdvik/string_list.c @@ -0,0 +1,166 @@ +#include +#include +#include + +#include "xdvi-config.h" +#include "xdvi.h" +#include "util.h" +#include "string_list.h" + + +/* + * Helper functions for string lists + */ +char * +string_list_to_str(char **list, const char *sep) +{ + char *result = xstrdup(""); + int i; + + for (i = 0; list[i] != NULL; i++) { + result = xstrcat(result, list[i]); + result = xstrcat(result, sep); + } + return result; +} + + +void +string_list_print(char **list) +{ + int i; + + for (i = 0; list != NULL && list[i] != NULL; i++) { + fprintf(stderr, "List %d: |%s|\n", i, list[i]); + } +} + +/* + * Reorder the list so that str (which is supposed to occur in the list somewhere) + * is the first element. + */ +char ** +string_list_reorder(char **list, char *str) +{ + size_t i; + char *tmp; + Boolean found = False; + + for (i = 0; list[i] != NULL; i++) { + if (strcmp(list[i], str) == 0) { + found = True; + break; + } + } + + if (!found) { + XDVI_ERROR((stderr, "Item `%s' not found in list!\n", str)); + return list; + } + + tmp = list[0]; + list[0] = str; + list[i] = tmp; + return list; +} + +/* + * Move the item at position idx to the start of the list, + * by iteratively swapping it with its predecessor. + */ +char ** +string_list_move_to_start(char **list, size_t idx) +{ + size_t i; + +#if 0 + for (i = 0; list[i] != NULL; i++) { + fprintf(stderr, "list before: %d: |%s|\n", i, list[i]); + } +#endif + + for (i = idx; i > 0; i--) { + char *tmp = list[i]; + list[i] = list[i - 1]; + list[i - 1] = tmp; + } + +#if 0 + for (i = 0; list[i] != NULL; i++) { + fprintf(stderr, "list after: %d: |%s|\n", i, list[i]); + } +#endif + + return list; +} + +/* + * Rotate the list so that the first element is shifted to the end, + * and all next elements are moved down by 1; e.g.: + * before rotate: a b c d e f + * after rotate: b c d e f a + */ +char ** +string_list_rotate_down(char **list) +{ + size_t i; + char *tmp; + + tmp = list[0]; + if (tmp == NULL) { + return list; + } + for (i = 1; list[i] != NULL; i++) { + list[i - 1] = list[i]; + } + list[i - 1] = tmp; + + return list; +} + +/* + * Rotate the list so that the last element is shifted to the beginning, + * and all next elements are moved up by 1; e.g.: + * before rotate: a b c d e f + * after rotate: f a b c d e + */ +char ** +string_list_rotate_up(char **list) +{ + size_t i; + char *tmp = NULL; + + if (list[0] == NULL) { + return list; + } + /* go to end */ + for (i = 0; list[i] != NULL; i++) { ; } + i--; /* get last index */ + + tmp = list[i]; + for (; i > 0; i--) { + list[i] = list[i - 1]; + } + list[0] = tmp; + + return list; +} + +char ** +string_list_prepend(char **list, const char *str) +{ + int i, k; + /* reallocate with larger capacity */ + for (i = 0; list[i] != NULL; i++) { ; } + i++; + list = xrealloc(list, (i + 1) * sizeof *list); + + /* shift old contents down */ + for (k = i; k > 0; k--) { + list[k] = list[k - 1]; + } + /* add new element at beginning */ + list[0] = xstrdup(str); + + return list; +} diff --git a/Build/source/texk/xdvik/string_list.h b/Build/source/texk/xdvik/string_list.h new file mode 100644 index 00000000000..f89a7651984 --- /dev/null +++ b/Build/source/texk/xdvik/string_list.h @@ -0,0 +1,8 @@ + +char *string_list_to_str(char **list, const char *sep); +void string_list_print(char **list); +char **string_list_reorder(char **list, char *str); +char **string_list_move_to_start(char **list, size_t idx); +char **string_list_rotate_down(char **list); +char **string_list_rotate_up(char **list); +char **string_list_prepend(char **list, const char *str); diff --git a/Build/source/texk/xdvik/tests/Makefile.in b/Build/source/texk/xdvik/tests/Makefile.in new file mode 100644 index 00000000000..2d5f4d580ea --- /dev/null +++ b/Build/source/texk/xdvik/tests/Makefile.in @@ -0,0 +1,120 @@ +# @configure_input@ +# Makefile for xdvik +# +# - 1999/05/08: janl: Removed submakes for libwww and kpathsea. That's what +# the top makefile is for! +# + + +### NOTE: kpse_include paths must be relative to texk/xdvik, since that +### is from where the configure is run! +kpse_include ../make/paths.mk +kpse_include ../make/library.mk +kpse_include ../make/common.mk +kpse_include ../make/programs.mk +kpse_include xdvi_objects.mk + +kpathsea_parent = ../.. + +x_cppflags=@X_CFLAGS@ @iconv_includes@ +x_ldflags=@X_LIBS@ @x_linker_options@ @iconv_libpath@ +x_pre_libs=@X_PRE_LIBS@ +x_extra_libs=@X_EXTRA_LIBS@ @iconv_libs@ +x_tool_libs=@x_tool_libs@ +x_xmu_lib=@x_xmu_lib@ +x_xpm_libs=@x_xpm_libs@ +x_ext_lib=@x_ext_lib@ + +x_link = $(LDLIBT1) $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt $(x_pre_libs) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs) + +LDLIBT1=@LDLIBT1@ +LIBT1CPPFLAGS=@LIBT1CPPFLAGS@ +LIBT1DEP=@LIBT1DEP@ +LIBT1DIR = ../../../libs/t1lib +LIBTYPE1DIR = $(LIBT1DIR)/../type1 +LIBT1SRCDIR = $(srcdir)/$(LIBT1DIR) + +LIBGUI=../gui/libgui.a +LIBGUIDEP=$(LIBGUI) + +CPP = @CPP@ +RANLIB = @RANLIB@ + +# Make `#include ' and `-lX...' work. +# This matches web2c (needed only for Metafont). +x_cppflags = @X_CFLAGS@ + +# Extra xdvi-specific compiler options. +ps_def = @PS_DEF@ -DXSERVER_INFO +prog_cflags = @XTRA_WARN_CFLAGS@ -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) + +# Note: to be able to use one depend.mk file for both Motif/Xaw (which +# is needed since only maintainers are supposed to invoke `make depend') +# we include *all* object files and have tests for #ifdef MOTIF/XAW inside +# the files. +objects = \ + test_dl_list.o \ + test_string_list.o \ + test_string_utils.o \ + test_util.o \ + run_tests.o + + +# This are the files from xdvi needed to link the tests +xdvi_objects = \ + ../browser.o \ + ../dvi-draw.o \ + ../dvi-init.o \ + ../dvisel.o \ + ../encodings.o \ + ../events.o \ + ../exit-handlers.o \ + ../filehist.o \ + ../font-open.o \ + ../gf.o \ + ../hypertex.o \ + ../image-magick.o \ + ../mime.o \ + ../my-snprintf.o \ + ../my-vsnprintf.o \ + ../pagehist.o \ + ../pk.o \ + ../print-internal.o \ + ../psdps.o \ + ../psgs.o \ + ../psheader.o \ + ../psnews.o \ + ../read-mapfile.o \ + ../search-internal.o \ + ../special.o \ + ../string-utils.o \ + ../string_list.o \ + ../tfmload.o \ + ../util.o \ + ../dl_list.o \ + ../vf.o \ + ../xdvi.o \ + ../xserver-info.o \ + ../x_util.o + +default all: run_tests + +run_tests: $(objects) $(xdvi_objects) $(LIBT1DEP) $(LIBGUIDEP) + $(kpathsea_link) $(objects) $(xdvi_objects) $(LIBGUI) $(x_link) $(LOADLIBES) + +test: run_tests + ./run_tests + +test_verbose: run_tests + ./run_tests -v + +kpse_include ../make/dist.mk +kpse_include ../make/clean.mk + +clean:: + rm -f *.o *.a + +c_auto_h_dir = .. +kpse_include ../make/rdepend.mk +kpse_include ./gui/depend.mk +kpse_include ./tests/depend.mk diff --git a/Build/source/texk/xdvik/tests/Makefile.in.orig b/Build/source/texk/xdvik/tests/Makefile.in.orig new file mode 100644 index 00000000000..c4a03c1ecde --- /dev/null +++ b/Build/source/texk/xdvik/tests/Makefile.in.orig @@ -0,0 +1,119 @@ +# Makefile for xdvik +# +# - 1999/05/08: janl: Removed submakes for libwww and kpathsea. That's what +# the top makefile is for! +# + + +### NOTE: ac_include paths must be relative to texk/xdvik, since that +### is from where the configure is run! +ac_include ../make/paths.mk +ac_include ../make/library.mk +ac_include ../make/common.mk +ac_include ../make/programs.mk +ac_include xdvi_objects.mk + +kpathsea_parent = ../.. + +x_cppflags=@X_CFLAGS@ @iconv_includes@ +x_ldflags=@X_LIBS@ @x_linker_options@ @iconv_libpath@ +x_pre_libs=@X_PRE_LIBS@ +x_extra_libs=@X_EXTRA_LIBS@ @iconv_libs@ +x_tool_libs=@x_tool_libs@ +x_xmu_lib=@x_xmu_lib@ +x_xpm_libs=@x_xpm_libs@ +x_ext_lib=@x_ext_lib@ + +x_link = $(LDLIBT1) $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt $(x_pre_libs) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs) + +LDLIBT1=@LDLIBT1@ +LIBT1CPPFLAGS=@LIBT1CPPFLAGS@ +LIBT1DEP=@LIBT1DEP@ +LIBT1DIR = ../../../libs/t1lib +LIBTYPE1DIR = $(LIBT1DIR)/../type1 +LIBT1SRCDIR = $(srcdir)/$(LIBT1DIR) + +LIBGUI=../gui/libgui.a +LIBGUIDEP=$(LIBGUI) + +CPP = @CPP@ +RANLIB = @RANLIB@ + +# Make `#include ' and `-lX...' work. +# This matches web2c (needed only for Metafont). +x_cppflags = @X_CFLAGS@ + +# Extra xdvi-specific compiler options. +ps_def = @PS_DEF@ -DXSERVER_INFO +prog_cflags = @XTRA_WARN_CFLAGS@ -I.. -I$(srcdir)/.. $(x_cppflags) $(ps_def) + +# Note: to be able to use one depend.mk file for both Motif/Xaw (which +# is needed since only maintainers are supposed to invoke `make depend') +# we include *all* object files and have tests for #ifdef MOTIF/XAW inside +# the files. +objects = \ + test_dl_list.o \ + test_string_list.o \ + test_string_utils.o \ + test_util.o \ + run_tests.o + + +# This are the files from xdvi needed to link the tests +xdvi_objects = \ + ../browser.o \ + ../dvi-draw.o \ + ../dvi-init.o \ + ../dvisel.o \ + ../encodings.o \ + ../events.o \ + ../exit-handlers.o \ + ../filehist.o \ + ../font-open.o \ + ../gf.o \ + ../hypertex.o \ + ../image-magick.o \ + ../mime.o \ + ../my-snprintf.o \ + ../my-vsnprintf.o \ + ../pagehist.o \ + ../pk.o \ + ../print-internal.o \ + ../psdps.o \ + ../psgs.o \ + ../psheader.o \ + ../psnews.o \ + ../read-mapfile.o \ + ../search-internal.o \ + ../special.o \ + ../string-utils.o \ + ../string_list.o \ + ../tfmload.o \ + ../util.o \ + ../dl_list.o \ + ../vf.o \ + ../xdvi.o \ + ../xserver-info.o \ + ../x_util.o + +default all: run_tests + +run_tests: $(objects) $(xdvi_objects) $(LIBT1DEP) $(LIBGUIDEP) + $(kpathsea_link) $(objects) $(xdvi_objects) $(LIBGUI) $(x_link) $(LOADLIBES) + +test: run_tests + ./run_tests + +test_verbose: run_tests + ./run_tests -v + +ac_include ../make/dist.mk +ac_include ../make/clean.mk + +clean:: + rm -f *.o *.a + +c_auto_h_dir = .. +ac_include ../make/rdepend.mk +ac_include ./gui/depend.mk +ac_include ./tests/depend.mk diff --git a/Build/source/texk/xdvik/tests/README b/Build/source/texk/xdvik/tests/README new file mode 100644 index 00000000000..f92ceca8cf3 --- /dev/null +++ b/Build/source/texk/xdvik/tests/README @@ -0,0 +1,29 @@ +1. To run the tests: + +$ cd texk/xdvik +$ make test + +or + +$ make test_verbose + +to see more details on the tests. + + + +2. To add a new test: + +(a) Adding a test to an existing test file: + - create a new function "static Boolean (int verbosity)" + - add a register_test() call to the "register_all_...()" method + at the bottom of the file: + "register_test(, "") + +(b) Adding a new test file, e.g. test_foo.c: + - add test_foo.o to the "objects" definition in Makefile.in + - add a declaration for "extern void register_all_from_test_foo()" to run_tests.h + - add a call to "register_all_from_test_foo()" to run_tests.c + - define "register_all_from_test_foo(void)" at the botton of test_foo.c and + add register_test() methods for all test functions in the file + (see the existing test files for examples). + - rerun "make depend" as described in the toplevel file "README_maintainers". diff --git a/Build/source/texk/xdvik/tests/depend.mk b/Build/source/texk/xdvik/tests/depend.mk new file mode 100644 index 00000000000..36f811c632a --- /dev/null +++ b/Build/source/texk/xdvik/tests/depend.mk @@ -0,0 +1,245 @@ +run_tests.o: run_tests.c \ + run_tests.h \ + ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../hypertex.h \ + ../dvi-init.h \ + ../special.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h +test1.o: test1.c \ + run_tests.h \ + ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../hypertex.h \ + ../dvi-init.h \ + ../special.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h +test_dl_list.o: test_dl_list.c \ + run_tests.h \ + ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../hypertex.h \ + ../dvi-init.h \ + ../special.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../dl_list.h +test_string_list.o: \ + test_string_list.c \ + run_tests.h \ + ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../hypertex.h \ + ../dvi-init.h \ + ../special.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h \ + ../string_list.h +test_string_utils.o: \ + test_string_utils.c \ + ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/c-vararg.h \ + run_tests.h \ + ../hypertex.h \ + ../dvi-init.h \ + ../special.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h +test_util.o: test_util.c \ + run_tests.h \ + ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-config.h \ + ../xdvi-debug.h \ + ../xdvi.h \ + ../version.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h \ + $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h \ + $(kpathsea_srcdir)/lib.h \ + $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + ../hypertex.h \ + ../dvi-init.h \ + ../special.h \ + ../events.h \ + ../string-utils.h \ + ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h \ + $(kpathsea_srcdir)/c-vararg.h \ + ../events.h \ + ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + $(kpathsea_srcdir)/tex-file.h diff --git a/Build/source/texk/xdvik/tests/depend.mk.orig b/Build/source/texk/xdvik/tests/depend.mk.orig new file mode 100644 index 00000000000..b8c28743aef --- /dev/null +++ b/Build/source/texk/xdvik/tests/depend.mk.orig @@ -0,0 +1,93 @@ +run_tests.o: run_tests.c \ + run_tests.h ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h \ + $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h ../hypertex.h ../dvi-init.h ../special.h \ + ../events.h ../string-utils.h ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h +test_dl_list.o: test_dl_list.c run_tests.h ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h ../hypertex.h ../dvi-init.h ../special.h \ + ../events.h ../string-utils.h ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + ../dl_list.h +test_string_list.o: test_string_list.c run_tests.h ../xdvi-config.h \ + ../c-auto.h \ + ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h ../hypertex.h ../dvi-init.h ../special.h \ + ../events.h ../string-utils.h ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h \ + ../string_list.h +test_string_utils.o: test_string_utils.c ../xdvi-config.h ../c-auto.h \ + ../xdvi.h ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h run_tests.h \ + ../hypertex.h ../dvi-init.h ../special.h ../events.h ../string-utils.h \ + ../my-vsnprintf.h $(kpathsea_srcdir)/tex-file.h ../util.h \ + $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h +test_util.o: test_util.c run_tests.h ../xdvi-config.h ../c-auto.h \ + ../xdvi.h \ + ../xdvi-debug.h ../version.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h \ + $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-pathmx.h \ + $(kpathsea_srcdir)/c-dir.h \ + $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h ../hypertex.h ../dvi-init.h ../special.h \ + ../events.h ../string-utils.h ../my-vsnprintf.h \ + $(kpathsea_srcdir)/tex-file.h ../util.h $(kpathsea_srcdir)/c-stat.h \ + $(kpathsea_srcdir)/hash.h diff --git a/Build/source/texk/xdvik/tests/run_tests.c b/Build/source/texk/xdvik/tests/run_tests.c new file mode 100644 index 00000000000..5235b9b5b2c --- /dev/null +++ b/Build/source/texk/xdvik/tests/run_tests.c @@ -0,0 +1,127 @@ +#include +#include +#include + +#include "run_tests.h" +#include "util.h" + +/* helper routines */ +Boolean test_str_equality(int verbosity, const char *str1, const char *str2) +{ + int res = strcmp(str1, str2); + if (res != 0) { + if (verbosity) { + ERROR((stderr, "|%s| != |%s|\n", str1, str2)); + } + return False; + } + if (verbosity) { + INFO((stderr, "|%s| == |%s|\n", str1, str2)); + } + return True; +} + +Boolean +test_str_list_equality(int verbosity, char **str_list1, char **str_list2) +{ + size_t i; + for (i = 0; str_list1[i] != NULL || str_list2[i] != NULL; i++) + { + int res; + + if (str_list1[i] == NULL || str_list2[i] == NULL) { + if (verbosity) { + ERROR((stderr, "Items %d differ: |%s| != |%s|\n", i, str_list1[i], str_list2[i])); + } + return False; + } + + res = strcmp(str_list1[i], str_list2[i]); + if (res != 0) { + if (verbosity) { + ERROR((stderr, "Items %d differ: |%s| != |%s|\n", i, str_list1[i], str_list2[i])); + } + return False; + } + else if (verbosity) { + INFO((stderr, "Items %d equal: |%s| == |%s|\n", i, str_list1[i], str_list2[i])); + } + } + return True; +} + + + +struct test_proc { + const char *name; + testProcT proc; +}; + +static size_t m_test_proc_size = 0; +static struct test_proc *m_test_proc_list = NULL; + +void register_test(testProcT proc, const char *name) +{ + size_t old_idx = m_test_proc_size; + m_test_proc_size++; + m_test_proc_list = xrealloc(m_test_proc_list, m_test_proc_size * sizeof *m_test_proc_list); + m_test_proc_list[old_idx].name = xstrdup(name); + m_test_proc_list[old_idx].proc = proc; +} + + +static Boolean +run_all_tests(int verbosity) +{ + size_t i; + + int tests_failed = 0; + int tests_ok = 0; + + fprintf(stdout, "\nGoing to run %d tests ...\n", m_test_proc_size); + + for (i = 0; i < m_test_proc_size; i++) { + Boolean retval = m_test_proc_list[i].proc(verbosity); + if (!retval) { + tests_failed++; + m_test_proc_list[i].proc(True); + } + else { + tests_ok++; + } + fprintf(stdout, "%sTest %d: %s (%s)\n", + retval ? "" : "*****", + i + 1, + retval ? "OK" : "FAILURE", + m_test_proc_list[i].name); + } + +/* fprintf(stdout, "Ran %d tests: %d OK, %d failures.\n", m_test_proc_size, tests_ok, tests_failed); */ + if (tests_failed == 0) { + fprintf(stdout, "Great! All tests succeeded.\n\n"); + return True; + } + else { + fprintf(stdout, "Darn, %d of %d tests failed!\n\n", tests_failed, m_test_proc_size); + return False; + } +} + +int main(int argc, char *argv[]) +{ + int verbosity = 0; + /* fprintf(stderr, "argc: %d, argv1: %s\n", argc, argv[1]); */ + if (argc > 1 && strcmp(argv[1], "-v") == 0) { + verbosity = 1; + } + + register_all_from_test_dl_list(); + register_all_from_test_string_utils(); + register_all_from_test_string_list(); + register_all_from_test_util(); + + if (!run_all_tests(verbosity)) + return 1; + else + return 0; +} diff --git a/Build/source/texk/xdvik/tests/run_tests.h b/Build/source/texk/xdvik/tests/run_tests.h new file mode 100644 index 00000000000..8aa1dfd109f --- /dev/null +++ b/Build/source/texk/xdvik/tests/run_tests.h @@ -0,0 +1,34 @@ +#include "xdvi-config.h" + +#include /* ZLB: must be before sys/socket.h for IRIX 5.3 */ +#include +#include /* this defines FASYNC */ +#include /* this defines SIOCSPGRP and FIOASYNC */ +#include /* this defines WIFEXITED and WEXITSTATUS */ + +#include "xdvi.h" +#include "hypertex.h" +#include "dvi-init.h" +#include "special.h" +#include "string-utils.h" + +#include "kpathsea/tex-file.h" + +#include "events.h" +#include "util.h" + +#define ERROR(X) do { fprintf(stderr, "%s:%d: Error: ", __FILE__, __LINE__); fprintf X; } while(0) +#define INFO(X) do { fprintf(stderr, "%s:%d: Info: ", __FILE__, __LINE__); fprintf X; } while(0) + +typedef Boolean (*testProcT)(int verbosity); + +extern void register_test(testProcT testproc, const char *name); + +/* test helpers */ +extern Boolean test_str_equality(int verbosity, const char *str1, const char *str2); +extern Boolean test_str_list_equality(int verbosity, char **str_list1, char **str_list2); + +extern void register_all_from_test_dl_list(void); +extern void register_all_from_test_string_utils(void); +extern void register_all_from_test_string_list(void); +extern void register_all_from_test_util(void); diff --git a/Build/source/texk/xdvik/tests/test1.c b/Build/source/texk/xdvik/tests/test1.c new file mode 100644 index 00000000000..cb917e17740 --- /dev/null +++ b/Build/source/texk/xdvik/tests/test1.c @@ -0,0 +1,14 @@ +#include "run_tests.h" + +static Boolean mytest1(void) { + return 1 == 1; +} + +static Boolean mytest2(void) { + return 0 == 0; +} + +void register_all_from_test1(void) { + register_test(mytest1, "Trivial equality"); + register_test(mytest2, "ld_list"); +} diff --git a/Build/source/texk/xdvik/tests/test_dl_list.c b/Build/source/texk/xdvik/tests/test_dl_list.c new file mode 100644 index 00000000000..a929b76ef6c --- /dev/null +++ b/Build/source/texk/xdvik/tests/test_dl_list.c @@ -0,0 +1,96 @@ +#include "run_tests.h" +#include "dl_list.h" + +static struct elem { + int i; + const char *name; +} elems[] = { + { 1, "Hello" }, + { 2, " " }, + { 3, "World" }, +}; + +static struct elem test_elems[] = { + { 1, "Hello" }, + { 3, "Another" }, + { 1, "Hello" }, + { 2, " " }, + { 3, "World" }, +}; + +static void printer_func(const void *e_in) { + const struct elem *e = (const struct elem *)e_in; + INFO((stderr, "ELEM: %d, `%s'\n", e->i, e->name)); +} + +static Boolean test_equality(int verbose, + struct dl_list *list, + const struct elem *elems, + size_t list_len, + size_t elem_cnt) +{ + size_t i; + struct dl_list *ptr = NULL; + + if (list_len != elem_cnt) { + if (verbose) { + ERROR((stderr, "List len %d != %d\n", list_len, elem_cnt)); + } + return False; + } + + for (i = 0, ptr = list; i < list_len; i++, ptr = ptr->next) { + const struct elem *curr = (const struct elem *)ptr->item; + + if (verbose) { + INFO((stderr, "Checking: `%s' - `%s'\n", elems[i].name, curr->name)); + } + if (strcmp(test_elems[i].name, curr->name) != 0) { + return False; + } + if (elems[i].i != curr->i) { + return False; + } + } + return True; +} + +static Boolean dl_list_test1(int verbosity) { + struct dl_list *testlist = NULL; + size_t list_len; + static struct elem e1 = { 3, "Another" }; + static struct elem e2 = { 1, "Hello" }; + + testlist = dl_list_insert(testlist, &elems[0]); + testlist = dl_list_insert(testlist, &elems[1]); + testlist = dl_list_insert(testlist, &elems[2]); + testlist = dl_list_head(testlist); + + if (verbosity) { + testlist = dl_list_head(testlist); + dl_list_apply(testlist, printer_func); + } + + list_len = dl_list_len(testlist); + + test_equality(verbosity, testlist, elems, list_len, 3); + + /* test pushing */ + testlist = dl_list_push_front(testlist, &e1); + testlist = dl_list_push_front(testlist, &e2); + testlist = dl_list_head(testlist); + list_len = dl_list_len(testlist); + + test_equality(verbosity, testlist, test_elems, list_len, 5); + + /* test truncating */ + testlist = dl_list_truncate(testlist); + testlist = dl_list_truncate(testlist); + + + return True; +} + +void register_all_from_test_dl_list(void) { + register_test(dl_list_test1, "dl_list construction"); +} diff --git a/Build/source/texk/xdvik/tests/test_string_list.c b/Build/source/texk/xdvik/tests/test_string_list.c new file mode 100644 index 00000000000..1f23158949a --- /dev/null +++ b/Build/source/texk/xdvik/tests/test_string_list.c @@ -0,0 +1,75 @@ +#include "run_tests.h" +#include "string_list.h" + +static Boolean +string_list_test1(int verbosity) +{ + static char *test_str = "This\nis\na\ntest\n"; + static char *test_str_rotated = "is\na\ntest\nThis\n"; + static char *test_list[] = { + "This", + "is", + "a", + "test", + NULL + }; + + char *res_str; + char **test_list_orig, **test_list_rotated; + + res_str = string_list_to_str(test_list, "\n"); + if (!test_str_equality(verbosity, res_str, test_str)) { + return False; + } + + test_list_rotated = string_list_rotate_down(test_list); + if (!test_str_equality(verbosity, + string_list_to_str(test_list_rotated, "\n"), + test_str_rotated)) { + return False; + } + + test_list_orig = string_list_rotate_up(test_list_rotated); + if (!test_str_list_equality(verbosity, + test_list_orig, + test_list)) { + return False; + } + return True; +} + +static Boolean +string_list_test2(int verbosity) +{ + static char *test_str = ""; + static char *test_list[] = { NULL }; + char **res_list; + char *res_str = string_list_to_str(test_list, "#"); + + if (!test_str_equality(verbosity, res_str, test_str)) { + return False; + } + + /* string_list_print(test_list); */ + + res_list = string_list_rotate_down(test_list); + + /* string_list_print(res_list); */ + + if (!test_str_equality(verbosity, + test_str, + string_list_to_str(res_list, "\n"))) + { + return False; + } + return True; +} + +/* todo: append, prepend, reorder */ + +void +register_all_from_test_string_list(void) +{ + register_test(string_list_test1, "string lists"); + register_test(string_list_test2, "empty string lists"); +} diff --git a/Build/source/texk/xdvik/tests/test_string_utils.c b/Build/source/texk/xdvik/tests/test_string_utils.c new file mode 100644 index 00000000000..c8a7dadb3bb --- /dev/null +++ b/Build/source/texk/xdvik/tests/test_string_utils.c @@ -0,0 +1,431 @@ +#include "xdvi-config.h" +#include "xdvi.h" +#include "kpathsea/c-vararg.h" + +#include +#include +#include + +#include "run_tests.h" + +#include "string-utils.h" + +#define DEBUG 0 + +static Boolean test_get_separated_list(int verbose) +{ + char *test_list1[] = { + "This is the first line", + "This is the second", + "This, is the third", + "The last one", + NULL + }; + char *test_list2[] = { + "This", + "is", + "another", + "first", + "line", + NULL + }; + const char *teststring1 = "This is the first line,This is the second,\"This, is the third\",The last one"; + const char *teststring2 = "This\nis another\tfirst line"; + + char **res_list1 = get_separated_list(teststring1, ",", True); + char **res_list2 = get_separated_list(teststring2, " \t\n", True); + /* TODO: deallocate? */ + return test_str_list_equality(verbose, test_list1, res_list1) && test_str_list_equality(verbose, test_list2, res_list2); +} + +static Boolean test_str_is_prefix(int verbose) +{ + static struct stringtest { + char *str1; + char *str2; + Boolean case_sensitive; + Boolean result; + } tests[] = { + { "foo", "foobar", True, True }, + { "foo", "Foobar", True, False }, + { "foo", "Foobar", False, True }, + { "foo", "FOObar", False, True }, + { "foo", "foo", True, True }, + { "f", "foo", True, True }, + { "b", "foo", True, False }, + { "foo", "b", True, False }, + { "", "foo", True, True }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "str_is_prefix(%s,%s,%d) -> %d == %d?\n", + tests[i].str1, + tests[i].str2, + tests[i].case_sensitive, + str_is_prefix(tests[i].str1, tests[i].str2, tests[i].case_sensitive), + tests[i].result)); + } + if (str_is_prefix(tests[i].str1, tests[i].str2, tests[i].case_sensitive) != tests[i].result) { + result = False; + } + } + return result; +} + +static Boolean test_str_is_suffix(int verbose) +{ + static struct stringtest { + char *str1; + char *str2; + Boolean case_sensitive; + Boolean result; + } tests[] = { + { "bar", "foobar", True, True }, + { "bar", "FooBar", True, False }, + { "bar", "fooBAR", False, True }, + { "bar", "fooBaR", False, True }, + { "bar", "bar", True, True }, + { "r", "bar", True, True }, + { "x", "bar", True, False }, + { "bar", "r", True, False }, + { "", "bar", True, True }, + { "", "", True, True }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "str_is_suffix(%s,%s,%d) -> %d == %d?\n", + tests[i].str1, + tests[i].str2, + tests[i].case_sensitive, + str_is_suffix(tests[i].str1, tests[i].str2, tests[i].case_sensitive), + tests[i].result)); + } + if (str_is_suffix(tests[i].str1, tests[i].str2, tests[i].case_sensitive) != tests[i].result) { + result = False; + } + } + return result; +} + +static Boolean test_is_spaces_only(int verbose) +{ + static struct stringtest { + char *str1; + Boolean result; + } tests[] = { + { "bar", False }, + { " \t\n ", True }, + { " a ", False }, + { "", True }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "is_spaces_only(%s) -> %d == %d?\n", + tests[i].str1, + is_spaces_only(tests[i].str1), + tests[i].result)); + } + if (is_spaces_only(tests[i].str1) != tests[i].result) { + result = False; + } + } + return result; +} + +static Boolean test_my_stristr(int verbose) +{ + static struct stringtest { + char *str1; + char *str2; + char *result; + } tests[] = { + { "paloozah", "ooz", "oozah" }, + { "paloozah", "pa", "paloozah" }, + { "paloozah", "par", NULL }, + { "paloozah", "x", NULL }, + { "PALOOZAH", "ooz", "OOZAH" }, + { "PALOOZAH", "ah", "AH" }, + { "PALOOZAH", "h", "H" }, + { "h", "h", "h" }, + { "H", "h", "H" }, + { "", "h", NULL }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "my_stristr(%s, %s) -> %s == %s?\n", + tests[i].str1, + tests[i].str2, + my_stristr(tests[i].str1, tests[i].str2), + tests[i].result)); + } + if (my_stristr(tests[i].str1, tests[i].str2) != tests[i].result) { + result = False; + } + } + return result; +} + +static Boolean test_format_arg(int verbose) +{ + static struct stringtest { + char *str1; + char *arg; + char *result; + } tests[] = { + { "netscape(%s, same-window)", "file.html", "netscape(file.html, same-window)" }, + { "netscape(same-window)", "file.html", "netscape(same-window)" }, + { "%s", "a", "a" }, + { "", "", "" }, + }; + + size_t i; + int tmpcnt = 0; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "format_arg(%s) -> %s == %s, %d\n", + tests[i].str1, + format_arg(tests[i].str1, tests[i].arg, &tmpcnt), + tests[i].result, + tmpcnt)); + } + if (!test_str_equality(verbose, + format_arg(tests[i].str1, tests[i].arg, &tmpcnt), + tests[i].result)) { + result = False; + } + } + /* tempcnt shouldn't be reset to 0 by format_arg() */ + if (tmpcnt != 1) { + ERROR((stderr, "tmpcnt should be 1\n")); + result = False; + } + return result; +} + +static Boolean test_escape_format_arg(int verbose) +{ + static struct stringtest { + char *str; + char *result; + } tests[] = { + { "netscape(%s, same-window)", "netscape(%%s, same-window)" }, + { "%%s", "%%%%s" }, + { "%d%s", "%%d%%s" }, + { "a", "a" }, + { "", "" }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "escape_format_arg(%s) -> %s == %s\n", + tests[i].str, + escape_format_arg(tests[i].str), + tests[i].result)); + } + if (!test_str_equality(verbose, + escape_format_arg(tests[i].str), + tests[i].result)) { + result = False; + } + } + return result; +} + +static Boolean test_filename_append_dvi(int verbose) +{ + static struct stringtest { + char *str1; + char *str2; + } tests[] = { + { "file:///tmp/foo.bar", "/tmp/foo.bar" }, + { "file:///tmp/foo", "/tmp/foo.dvi" }, + /* the following two mimick firefox behaviour with double/single slashes */ + { "file://tmp/foo", "/foo.dvi" }, + { "file:/tmp/foo", "/tmp/foo.dvi" }, + { "file://localhost/tmp/foo", "/tmp/foo.dvi" }, + { "~/tmp/foo", "~/tmp/foo.dvi" }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + char *tmp = filename_append_dvi(tests[i].str1); + if (verbose) { + INFO((stderr, "filename_append_dvi(%s) -> %s == %s?\n", + tests[i].str1, + tmp, + tests[i].str2)); + } + if (!test_str_equality(verbose, tmp, tests[i].str2)) { + result = False; + } + free(tmp); + } + return result; +} + +static Boolean test_canonicalize_path(int verbose) +{ + static struct stringtest { + char *str1; + char *str2; + } tests[] = { + { "/foo/a/bz.to/bar.dvi", "/foo/a/bz.to/bar.dvi" }, + { "/foo/../bar.dvi", "/bar.dvi" }, + { "/foo/../bar.dvi", "/bar.dvi" }, + { "/foo/./roo/./bar.dvi", "/foo/roo/bar.dvi" }, + { "/foo/./roo/../bar.dvi", "/foo/bar.dvi" }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "canonicalize_path(%s) -> %s == %s?\n", + tests[i].str1, + canonicalize_path(tests[i].str1), + tests[i].str2)); + } + if (!test_str_equality(verbose, canonicalize_path(tests[i].str1), tests[i].str2)) { + result = False; + } + } + return result; +} + + + +static Boolean test_expand_filename(int verbose) +{ + char cwd[10240]; + char *currpath, *testpath1, *testpath2; + + currpath = xstrdup(getcwd(cwd, 10240)); + testpath1 = expand_filename(__FILE__, USE_CWD_PATH); + globals.dvi_file.dirname = xstrdup(cwd); + globals.dvi_file.dirname = xstrcat(globals.dvi_file.dirname, "/"); + testpath2 = expand_filename(__FILE__, USE_DVI_PATH); + + currpath = xstrcat(currpath, "/"); + currpath = xstrcat(currpath, __FILE__); + + return test_str_equality(verbose, testpath1, currpath) \ + && test_str_equality(verbose, testpath2, currpath); +} + + +static Boolean test_get_extension(int verbose) +{ + const char *test_strings[][2] = { + { "/dev/fd/3", NULL }, + { "/home/user/file.dvi", ".dvi" }, + { "/home/user/file.ps", ".ps" }, + { "/home/user.bar/file.dvi", ".dvi" }, + { "/home/user.bar/file", NULL }, + { "/home/user/file", NULL }, + { NULL, NULL } + }; + + size_t i; + + for (i = 0; test_strings[i][0] != NULL; i++) { + const char *tmp = get_extension(test_strings[i][0]); + if (tmp == NULL && test_strings[i][1] == NULL) { + if (verbose) + INFO((stderr, "Checking extension of |%s| OK: == \n", test_strings[i][0])); + } + else if (tmp == NULL && test_strings[i][1] != NULL) { + if (verbose) + ERROR((stderr, "extension of |%s| gave - should be |%s|\n", + test_strings[i][0], test_strings[i][1])); + return False; + } + else if (tmp != NULL && test_strings[i][1] == NULL) { + if (verbose) + ERROR((stderr, "extension of |%s| gave |%s| - should be \n", + test_strings[i][0], tmp)); + return False; + } + else { + if (strcmp(tmp, test_strings[i][1]) != 0) { + if (verbose) + ERROR((stderr, "ERROR: extension of |%s| gave |%s| - should be |%s|\n", + test_strings[i][0], tmp, test_strings[i][1])); + return False; + } + else { + if (verbose) + INFO((stderr, "Checking extension of |%s| OK: |%s| == |%s|\n", + test_strings[i][0], tmp, test_strings[i][1])); + } + } + } + + return True; +} + +static Boolean test_length_of_int(int verbose) +{ + static struct stringtest { + int d; + int len; + } tests[] = { + { 0, 1 }, + { 1, 1 }, + { 11, 2 }, + { 111, 3 }, + { 100, 3 }, + { 100000, 6 }, + { 999999, 6 }, + { 1000000, 7 }, + { 101, 3 }, + { 001, 1 }, + }; + + size_t i; + Boolean result = True; + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + if (verbose) { + INFO((stderr, "length_of_int(%d) -> %d == %d?\n", + tests[i].d, + length_of_int(tests[i].d), + tests[i].len)); + } + if (length_of_int(tests[i].d) != tests[i].len) { + result = False; + } + } + return result; +} + +void register_all_from_test_string_utils(void) +{ + register_test(test_str_is_prefix, "str_is_prefix()"); + register_test(test_str_is_suffix, "str_is_suffix()"); + register_test(test_is_spaces_only, "is_spaces_only()"); + register_test(test_my_stristr, "my_stristr()"); + register_test(test_filename_append_dvi, "filename_append_dvi()"); + /* TODO: expand_filename_append_dvi */ + register_test(test_canonicalize_path, "canonicalize_path()"); + register_test(test_format_arg, "format_arg()"); + register_test(test_escape_format_arg, "escape_format_arg()"); + register_test(test_expand_filename, "expand_filename()"); + register_test(test_get_separated_list, "get_separated_list"); + register_test(test_length_of_int, "length_of_int()"); + register_test(test_get_extension, "Filename extensions"); +} diff --git a/Build/source/texk/xdvik/tests/test_util.c b/Build/source/texk/xdvik/tests/test_util.c new file mode 100644 index 00000000000..239927190c8 --- /dev/null +++ b/Build/source/texk/xdvik/tests/test_util.c @@ -0,0 +1,45 @@ +#include "run_tests.h" +#include "util.h" +#include "string-utils.h" + +static Boolean +test_src_format_arguments(int verbose) +{ + static struct stringtest { + char *str; + char *res[16]; /* big enuff */ + } tests[] = { + { "emacsclient --no-wait +%l %f", + { "emacsclient", "--no-wait", "+10", "/this/is/a/filename.tex", NULL } + }, + { "vim +%l:%c %f", + { "vim", "+10:0", "/this/is/a/filename.tex", NULL } + }, + { "bazoo %f:%l:%c", + { "bazoo", "/this/is/a/filename.tex:10:0", NULL } + } + }; + + const char *filename = "/this/is/a/filename.tex"; + int lineno = 10; + int colno = 0; + size_t i; + Boolean res = True; + + for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { + char **argv = get_separated_list(tests[i].str, " \t", True); + argv = src_format_arguments(argv, filename, lineno, colno); + if (!test_str_list_equality(verbose, argv, tests[i].res)) { + res = False; + } + } + + return res; +} + + +void +register_all_from_test_util(void) +{ + register_test(test_src_format_arguments, "src_format_arguments"); +} diff --git a/Build/source/texk/xdvik/texmf/XDvi b/Build/source/texk/xdvik/texmf/XDvi index 027df469453..c1fcea25532 100644 --- a/Build/source/texk/xdvik/texmf/XDvi +++ b/Build/source/texk/xdvik/texmf/XDvi @@ -26,6 +26,15 @@ !!! This should be the best choice for modern displays with large color depth. *thorough: true +!!! Add some useful translations for the mouse wheel (bug #1422928) +*wheelTranslations:\ +Shift:left(.08)\n\ +Shift:right(.08)\n\ +Ctrl:set-shrink-factor(+)\n\ +Ctrl:set-shrink-factor(-)\n\ +:wheel(-.7)\n\ +:wheel(.7) + !!!------------------------------------------------------------------------------ !!!------------------------------ Motif toolbar --------------------------------- !!!------------------------------------------------------------------------------ @@ -76,18 +85,9 @@ *textColumns: 50 !!! make all text/entry fields white, for better contrasts: -*file_text.background: white -*searchbox_input.background: white -*print_text.background: white -*dvips_options_text.background: white -*from_page.background: white -*to_page.background: white -*topics_list.background: white -*help_text.background: white -*FilterText.background: white -*DirList.background: white -*ItemsList.background: white -*file.Text.background: white +*XmDialogShell*XmTextField.background: white +*XmDialogShell*XmText.background: white +*XmDialogShell*XmList.background: white !!! adjust position of header in help window *help_window*right_form.topOffset: 10 diff --git a/Build/source/texk/xdvik/texmf/xdvi.cfg b/Build/source/texk/xdvik/texmf/xdvi.cfg index f058b6e2b62..f175e5a3f92 100644 --- a/Build/source/texk/xdvik/texmf/xdvi.cfg +++ b/Build/source/texk/xdvik/texmf/xdvi.cfg @@ -53,6 +53,10 @@ enc 8y TeXnANSIEncoding texnansi.enc % files, later entries will override earlier ones (and a warning % will be printed to stderr). % +% However, normally it isn't necessary to add any other map file here +% because ps2pk.map is (normally) a generated file (by the updmap +% script). Instead, map files should be added to the updmap.cfg file. +% % ps2pk has no "built-in" fonts, just like xdvik, so its map file is used % for xdvik too. For teTeX-1.0, psfonts.map is needed in addition. diff --git a/Build/source/texk/xdvik/tfmload.c b/Build/source/texk/xdvik/tfmload.c index 4b904b2576e..6d2ceb1c9b6 100644 --- a/Build/source/texk/xdvik/tfmload.c +++ b/Build/source/texk/xdvik/tfmload.c @@ -37,9 +37,9 @@ tfmload(const char *name, long *design, long *widths, long *fontdimen2) filename = kpse_find_tfm(name); if (filename == NULL) { - filename = kpse_find_tfm("cmr10.tfm"); - if (fallbacktfm == 0) - fallbacktfm = 1; + filename = kpse_find_tfm("cmr10.tfm"); + if (fallbacktfm == 0) + fallbacktfm = 1; } if (filename == NULL) @@ -68,7 +68,7 @@ tfmload(const char *name, long *design, long *widths, long *fontdimen2) f_param_num = get_bytes(curfnt, 2); /* np = number of font parameter words */ /* Header, 32 bit signed quantities */ - get_bytes(curfnt, 4); /* header[0]: checksum */ + (void)get_bytes(curfnt, 4); /* header[0]: checksum */ *design = get_bytes(curfnt, 4); /* header[1]: design size */ /* Skip the rest: header[2..(hd-1)] */ @@ -84,8 +84,8 @@ tfmload(const char *name, long *design, long *widths, long *fontdimen2) /* The charinfo array: */ for (i = bc; i <= ec; i++) { chardat[i] = get_byte(curfnt); /* 8 bits of width index */ - get_byte(curfnt); /* skip */ - get_bytes(curfnt, 2); /* skip, jump */ + (void)get_byte(curfnt); /* skip */ + (void)get_bytes(curfnt, 2); /* skip, jump */ } /* The (compressed!) width table */ @@ -94,7 +94,7 @@ tfmload(const char *name, long *design, long *widths, long *fontdimen2) /* skip to font parameter words */ for (i = 0; i < f_param_off; i++) - get_bytes(curfnt, 4); + (void)get_bytes(curfnt, 4); /* read fontdimen2 (width of space) */ for (i = 0; i < f_param_num; i++) { diff --git a/Build/source/texk/xdvik/translations.h b/Build/source/texk/xdvik/translations.h index c811e540766..c8b6fe1bbd1 100644 --- a/Build/source/texk/xdvik/translations.h +++ b/Build/source/texk/xdvik/translations.h @@ -8,6 +8,16 @@ static const char base_key_translations[] = (i.e. `alt ctrl' before `ctrl' before unmodified) `:' at start of description means that case matters */ + "1: digit(1)\n" + "2: digit(2)\n" + "3: digit(3)\n" + "4: digit(4)\n" + "5: digit(5)\n" + "6: digit(6)\n" + "7: digit(7)\n" + "8: digit(8)\n" + "9: digit(9)\n" + ": motion()\n" "Ctrl]: pagehistory-delete-forward()\n" "Ctrl[: pagehistory-delete-backward()\n" /* it seems the following is needed for compatibility with german, french, @@ -24,6 +34,7 @@ static const char base_key_translations[] = ":Ctrl-: set-shrink-factor(-)\n" ":-: minus()\n" ":?: help()\n" +/* ":/: incremental-find()\n" */ ":>: goto-page()\n" ":<: goto-page(1)\n" ":^: home()\n" @@ -38,6 +49,7 @@ static const char base_key_translations[] = ":c: center()\n" /* removed, redundant and gets in the way ":Ctrld: quit()\n" */ + ":D: toggle-grid-mode()\n" ":d: down()\n" "Ctrlf: find()\n" ":F: htex-forward()\n" @@ -119,34 +131,46 @@ static const char base_key_translations[] = "Escape: discard-number()\n" #endif #ifdef XK_KP_Left - "KP_Home: home()\n" - "KP_Left: left()\n" - "KP_Up: up()\n" - "KP_Right: right()\n" - "KP_Down: down()\n" - "KP_Prior: back-page()\n" - "KP_Next: forward-page()\n" - "KP_Delete: up-or-previous()\n" - "KP_Enter: forward-page()\n" + "~@Num_LockKP_Home:home()\n" + "~@Num_LockKP_Left:left(0.015)\n" + "~@Num_LockKP_Begin:center()\n" + "~@Num_LockKP_Up:up(0.015)\n" + "~@Num_LockKP_Right:right(0.015)\n" + "~@Num_LockKP_Down:down(0.015)\n" + "~@Num_LockKP_Prior:back-page()\n" + "~@Num_LockKP_Next:forward-page()\n" + "KP_Enter:forward-page()\n" + "KP_Delete:up-or-previous()\n" + "KP_1:digit(1)\n" + "KP_2:digit(2)\n" + "KP_3:digit(3)\n" + "KP_4:digit(4)\n" + "KP_5:digit(5)\n" + "KP_6:digit(6)\n" + "KP_7:digit(7)\n" + "KP_8:digit(8)\n" + "KP_9:digit(9)\n" + "KP_0:digit(0)\n" #endif ""; static const char base_mouse_translations[] = - "Shift: drag(+)\n" - "Shift: drag(|)\n" - "Shift: drag(-)\n" - "Ctrl: source-special()\n" - ": do-href()magnifier(*1)\n" - ": do-href-newwindow()magnifier(*2)\n" - ": magnifier(*3)\n" - ": magnifier(*4)\n" - ": magnifier(*5)\n" + ":release()\n" + "Shift: mouse-modes(\"drag(+)\")\n" + "Shift: mouse-modes(\"drag(|)\")\n" + "Shift: mouse-modes(\"drag(-)\")\n" + "Ctrl: mouse-modes(\"source-special()\", \"source-special()\", \"source-special()\")\n" + ": mouse-modes(\"do-href()magnifier(*2)\", \"text-selection()\", \"ruler()\")\n" + ": mouse-modes(\"do-href-newwindow()magnifier(*2)\", \"text-selection()\", \"ruler()\")\n" + ": mouse-modes(\"magnifier(*3)\")\n" + ": mouse-modes(\"wheel(-0.2)\")\n" + ": mouse-modes(\"wheel(0.2)\")\n" ""; -#if defined(NEW_MENU_CREATION) || defined(MOTIF) -static const char default_menu_config[] = +/* #if defined(NEW_MENU_CREATION) || defined(MOTIF) */ + /* BNF-like Syntax of the entries: @@ -162,21 +186,25 @@ static const char default_menu_config[] = button-type ::= `PUSH' | `RADIO' | `CHECK' | `SEP' Notes: - - In entry-line, every occurrence of `:' that's not a separator needs to be escaped - like this: `\:'; similar for `>' in menu-spec and `|' in menu-title. + - In entry-line, every occurrence of `:' that's not a separator has to be + escaped like this: `\:'; similar for `>' in menu-spec and `|' in menu-title. - Every `>' in menu-spec creates a submenu for the corresponding menu. - mnemonic is the key binding for the action, displayed as mnemonic string in the Motif menus (not yet in the Xaw version, since Xaw doesn't provide for - such mnemonics by default). + such mnemonics). - accelerator is the Motif menu accelerator key. */ +static const char default_menu_config[] = "File|F > Open ...|O :PUSH :Ctrl-o :select-dvi-file()\n" - "File|F > Open Recent |R :PUSH : :recent-files()\n" - "File|F > Reload|R :PUSH :R :reread-dvi-file()\n" + "File|F > Open Recent|R :PUSH : :recent-files()\n" + "File|F > Reload|l :PUSH :R :reread-dvi-file()\n" + "File|F :SEP ::\n" "File|F > Find ...|F :PUSH :Ctrl-f :find()\n" - "File|F > Find next ...|N :PUSH :Ctrl-g :find-next()\n" + "File|F > Find Next ...|N :PUSH :Ctrl-g :find-next()\n" + "File|F :SEP ::\n" "File|F > Print ...|P :PUSH :Ctrl-p :print()\n" - "File|F > Save as ...|S :PUSH :Ctrl-s :save()\n" + "File|F > Save As ...|S :PUSH :Ctrl-s :save()\n" + "File|F :SEP ::\n" "File|F > Quit|Q :PUSH :q :quit()\n" /* ========== */ "Navigate|N > Page-10| :PUSH :10 p :back-page(10)\n" @@ -197,6 +225,7 @@ static const char default_menu_config[] = "Navigate|N > Back Hyperlink|B :PUSH :B :htex-back()\n" "Navigate|N > Forward Hyperlink|F :PUSH :F :htex-forward()\n" /* ========== */ +#ifdef MOTIF /* Motif zoom buttons are more verbose to emphasise the accelerator */ "Zoom|Z > Shrink by 1|1 :RADIO :1 s :set-shrink-factor(1)\n" "Zoom|Z > Shrink by 2|2 :RADIO :2 s :set-shrink-factor(2)\n" "Zoom|Z > Shrink by 3|3 :RADIO :3 s :set-shrink-factor(3)\n" @@ -206,6 +235,17 @@ static const char default_menu_config[] = "Zoom|Z > Shrink by 7|7 :RADIO :7 s :set-shrink-factor(7)\n" "Zoom|Z > Shrink by 8|8 :RADIO :8 s :set-shrink-factor(8)\n" "Zoom|Z > Shrink by 9|9 :RADIO :9 s :set-shrink-factor(9)\n" +#else + "Zoom|Z > 1|1 :RADIO :1 s :set-shrink-factor(1)\n" + "Zoom|Z > 2|2 :RADIO :2 s :set-shrink-factor(2)\n" + "Zoom|Z > 3|3 :RADIO :3 s :set-shrink-factor(3)\n" + "Zoom|Z > 4|4 :RADIO :4 s :set-shrink-factor(4)\n" + "Zoom|Z > 5|5 :RADIO :5 s :set-shrink-factor(5)\n" + "Zoom|Z > 6|6 :RADIO :6 s :set-shrink-factor(6)\n" + "Zoom|Z > 7|7 :RADIO :7 s :set-shrink-factor(7)\n" + "Zoom|Z > 8|8 :RADIO :8 s :set-shrink-factor(8)\n" + "Zoom|Z > 9|9 :RADIO :9 s :set-shrink-factor(9)\n" +#endif "Zoom|Z :SEP ::\n" "Zoom|Z > Fit in Window|F :PUSH :s :set-shrink-factor(a)\n" "Zoom|Z :SEP ::\n" @@ -218,17 +258,20 @@ static const char default_menu_config[] = "Mark|M > Toggle Odd Pages|O :PUSH :1 m :toggle-mark(1)\n" "Mark|M > Toggle Even Pages|E :PUSH :2 m :toggle-mark(2)\n" "Mark|M > Toggle Current Page|C :PUSH :m :toggle-mark()\n" +#ifndef MOTIF /* special `Modes' menu for Xaw */ + "Modes|M > Magnifier|M :RADIO :Ctrl-m :switch-mode(0)\n" + "Modes|M > Text Selection|T :RADIO :Ctrl-m :switch-mode(1)\n" + "Modes|M > Ruler|R :RADIO :Ctrl-m :switch-mode(2)\n" +#endif /* ========== */ "Options|O > Keep Position|K :CHECK :k :set-keep-flag(toggle)\n" "Options|O > Use TeX Page Numbers|T :CHECK :T :use-tex-pages(toggle)\n" "Options|O :SEP ::\n" -/* removed this one, since it only duplicates the toolbar and is too awkward to use */ -/* "Options|O > Fonts|F > Fonts Darker|D :PUSH :Alt-Ctrl-+ :change-density(5)\n" */ -/* "Options|O > Fonts|F > Fonts Lighter|L :PUSH :Alt-Ctrl-- :change-density(-5)\n" */ /* ---------- */ +#ifdef MOTIF /* nested menus are used in Motif only */ #if 0 /* TODO: implement setting paper size at runtime */ - "Options|O > Paper|a > US|U :RADIO : :set-papersize(us)\n" + "Options|O > Paper|a > US letter|U :RADIO : :set-papersize(us)\n" "Options|O > Paper|a > Legal|L :RADIO : :set-papersize(legal)\n" "Options|O > Paper|a > Foolscap|F :RADIO : :set-papersize(foolscap)\n" "Options|O > Paper|a > A1|1 :RADIO : :set-papersize(a1)\n" @@ -248,23 +291,27 @@ static const char default_menu_config[] = "Options|O > Postscript|o > Show PS|S :RADIO :1 v :set-ps(1)\n" "Options|O > Postscript|o > Show PS and Bounding Boxes|B :RADIO :2 v :set-ps(2)\n" "Options|O > Postscript|o > Show Bounding Boxes Only|O :RADIO :0 v :set-ps(0)\n" +# ifdef GS_PS "Options|O > Postscript|o :SEP ::\n" "Options|O > Postscript|o > Use PS Anti-Aliasing|A :CHECK :V :set-gs-alpha(toggle)\n" +# endif # endif -/* ---------- */ -/* removed, since it was redundant to Preferences */ -/* # ifdef MOTIF */ -/* "Options|O > Window Configuration|W > Show Statusline|S :CHECK :1x :set-expert-mode(1)\n" */ -/* "Options|O > Window Configuration|W > Show Scrollbars|c :CHECK :2x :set-expert-mode(2)\n" */ -/* "Options|O > Window Configuration|W > Show Pagelist|P :CHECK :3x :set-expert-mode(3)\n" */ -/* "Options|O > Window Configuration|W > Show Toolbar|T :CHECK :4x :set-expert-mode(4)\n" */ -/* # endif */ /* ---------- */ "Options|O > Mouse Mode|M > Magnifier|M :RADIO :0 Ctrl-m :switch-mode(0)\n" "Options|O > Mouse Mode|M > Text Selection|T :RADIO :1 Ctrl-m :switch-mode(1)\n" "Options|O > Mouse Mode|M > Ruler|R :RADIO :2 Ctrl-m :switch-mode(2)\n" "Options|O :SEP ::\n" "Options|O > Preferences ...|P :PUSH : :prefs-dialog()\n" +#else + "Options|O > Show PS|S :RADIO :1 v :set-ps(1)\n" + "Options|O > Show PS and Bounding Boxes|B :RADIO :2 v :set-ps(2)\n" + "Options|O > Show Bounding Boxes Only|O :RADIO :0 v :set-ps(0)\n" + "Options|O :SEP ::\n" + "Options|O > Use PS Anti-Aliasing|A :CHECK :V :set-gs-alpha(toggle)\n" + "Options|O :SEP ::\n" + "Options|O > Fonts Darker|D :PUSH :Alt-Ctrl-+:change-density(5)\n" + "Options|O > Fonts Lighter|L :PUSH :Alt-Ctrl--:change-density(-5)\n" +#endif /* MOTIF */ /* ========== */ "Help|H > Introduction ...|I :PUSH : :help(Introduction)\n" "Help|H > Page Motion ...|P :PUSH : :help(Page Motion)\n" @@ -279,92 +326,7 @@ static const char default_menu_config[] = "Help|H > New Features in this Version|F:PUSH::load-url(http\\://xdvi.sourceforge.net/releases.html#" XDVI_VERSION ")\n" "Help|H > Submit a Bug Report|B :PUSH ::load-url(http\\://sourceforge.net/tracker/?func=add&group_id=23164&atid=377580)\n" ""; -#else /* NEW_MENU_CREATION */ -/* TODO: - - describe this in manpage - - use in the Motif version as well -*/ -static const char default_menu_config[] = -/* menu: submenu: accelerator: action */ - "File: Open ...: Ctrl-o: select-dvi-file()\n" - "File: Open Recent: : recent-files()\n" - "File: Find ...: Ctrl-f: find()\n" - "File: Find next ...: Ctrl-g: find-next()\n" - "File: Reload: R: reread-dvi-file()\n" - "File: Save as ...: Ctrl-s: save()\n" - "File: Print ...: Ctrl-p: print()\n" - "File: Quit: q: quit()\n" - "Navigate: First: 1 g: goto-page(1)\n" - "Navigate: Page-10: 10 p: back-page(10)\n" - "Navigate: Page-5: 5 p: back-page(10)\n" - "Navigate: Prev: p: back-page(1)\n" - "Navigate: SEP\n" - "Navigate: Next: n: forward-page(1)\n" - "Navigate: Page+5: 5 n: forward-page(5)\n" - "Navigate: Page+10: 10 n: forward-page(10)\n" - "Navigate: Last: g: goto-page()\n" - "Navigate: SEP\n" - "Navigate: Back Hyperlink: B: htex-back()\n" - "Navigate: Forward Hyperlink: F: htex-forward()\n" - "Zoom: Zoom In: Ctrl-+: set-shrink-factor(+)\n" - "Zoom: Zoom Out: Ctrl--: set-shrink-factor(-)\n" - "Zoom: SEP\n" -/* "Zoom:Full size (1 s):set-shrink-factor(1)\n" */ - "Zoom: Fit in Window: s: set-shrink-factor(a)\n" - "Zoom: SEP\n" - "Zoom: $#: 1 s: set-shrink-factor(1)\n" - "Zoom: $#: 2 s: set-shrink-factor(2)\n" - "Zoom: $#: 3 s: set-shrink-factor(3)\n" - "Zoom: $#: 4 s: set-shrink-factor(4)\n" - "Zoom: $#: 5 s: set-shrink-factor(5)\n" - "Zoom: $#: 6 s: set-shrink-factor(6)\n" - "Zoom: $#: 7 s: set-shrink-factor(7)\n" - "Zoom: $#: 8 s: set-shrink-factor(8)\n" - "Zoom: $#: 9 s: set-shrink-factor(9)\n" -/* "Zoom:$%%:shrink-to-dpi(150)\n" */ -/* "Zoom:$%%:shrink-to-dpi(100)\n" */ -/* "Zoom:$%%:shrink-to-dpi(50)\n" */ - "Mark: Mark All Pages: -1 m: toggle-mark(-1)\n" - "Mark: Unmark All Pages: 0 m: toggle-mark(0)\n" - "Mark: SEP\n" - "Mark: Toggle Odd Pages: 1 m: toggle-mark(1)\n" - "Mark: Toggle Even Pages: 2 m: toggle-mark(2)\n" - "Mark: Toggle Current Page: m: toggle-mark()\n" - "Modes: Magnifier: Ctrl-m: switch-mode(0)\n" - "Modes: Text Selection: Ctrl-m: switch-mode(1)\n" - "Modes: Ruler: Ctrl-m: switch-mode(2)\n" -# if PS - "Options: Show PS: 1 v: set-ps(1)\n" - "Options: Show PS and Bounding Boxes: 2 v: set-ps(2)\n" - "Options: Show Bounding Boxes Only: 0 v: set-ps(0)\n" - "Options: SEP\n" - "Options: Use PS Anti-Aliasing: V: set-gs-alpha(toggle)\n" -# endif - "Options: SEP\n" -/* "Options:Keep position:set-keep-flag(1)\n" */ -/* "Options:Don't keep position:set-keep-flag(0)\n" */ - "Options: Keep Position: k: set-keep-flag(toggle)\n" - "Options: Use TeX Pages: T: use-tex-pages(toggle)\n" -/* hmm, this probably is better kept in a `preferences' window: */ -/* "Options:SEP\n" */ -/* "Options:Show statusline:1 x:set-expert-mode(1)\n" */ - "Options: SEP\n" - "Options: Fonts Darker: Alt-Ctrl-+: change-density(5)\n" - "Options: Fonts Lighter: Alt-Ctrl--: change-density(-5)\n" - "Help: Introduction ...: : help(Introduction)\n" - "Help: Page Motion ...: : help(Page Motion)\n" - "Help: Other Commands ...: : help(Other Commands)\n" - "Help: Hyperlinks ...: : help(Hyperlinks)\n" - "Help: Mouse Buttons ...: : help(Mouse Buttons)\n" - "Help: Mouse Modes ...: : help(Mouse Modes)\n" - "Help: String Search ...: : help(String Search)\n" - "Help: Printing and Saving ...:: help(Printing and Saving)\n" - "Help: Source Specials ...: : help(Source Specials)\n" - "Help:SEP\n" - "Help: New Features in this Version:: load-url(http\\://xdvi.sourceforge.net/releases.html#" XDVI_VERSION ")\n" - "Help: Send a Bug Report: : load-url(http\\://sourceforge.net/tracker/?func=add&group_id=23164&atid=377580)\n" - ""; -#endif /* NEW_MENU_CREATION */ + static const char default_toolbar_translations[] = /* index statusline-text tooltip action */ diff --git a/Build/source/texk/xdvik/util.c b/Build/source/texk/xdvik/util.c index d34ef137387..eb891cc76f6 100644 --- a/Build/source/texk/xdvik/util.c +++ b/Build/source/texk/xdvik/util.c @@ -21,8 +21,8 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NOTE: - xdvi is based on prior work, as noted in the modification history - in xdvi.c. +xdvi is based on prior work, as noted in the modification history +in xdvi.c. \*========================================================================*/ @@ -49,6 +49,7 @@ NOTE: #include "search-internal.h" #include "encodings.h" #include "filehist.h" +#include "exit-handlers.h" #include "xm_prefs.h" /* for preferences_changed() */ #include @@ -141,151 +142,50 @@ extern void *realloc(); #define BUF_SIZE 1024 -/* - Insert item to the list and return the result. -*/ -struct dl_list * -dl_list_insert(struct dl_list *list, void *item) +void +xdvi_assert(const char *version, + const char *filename, + int lineno, + Boolean condition, + const char *fmt, ...) { - struct dl_list *new_elem = xmalloc(sizeof *new_elem); - new_elem->item = item; - new_elem->next = NULL; - new_elem->prev = NULL; - - if (list == NULL) { - list = new_elem; - } - else { - /* append after current position */ - struct dl_list *ptr = list; - - new_elem->next = ptr->next; - new_elem->prev = ptr; - - if (ptr->next != NULL) - ptr->next->prev = new_elem; - - ptr->next = new_elem; + if (!(condition)) { + fprintf(stderr, + "\n************************************************************\n" + "XDvi %s: Failed assertion:\n%s:%d: ", + version, filename, lineno); + va_list argp; + va_start(argp, fmt); + (void)vfprintf(stderr, fmt, argp); + va_end(argp); +#ifdef NDEBUG + fprintf(stderr, + "\nAborting now. Please report this as a bug to:\n" + "http://sourceforge.net/tracker/?group_id=23164&atid=377580\n" + "If a core dump has been produced, please invoke:\n" + "gdb %s core\nThen type \"bt\", " + "and include the resulting output in your bug report.\n" + "************************************************************\n", + globals.program_name); + do_abort(); +#else + fprintf(stderr, + "\nPlease report this as a bug to:\n" + "http://sourceforge.net/tracker/?group_id=23164&atid=377580\n" + "************************************************************\n"); +#endif } - return new_elem; -} - -/* - Return head of the list. -*/ -struct dl_list * -dl_list_head(struct dl_list *list) -{ - for (; list != NULL && list->prev != NULL; list = list->prev) { ; } - return list; } -/* - Put a new item at the front of the list (current front is passed in first argument) - and return its position. -*/ -struct dl_list * -dl_list_push_front(struct dl_list *list, void *item) -{ - struct dl_list *new_elem = xmalloc(sizeof *new_elem); - new_elem->item = item; - new_elem->next = NULL; - new_elem->prev = NULL; - - if (list != NULL) { /* prepend to current position */ - new_elem->next = list; - list->prev = new_elem; - } - return new_elem; -} -/* - Truncate list so that current pointer is the last element. -*/ -struct dl_list * -dl_list_truncate(struct dl_list *list) +void +xdvi_bell(void) { - struct dl_list *ptr = list->next; - struct dl_list *save; - - list->next = NULL; - - while (ptr != NULL) { - save = ptr->next; - free(ptr); - ptr = save; + if (!resource.hush_bell) { + XBell(DISP, 0); } - return list; -} - -/* - Truncate list at the head (i.e. remove the first element from it - head must be passed to this list), - and return the result. -*/ -struct dl_list * -dl_list_truncate_head(struct dl_list *list) -{ - struct dl_list *ptr = list->next; - if (list->next != NULL) - list->next->prev = NULL; - free(list); - return ptr; } -/* - If the item pointed to by *list isn't the head of the list, remove it, - set *list to the previous item, and return True. Else return False. -*/ -Boolean -dl_list_remove_item(struct dl_list **list) -{ - struct dl_list *ptr = *list; /* item to remove */ - if (ptr->prev == NULL) - return False; - ptr->prev->next = ptr->next; - if (ptr->next != NULL) - ptr->next->prev = ptr->prev; - /* update list */ - *list = (*list)->prev; - /* remove item */ - free(ptr); - - return True; -} - -/* - Remove all items matching compare_func() from list. Must be called - with a pointer to the head of the list, which is also returned. - Returns the number of removed items in `count'. -*/ -struct dl_list * -dl_list_remove(struct dl_list *list, const void *item, - int *count, - void **removed_item, - Boolean (*compare_func)(const void *item1, const void *item2)) -{ - struct dl_list *ptr = list; - while (ptr != NULL) { - struct dl_list *next = ptr->next; - if (compare_func(ptr->item, item)) { /* match */ - *removed_item = ptr->item; - (*count)++; - if (ptr->prev != NULL) { - ptr->prev->next = ptr->next; - } - else { /* removed first element */ - list = list->next; - } - - if (ptr->next != NULL) - ptr->next->prev = ptr->prev; - free(ptr); - ptr = NULL; - } - ptr = next; - } - return list; -} /* NOTE: keep this table in sync with the #defines in xdvi-debug.h! */ @@ -294,7 +194,7 @@ struct debug_string_options debug_options[] = { { DBG_DVI, "dvi", ", " }, { DBG_PK, "pk", ", " }, { DBG_BATCH, "batch", ", " }, - { DBG_EVENT, "event", ", " }, + { DBG_EVENT, "events", ", " }, { DBG_PS, "ps", ",\n"}, { DBG_STAT, "stat", ", " }, { DBG_HASH, "hash", ", " }, @@ -402,12 +302,12 @@ xdvi_exit(int status) if (preferences_changed()) { return; } -/* else { */ -/* fprintf(stderr, "Preferences not changed.\n"); */ -/* } */ + /* else { */ + /* fprintf(stderr, "Preferences not changed.\n"); */ + /* } */ #endif /* try to save user preferences, unless we're exiting with an error */ - if (status == 0 && !save_user_preferences(True)) + if (status == EXIT_SUCCESS && !save_user_preferences(True)) return; /* Clean up the "xdvi windows" property in the root window. */ @@ -417,9 +317,8 @@ xdvi_exit(int status) #if PS ps_destroy(); #endif - remove_tmp_dvi_file(); - close_iconv(); + call_exit_handlers(); exit(status); } @@ -679,7 +578,7 @@ my_realpath(const char *path, char *resolved) /* go back to where we came from */ #ifdef HAVE_FCHDIR - fchdir(fd); + (void)fchdir(fd); close(fd); #else chdir(cwd); @@ -689,7 +588,7 @@ my_realpath(const char *path, char *resolved) /* arrive here in case of error: go back to where we came from, and return NULL */ #ifdef HAVE_FCHDIR - fchdir(fd); + (void)fchdir(fd); close(fd); #else chdir(cwd); @@ -761,6 +660,14 @@ xmemdup(const char *str, size_t len) #endif /* not KPATHSEA */ +/* like xstrdup(), but with XtMalloc() */ +char * +xt_strdup(const char *ptr) +{ + char *ret = XtMalloc(strlen(ptr) + 1); + return strcpy(ret, ptr); +} + /* * Append str2 to str1, reallocating str1 as neccessary. @@ -1026,7 +933,7 @@ handle_child_exit(int status, struct xchild *this) if (this->io != NULL && (WIFEXITED(status) != 0) && (WEXITSTATUS(status) != 0) - && (err_msg = (this->io->read_proc)(this->io->fd)) != NULL) { + && (err_msg = (this->io->read_proc)(this->io->fd, NULL)) != NULL) { if (this->name == NULL) { popup_message(globals.widgets.top_level, @@ -1053,9 +960,11 @@ handle_child_exit(int status, struct xchild *this) } static void -dummy_write_proc(int fd) +dummy_write_proc(int fd, void *data) { UNUSED(fd); + UNUSED(data); + fprintf(stderr, "============== dummy_write_proc called for fd %d\n", fd); } @@ -1065,12 +974,14 @@ dummy_write_proc(int fd) * afterwards. */ char * -read_child_error(int fd) +read_child_error(int fd, void *data) { int bytes = 0, buf_old_size = 0, buf_new_size = 0; char tmp_buf[BUF_SIZE]; char *err_buf = xstrdup(""); char *ret; + UNUSED(data); + /* collect stderr messages into err_buf */ while ((bytes = read(fd, tmp_buf, BUF_SIZE - 1)) > 0) { buf_old_size = buf_new_size; @@ -1136,10 +1047,10 @@ fork_process(const char *proc_name, Boolean redirect_stdout, return False; case 0: /* child */ if (dirname != NULL) - chdir(dirname); + (void)chdir(dirname); if (globals.debug & DBG_FILES) { char path[MAXPATHLEN]; - getcwd(path, MAXPATHLEN); + (void)getcwd(path, MAXPATHLEN); fprintf(stderr, "Directory of running `%s': `%s'\n", proc_name, path); } @@ -1148,7 +1059,7 @@ fork_process(const char *proc_name, Boolean redirect_stdout, this will hang the child forever. Closing all other file descriptors, as in the #if TRY_FIX regions, seems to fix this, but it also loses all output ... - */ + */ #if TRY_FIX close(0); close(1); @@ -1196,6 +1107,7 @@ fork_process(const char *proc_name, Boolean redirect_stdout, #endif my_io->read_proc = read_child_error; my_io->write_proc = dummy_write_proc; + my_io->data = data; my_child->next = NULL; my_child->pid = pid; @@ -1238,24 +1150,24 @@ prep_fd(int fd, wide_bool noblock) } else # endif - { + { # ifdef FASYNC - if (fcntl(fd, F_SETOWN, getpid()) == -1) - perror("xdvi: fcntl F_SETOWN"); - if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | FASYNC) == -1) - perror("xdvi: fcntl F_SETFL"); + if (fcntl(fd, F_SETOWN, getpid()) == -1) + perror("xdvi: fcntl F_SETOWN"); + if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | FASYNC) == -1) + perror("xdvi: fcntl F_SETFL"); # elif defined SIOCSPGRP && defined FIOASYNC - /* For HP-UX B.10.10 and maybe others. See "man 7 socket". */ - int arg; + /* For HP-UX B.10.10 and maybe others. See "man 7 socket". */ + int arg; - arg = getpid(); - if (ioctl(fd, SIOCSPGRP, &arg) == -1) - perror("xdvi: ioctl SIOCSPGRP"); - arg = 1; - if (ioctl(fd, FIOASYNC, &arg) == -1) - perror("xdvi: ioctl FIOASYNC"); + arg = getpid(); + if (ioctl(fd, SIOCSPGRP, &arg) == -1) + perror("xdvi: ioctl SIOCSPGRP"); + arg = 1; + if (ioctl(fd, FIOASYNC, &arg) == -1) + perror("xdvi: ioctl FIOASYNC"); # endif - } + } #endif /* not FLAKY_SIGPOLL */ } @@ -1291,13 +1203,14 @@ parse_debugging_string(const char *arg) while (isspace((int)*curr)) curr++; for (i = 0; debug_options[i].description != NULL; i++) { - /* match on length of passed argument, to allow for abbreviations */ + size_t curr_opt_len = strlen(debug_options[i].description); + /* Should we match on length of passed argument, to allow for abbreviations? */ if (memicmp(curr, debug_options[i].description, - strlen(debug_options[i].description)) == 0 - && (curr[strlen(debug_options[i].description)] == '\0' - || curr[strlen(debug_options[i].description)] == ',' - || isspace((int)curr[strlen(debug_options[i].description)]))) { + curr_opt_len) == 0 + && (curr[curr_opt_len] == '\0' + || curr[curr_opt_len] == ',' + || isspace((int)curr[curr_opt_len]))) { matched = True; retval |= debug_options[i].bitmap; fprintf(stderr, "Debugging option: \"%s\" = \"%s\", debug: %d\n", @@ -1496,14 +1409,13 @@ find_file(const char *filename, struct stat *statbuf, kpse_file_format_type path * /absolute/path/ + relative/path/filename */ ASSERT(globals.dvi_file.dirname != NULL, "globals.dvi_file.dirname should have been initialized"); - { - pathname = xstrdup(globals.dvi_file.dirname); - pathname = xstrcat(pathname, filename); - TRACE_SRC((stderr, "Trying globals.dvi_file.dirname: \"%s\"", pathname)); - if (stat(pathname, statbuf) == 0) { - return pathname; - } + pathname = xstrdup(globals.dvi_file.dirname); + pathname = xstrcat(pathname, filename); + + TRACE_SRC((stderr, "Trying globals.dvi_file.dirname: \"%s\"", pathname)); + if (stat(pathname, statbuf) == 0) { + return pathname; } /* @@ -1517,20 +1429,75 @@ find_file(const char *filename, struct stat *statbuf, kpse_file_format_type path } /* - * case 4: - * try a kpathsea search for filename + * case 4a: + * try a kpathsea search for filename, from globals.dvi_file.dirname */ - TRACE_SRC((stderr, - "trying kpathsearch for filename \"%s\"", - filename)); - tmp = kpse_find_file(filename, pathinfo, True); + { +#ifdef HAVE_FCHDIR + int fd; +#else + char cwd[MAXPATHLEN]; +#endif - if (tmp != NULL && stat(tmp, statbuf) == 0) { - TRACE_SRC((stderr, "Found file: `%s'", tmp)); - free(pathname); - return tmp; + /* Save cwd for going back later */ + if ( +#ifdef HAVE_FCHDIR + (fd = try_open(".", O_RDONLY)) >= 0 +#else /* HAVE_FCHDIR */ +# ifdef HAVE_GETCWD + getcwd(cwd, MAXPATHLEN) +# else + getwd(cwd) +# endif + != NULL +#endif /* HAVE_FCHDIR */ + ) { + if (chdir(globals.dvi_file.dirname) == 0) { + + TRACE_SRC((stderr, + "trying kpathsearch for filename \"%s\" from %s", + filename, globals.dvi_file.dirname)); + tmp = kpse_find_file(filename, pathinfo, True); + + if (tmp != NULL && stat(tmp, statbuf) == 0) { + free(pathname); + /* go back to where we came from */ +#ifdef HAVE_FCHDIR + (void)fchdir(fd); + close(fd); +#else + chdir(cwd); +#endif + if (tmp[0] == '/') { /* is it an absolute path? */ + pathname = xstrdup(tmp); + } + else { + pathname = xstrdup(globals.dvi_file.dirname); + pathname = xstrcat(pathname, tmp); + } + TRACE_SRC((stderr, "Found file: `%s'", pathname)); + free(tmp); + return pathname; + } + } + else { + /* + * case 4b: + * couldn't change to globals.dvi_file.dirname - try a kpathsea search from CWD + */ + TRACE_SRC((stderr, + "trying kpathsearch for filename \"%s\" from CWD", + filename)); + tmp = kpse_find_file(filename, pathinfo, True); + + if (tmp != NULL && stat(tmp, statbuf) == 0) { + TRACE_SRC((stderr, "Found file: `%s'", tmp)); + free(pathname); + return tmp; + } + } + } } - /* * case 5: * try a kpathsea search for pathname @@ -1560,6 +1527,13 @@ find_file(const char *filename, struct stat *statbuf, kpse_file_format_type path functions that can be used to store 2 type of values: char *, and long, where the latter is interpreted as char *. (See kpathsea/dir.c for an example of where this is used). + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + BUG ALERT: Note however that a long value may never be removed from + the hash table with hash_delete(), since it would do a strcmp() on + the long interpreted as a pointer! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + We can't use a different approach (like using a void *) since the debugging ouput of kpathsea relies on printing the value either as char * or long (depending on the value of the global flag @@ -1595,7 +1569,7 @@ find_str_int_hash(hashTableT *hashtable, const char *key, size_t *val) Insert key-value pair into hashtable. Note that the key is *not* copied (i.e. it is expected that is had been allocated somewhere else, and persists throughout the program). - */ +*/ void put_str_int_hash(hashTableT *hashtable, const char *key, size_t val) { @@ -1620,7 +1594,7 @@ set_dvi_name_expand(const char *new_filename) /* set globals.dvi_name, globals.dvi_file.dirname and globals.dvi_file.dirlen In contrast to previous function, input filename is not copied. - */ +*/ void set_dvi_name(char *new_filename) { @@ -1654,7 +1628,7 @@ copy_fp(FILE *in, FILE *out) if (bytes_in < TMP_BUF_SIZE && !feof(in)) return False; bytes_out = fwrite(buf, 1, bytes_in, out); -/* fprintf(stderr, "read %d, wrote %d bytes\n", bytes_in, bytes_out); */ + /* fprintf(stderr, "read %d, wrote %d bytes\n", bytes_in, bytes_out); */ if (bytes_out < bytes_in) return False; } @@ -1663,6 +1637,7 @@ copy_fp(FILE *in, FILE *out) #undef TMP_BUF_SIZE } + /* * Copy a file from `from_path' to `to'. Return True if successful, False else * (in which case caller should examine errno to find the error). @@ -1804,6 +1779,90 @@ iconv_convert_string(const char *from_enc, const char *to_enc, const char *str) #endif /* HAVE_ICONV_H */ } + +/* Replace (pseudo-)format arguments in NULL-terminated argv list as follows: + * %f -> filename, %l -> linenumber, %c -> column number. + * If %f or %l are not specified, they are appended as %f and +%l. + * If colno == 0, no %c argument is provided. + */ +char ** +src_format_arguments(char **argv, const char *filename, int lineno, int colno) +{ + size_t i; + Boolean found_filename = False; + Boolean found_lineno = False; + + for (i = 0; argv[i] != NULL; i++) { + char *ptr, *curr = argv[i]; + while ((ptr = strchr(curr, '%')) != NULL) { + char *p1; + if ((p1 = strchr("flc", ptr[1])) != NULL) { /* we have a formatting char */ + char digit_arg[LENGTH_OF_INT]; + const char *new_elem = NULL; + /* remember offsets and lengths */ + size_t l_init = ptr - argv[i]; + size_t l_rest = strlen(ptr + 2) + 1; + size_t l_mid; + + if (*p1 == 'f') { + found_filename = True; + new_elem = filename; + } + else if (*p1 == 'l') { + found_lineno = True; + sprintf(digit_arg, "%d", lineno); + new_elem = digit_arg; + } + else if (*p1 == 'c') { + sprintf(digit_arg, "%d", colno); + new_elem = digit_arg; + } + + l_mid = strlen(new_elem); + + argv[i] = xrealloc(argv[i], strlen(argv[i]) + l_mid + 1); + curr = argv[i] + l_init; /* need to reinitialize it because of realloc */ + memmove(curr + l_mid, curr + 2, l_rest); + memcpy(curr, new_elem, l_mid); + curr += l_mid; + } + else if (ptr[1] == '%') { /* escaped %, skip both */ + curr = ptr + 2; + } + else { + curr = ptr + 1; + } + } + } + + /* append line number and file name arguments if they were not specified */ + if (!found_lineno) { + i++; + argv = xrealloc(argv, (i + 1) * sizeof *argv); + argv[i - 1] = xmalloc(LENGTH_OF_INT + 2); + sprintf(argv[i - 1], "+%d", lineno); + argv[i] = NULL; + } + + if (!found_filename) { + i++; + argv = xrealloc(argv, (i + 1) * sizeof *argv); + argv[i - 1] = xstrdup(filename); + argv[i] = NULL; + } + + return argv; +} + +char * +xstrndup(const char *str, size_t len) +{ + char *new_str = xmalloc(len + 1); + memcpy(new_str, str, len); + new_str[len] = '\0'; + return new_str; +} + #if 0 /* * Search integer array of length for for . diff --git a/Build/source/texk/xdvik/util.h b/Build/source/texk/xdvik/util.h index 473d8d1be6d..615b521d3de 100644 --- a/Build/source/texk/xdvik/util.h +++ b/Build/source/texk/xdvik/util.h @@ -48,36 +48,23 @@ #include "events.h" /* for child proc stuff */ -/* double linked list */ -struct dl_list { - void *item; - struct dl_list *prev; - struct dl_list *next; -}; - -struct dl_list *dl_list_head(struct dl_list *list); -struct dl_list *dl_list_push_front(struct dl_list *list, void *item); -struct dl_list *dl_list_insert(struct dl_list *list, void *item); -struct dl_list *dl_list_truncate(struct dl_list *list); -struct dl_list *dl_list_truncate_head(struct dl_list *list); -struct dl_list *dl_list_remove(struct dl_list *list, - const void *elem, - int *count, - void **item, - Boolean (*compare_func)(const void *item1, const void *item2)); -Boolean dl_list_remove_item(struct dl_list **list); FILE *try_fopen(const char *fname, const char *mode); FILE *try_fdopen(int fd, const char *mode); int try_open(const char *fname, int flags); int try_open_mode(const char *fname, int flags, mode_t mode); extern int xdvi_temp_fd(char **tempfilename); - +extern void xdvi_assert(const char *version, + const char *filename, + int lineno, + Boolean condition, + const char *fmt, + ...); typedef void (*child_exited_proc)(int status, struct xchild *this); extern void handle_child_exit(int status, struct xchild *this); -extern char *read_child_error(int fd); +extern char *read_child_error(int fd, void *data); extern Boolean fork_process(const char *file, Boolean redirect_stdout, const char *dirname, childProcT exit_proc, void *data, @@ -112,6 +99,11 @@ extern int memicmp(const char *, const char *, size_t); /* extern char *xmemdump(const char *, size_t); */ /* extern void xputenv(const char *, const char *); */ +/* like xstrdup, but only copy len characters and zero-terminate at next index (allocates len+1 characters) */ +extern char *xstrndup(const char *str, size_t len); + +extern char *xt_strdup(const char *); /* like xstrdup, but with XtMalloc() */ + extern char *xstrcat(char *str1, const char *str2); extern int xpipe(int *); extern void close_a_file(void); @@ -135,6 +127,7 @@ extern unsigned long parse_debugging_option(const char *ptr); extern int get_avg_font_width(XFontStruct *font); extern char **split_line(const char *line, char sep, size_t begin, size_t end, size_t *ret_items); extern char *find_file(const char *filename, struct stat *statbuf, kpse_file_format_type pathinfo); +extern char **src_format_arguments(char **argv, const char *filename, int lineno, int colno); /* hashtable wrapper functions, mostly used by dvi-draw.c to @@ -154,14 +147,15 @@ struct str_int_hash_item { typedef hash_table_type hashTableT; /* from kpathsea */ extern Boolean find_str_int_hash(hashTableT *hashtable, const char *key, size_t *val); -void put_str_int_hash(hashTableT *hashtable, const char *key, size_t val); +extern void put_str_int_hash(hashTableT *hashtable, const char *key, size_t val); -Boolean copy_file(const char *from, const char *to); -Boolean copy_fp(FILE *in, FILE *out); +extern Boolean copy_file(const char *from, const char *to); +extern Boolean copy_fp(FILE *in, FILE *out); extern const char *get_text_encoding(void); extern char *iconv_convert_string(const char *from_enc, const char *to_enc, const char *str); +extern void xdvi_bell(void); /* Various error reporting macros. The reasons why these are macros are: diff --git a/Build/source/texk/xdvik/version.h b/Build/source/texk/xdvik/version.h index e2c6ef4744f..a00c4f1b42a 100644 --- a/Build/source/texk/xdvik/version.h +++ b/Build/source/texk/xdvik/version.h @@ -2,7 +2,7 @@ #ifndef VERSION_H_ #define VERSION_H_ -#define XDVI_VERSION "22.84.10" +#define XDVI_VERSION "22.84.14" #ifdef MOTIF #define XDVI_GUI "(Motif toolkit)" diff --git a/Build/source/texk/xdvik/vf.c b/Build/source/texk/xdvik/vf.c index 7fd4cd0379d..b5ab6ac005b 100644 --- a/Build/source/texk/xdvik/vf.c +++ b/Build/source/texk/xdvik/vf.c @@ -64,7 +64,7 @@ read_VF_index(struct font *fontp, wide_bool hushcs) long checksum; struct macro *newmacro; unsigned long maxcc = 0; - Boolean dummy = False; + Boolean dummy_success = False; fontp->read_char = NULL; fontp->flags |= FONT_VIRTUAL; @@ -90,10 +90,13 @@ read_VF_index(struct font *fontp, wide_bool hushcs) fontp->first_font = NULL; while ((cmnd = get_byte(VF_file)) >= FNTDEF1 && cmnd <= FNTDEF4) { struct font *newfontp = define_font(True, +#if DELAYED_MKTEXPK + True, +#endif VF_file, cmnd, fontp, fontp->vf_table, VFTABLELEN, &fontp->vf_chain, - &dummy); + &dummy_success); if (fontp->first_font == NULL) fontp->first_font = newfontp; } @@ -156,12 +159,12 @@ read_VF_index(struct font *fontp, wide_bool hushcs) else m->pos = xmalloc((unsigned)len); } - fread((char *)m->pos, 1, len, VF_file); + (void)fread((char *)m->pos, 1, len, VF_file); m->end = m->pos + len; } if (globals.debug & DBG_PK) - printf("Read VF macro for character %lu; dy = %ld, length = %d\n", - cc, m->dvi_adv, len); + printf("Read VF macro for character %lu; dy = %ld, length = %d\n", + cc, m->dvi_adv, len); } if (cmnd != POST) XDVI_FATAL((stderr, "Wrong command byte found in VF macro list: %d", cmnd)); diff --git a/Build/source/texk/xdvik/withenable.ac b/Build/source/texk/xdvik/withenable.ac index 8a1f6c32f42..90ee99eb086 100644 --- a/Build/source/texk/xdvik/withenable.ac +++ b/Build/source/texk/xdvik/withenable.ac @@ -1,5 +1,35 @@ dnl withenable.ac: --with and --enable options. +# Check for toolkit options. This used to be --with-x-toolkit, but was changed +# to remove clashes with metafont which accepts different values. +# We allow `yes' as synonym for the default toolkit, for easier communication +# with ../kpathsea/xt.ac. +dnl +dnl This defines --with-x implicitly (which is why we use that package +dnl name below), so put it here, so it comes first in the --help output. +dnl This reads best. +dnl +dnl Remember to add AC_PATH_XTRA when actually using X. +dnl +AC_ARG_WITH([xdvi-x-toolkit], +[ --with-xdvi-x-toolkit=KIT + Use toolkit KIT for xdvi (KIT=motif/xaw/xaw3d/neXtaw). + If no --with-xdvi-x-toolkit option is used, use Motif + if available, else Xaw.], +[ case "${withval}" in + next | nextaw | neXtaw ) val=neXtaw ;; + xaw3d ) val=xaw3d ;; + x | xa | xaw ) val=xaw ;; + y | ye | yes ) val=yes ;; + m | mo | mot | moti | motif ) val=motif ;; + * ) +AC_MSG_WARN([unknown --with-xdvi-x-toolkit argument \`$withval'; using xaw.]) + val=xaw;; + esac + with_xdvi_x_toolkit=$val +]) + + # Check if the user wants to use Ghostscript, DPS or NeWS to # display PostScript. AC_ARG_WITH([ps], @@ -20,7 +50,7 @@ AC_ARG_ENABLE([grey], else echo DISABLED grey fi], -[AC_DEFINE([GREY], 1)]) +AC_DEFINE([GREY], 1)) AC_ARG_ENABLE([color], [ --disable-color Disable support for color specials], @@ -29,25 +59,25 @@ AC_ARG_ENABLE([color], else echo DISABLED color fi], -[AC_DEFINE([COLOR], 1)]) +AC_DEFINE([COLOR], 1)) dnl OBSOLETE AC_ARG_ENABLE([buttons], dnl OBSOLETE [ --disable-buttons Disable buttons on the side of the window], dnl OBSOLETE [if test "$enableval" = yes; then -dnl OBSOLETE AC_DEFINE(BUTTONS) +dnl OBSOLETE AC_DEFINE([BUTTONS], 1, [Define to enable buttons on the side of the window.]) dnl OBSOLETE else dnl OBSOLETE echo DISABLED buttons dnl OBSOLETE fi], -dnl OBSOLETE [AC_DEFINE(BUTTONS)]) +dnl OBSOLETE AC_DEFINE([BUTTONS], 1)) dnl OBSOLETE AC_ARG_ENABLE([statusline], dnl OBSOLETE [ --disable-statusline Disable statusline at bottom of window], dnl OBSOLETE [if test "$enableval" = yes; then -dnl OBSOLETE AC_DEFINE(STATUSLINE) +dnl OBSOLETE AC_DEFINE([STATUSLINE], 1, [Define to enable statusline at bottom of window.]) dnl OBSOLETE else dnl OBSOLETE echo DISABLED statusline dnl OBSOLETE fi], -dnl OBSOLETE [AC_DEFINE(STATUSLINE)]) +dnl OBSOLETE AC_DEFINE([STATUSLINE], 1)) AC_ARG_ENABLE([t1lib], [ --disable-t1lib Do not use T1lib (direct rendering of Type1 fonts)], @@ -124,26 +154,3 @@ AC_ARG_ENABLE([magick], fi]) AC_SUBST(LDT1LIB) - -dnl This defines --with-x implicitly (which is why we use that package -dnl name below), so put it here, so it comes first in the --help output. -dnl This reads best. - -dnl Remember to add AC_PATH_XTRA when actually using X. - -AC_ARG_WITH([xdvi-x-toolkit], -[ --with-xdvi-x-toolkit=KIT - Use toolkit KIT for xdvi (KIT=motif/xaw/xaw3d/neXtaw). - If no --with-xdvi-x-toolkit option is used, use Motif - if available, else Xaw.], -[ case "${withval}" in - next | nextaw | neXtaw ) val=neXtaw ;; - xaw3d ) val=xaw3d ;; - x | xa | xaw ) val=xaw ;; - m | mo | mot | moti | motif ) val=motif ;; - * ) -AC_MSG_WARN([unknown --with-xdvi-x-toolkit argument \`$withval'; using xaw.]) - val=xaw;; - esac - with_xdvi_x_toolkit=$val -]) diff --git a/Build/source/texk/xdvik/withenable.ac.orig b/Build/source/texk/xdvik/withenable.ac.orig new file mode 100644 index 00000000000..02887e7d498 --- /dev/null +++ b/Build/source/texk/xdvik/withenable.ac.orig @@ -0,0 +1,149 @@ +dnl withenable.ac: --with and --enable options. + +# Check for toolkit options. This used to be --with-x-toolkit, but was changed +# to remove clashes with metafont which accepts different values. +# We allow `yes' as synonym for the default toolkit, for easier communication +# with ../kpathsea/xt.ac. +AC_ARG_WITH(xdvi-x-toolkit, +[ --with-xdvi-x-toolkit=KIT + Use toolkit KIT for xdvi (KIT=motif/xaw/xaw3d/neXtaw). + If no --with-xdvi-x-toolkit option is used, use Motif + if available, else Xaw.], +[ case "${withval}" in + next | nextaw | neXtaw ) val=neXtaw ;; + xaw3d ) val=xaw3d ;; + x | xa | xaw ) val=xaw ;; + y | ye | yes ) val=yes ;; + m | mo | mot | moti | motif ) val=motif ;; + * ) +AC_MSG_WARN([unknown --with-xdvi-x-toolkit argument \`$withval'; using xaw.]) + val=xaw;; + esac + with_xdvi_x_toolkit=$val +]) + + +# Check if the user wants to use Ghostscript, DPS or NeWS to +# display PostScript. +AC_ARG_WITH(ps, +[ --with-ps=PS Use PostScript (PS=no/yes/gs/dps/news, default gs)], +[case $withval in + yes|gs) PS_DEF="$PS_DEF -DPS_GS";; + no) PS_DEF=no;; + dps) PS_DEF="$PS_DEF -DPS_DPS";; + news) PS_DEF="$PS_DEF -DPS_NEWS";; + *)] AC_MSG_WARN(Unknown --with-ps argument \`$withval'; using gs.);; + esac) + +AC_ARG_ENABLE(grey, +[ --disable-grey Disable greyscale anti-aliasing for shrunken bitmaps] +, +[if test "$enableval" = yes; then + AC_DEFINE(GREY) + else + echo DISABLED grey +fi], +AC_DEFINE(GREY)) + +AC_ARG_ENABLE(color, +[ --disable-color Disable support for color specials], +[if test "$enableval" = yes; then + AC_DEFINE(COLOR) + else + echo DISABLED color +fi], +AC_DEFINE(COLOR)) + +dnl OBSOLETE AC_ARG_ENABLE(buttons, +dnl OBSOLETE [ --disable-buttons Disable buttons on the side of the window], +dnl OBSOLETE [if test "$enableval" = yes; then +dnl OBSOLETE AC_DEFINE(BUTTONS) +dnl OBSOLETE else +dnl OBSOLETE echo DISABLED buttons +dnl OBSOLETE fi], +dnl OBSOLETE AC_DEFINE(BUTTONS)) + +dnl OBSOLETE AC_ARG_ENABLE(statusline, +dnl OBSOLETE [ --disable-statusline Disable statusline at bottom of window], +dnl OBSOLETE [if test "$enableval" = yes; then +dnl OBSOLETE AC_DEFINE(STATUSLINE) +dnl OBSOLETE else +dnl OBSOLETE echo DISABLED statusline +dnl OBSOLETE fi], +dnl OBSOLETE AC_DEFINE(STATUSLINE)) + +AC_ARG_ENABLE(t1lib, +[ --disable-t1lib Do not use T1lib (direct rendering of Type1 fonts)], +[if test "$enableval" = yes; then + T1LIB=1 + LDT1LIB=../../libs/t1lib/lib/.libs/libt1.a + AC_DEFINE(LDT1LIB) + AC_DEFINE(T1LIB) +else + T1LIB= + LDT1LIB= + echo DISABLED t1lib +fi], +T1LIB=1 +LDT1LIB=../../libs/t1lib/lib/.libs/libt1.a +AC_DEFINE(LDT1LIB) +AC_DEFINE(T1LIB)) + +AC_ARG_ENABLE(gf, +[ --enable-gf Enable gf format pixel files (in addition to pk)], +[if test "$enableval" != no; then + AC_DEFINE(USE_GF) + OPT_SRCS="$OPT_SRCS gf.c" + OPT_OBJS="$OPT_OBJS gf.o" +fi]) + +AC_ARG_ENABLE(a4, +[ --disable-a4 Set default paper size to letter and default unit to inch], +[if test "$enableval" = yes; then + AC_DEFINE(A4) + else + echo Disabled a4/cm, using letter/in instead +fi], +AC_DEFINE(A4)) + +AC_ARG_ENABLE(magick, +[ --enable-magick Use ImageMagick to load/render image files. + EXPERIMENTAL - DO NOT USE!], +[if test "$enableval" != no; then + echo -n "checking for ImageMagick >= 5.3 ... " + if MAGICK_VER=`Magick-config --version 2>/dev/null`; then + echo $MAGICK_VER + set -- `echo $MAGICK_VER | sed -e 's/\./ /g'` + MAGICK_VER_MAJOR=$1 + MAGICK_VER_MINOR=$2 + if expr $MAGICK_VER_MAJOR \> 4 >/dev/null && \ + (expr $MAGICK_VER_MAJOR \> 5 >/dev/null || \ + expr $MAGICK_VER_MINOR \> 2 >/dev/null); then + MAGICK_CPP="-DMAGICK_VER_MAJOR=$MAGICK_VER_MAJOR -DMAGICK_VER_MINOR=$MAGICK_VER_MINOR `Magick-config --cppflags`" + # echo "CPP: $MAGICK_CPP" + MAGICK_LD="`Magick-config --libs`" + # echo "LD: $MAGICK_LD" + echo "ImageMagick support enabled" + MAGICK_INCLUDE= + MAGICK_LIBDIR= + + if test "x$with_magick_include" != x; then + MAGIC_INCLUDE="-I$with_magick_include" + fi + if test "x$with_magick_libdir" != x; then + MAGIC_LIBDIR="-L$with_magick_libdir" + fi + + X_EXTRA_LIBS="$X_EXTRA_LIBS $MAGIC_LIBDIR $MAGICK_LD" + X_CFLAGS="$X_CFLAGS $MAGIC_INCLUDE $MAGICK_CPP" + AC_DEFINE(MAGICK) + #echo MAGICK_DEF=\"$MAGICK_DEF\" + else + echo "ImageMagick version too old - ImageMagick support disabled" + fi + else + echo "Can't run 'Magick-config' - ImageMagick support disabled" + fi +fi]) + +AC_SUBST(LDT1LIB) diff --git a/Build/source/texk/xdvik/x_util.c b/Build/source/texk/xdvik/x_util.c index 79dd5a6a531..e1c390e6e88 100644 --- a/Build/source/texk/xdvik/x_util.c +++ b/Build/source/texk/xdvik/x_util.c @@ -86,7 +86,7 @@ scroll_page_if_needed(int x_min, int x_max, int y_min, int y_max) /* check if we need to scroll vertically; first, down for y_min */ test_scroll = y_min + drawing_y - clip_h; if ((resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0) - test_scroll += global_statusline_h; + test_scroll += get_statusline_height(); TRACE_SRC((stderr, "test_scroll vertically: %d", test_scroll)); #if DEBUG_SCROLL_IF_NEEDED @@ -200,20 +200,22 @@ Window get_window_id(char *window_p) { Window w; + unsigned char *tmp; + tmp = (unsigned char *)window_p; -#ifndef WORD64 +#if !(defined(WORD64) || defined(LONG64)) w = (*((xuint32 *) window_p)); #else # if WORDS_BIGENDIAN - w = ((unsigned long)wp[0] << 24) | - ((unsigned long)wp[1] << 16) | - ((unsigned long)wp[2] << 8) | - (unsigned long)wp[3]; + w = ((unsigned long)tmp[0] << 24) | + ((unsigned long)tmp[1] << 16) | + ((unsigned long)tmp[2] << 8) | + (unsigned long)tmp[3]; # else - w = ((unsigned long)wp[3] << 24) | - ((unsigned long)wp[2] << 16) | - ((unsigned long)wp[1] << 8) | - (unsigned long)wp[0]; + w = ((unsigned long)tmp[3] << 24) | + ((unsigned long)tmp[2] << 16) | + ((unsigned long)tmp[1] << 8) | + (unsigned long)tmp[0]; # endif #endif return w; @@ -360,7 +362,7 @@ update_window_property(Window w, Boolean prepend) } if (prepend) { /* add our ID again to front */ -#ifdef WORD64 +#if (defined(WORD64) || defined(LONG64)) unsigned char data[4]; set_window_id(w, data); #else @@ -454,30 +456,35 @@ Atom atom_reread_prefs(void) } /* - * Syntetisize a button press object for the `button' passed as - * the second argument. + * Syntesize a mouse-1 down event for the Widget w passed as second argument. + * This can be, e.g. a dialog button, or some other window. */ void -synthetisize_event(XEvent *ev, Widget button) +synthesize_event(XEvent *ev, Widget w) { memset(ev, 0, sizeof(XButtonPressedEvent)); ev->type = ButtonPress; ev->xbutton.serial = 1; ev->xbutton.send_event = True; ev->xbutton.button = 1; - ev->xbutton.display = XtDisplayOfObject(button); - ev->xbutton.window = XtWindowOfObject(button); + ev->xbutton.display = XtDisplayOfObject(w); + ev->xbutton.window = XtWindowOfObject(w); } #ifdef MOTIF int xm_get_height(Widget w) { int ret_h = 0; - static Arg args = { XtNheight, (XtArgVal)0 }; + static Dimension h0, h1, h2; + static Arg args[] = { + {XmNheight, (XtArgVal) &h0}, + {XmNmarginHeight, (XtArgVal) &h1}, + {XmNshadowThickness, (XtArgVal) &h2}, + }; ASSERT(w != NULL, "widget in xm_get_width mustn't be NULL!"); - args.value = (XtArgVal)&ret_h; - XtGetValues(w, &args, 1); + XtGetValues(w, args, XtNumber(args)); + ret_h = h0 + 2 * h1 + 2 * h2; TRACE_GUI((stderr, "xm_get_height: %d", ret_h)); return ret_h; } @@ -497,7 +504,7 @@ int xm_get_width(Widget w) /* * Get pixel from color `colorname'. We try to keep this as * high-level as possible, with simple black as fallback. -*/ + */ void str_to_pixel(Widget w, const char *colorname, Pixel *ret) { @@ -521,7 +528,7 @@ str_to_pixel(Widget w, const char *colorname, Pixel *ret) * Convert pixel value `pix' to color name passed as str, * of length len, or `black' if conversion failed. * -- FIXME: This is broken!!! -*/ + */ void pixel_to_str(Widget w, Pixel pix, char *str, size_t len) { @@ -602,6 +609,35 @@ get_matching_parent(Widget w, Widget d, const char *fmt, ...) return parent; } +void +adjust_width_to_max(Widget w, ...) +{ + Dimension max = 0; + Widget w1 = w; + + va_list argp; + va_start(argp, w); + + /* get maximum width */ + while (w1 != NULL) { + Dimension curr; + XtVaGetValues(w1, XtNwidth, &curr, NULL); + if (curr > max) + max = curr; + w1 = va_arg(argp, Widget); + } + va_end(argp); + + /* set maximum width */ + va_start(argp, w); + w1 = w; + while (w1 != NULL) { + XtVaSetValues(w1, XtNwidth, max, NULL); + w1 = va_arg(argp, Widget); + } + va_end(argp); +} + /* Return True if p is a parent of widget w, stopping (and returning FALSE) if s is reached (which should be the toplevel window of the hierarchy). */ @@ -752,10 +788,10 @@ get_widget_by_name(Widget *ret, Widget parent, const char *name, Boolean report_ char buf[1024]; Widget test; -/* if (parent == 0 || !XtIsManaged(parent)) { */ -/* fprintf(stderr, "Widget %p not managed!\n", parent); */ -/* return False; */ -/* } */ + /* if (parent == 0 || !XtIsManaged(parent)) { */ + /* fprintf(stderr, "Widget %p not managed!\n", parent); */ + /* return False; */ + /* } */ if (strlen(name) > 1023) { popup_message(globals.widgets.top_level, @@ -833,15 +869,15 @@ merge_into_user_db(XrmDatabase db) const char *const xdvirc_filename = ".xdvirc"; const char *const xdvirc_signature_line = "!!! ~/.xdvirc, used by xdvi(1) to save user preferences.\n"; const char *const xdvirc_header = "" - "!!!\n" - "!!! Do not edit this file, it will be overwritten by xdvi.\n" - "!!! This file contains resources that have been set via the\n" - "!!! menus/dialogs. The contents of this file will override\n" - "!!! the entries in your ~/.Xdefaults file (but not the command\n" - "!!! line arguments passed to xdvi). Remove this file\n" - "!!! if you want to get rid of all these customizations,\n" - "!!! or start xdvi with the `-q' option to ignore this file.\n" - "!!!\n"; +"!!!\n" +"!!! Do not edit this file, it will be overwritten by xdvi.\n" +"!!! This file contains resources that have been set via the\n" +"!!! menus/dialogs. The contents of this file will override\n" +"!!! the entries in your ~/.Xdefaults file (but not the command\n" +"!!! line arguments passed to xdvi). Remove this file\n" +"!!! if you want to get rid of all these customizations,\n" +"!!! or start xdvi with the `-q' option to ignore this file.\n" +"!!!\n"; static char * get_xdvirc_path(const char *basename) @@ -867,7 +903,7 @@ save_geometry(void) int x_off, y_off; Dimension w, h; Window dummy; -/* char *geom_str; */ + /* char *geom_str; */ (void)XTranslateCoordinates(DISP, XtWindow(globals.widgets.top_level), RootWindowOfScreen(SCRN), @@ -878,7 +914,7 @@ save_geometry(void) XtNwidth, &w, XtNheight, &h, #ifdef MOTIF -/* XmNgeometry, &geom_str, */ + /* XmNgeometry, &geom_str, */ #endif NULL); TRACE_GUI((stderr, "geometry: %dx%d+%d+%d", w, h, x_off, y_off)); @@ -1083,8 +1119,7 @@ get_xdvi_window_id(Boolean same_file, property_cbT callback) Window ret_window = 0; /* - * Get window list. Copy it over (we'll be calling property_get_data() - * again). + * Get window list. Copy it over (we'll be calling property_get_data() again). */ if ((window_list_len = property_get_window_list(&p)) == 0) return 0; @@ -1219,3 +1254,8 @@ clip_region_to_rect(XRectangle *rect) return ret; } +Boolean window_is_mapped(Window w, Display *dpy) +{ + XWindowAttributes xwa; + return XGetWindowAttributes(dpy, w, &xwa) && xwa.map_state == IsViewable; +} diff --git a/Build/source/texk/xdvik/x_util.h b/Build/source/texk/xdvik/x_util.h index 8ea92be5d29..dea5f55ec91 100644 --- a/Build/source/texk/xdvik/x_util.h +++ b/Build/source/texk/xdvik/x_util.h @@ -100,7 +100,7 @@ Atom atom_raise(void); /* instruct the current instance to reread preferences from ~/.xdvirc.tmp */ Atom atom_reread_prefs(void); -extern void synthetisize_event(XEvent *ev, Widget button); +extern void synthesize_event(XEvent *ev, Widget button); #ifdef MOTIF extern int xm_get_height(Widget w); @@ -110,6 +110,7 @@ extern void pixel_to_str(Widget w, Pixel pix, char *str, size_t len); extern void pixel_to_color(Pixel pix, XColor *color, Display *display, Colormap colormap); #endif +extern void adjust_width_to_max(Widget w, ...); extern Widget get_matching_parent(Widget w, Widget p, const char *fmt, ...); extern Boolean widget_is_parent(Widget w, Widget p, Widget s); @@ -138,4 +139,6 @@ extern void set_string_property(const char *str, Atom prop, Window win); extern Boolean clip_region(int *x, int *y, int *w, int *h); extern Boolean clip_region_to_rect(XRectangle *rect); +extern Boolean window_is_mapped(Window w, Display *dpy); + #endif diff --git a/Build/source/texk/xdvik/xdvi-search.el b/Build/source/texk/xdvik/xdvi-search.el index 75e86d3bb35..8f611149aed 100644 --- a/Build/source/texk/xdvik/xdvi-search.el +++ b/Build/source/texk/xdvik/xdvi-search.el @@ -1,4 +1,4 @@ -;;; (X)Emacs frontend to forward search with xdvi(k). +;;; xdvi-search.el --- (X)Emacs frontend for forward search with xdvi(k) ;;; Requires xdvi(k) >= 22.38. ;;; ;;; See http://xdvi.sourceforge.net/inverse-search.html and the section @@ -6,7 +6,9 @@ ;;; ;;; This file is available from: http://xdvi.sourceforge.net/xdvi-search.el ;;; -;;; $Revision: 1.15.2.43 $, tested with Emacs 20.4 to 21.2 and Xemacs 21.1 to 21.5 +;;; Copyright (C) 2004 - 2006 Stefan Ulrich +;;; Copyright (C) 2006, Chris Stucchio (minor modifications) +;;; $Revision: 1.37 $, tested with Emacs 20.4 to 21.2 and Xemacs 21.1 to 21.5 ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License @@ -23,56 +25,68 @@ ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;;; ;;; -;;; Usage: -;;; -;;; - Add this file to some place where emacs can find it -;;; (e.g. put it into a directory ~/emacs/, which you add to your -;;; load path by putting the following line into your .emacs file: -;;; -;;; (add-to-list 'load-path (expand-file-name "~/emacs/")) -;;; -;;; Then, add the following line to your .emacs file: -;;; -;;; (require 'xdvi-search) -;;; -;;; After compiling your .tex file with source specials activated, you should -;;; be able to use -;;; M-x xdvi-jump-to-line -;;; to make xdvi jump to the current location of the cursor. -;;; -;;; You could also bind this command to a key, e.g. by adding -;;; a binding to tex-mode-hook: -;;; -;;; (add-hook 'tex-mode-hook (lambda () -;;; (local-set-key "\C-c\C-j" 'xdvi-jump-to-line))) -;;; -;;; (without AucTeX; use LaTeX-mode-hook instead of tex-mode-hook with AucTeX. -;;; Note that with AucTeX, C-c C-j is already bound to LaTeX-insert-item, so -;;; you might want to use a different key combination instead.) -;;; -;;; - Note that with xdvik < 22.74.2, you may need to use one of the -;;; functions xdvi-jump-to-line-fullpath() or xdvi-jump-to-line-relpath() -;;; instead of xdvi-jump-to-line(), depending on the type of paths contained -;;; in your \include{} commands. See the docstring of xdvi-jump-to-line() -;;; for more information. -;;; -;;; Please send bug reports, improvements etc. to -;;; . -;;; - +;;; Commentary: +;; +;; Usage: +;; +;; - Add this file to some place where Emacs can find it +;; (e.g. put it into a directory ~/emacs/, which you add to your +;; load path by putting the following line into your .emacs file: +;; +;; (add-to-list 'load-path (expand-file-name "~/emacs/")) +;; +;; Then, add the following line to your .emacs file: +;; +;; (require 'xdvi-search) +;; +;; After compiling your .tex file with source specials activated, you should +;; be able to use +;; M-x xdvi-jump-to-line +;; to make xdvi jump to the current location of the cursor. +;; +;; You could also bind this command to a key, e.g. by adding +;; a binding to tex-mode-hook: +;; +;; (add-hook 'tex-mode-hook (lambda () +;; (local-set-key "\C-c\C-j" 'xdvi-jump-to-line))) +;; +;; +;; (without AucTeX; use LaTeX-mode-hook instead of tex-mode-hook with AucTeX. +;; Note that with AucTeX, C-c C-j is already bound to LaTeX-insert-item, so +;; you might want to use a different key combination instead.) +;; +;; - Note that with xdvik < 22.74.2, you may need to use one of the +;; functions xdvi-jump-to-line-fullpath() or xdvi-jump-to-line-relpath() +;; instead of xdvi-jump-to-line(), depending on the type of paths contained +;; in your \include{} commands. See the docstring of xdvi-jump-to-line() +;; for more information. +;; +;; Please send bug reports, improvements etc. to +;; . +;; + + +;;; Code: ;;; ;;; Customizable stuff ;;; + (defgroup xdvi-search nil - "Support for inverse search with (La)TeX and DVI previewers." - :group 'languages) + "Support for inverse search with (La)TeX and DVI previewers." + :group 'languages) (defcustom explicit-shell-file-name nil "*If non-nil, file name to use for explicitly requested inferior shell." :type '(choice (const :tag "nil" nil) file) :group 'xdvi-search) +(defcustom xdvi-shell-buffer-name nil + "*If non-nil, file name to use for explicitly requested inferior shell." + :type '(choice (const :tag "nil" nil) file) + :group 'xdvi-search) + + (defcustom xdvi-bin "xdvi" "*Name of the xdvi executable." :type '(choice (const "xdvi") file) @@ -88,8 +102,8 @@ ;;; global variables/constants ;;; (defvar xdvi-version-number 0 - "*Version of xdvi(k) you're using; only set this to override the built-in -version recognition if that fails. + "*Version of xdvi(k) you're using. +Only set this to override the built-in version recognition if that fails. The version number is computed as: major * 1000000 + minor * 1000 + patchlevel, where alphabetic characters are ignored; e.g. 22040000 equals version 22.40c; 22077002 equals version 22.77.2.") @@ -97,27 +111,28 @@ where alphabetic characters are ignored; e.g. 22040000 equals version 22.40c; (defvar xdvi-is-xdvik nil "Whether we're really using xdvik instead of xdvi.") -(defconst xdvik-new-search-version 22074001 - "First version of xdvik to implement new search algorithm that ignores .tex suffixes and -has a -nofork option.") - - ;;; ;;; exported functions ;;; +;;;###autoload (defun xdvi-jump-to-line-fullpath () - (interactive) "See `xdvi-jump-to-line' for documentation." + (interactive) (xdvi-jump-to-line 3)) +;;;###autoload (defun xdvi-jump-to-line-relpath () - (interactive) "See `xdvi-jump-to-line' for documentation." + (interactive) (xdvi-jump-to-line 2)) +;;;###autoload (defun xdvi-jump-to-line (flag) "Call xdvi to perform a `forward search' for current file and line number. -Xdvi needs three pieces of information for this: +The optional argument FLAG controls the path searching behaviour; see also +'xdvi-jump-to-line-fullpath' and 'xdvi-jump-to-line-relpath'. + +Xdvi needs three pieces of information for forward search: - the current line number - the name of the current input file @@ -133,7 +148,7 @@ For the current input file name, we need to rely on the DVI viewer to make a smart matching of path suffixes with the file names that actually occur in the specials, since specials inserted by TeX's `-src' option may contain absolute or relative paths, depending on -whether TeX is called with a relative or absolute filename. (Similarly +whether TeX is called with a relative or absolute filename. (Similarly for srcltx.sty, which can't expand paths.) Note to users of older versions of xdvik (< 22.74.2), or non-k xdvi: @@ -148,8 +163,7 @@ There are various ways of specifying an input file path for LaTeX's Versions of xdvik < 22.74.2 and plain xdvi will not match pathname suffixes. With these versions, `xdvi-jump-to-line' will only work with variant (1); for (2) or (3) you will need to use one of `xdvi-jump-to-line-relpath' (for 2) -or `xdvi-jump-to-line-fullpath' (for 3) instead. -" +or `xdvi-jump-to-line-fullpath' (for 3) instead." (interactive "P") (save-excursion (save-restriction @@ -163,6 +177,7 @@ or `xdvi-jump-to-line-fullpath' (for 3) instead. ;;; then adding 1 (curr-line (+ 1 (count-lines (point-min) (point)))) ;;; name of master .tex file, to be used as DVI basename: + (abspath (file-name-directory buffer-file-name)) (master-file (if (fboundp 'TeX-master-file) (TeX-master-file t) (xdvi-get-masterfile (xdvi-master-file-name)))) @@ -170,9 +185,9 @@ or `xdvi-jump-to-line-fullpath' (for 3) instead. ;;; DVI file name: (dvi-file (concat (file-name-sans-extension master-file) ".dvi")) ;;; Current source filename - (filename (get-source-filename (buffer-file-name) (car xdvi-version-info) flag))) - (if (xdvi-has-no-inverse-search (car xdvi-version-info)) - (error "Your xdvi version is too old; see http://xdvi.sourceforge.net/inverse-search.html for more information.")) + (filename (get-source-filename (buffer-file-name) flag))) + (if (not (xdvi-has-inverse-search (car xdvi-version-info))) + (error "Your xdvi version is too old; see http://xdvi.sourceforge.net/inverse-search.html for more information")) (if (not (file-exists-p dvi-file)) (message "File %s does not exist; maybe you need to run latex first?" dvi-file) (save-window-excursion @@ -206,11 +221,12 @@ or `xdvi-jump-to-line-fullpath' (for 3) instead. ;; bash/ksh/sh ((list ">" "2>&1"))))) (cond ((string-match "XEmacs" emacs-version) - (shell)) + (xdvi-shell)) ((< emacs-major-version 21) - (shell)) - ((shell "*xdvi-shell*"))) + (xdvi-shell)) + ((shell (or xdvi-shell-buffer-name "*xdvi-shell*")))) (comint-send-input) + (insert (concat "cd " abspath ";") ) (insert xdvi-bin " -sourceposition '" (int-to-string curr-line) " " filename "' " dvi-file @@ -237,35 +253,70 @@ or `xdvi-jump-to-line-fullpath' (for 3) instead. ;;; ;;; internal functions ;;; -(defun xdvi-has-no-inverse-search (version) - (< version 22038000)) +(defun shell-with-name (name) + "This function opens a shell in a buffer with name given by the argument, and switches to that buffer. If the buffer already exists, we simply switch to it." + (let ((buffer-of-name (get-buffer name)) + (tempname (generate-new-buffer-name "*tempshell*") ) ) + (cond ((bufferp buffer-of-name) ;If the buffer exists, switch to it (assume it is a shell) + (switch-to-buffer name)) + ( (bufferp (get-buffer "*shell*")) + (progn + (shell) + (rename-buffer tempname) + (shell) + (rename-buffer name) + (switch-to-buffer tempname) + (rename-buffer "*shell*") + (switch-to-buffer name))) + ( t + (progn + (shell) + (rename-buffer name) + ) + ) + ) + ) + ) + +(defun xdvi-shell () + "Behaves just like function shell, but creates the shell in buffer named *xdvi-shell* (unless of course the user chooses to modify the xdvi-shell-buffer-name variable.)" + (shell-with-name (or xdvi-shell-buffer-name "*xdvi-shell*") ) + ) + +(defun xdvi-has-inverse-search (version) + "Return True if inverse search is available for this VERSION of xdvi(k)." + (>= version 22038000)) (defun xdvi-has-nofork (version is-xdvik) + "Return True if the '-nofork' option is available for this VERSION of xdvi(k). +This option was implemented in version 22.74.1 of xdvik, and 22.61 of plain xdvi. +Argument IS-XDVIK controls whether we're running xdvik or plain xdvi." (if is-xdvik - ; xdvik got -nofork in version 22.74.1 (>= version 22074001) (>= version 22061000))) -(defun get-source-filename (fname version flag) +(defun get-source-filename (fname flag) + "Helper function to extract the file name from the file name FNAME. +FLAG controls whether to use the full path or a relative path." (if (> flag 1) (if (> flag 2) ;;; full path name, for use with TeX patch and when using the ;;; full path in \input or \include with srcltx.sty: - (expand-file-name (buffer-file-name)) + (expand-file-name fname) ;;; relative path name: if current path and path of master file match partly, ;;; use the rest of this path; else use buffer name. This can treat both the ;;; cases when a relative path is used in \input{}, or when just the filename ;;; is used and the file is located in the current directory (suggested by ;;; frisk@isy.liu.se). (if (string-match (concat "^" (regexp-quote (file-name-directory master-file))) - (buffer-file-name)) - (substring (buffer-file-name) (match-end 0)) - (buffer-file-name))) + fname) + (substring fname (match-end 0)) + fname)) ;;; buffer file name without path: - (file-name-nondirectory (buffer-file-name)))) + (file-name-nondirectory fname))) (defun xdvi-get-version-number (default) - "Return a tuple of (version-number xdvi-is-xdvik), or (default nil) if default != 0." + "Return a tuple of (version-number xdvi-is-xdvik), or (DEFAULT nil) if DEFAULT != 0." (if (not (= default 0)) (list default nil) (save-window-excursion @@ -274,7 +325,7 @@ or `xdvi-jump-to-line-fullpath' (for 3) instead. (call-process xdvi-bin nil "*xdvi-version*" nil "-version") (goto-char (point-min)) (if (not (re-search-forward "xdvi\\((?k)?\\)? version \\([0-9]+\\)\\.\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" nil t)) - (error "Unable to get xdvi version number - please check value of `xdvi-bin', or set it manually via `xdvi-version-number'.") + (error "Unable to get xdvi version number - please check value of `xdvi-bin', or set it manually via `xdvi-version-number'") (let* ((major (string-to-int (buffer-substring (match-beginning 2) (match-end 2)))) (minor (string-to-int (buffer-substring (match-beginning 3) (match-end 3)))) (patchlevel (if (match-beginning 5) @@ -288,6 +339,7 @@ or `xdvi-jump-to-line-fullpath' (for 3) instead. ))))) (defun xdvi-process-sentinel (process signal) + "Return a readable error message for subprocess PROCESS which has terminated with SIGNAL." (let ((retmsg (substring signal 0 -1))) (if (string-match "abnormally" retmsg) (progn @@ -297,7 +349,7 @@ or `xdvi-jump-to-line-fullpath' (for 3) instead. (defun xdvi-get-masterfile (file) "Small helper function for AucTeX compatibility. -Converts the special value t that TeX-master might be set to +Converts the special value t that TeX-master might be set to (Argument FILE) into a real file name." (if (eq file t) (buffer-file-name) diff --git a/Build/source/texk/xdvik/xdvi-sh.in b/Build/source/texk/xdvik/xdvi-sh.in old mode 100755 new mode 100644 index 6f77a666bc9..f9a2d8299fa --- a/Build/source/texk/xdvik/xdvi-sh.in +++ b/Build/source/texk/xdvik/xdvi-sh.in @@ -17,15 +17,22 @@ test -f /bin/bsh && test -z "$RUNNING_BSH" \ && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; } RUNNING_BSH= -# -help and -version only work if they are the only options. Therefore, -# we cannot give the "-name xdvi" parameter in that case. -# SU: Actually, with current xdvik, they should work in any position; but -# we may keep this for compatibility with older versions and non-k xdvi. +# -help and -version only used to work if they were the only options, +# so the "-name xdvi" parameter wasn't used in that case. With current +# xdvik, it should work in any case, but we keep this logic for compatibility +# with older xdvik and plain xdvi versions. +have_basename=`basename foo/bar 2>&1 | grep -i 'not found'` +if [ "$have_basename"xxx = "xxx" ]; then + BASE_NAME=`basename $0` +else + BASE_NAME=`echo $0 | sed 's!.*/!!'` +fi + case "$#:$1" in 1:-help|1:-version) NAMEOPT=;; *) - NAMEOPT='-name xdvi';; + NAMEOPT="-name $BASE_NAME";; esac xdviappfile=`kpsewhich -progname=xdvi --format='other text files' XDvi` diff --git a/Build/source/texk/xdvik/xdvi.1.in b/Build/source/texk/xdvik/xdvi.1.in index cfa223f9579..75411f74f7c 100644 --- a/Build/source/texk/xdvik/xdvi.1.in +++ b/Build/source/texk/xdvik/xdvi.1.in @@ -68,21 +68,19 @@ xdvi \- DVI Previewer for the X Window System [\fB\-allowshell\fP] #endif [\fB\-altfont\fP \fIfont\fP] -[\fB\-base\fP \fIbase URL\fP] -.\" [\fB\-bd\fP \fIcolor\fP] [\fB\-bg\fP \fIcolor\fP] [\fB\-browser\fP \fIWWWbrowser\fP] -[\fB\-bw\fP \fIwidth\fP] -[\fB\-bw\fP \fIwidth\fP] [\fB\-copy\fP] [\fB\-cr\fP \fIcolor\fP] [\fB\-debug\fP \fIbitmask\fP|\fIstring[,string ...]\fP] [\fB\-display\fP \fIhost:display\fP] [\fB\-dvipspath\fP \fIpath\fP] [\fB\-editor\fP \fIcommand\fP] +[\fB\-expert\fP] [\fB\-expertmode\fP \fIflag\fP] [\fB\-fg\fP \fIcolor\fP] [\fB\-findstring\fP \fIstring\fP] +[\fB\-text-encoding\fP \fIencoding\fP] [\fB\-font\fP \fIfont\fP] [\fB\-fullscreen \fP] #ifgrey @@ -98,12 +96,13 @@ xdvi \- DVI Previewer for the X Window System [\fB\-h\fP] [\fB\-help\fP] [\fB\-hl\fP \fIcolor\fP] -[\fB\-href\fP \fIanchor\fP] +[\fB\-anchorposition\fP \fIanchor\fP] [\fB\-hush\fP] [\fB\-hushchars\fP] [\fB\-hushchecksums\fP] -[\fB\-hushspecials\fP] +[\fB\-warnpecials\fP] [\fB\-hushstdout\fP] +[\fB\-hushbell\fP] [\fB\-icongeometry\fP \fIgeometry\fP] [\fB\-iconic\fP] #ifgrey @@ -114,6 +113,7 @@ xdvi \- DVI Previewer for the X Window System #endif [\fB\-keep\fP] [\fB\-l\fP] +[\fB\-license\fP] [\fB\-linkcolor\fP \fIcolor\fP] [\fB\-linkstyle\fP \fI0|1|2|3\fP] [\fB\-margins\fP \fIdimen\fP] @@ -328,26 +328,10 @@ file cannot be found. This is useful, for example, with PostScript fonts. Determines the color of the background. Same as .BR -bg . .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.\" .TP -.\" .BI \-bd " color" -.\" .RB ( .borderColor ) -.\" Determines the color of the window border. -.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP .BI \-bg " color" .RB ( .background ) Determines the color of the background. -.\" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.\" .TP -.\" .BI \-bordercolor " color" -.\" Same as -.\" .BR -bd . -.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.TP -.BI \-borderwidth " width" -.RB ( .borderWidth ) -Specifies the width of the border of the window. Same as -.BR -bw . .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP .BI \-browser " browser" @@ -365,12 +349,7 @@ and .B WWWBROWSER (in that order) are used to determine the browser command. If these are not set either, the following default value is used: -.SB netscape -raise -remote "openURL(%s,new-window)":xterm -e lynx %s:xterm -e wget %s -.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -.TP -.BI \-bw " width" -.RB ( .borderWidth ) -Specifies the width of the border of the window. +\fBxdg-open %s:htmlview %s:firefox -remote -remote "openURL(%s,new-window)":mozilla -remote "openURL(%s,new-window)":netscape -raise -remote "openURL(%s,new-window)":xterm -e w3m %s:xterm -e lynx %s:xterm -e wget %s\fP .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #ifgrey .TP @@ -620,6 +599,14 @@ option is used. Determines the color of the text (foreground). .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP +.BI \-text-encoding " encoding" +.RB ( .textEncoding ) +Use +.I encoding +as text encoding of the string in the "Find" window. Usually, +this shouldn't be needed since the encoding is determined from the locale settings. +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP .B \-findstring\fP \fIstring\fP This option triggers a search for .I string @@ -746,7 +733,7 @@ and of the highlighting markers in forward search and string search. The default is the foreground color. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.BI \-href " anchor" +.BI \-anchorposition " anchor" Jump to .I anchor after opening the DVI file. This is only useful when invoking @@ -779,13 +766,13 @@ file and the font file. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #ifkpathsea .TP -.B \-hushspecials -.RB ( .hushSpecials ) +.B \-warnspecials +.RB ( .warnSpecials ) Causes .B xdvi -to suppress warnings about +to print warnings about .B \especial -strings that it cannot process. +strings that it cannot process to stderr. These warnings are suppressed by default. #endif .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP @@ -798,6 +785,11 @@ Note that errors or warnings will still be printed to even if this option is used. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP +.B \-hushbell +.RB ( .hushBell ) +Don't sound the X bell when an error occurs. +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP .BI \-icongeometry " geometry" .RB ( .iconGeometry ) Specifies the initial position for the icon. @@ -859,14 +851,12 @@ Sets a flag to indicate that .B xdvi should not move to the home position when moving to a new page. See also the .RB ` k ' -keystroke. This flag is only honoured by the -.B up() -and -.B down() -actions, not by -.B up-or-previous() -and -.BR down-or-next() . +keystroke. This flag is honored by all page switching actions and by +.B up-or-previous() / +.BR down-or-next() , +although the latter only honor the horizontal postion, not the vertical one. +This allows for a "continuous" scrolling back an forth through a document with +a display window narrower than a page width. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP .B \-l @@ -874,6 +864,10 @@ and List the names of all fonts used. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP +.B \-license +Prints licensing information. +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP .BI \-linkcolor .RB ( .linkColor ) Color used for unvisited hyperlinks (`Blue2' by default). Hyperlinks @@ -1667,7 +1661,7 @@ currently ignored. .BI \-useTeXpages Use logical \*(Te\& pages (the values of the .I \ecount0 -register) instead of physical pages for the pagelist tables and +register) instead of physical pages for the pagelist labels and when jumping to a page in a document with the `g' keystroke (or the .B goto-page() action). @@ -1720,7 +1714,10 @@ until the DVI file can be read entirely. .BI \-wheelunit " pixels" .RB ( .wheelUnit ) Sets the number of pixels that a motion of a wheel mouse will move the -image up or down. If set to zero, the wheel mouse functionality is disabled. +image up or down. (See the +.B wheel +action, below, for more information on this.) +If set to zero, the wheel mouse functionality is disabled. The default value is 80. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP @@ -1773,17 +1770,30 @@ The escape key discards the numerical prefix for all actions (useful when you mistyped a number). .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP +.BR Return " key" +.RB [ forward-page() ] +Moves to the next page (or to the +.IR n th +next page if a number is given). Synonyms are +.RB ` n ', +.RB ` f ' +and Line Feed. +.TP +.BR Backspace " key" +.RB [ back-pagee() ] +Moves to the previous page (or back +.I n +pages). Synonyms are +.RB ` p ', +.RB ` b ' +and +.BR Ctrl-h . +.TP .BR Delete " key" .RB [ up-or-previous() ] -Moves down two-thirds of a window-full, or to the top of the previous page -if already at the bottom of the page. With a float argument, moves down the -corresponding fraction of a window-full. By default, the -.I Space -key is bound to the action -.B unpause-or-next() -which does a similar thing; see there. -.br -The `keep' flag is ignored by these actions. +Moves up two-thirds of a window-full, or to the top of the previous page +if already at the top of the page. With a float argument, moves up the +corresponding fraction of a window-full. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP .BR Space " key" @@ -1798,7 +1808,10 @@ display the next portion of the page until the next .I special-string or the end of the page is encountered. See the description of the .B \-pause -option for details. +option for details. The action +.RB [ down-or-next() ] +does a similar thing, but without pausing; it is not bound to a key +by default. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP .BR Ctrl-Home " (Xaw), " Ctrl-osfBeginLine " (Motif)" @@ -1964,9 +1977,10 @@ for more information on navigating the links. Moves to the previous page (or back .I n pages). Synonyms are -.RB ` p ' +.RB ` p ', +.B Ctrl-h and -.BR Ctrl-h . +.BR Backspace . .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #ifcolor .TP @@ -1989,6 +2003,15 @@ Moves the page so that the point currently beneath the mouse cursor is moved to the middle of the window, and warps the mouse cursor to the same place. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP +.B D +.RB [ toggle-grid-mode() ] +This key toggles the use of a grid on the displayed page. +If no number is given, the grid mode is switched on or off. +By prepending a number from 1 to 3, 3 different grid levels can be set. +The units of the grid are inches or centimeters, depending +on whether the paper format is letter (in) or a4 (cm). +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP .B d .RB [ down() ] Moves page down two thirds of a window-full. With a float argument to ``down'', @@ -2201,9 +2224,10 @@ the default behaviour. Moves to the previous page (or back .I n pages). Synonyms are -.RB ` b ' +.RB ` b ', +.B Ctrl-h and -.BR Ctrl-h . +.BR Backspace . .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP .B q @@ -2407,13 +2431,44 @@ See also the option .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH MOUSE ACTIONS IN THE MAIN WINDOW -.TP -.B Mouse-1 -.RB [ do-href()magnifier(*1) ] +The mouse actions can be customized by setting the X resource +.BR mouseTranslations . +Since there are three different mouse modes (see the section +.B MODES +below), there is a special action +.B mouse-modes +which lists the actions for each of the three modes: +\fBmouse-modes("ACTIONS-FOR-MODE1", "ACTIONS-FOR-MODE2", "ACTIONS-FOR-MODE3")\fR. +If only one argument is specified, this action is used for all modes. +The default bindings are as follows: +.RS 5 +.nf +.ft 3 +.sp 1n +xdvi.mouseTranslations: \e +Shift:mouse-modes("drag(+)")\en\e +Shift:mouse-modes("drag(|)")\en\e +Shift:mouse-modes("drag(-)")\en\e +Ctrl:mouse-modes("source-special()")\en\e +: mouse-modes("do-href()magnifier(*2)", "text-selection()", "ruler()")\en\e +: mouse-modes("do-href-newwindow()magnifier(*2)", "text-selection()", "ruler()")\en\e +: mouse-modes("magnifier(*3)")\en\e +: mouse-modes("wheel(-0.2)")\en\e +: mouse-modes("wheel(0.2)")\en\e +.sp 1n +.ft +.fi +.RE +All of these actions are described in more detail below. +Note the use of quote symbols around the action strings, which are neccessary +to group them into one argument. +The buttons 4 and 5 refer to wheel movements (wheel up/down) on wheel mice. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.B Mouse-2 -.RB [ do-href-newwindow()magnifier(*2) ] +.B do-href() +.TP +.B do-href-newwindow() +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Usually, if a binding specifies more then one action, all actions are executed in a sequence. The hyperlink bindings .B do-href() @@ -2424,10 +2479,8 @@ are special in that they are used as an to other actions that might follow them .I if the mouse is currently located on a hyperlink. -In this case, none of the other actions will be executed. -Otherwise, -.I only -the other actions are executed. +In this case, none of the other actions will be executed; +otherwise, only the other actions are executed. .br The action .B do-href() @@ -2439,21 +2492,17 @@ In both cases, the location of the target is indicated by a small arrow drawn in the same color as a visited link in the left corner of the window. +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.B Mouse-3 -.RB [ magnifier(*3) ] -The actions -.B magnifier(n) -will pop up a ``magnifying glass'' which shows the unshrunk +.B magnifier(n x m) +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP +.B magnifier(*n) +This action will pop up a ``magnifying glass'' which shows the unshrunk image of the region around the mouse pointer. The magnifier disappears when the mouse button is released. Moving the mouse cursor while holding the button down will move the magnifier. .br -In \fB`Ruler Mode'\fR, the first button moves or sets a ruler cross instead; -see the section -.BR MODES , -below, for details. -.br Different mouse buttons produce different sized windows, as indicated by the the argument of the @@ -2468,48 +2517,65 @@ through .BR *5 , referring to the value specified by the corresponding .BI \-mgs n -option. Note that in order to assign magnifier actions to -the buttons 4 or 5, you need to use the resource -.B wheelTranslations -(more about this resource below), e.g.: -.sp -xdvi.wheelTranslations: : magnifier(*4)\en\e - : magnifier(*5)\en -.sp +option. +.\" Note that in order to assign magnifier actions to +.\" the buttons 4 or 5, you need to use the resource +.\" .B wheelTranslations +.\" (more about this resource below), e.g.: +.\" .sp +.\" xdvi.wheelTranslations: : magnifier(*4)\en\e +.\" : magnifier(*5)\en +.\" .sp .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.B Shift-Mouse-1 -.RB [ drag(+) ] +.B drag(+) .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.B Shift-Mouse-2 -.RB [ drag(|) ] +.B drag(|) .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.B Shift-Mouse-3 -.RB [ drag(-) ] -Drags the page with the mouse. Shift-Mouse 1 allows dragging in all directions, -Shift-Mouse 2 allows vertical dragging only, and Shift-Mouse 3 allows -horizontal dragging only. To access these actions via customization, use the -.B drag -action. This action should have one parameter, the character +.B drag(-) +Drags the page with the mouse. This action should have one parameter, the character .RB `` | '', .RB `` - '', or .RB `` + '', -indicating vertical dragging, horizontal dragging, or dragging in both +indicating vertical dragging only, horizontal dragging only, or dragging in all directions. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.B Ctrl-Mouse-1 -.RB [ source-special() ] -Holding down the -.I Ctrl -key and clicking mouse button 1 starts a ``reverse search'', +.B source-special() +This action starts a ``reverse search'', opening the editor at the location in the \*(Te\& file corresponding to the pointer location in the DVI file. See the section on SOURCE SPECIALS, below, for more information on this. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP +.B wheel() +This action can be used to scroll the image with a wheel mouse, where it +is usually bound to mouse button 4 (wheel up) or 5 (wheel down). +The action takes one parameter, giving the distance to scroll the +image. If the parameter contains a decimal point, the distance is +given in wheel units; otherwise, pixels. A negative value scrolls up, +a positive value scrolls down. +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP +.B text-selection() +This action allows you to mark a rectangular region of text in the DVI file. +The text is put into the X selection buffer and can be pasted into other +applictions (e.g. text editors). This works similar to the Plain text option +in the +.B Save +dialog; see the discussion there for more information on encoding issues. +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP +.B ruler() +This action creates a cross-shaped ruler. Moving the mouse and holding +the button down drags the ruler and lets you measure distances on the page. +See the section +.B Ruler Mode +for more information on this. +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH UNBOUND ACTIONS The following actions are not bound to a key by default, but are available @@ -2611,19 +2677,14 @@ keys should come first, for example: .ft 3 .sp 1n xdvi.mainTranslations: #override \e -Ctrl: magnifier(*3)\en\e -Shift: magnifier(*2)\en\e -: magnifier(*1)\en +Shifts: select-dvi-file()\en\e +Ctrls: save()\en\e +s: find()\en .sp 1n .ft .fi .RE .PP -Note: The additional `Modes' for Mouse-1 (Ruler Mode, Text Mode - see -the section -.BR MODES ) -only work if Mouse-1 has the magnifier() action bound to it. -.PP Because .B xdvi needs to capture pointer motion events, and because the X Toolkit @@ -2648,123 +2709,6 @@ will cause the key to quit .BR xdvi . .PP -Support of wheel mice is controlled by the -.B wheelTranslations -resource. Generally the only action routine called by this resource should be -.BR wheel . -The default value is -``\fB:wheel(-1.)\en:wheel(1.)\fR''. -Because this resource is implemented differently from the others, it should -not begin with -.RB ``#override ''; -when specifying a value for this resource, all wheel actions should be -included. -.\" #ifxaw -.\" NOTE: following is different with Motif, and will change for Xaw too ... -.\" removed for the time being. -.\" -.\" .PP -.\" The menu entries and actions may also be customized, in a similar manner. -.\" In this case the resource -.\" .B menuTranslations -.\" should consist of a string describing the pulldown menu names, submenu entries -.\" and the associated actions. Currently, only one level of submenus is provided for. -.\" The description consists of lines (substrings separated by the newline character -.\" `\fB\\n\fP'), -.\" where each line describes one menu entry. Each line consists of a colon-separated -.\" list containing the following elements: -.\" .RS 2 -.\" .TP 2 -.\" - -.\" the name of the menu; -.\" .TP -.\" - -.\" the name of the submenu; -.\" .TP -.\" - -.\" an accelerator for the action (the accelerator is currently not displayed in the menu, but it might be in future versions); -.\" .TP -.\" - -.\" one of the actions mentioned in the sections on KEYSTROKES above. -.\" .RE -.\" .PP -.\" Instead of a submenu and an action, an entry may also contain the string -.\" .RB `` SEP '' ; -.\" in this case, a separator line is inserted after the preceding menu entry. -.\" .PP -.\" The default value of this resource is as follows: -.\" .RS 5 -.\" .nf -.\" .ft 3 -.\" .sp 1n -.\" xdvi.menuTranslations: \e -.\" File:Open ...:Ctrl-o:select-dvi-file()\en\e -.\" File:Find ...:Ctrl-f:find()\en\e -.\" File:Reload:R:reread-dvi-file()\en\e -.\" File:Print ...:Ctrl-p:print()\en\e -.\" File:Save as ...::save()\en\e -.\" File:Quit:q:quit()\en\e -.\" Navigate:First:1 g:goto-page(1)\en\e -.\" Navigate:Page-10:10 p:back-page(10)\en\e -.\" Navigate:Page-5:5 p:back-page(10)\en\e -.\" Navigate:Prev:p:back-page(1)\en\e -.\" Navigate:SEP:\en\e -.\" Navigate:Next:n:forward-page(1)\en\e -.\" Navigate:Page+5:5 n:forward-page(5)\en\e -.\" Navigate:Page+10:10 n:forward-page(10)\en\e -.\" Navigate:Last:g:goto-page()\en\e -.\" Navigate:SEP:\en\e -.\" Navigate:Back Hyperlink:B:htex-back()\en\e -.\" Mark:Mark all:-1 m:toggle-mark(-1)\en\e -.\" Mark:Unmark all:0 m:toggle-mark(0)\en\e -.\" Mark:SEP:\en\e -.\" Mark:Toggle odd:1 m:toggle-mark(1)\en\e -.\" Mark:Toggle even:2 m:toggle-mark(2)\en\e -.\" Mark:Toggle current:m:toggle-mark()\en\e -.\" Zoom:Zoom in:Ctrl-+:set-shrink-factor(+)\en\e -.\" Zoom:Zoom out:Ctrl--:set-shrink-factor(-)\en\e -.\" Zoom:SEP:\en\e -.\" Zoom:Fit in window:s:set-shrink-factor(a)\en\e -.\" Zoom:SEP:\en\e -.\" Zoom:$#:1 s:set-shrink-factor(1)\en\e -.\" Zoom:$#:2 s:set-shrink-factor(2)\en\e -.\" Zoom:$#:3 s:set-shrink-factor(3)\en\e -.\" Zoom:$#:4 s:set-shrink-factor(4)\en\e -.\" Zoom:$#:5 s:set-shrink-factor(5)\en\e -.\" Zoom:$#:6 s:set-shrink-factor(6)\en\e -.\" Zoom:$#:7 s:set-shrink-factor(7)\en\e -.\" Zoom:$#:8 s:set-shrink-factor(8)\en\e -.\" Zoom:$#:9 s:set-shrink-factor(9)\en\e -.\" Options:View PS:1 v:set-ps(1)\en\e -.\" Options:View PS + bbox:2 v:set-ps(2)\en\e -.\" Options:No PS, bbox only:0 v:set-ps(0)\en\e -.\" Options:SEP:\en\e -.\" Options:Keep position:k:set-keep-flag(toggle)\en\e -.\" Options:SEP:\en\e -.\" Options:Fonts darker:Alt-Ctrl-+:change-density(25)\en\e -.\" Options:Fonts lighter:Alt-Ctrl--:change-density(-25)\en\e -.\" Help:About ...::help(helpGeneral)\en\e -.\" Help:Page Motion ...::help(helpPagemotion)\en\e -.\" Help:Other Commands ...::help(helpOthercommands)\en\e -.\" Help:Mouse Buttons ...::help(helpMousebuttons)\en\e -.\" Help:HyperTeX commands ...::help(helpHypertex)\en\e -.\" Help:Source specials ...::help(helpSourcespecials)\en -.\" .sp 1n -.\" .ft -.\" .fi -.\" .RE -.\" .PP -.\" The label string may contain a colon if it is escaped by a backslash -.\" (`\fB\\\fP'). (Note: Since the internal handling of menus requires -.\" every menu label to be unique, xdvi's special strings for customizing -.\" shrink factors in the buttons -- -.\" .RB ` $# ', -.\" .RB ` $% ' -.\" and -.\" .RB ' $_ ' -.\" -- are not supported by xdvik). -.\" endif -.PP Some resources are provided to allow customization of the geometry of the Xaw command buttons. Again, they are not changeable via command-line options, other than via the @@ -2823,15 +2767,6 @@ Button 3 moves the image down or left by the same amount. The scrollbars can be removed via the .I -expertmode flag/keystroke (which see). -.PP -Wheel mice are supported: motion of the wheel on such a mouse moves the -image up or down by the number of pixels indicated by the -.B \-wheelunit -option. To access this option via customization, use the -.B wheel -action. This action takes one parameter, giving the distance to scroll -the image. If the parameter contains a decimal point, the distance is given -in wheel units; otherwise, pixels. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH MAGNIFIER @@ -3271,16 +3206,13 @@ to convert the DVI file to a Postscript file, then uses to convert the Postscript file to PDF). .TP - -Plain text in ISO-8859-1 or UTF-8 encoding (the latter will preserve more -of the special LaTeX characters e.g. from mathematical mode). +Plain text in ISO-8859-1 or UTF-8 encoding. The latter will preserve more +of the special LaTeX characters e.g. from mathematical mode. Note however +that e.g. only few of LaTeX's mathematical symbols can be rendered correctly +as text; so this funcionality works best for plain text documents. If a character cannot be displayed in the selected charset, it is replaced by `\e' followed by the hexadecimal character code. If a character is not recognized at all, it is replaced by `?'. -If you think that xdvi should recognize a character but doesn't, -please send a feature request to the address given in -.B AUTHORS -below. Likewise, if you observe spurious spaces or unwanted linebreaks in -the output, please report this as a bug. .RE .PP The programs for Postscript and PDF conversion can be customized via @@ -3295,8 +3227,7 @@ respectively; see the explanation of these options above for more details. The keystroke .B Ctrl-m [\fBswitch-mode()\fR] -switches between three different bindings for -.BR Mouse-1 , +switches between three different mouse bindings, which can also be activated via the .B Modes menu (in Motif, this is a submenu of the @@ -4220,7 +4151,7 @@ macros; this is not likely to change in the near future. This also means that e.g. colored tables (as created by the .I colortbl package) may render incorrectly: Text in colors different from the -default foreground color may not not be displayed. When the page is +default foreground color may not be displayed. When the page is redrawn (e.g. after using the magnifier), the background color of the cells may overdraw the text. #endif diff --git a/Build/source/texk/xdvik/xdvi.c b/Build/source/texk/xdvik/xdvi.c index 3a73f678394..e1dcaaa0e4b 100644 --- a/Build/source/texk/xdvik/xdvi.c +++ b/Build/source/texk/xdvik/xdvi.c @@ -74,8 +74,6 @@ NOTE: xdvi is based on prior work as noted in the modification history, below. #include "xdvi.h" #include "version.h" -#include - /* Xlib and Xutil are already included */ #include #include @@ -152,14 +150,12 @@ XmStringCharSet G_charset = XmFONTLIST_DEFAULT_TAG; #include "kpathsea/c-fopen.h" #include "kpathsea/c-pathch.h" #include "kpathsea/c-stat.h" -#include "kpathsea/proginit.h" #include "kpathsea/progname.h" #include "kpathsea/tex-file.h" #include "kpathsea/tex-hush.h" #include "kpathsea/tex-make.h" #include "string-utils.h" #include "kpathsea/c-errno.h" -#include "kpathsea/expand.h" #include "translations.h" #include "dvi-init.h" @@ -173,30 +169,21 @@ XmStringCharSet G_charset = XmFONTLIST_DEFAULT_TAG; #include "dvi-draw.h" #include "statusline.h" #include "util.h" -#include "my-snprintf.h" #include "hypertex.h" #include "xaw_menu.h" #include "xdvi-debug.h" #include "pagehist.h" #include "filehist.h" -#include "sfSelFile.h" #include "print-internal.h" +#include "exit-handlers.h" #include "xm_prefsP.h" /* for Xdvi_PREFS_BROWSER_DEFAULTS and Xdvi_PREFS_EDITOR_DEFAULTS */ -#include "pixmaps/time16.xbm" -#include "pixmaps/time16_mask.xbm" #ifdef VMS # include "pixmaps/hand.xbm" # include "pixmaps/hand_mask.xbm" #endif #include "pixmaps/magglass.xbm" #include "pixmaps/magglass_mask.xbm" -#include "pixmaps/drag_vert.xbm" -#include "pixmaps/drag_vert_mask.xbm" -#include "pixmaps/drag_horiz.xbm" -#include "pixmaps/drag_horiz_mask.xbm" -#include "pixmaps/drag_omni.xbm" -#include "pixmaps/drag_omni_mask.xbm" #ifdef DEBUG #include @@ -317,17 +304,6 @@ Boolean ignore_papersize_specials = False; # define GS_PATH "gs" #endif -#if A4 -# define DEFAULT_PAPER "a4" -#else -# define DEFAULT_PAPER "us" -#endif - -/* - * Main application context, used for Xt event processing. - */ -XtAppContext app = NULL; - static Dimension bwidth = 2; struct x_resources resource; @@ -337,193 +313,12 @@ struct program_globals globals; /* color of cursor */ static XColor m_cursor_color; -/* default magnifier dimensions */ -static struct mg_size_rec { - int w; - int h; -} mg_size[] = { - {200, 150}, {400, 250}, {700, 500}, {1000, 800}, {1200, 1200} -}; - -size_t get_magglass_items(void) { - return XtNumber(mg_size); -} - -int get_magglass_width(int idx) { - return mg_size[idx].w; -} - -int get_magglass_height(int idx) { - return mg_size[idx].h; -} struct WindowRec mane = { (Window) 0, 1, 0, 0, 0, 0, MAXDIM, 0, MAXDIM, 0 }; /* currwin is temporary storage except for within redraw() */ struct WindowRec currwin = { (Window) 0, 1, 0, 0, 0, 0, MAXDIM, 0, MAXDIM, 0 }; -/* - * Data for options processing. - */ -static const char SILENT[] = " "; /* flag value for usage() */ - -static const char SUBST[] = "x"; /* another flag value */ - -static const char USAGESTR_END_MARKER[] = "__USAGE_END_MARKER__"; /* end marker */ - -static const char *SUBST_VAL[] = { "-mgs[n] " }; - -static XrmOptionDescRec options[] = { - {"-q", ".noInitFile", XrmoptionNoArg, (XPointer)"on" }, - {"+q", ".noInitFile", XrmoptionNoArg, (XPointer)"off" }, - {"-geometry", ".geometry", XrmoptionSepArg, (XPointer)NULL }, -#ifdef MOTIF - /* to make `-font' and `-fn' options work, make them an alias for `fontList' */ - { "-font", "*fontList", XrmoptionSepArg, (XPointer)NULL }, - { "-fn", "*fontList", XrmoptionSepArg, (XPointer)NULL }, -#endif - {"-s", ".shrinkFactor", XrmoptionSepArg, (XPointer)NULL }, -#ifndef VMS - {"-S", ".densityPercent", XrmoptionSepArg, (XPointer)NULL }, -#endif - {"-density", ".densityPercent", XrmoptionSepArg, (XPointer)NULL }, - {"-noomega", ".omega", XrmoptionNoArg, (XPointer)"off" }, - {"+noomega", ".omega", XrmoptionNoArg, (XPointer)"on" }, -#if COLOR - {"-nocolor", ".color", XrmoptionNoArg, (XPointer)"off" }, - {"+nocolor", ".color", XrmoptionNoArg, (XPointer)"on" }, -#endif -#ifdef GREY - {"-nogrey", ".grey", XrmoptionNoArg, (XPointer)"off" }, - {"+nogrey", ".grey", XrmoptionNoArg, (XPointer)"on" }, - {"-gamma", ".gamma", XrmoptionSepArg, (XPointer)NULL }, - {"-nomatchinverted",".matchInverted", XrmoptionNoArg, (XPointer)"off" }, - {"+nomatchinverted",".matchInverted", XrmoptionNoArg, (XPointer)"on" }, -/* {"-invertedfactor", ".invertedFactor", XrmoptionSepArg, (XPointer)NULL }, */ - {"-install", ".install", XrmoptionNoArg, (XPointer)"on" }, - {"-noinstall", ".install", XrmoptionNoArg, (XPointer)"off" }, -#endif - {"-rulecolor", ".ruleColor", XrmoptionSepArg, (XPointer)NULL }, - {"-p", ".pixelsPerInch", XrmoptionSepArg, (XPointer)NULL }, - {"-margins", ".Margin", XrmoptionSepArg, (XPointer)NULL }, - {"-sidemargin", ".sideMargin", XrmoptionSepArg, (XPointer)NULL }, - {"-topmargin", ".topMargin", XrmoptionSepArg, (XPointer)NULL }, - {"-offsets", ".Offset", XrmoptionSepArg, (XPointer)NULL }, - {"-xoffset", ".xOffset", XrmoptionSepArg, (XPointer)NULL }, - {"-yoffset", ".yOffset", XrmoptionSepArg, (XPointer)NULL }, - {"-paper", ".paper", XrmoptionSepArg, (XPointer)NULL }, - {"-altfont", ".altFont", XrmoptionSepArg, (XPointer)NULL }, -#ifdef MKTEXPK - {"-nomakepk", ".makePk", XrmoptionNoArg, (XPointer)"off" }, - {"+nomakepk", ".makePk", XrmoptionNoArg, (XPointer)"on" }, -#endif - {"-mfmode", ".mfMode", XrmoptionSepArg, (XPointer)NULL }, - {"-editor", ".editor", XrmoptionSepArg, (XPointer)NULL }, -#ifdef T1LIB - {"-not1lib", ".t1lib", XrmoptionNoArg, (XPointer)"off" }, - {"+not1lib", ".t1lib", XrmoptionNoArg, (XPointer)"on" }, -#endif - {"-sourceposition", ".sourcePosition", XrmoptionSepArg, (XPointer)NULL }, - {"-findstring", ".findString", XrmoptionSepArg, (XPointer)NULL }, - {"-text-encoding", ".textEncoding", XrmoptionSepArg, (XPointer)NULL }, - {"-unique", ".unique", XrmoptionNoArg, (XPointer)"on" }, - {"+unique", ".unique", XrmoptionNoArg, (XPointer)"off" }, - {"-nofork", ".fork", XrmoptionNoArg, (XPointer)"off" }, - {"+nofork", ".fork", XrmoptionNoArg, (XPointer)"on" }, -#ifdef RGB_ANTI_ALIASING - {"-subpixels", ".subPixels", XrmoptionSepArg, (XPointer)NULL }, -#endif - {"-l", ".listFonts", XrmoptionNoArg, (XPointer)"on" }, - {"+l", ".listFonts", XrmoptionNoArg, (XPointer)"off" }, - {"-watchfile", ".watchFile", XrmoptionSepArg, (XPointer)NULL }, - {"-expertmode", ".expertMode", XrmoptionSepArg, (XPointer)NULL }, - {"-expert", ".expert", XrmoptionNoArg, (XPointer)"on" }, - {"+expert", ".expert", XrmoptionNoArg, (XPointer)"off" }, - {"+statusline", ".statusline", XrmoptionNoArg, (XPointer)"off" }, - {"-statusline", ".statusline", XrmoptionNoArg, (XPointer)"on" }, - {"+useTeXpages", ".useTeXPages", XrmoptionNoArg, (XPointer)"off" }, - {"-useTeXpages", ".useTeXPages", XrmoptionNoArg, (XPointer)"on" }, - {"-mgs", ".magnifierSize1", XrmoptionSepArg, (XPointer)NULL }, - {"-mgs1", ".magnifierSize1", XrmoptionSepArg, (XPointer)NULL }, - {"-mgs2", ".magnifierSize2", XrmoptionSepArg, (XPointer)NULL }, - {"-mgs3", ".magnifierSize3", XrmoptionSepArg, (XPointer)NULL }, - {"-mgs4", ".magnifierSize4", XrmoptionSepArg, (XPointer)NULL }, - {"-mgs5", ".magnifierSize5", XrmoptionSepArg, (XPointer)NULL }, - {"-warnspecials", ".warnSpecials", XrmoptionNoArg, (XPointer)"on" }, - {"+warnspecials", ".warnSpecials", XrmoptionNoArg, (XPointer)"off" }, - {"-hush", ".Hush", XrmoptionNoArg, (XPointer)"on" }, - {"+hush", ".Hush", XrmoptionNoArg, (XPointer)"off" }, - {"-hushchars", ".hushLostChars", XrmoptionNoArg, (XPointer)"on" }, - {"+hushchars", ".hushLostChars", XrmoptionNoArg, (XPointer)"off" }, - {"-hushchecksums", ".hushChecksums", XrmoptionNoArg, (XPointer)"on" }, - {"+hushchecksums", ".hushChecksums", XrmoptionNoArg, (XPointer)"off" }, - {"-hushstdout", ".hushStdout", XrmoptionNoArg, (XPointer)"on" }, - {"+hushstdout", ".hushStdout", XrmoptionNoArg, (XPointer)"off" }, - {"-safer", ".safer", XrmoptionNoArg, (XPointer)"on" }, - {"+safer", ".safer", XrmoptionNoArg, (XPointer)"off" }, - {"-fg", ".foreground", XrmoptionSepArg, (XPointer)NULL }, - {"-foreground", ".foreground", XrmoptionSepArg, (XPointer)NULL }, - {"-bg", ".background", XrmoptionSepArg, (XPointer)NULL }, - {"-background", ".background", XrmoptionSepArg, (XPointer)NULL }, - {"-hl", ".highlight", XrmoptionSepArg, (XPointer)NULL }, - {"-cr", ".cursorColor", XrmoptionSepArg, (XPointer)NULL }, - {"-icongeometry", ".iconGeometry", XrmoptionSepArg, (XPointer)NULL }, - {"-keep", ".keepPosition", XrmoptionNoArg, (XPointer)"on" }, - {"+keep", ".keepPosition", XrmoptionNoArg, (XPointer)"off" }, - {"-copy", ".copy", XrmoptionNoArg, (XPointer)"on" }, - {"+copy", ".copy", XrmoptionNoArg, (XPointer)"off" }, - {"-thorough", ".thorough", XrmoptionNoArg, (XPointer)"on" }, - {"+thorough", ".thorough", XrmoptionNoArg, (XPointer)"off" }, - {"-fullscreen", ".fullscreen", XrmoptionNoArg, (XPointer)"on" }, - {"+fullscreen", ".fullscreen", XrmoptionNoArg, (XPointer)"off" }, - {"-pause", ".pause", XrmoptionNoArg, (XPointer)"on" }, - {"+pause", ".pause", XrmoptionNoArg, (XPointer)"off" }, - {"-pausespecial", ".pauseSpecial", XrmoptionSepArg, (XPointer)NULL }, - {"-wheelunit", ".wheelUnit", XrmoptionSepArg, (XPointer)NULL }, - {"-mousemode", ".mouseMode", XrmoptionSepArg, (XPointer)NULL }, -#ifdef PS - {"-postscript", ".postscript", XrmoptionSepArg, (XPointer)NULL }, - {"-allowshell", ".allowShell", XrmoptionNoArg, (XPointer)"on" }, - {"+allowshell", ".allowShell", XrmoptionNoArg, (XPointer)"off" }, -# ifdef PS_DPS - {"-nodps", ".dps", XrmoptionNoArg, (XPointer)"off" }, - {"+nodps", ".dps", XrmoptionNoArg, (XPointer)"on" }, -# endif -# ifdef PS_NEWS - {"-nonews", ".news", XrmoptionNoArg, (XPointer)"off" }, - {"+nonews", ".news", XrmoptionNoArg, (XPointer)"on" }, -# endif -# ifdef PS_GS - {"-noghostscript", ".ghostscript", XrmoptionNoArg, (XPointer)"off" }, - {"+noghostscript", ".ghostscript", XrmoptionNoArg, (XPointer)"on" }, - {"-nogssafer", ".gsSafer", XrmoptionNoArg, (XPointer)"off" }, - {"+nogssafer", ".gsSafer", XrmoptionNoArg, (XPointer)"on" }, - {"-gsalpha", ".gsAlpha", XrmoptionNoArg, (XPointer)"on" }, - {"+gsalpha", ".gsAlpha", XrmoptionNoArg, (XPointer)"off" }, - {"-interpreter", ".interpreter", XrmoptionSepArg, (XPointer)NULL }, - {"-gspalette", ".palette", XrmoptionSepArg, (XPointer)NULL }, -# endif -# ifdef MAGICK - {"-magick", ".ImageMagick", XrmoptionNoArg, (XPointer)"on" }, - {"+magick", ".ImageMagick", XrmoptionNoArg, (XPointer)"off" }, - {"-magick_cache", ".MagickCache", XrmoptionSepArg, (XPointer)NULL }, -# endif -#endif /* PS */ - {"-noscan", ".prescan", XrmoptionNoArg, (XPointer)"off" }, - {"+noscan", ".prescan", XrmoptionNoArg, (XPointer)"on" }, - {"-notempfile", ".tempFile", XrmoptionNoArg, (XPointer)"off" }, - {"+notempfile", ".tempFile", XrmoptionNoArg, (XPointer)"on" }, - {"-dvipspath", ".dvipsPath", XrmoptionSepArg, (XPointer)NULL }, - {"-ps2pdfpath", ".ps2pdfPath", XrmoptionSepArg, (XPointer)NULL }, - {"-debug", ".debugLevel", XrmoptionSepArg, (XPointer)NULL }, - {"-linkstyle", ".linkStyle", XrmoptionSepArg, (XPointer)NULL }, - {"-linkcolor", ".linkColor", XrmoptionSepArg, (XPointer)NULL }, - {"-visitedlinkcolor",".visitedLinkColor", XrmoptionSepArg, (XPointer)NULL }, - {"-browser", ".wwwBrowser", XrmoptionSepArg, (XPointer)NULL }, - {"-anchorposition", ".anchorPosition", XrmoptionSepArg, (XPointer)NULL }, -}; - - #define offset(field) XtOffsetOf(struct x_resources, field) static int base_tick_length = 4; @@ -554,24 +349,42 @@ static XtResource application_resources[] = { offset(omega), XtRString, "true"}, {"mainTranslations", "MainTranslations", XtRString, sizeof(char *), offset(main_translations), XtRString, (XtPointer) NULL}, - {"wheelTranslations", "WheelTranslations", XtRString, sizeof(char *), - offset(wheel_translations), XtRString, (XtPointer) ":wheel(-0.2)\n:wheel(0.2)"}, + {"mouseTranslations", "MouseTranslations", XtRString, sizeof(char *), + offset(mouse_translations), XtRString, (XtPointer) NULL }, {"wheelUnit", "WheelUnit", XtRInt, sizeof(int), offset(wheel_unit), XtRImmediate, (XtPointer) 80}, {"mouseMode", "MouseMode", XtRInt, sizeof(int), - offset(mouse_mode), XtRImmediate, (XtPointer)MOUSE_MAGNIFIER_MODE}, + offset(mouse_mode), XtRImmediate, (XtPointer) MOUSE_MODE1 }, + {"mouseMode1Name", "MouseMode1Name", XtRString, sizeof(char *), + offset(mouse_mode1_name), XtRString, (XtPointer) "Magnifier"}, + {"mouseMode1Description", "MouseMode1Description", XtRString, sizeof(char *), + offset(mouse_mode1_description), XtRString, (XtPointer) "click to enlarge text"}, + {"mouseMode1Cursor", "MouseMode1Cursor", XtRInt, sizeof(int), + offset(mouse_mode1_cursor), XtRImmediate, (XtPointer) -1}, + {"mouseMode2Name", "MouseMode2Name", XtRString, sizeof(char *), + offset(mouse_mode2_name), XtRString, (XtPointer) "Text Selection"}, + {"mouseMode2Description", "MouseMode2Description", XtRString, sizeof(char *), + offset(mouse_mode2_description), XtRString, (XtPointer) "click and drag to select a region of text"}, + {"mouseMode2Cursor", "MouseMode2Cursor", XtRInt, sizeof(int), + offset(mouse_mode2_cursor), XtRImmediate, (XtPointer) XC_cross }, + {"mouseMode3Name", "MouseMode3Name", XtRString, sizeof(char *), + offset(mouse_mode3_name), XtRString, (XtPointer) "Ruler"}, + {"mouseMode3Description", "MouseMode3Description", XtRString, sizeof(char *), + offset(mouse_mode3_description), XtRString, (XtPointer) "click and drag to set/move ruler"}, + {"mouseMode3Cursor", "MouseMode3Cursor", XtRInt, sizeof(int), + offset(mouse_mode3_cursor), XtRImmediate, (XtPointer) XC_crosshair }, #ifdef GREY {"gamma", "Gamma", XtRFloat, sizeof(float), offset(gamma), XtRString, "1"}, -/* {"invertedFactor", "InvertedFactor", XtRFloat, sizeof(float), */ -/* offset(inverted_factor), XtRString, "3.0"}, */ + /* {"invertedFactor", "InvertedFactor", XtRFloat, sizeof(float), */ + /* offset(inverted_factor), XtRString, "3.0"}, */ #endif {"pixelsPerInch", "PixelsPerInch", XtRInt, sizeof(int), offset(pixels_per_inch), XtRImmediate, (XtPointer) BDPI}, {"sideMargin", "Margin", XtRString, sizeof(char *), offset(sidemargin), XtRString, (XtPointer) NULL}, {"tickLength", "TickLength", XtRInt, sizeof(int), - offset(tick_length), XtRInt, (XtPointer) & base_tick_length}, + offset(tick_length), XtRInt, (XtPointer) &base_tick_length}, {"tickUnits", "TickUnits", XtRString, sizeof(char *), offset(tick_units), XtRString, "mm"}, {"topMargin", "Margin", XtRString, sizeof(char *), @@ -595,7 +408,7 @@ static XtResource application_resources[] = { #else "false" #endif - }, + }, {"mfMode", "MfMode", XtRString, sizeof(char *), offset(mfmode), XtRString, MFMODE}, {"editor", "Editor", XtRString, sizeof(char *), @@ -630,12 +443,16 @@ static XtResource application_resources[] = { offset(reverse), XtRString, "false"}, {"warnSpecials", "WarnSpecials", XtRBoolean, sizeof(Boolean), offset(warn_spec), XtRString, "false"}, - {"hushLostChars", "Hush", XtRBoolean, sizeof(Boolean), + {"hush", "Hush", XtRBoolean, sizeof(Boolean), + offset(hush), XtRString, "false"}, + {"hushLostChars", "HushLostChars", XtRBoolean, sizeof(Boolean), offset(hush_chars), XtRString, "false"}, - {"hushChecksums", "Hush", XtRBoolean, sizeof(Boolean), + {"hushChecksums", "HushChecksums", XtRBoolean, sizeof(Boolean), offset(hush_chk), XtRString, "false"}, {"hushStdout", "HushStdout", XtRBoolean, sizeof(Boolean), offset(hush_stdout), XtRString, "false"}, + {"hushBell", "HushBell", XtRBoolean, sizeof(Boolean), + offset(hush_bell), XtRString, "false"}, {"safer", "Safer", XtRBoolean, sizeof(Boolean), offset(safer), XtRString, "false"}, #ifdef VMS @@ -713,9 +530,9 @@ static XtResource application_resources[] = { offset(btn_top_spacing), XtRImmediate, (XtPointer) 16}, {"buttonBetweenSpacing", "ButtonSpacing", XtRDimension, sizeof(Dimension), offset(btn_between_spacing), XtRImmediate, (XtPointer) 8}, - /* ignored; only for backwards compatibility */ + /* only used if menus consist of buttons only */ {"buttonBetweenExtra", "ButtonSpacing", XtRDimension, sizeof(Dimension), - offset(btn_between_extra), XtRImmediate, (XtPointer)0}, + offset(btn_between_extra), XtRImmediate, (XtPointer)16}, {"buttonBorderWidth", "BorderWidth", XtRDimension, sizeof(Dimension), offset(btn_border_width), XtRImmediate, (XtPointer) 1}, #endif /* MOTIF */ @@ -799,6 +616,12 @@ static XtResource application_resources[] = { offset(prefs_browser_list), XtRString, (XtPointer)Xdvi_PREFS_BROWSER_DEFAULTS }, {"prefsEditorList", "PrefsEditorList", XtRString, sizeof(char *), offset(prefs_editor_list), XtRString, (XtPointer)Xdvi_PREFS_EDITOR_DEFAULTS }, +# if USE_COMBOBOX + {"searchHistory", "SearchHistory", XtRString, sizeof(char *), + offset(search_history), XtRString, (XtPointer)NULL }, + {"searchHistorySize", "SearchHistorySize", XtRInt, sizeof(int), + offset(search_history_size), XtRImmediate, (XtPointer)20}, +# endif #endif /* defaults for unknown mime types */ {"unknownMimeSuffix", "UnknownMimeSuffix", XtRString, sizeof(char *), @@ -810,6 +633,9 @@ static XtResource application_resources[] = { /* bitmask for current search window settings; only used internally! */ {"searchWindowDefaults", "SearchWindowDefaults", XtRInt, sizeof(int), offset(search_window_defaults), XtRImmediate, (XtPointer)0}, + /* whether to open file in new window from file selector (only for DVI files) */ + {"fileselOpenNewWindow", "FileselOpenNewWindow", XtRBoolean, sizeof(Boolean), + offset(filesel_open_new_window), XtRString, "False"}, /* resources for help text */ {"helpGeneral", "HelpGeneral", XtRString, sizeof(char *), offset(help_general), XtRString, NULL}, @@ -834,20 +660,14 @@ static XtResource application_resources[] = { offset(page_history_size), XtRImmediate, (XtPointer)1000}, }; -/* get these before setting `application_resources' */ -static XtResource xdvirc_resources[] = { - {"noInitFile", "NoInitFile", XtRBoolean, sizeof(Boolean), - offset(no_init_file), XtRString, "false"}, -}; - static XtResource app_pixel_resources[] = { /* get these later */ #endif /* GREY */ {"foreground", "Foreground", XtRPixel, sizeof(Pixel), offset(fore_Pixel), XtRString, XtDefaultForeground}, {"background", "Background", XtRPixel, sizeof(Pixel), offset(back_Pixel), XtRString, XtDefaultBackground}, -/* {"borderColor", "BorderColor", XtRPixel, sizeof(Pixel), */ -/* offset(brdr_Pixel), XtRPixel, (XtPointer) &resource.fore_Pixel}, */ + /* {"borderColor", "BorderColor", XtRPixel, sizeof(Pixel), */ + /* offset(brdr_Pixel), XtRPixel, (XtPointer) &resource.fore_Pixel}, */ {"highlight", "Highlight", XtRPixel, sizeof(Pixel), offset(hl_Pixel), XtRPixel, (XtPointer) &resource.fore_Pixel}, {"cursorColor", "CursorColor", XtRPixel, sizeof(Pixel), @@ -855,90 +675,6 @@ static XtResource app_pixel_resources[] = { /* get these later */ }; #undef offset -/* Here, list usage values for options that have `XrmoptionSepArg' set. - TODO: what does the `^' stand for? - */ -static const char *usagestr[] = { - /* geometry */ SILENT, -#ifdef MOTIF - /* font */ SILENT, - /* f */ SILENT, -#endif - /* shrinkFactor */ "shrink", -#ifndef VMS - /* S */ "density", - /* density */ SILENT, -#else - /* density */ "density", -#endif -#ifdef GREY - /* gamma */ "float", -#endif - /* rulecolor */ "color", - /* p */ "pixels", - /* margins */ "dimen", - /* sidemargin */ "dimen", - /* topmargin */ "dimen", - /* offsets */ "dimen", - /* xoffset */ "dimen", - /* yoffset */ "dimen", - /* paper */ "papertype", - /* altfont */ "font", - /* mfmode */ "mode-def", - /* editor */ "editor", - /* sourceposition */ "linenumber[ ]*filename", - /* findstring */ "string", - /* textencoding */ "charset", -#ifdef RGB_ANTI_ALIASING - /* subpixels */ "{rgb,bgr}[ i1 i2 i3]", -#endif - /* rv */ "^-l", "-rv", - /* watchfile */ "secs", - /* expertmode */ "flag", - /* mgs */ SUBST, - /* mgs1 */ SILENT, - /* mgs2 */ SILENT, - /* mgs3 */ SILENT, - /* mgs4 */ SILENT, - /* mgs5 */ SILENT, - /* fg */ "color", - /* foreground */ SILENT, - /* bg */ "color", - /* background */ SILENT, - /* hl */ "color", - /* cr */ "color", -#ifndef VMS - /* display */ "^-cr", "-display ", -#else - /* display */ "^-cr", "-display ", -#endif - /* geometry */ "^-cr", "-geometry ", - /* icongeometry */ "geometry", - /* iconic */ "^-icongeometry", "-iconic", - /* font */ "^-icongeometry", "-font ", - /* pausespecial */ "string", - /* wheelunit */ "pixels", - /* mousemode */ "0|1|2", -#ifdef PS - /* postscript */ "0|1|2", -# ifdef PS_GS - /* interpreter */ "path", - /* gspalette */ "monochrome|grayscale|color", -# endif -# ifdef MAGICK - /* magick_cache */ "size[k|K|m|M|g|G]", -# endif -#endif - /* dvipspath */ "path", - /* ps2pdfpath */ "path", - /* debug */ "bitmask|string[,string ...]", - /* linkstyle */ "0|1|2|3", - /* linkcolor */ "color", - /* visitedlinkcolor */ "color", - /* browser */ "WWWbrowser", - /* anchorposition */ "anchor", - /* [end marker] */ USAGESTR_END_MARKER -}; #ifndef MOTIF @@ -955,7 +691,7 @@ QueryGeometry(Widget w, UNUSED(constraints); reply->request_mode = CWWidth | CWHeight; reply->width = globals.page.w; - reply->height = globals.page.h + global_statusline_h; + reply->height = globals.page.h; return XtGeometryAlmost; } @@ -966,39 +702,39 @@ QueryGeometry(Widget w, /* if the following gives you trouble, just compile with -DNOQUERY */ static WidgetClassRec drawingWidgetClass = { { - /* superclass */ &widgetClassRec, - /* class_name */ "Draw", - /* widget_size */ sizeof(WidgetRec), - /* class_initialize */ NULL, - /* class_part_initialize */ NULL, - /* class_inited */ FALSE, - /* initialize */ NULL, - /* initialize_hook */ NULL, - /* realize */ XtInheritRealize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ NULL, - /* num_resources */ 0, - /* xrm_class */ NULLQUARK, - /* compress_motion */ FALSE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ FALSE, - /* visible_interest */ FALSE, - /* destroy */ NULL, - /* resize */ XtInheritResize, - /* expose */ XtInheritExpose, - /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ XtInheritAcceptFocus, - /* version */ XtVersion, - /* callback_offsets */ NULL, - /* tm_table */ XtInheritTranslations, - /* query_geometry */ QueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - } + /* superclass */ &widgetClassRec, + /* class_name */ "Draw", + /* widget_size */ sizeof(WidgetRec), + /* class_initialize */ NULL, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ NULL, + /* num_resources */ 0, + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ FALSE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ XtInheritResize, + /* expose */ XtInheritExpose, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ XtInheritAcceptFocus, + /* version */ XtVersion, + /* callback_offsets */ NULL, + /* tm_table */ XtInheritTranslations, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + } }; # define drawWidgetClass &drawingWidgetClass @@ -1006,101 +742,6 @@ static WidgetClassRec drawingWidgetClass = { # endif /* NOQUERY */ #endif /* not MOTIF */ -static int -compare_strings(const void *s, const void *t) -{ - const char **ss = (const char**)s; - const char **tt = (const char**)t; - - return memicmp(*ss, *tt, strlen(*tt) + 1); /* also check for final 0 */ -} - -static void -usage(int exitval) -{ - XrmOptionDescRec *opt; - const char **usageptr = usagestr; - const char **sv = SUBST_VAL; - const char *str1; - const char *str2; - const char *sorted_options[XtNumber(options)]; - char buf[256]; - char *s; - int col, n; - size_t nopt = 0, k; - - for (opt = options; opt < options + XtNumber(options); ++opt) { - str1 = opt->option; - if (*str1 != '-') - continue; - - ASSERT(*usageptr != USAGESTR_END_MARKER, "Too few elements in usageptr[]"); - - str2 = NULL; - if (opt->argKind != XrmoptionNoArg) { - str2 = *usageptr++; - if (str2 == SILENT) - continue; - if (str2 == SUBST) { - str1 = *sv++; - str2 = NULL; - } - } -#if 0 - fprintf(stderr, "str1: %s, str2: %s\n", str1, str2); -#endif - for (;;) { - if (str2 == NULL) - sprintf(buf, "[%.80s]", str1); - else - sprintf(buf, "[%.80s <%.80s>]", str1, str2); - -/* fprintf(stderr, "number of options: %d; len of usagestr: %d\n", */ -/* XtNumber(options), XtNumber(usagestr)); */ - ASSERT(nopt < XtNumber(options), "index out of range"); -/* fprintf(stderr, "sorted: %d=%s\n", nopt, buf); */ - sorted_options[nopt++] = xstrdup(buf); - - if (**usageptr != '^' || strcmp(*usageptr + 1, opt->option) != 0) - break; - ++usageptr; - str1 = *usageptr++; - str2 = NULL; - } - } - - ASSERT(*usageptr == USAGESTR_END_MARKER, "Too many elements in usageptr[]"); - -/* fprintf(stderr, "elems in sorted options: %d\n", nopt); */ - qsort((void*)sorted_options, - nopt, - sizeof(sorted_options[0]), - compare_strings); - - s = xstrdup("Usage: "); - s = xstrcat(s, XDVI_PROGNAME); /* use `xdvi' here, not `xdvik' or `xdvi-xaw.bin' or ... */ - s = xstrcat(s, " [+[]]"); - - col = strlen(s); - fputs(s, stdout); - - for (k = 0; k < nopt; ++k) { - n = strlen(sorted_options[k]); - if (col + n < 80) - putc(' ', stdout); - else { - fputs("\n\t", stdout); - col = 8 - 1; - } - fputs(sorted_options[k], stdout); - col += n + 1; - } - - /* put this in an extra line, to emphasize that it must come last */ - fputs("\n\t[dvi_file]\n", stdout); - - xdvi_exit(exitval); -} int atopix(const char *arg, Boolean allow_minus) @@ -1190,31 +831,6 @@ check_app_defaults_fileversion(void) #endif -static void -warn_about_prerelease_versions(void) -{ - int unstable_version = 0; - if (strstr(XDVI_VERSION_INFO, "-cvs") != NULL) - unstable_version = 1; - else if (strstr(XDVI_VERSION_INFO, "-beta") != NULL) - unstable_version = 2; - - if (unstable_version > 0) { - printf("\n**********************************************************************\n"); - printf("%s version %s,\n%s version.\n\n", XDVIK_PROGNAME, XDVI_VERSION_INFO, - unstable_version == 1 ? "an unstable development" : "a beta testing"); - printf("Want a stable version instead?\n" - " -> please visit one of:\n" - " http://xdvi.sourceforge.net/cvs-upgrade.html\n" - " http://sourceforge.net/project/showfiles.php?group_id=23164\n\n" - "Found a bug?\n" - " -> please report it to:\n" - " http://sourceforge.net/tracker/?group_id=23164&atid=377580\n\n" - "Thanks for your support!\n"); - printf("**********************************************************************\n"); - } -} - #ifdef GREY static Arg temp_args1[] = { @@ -1251,55 +867,6 @@ XdviCvtStringToPixel(Display *dpy, return XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret); } -/* - * Convert string to yes/no/maybe. Adapted from the X toolkit. - */ - -static Boolean -XdviCvtStringToBool3(Display *dpy, - XrmValuePtr args, Cardinal *num_args, - XrmValuePtr fromVal, XrmValuePtr toVal, - XtPointer *closure_ret) -{ - String str = (String) fromVal->addr; - static Bool3 value; - - UNUSED(args); - UNUSED(num_args); - UNUSED(closure_ret); - - if (memicmp(str, "true", 5) == 0 - || memicmp(str, "yes", 4) == 0 - || memicmp(str, "on", 3) == 0 || memicmp(str, "1", 2) == 0) - value = True; - - else if (memicmp(str, "false", 6) == 0 - || memicmp(str, "no", 3) == 0 - || memicmp(str, "off", 4) == 0 || memicmp(str, "0", 2) == 0) - value = False; - - else if (memicmp(str, "maybe", 6) == 0) - value = Maybe; - - else { - XtDisplayStringConversionWarning(dpy, str, XtRBoolean); - return False; - } - - if (toVal->addr != NULL) { - if (toVal->size < sizeof(Bool3)) { - toVal->size = sizeof(Bool3); - return False; - } - *(Bool3 *) (toVal->addr) = value; - } - else - toVal->addr = (XPointer) & value; - - toVal->size = sizeof(Bool3); - return True; -} - #endif @@ -1547,75 +1114,27 @@ set_icon_and_title(const char *icon_name, const char *title_name) (Pixmap) 0, NULL, 0, NULL); } -static void -display_version_info(void) -{ - printf("%s version %s ", XDVIK_PROGNAME, XDVI_VERSION); -#ifdef MOTIF - printf("(%s, runtime version %d.%d)\n", - /* XmVERSION, XmREVISION, XmUPDATE_LEVEL, */ - XmVERSION_STRING, - xmUseVersion / 1000, xmUseVersion % 1000); -#else - printf("%s\n", XDVI_GUI); -#endif - printf("Libraries: %s, T1lib version %s\n", kpathsea_version_string, T1LIB_VERSIONSTRING); -} - -static void -display_bug_reporting_info(void) -{ - printf("Please send bug reports, feature requests etc. to one of:\n" - " http://sourceforge.net/tracker/?group_id=23164&atid=377580\n" - " tex-k@tug.org (http://tug.org/mailman/listinfo/tex-k)\n\n" - "\n"); -} - -static void -display_licensing_info(void) -{ - fputs("Licenses: X Consortium license, GNU Library General Public\n" - "License, GNU General Public License (use option `-license'\n" - "for more details). There is NO WARRANTY of anything.\n\n", stdout); -} - -static void -display_long_licensing_info(void) -{ - fputs("The major parts of Xdvik are licensed under the X Consortium license.\n" - "Parts (encoding.c) are licensed under the GNU General Public License.\n" - "Xdvik uses the following libraries:\n" - "- The kpathsea library, licensed in part under the GNU General Public\n" - " License, in part under the GNU Library General Public License.\n" - "- t1lib, licensed in parts under the GNU Library General Public License,\n" - " in parts under the X Consortium license.\n" - "There is NO WARRANTY of anything.\n\n", stdout); -} - static void get_window_constraints(XtWidgetGeometry *reply, Dimension screen_w, Dimension screen_h, - int add_h) + int *add_h) { XtWidgetGeometry constraints; constraints.request_mode = reply->request_mode = 0; - /* fprintf(stderr, "setting constraints.width to %d\n", globals.page.w); */ + /* fprintf(stderr, "setting constraints.width to %d\n", globals.page.w); */ constraints.width = globals.page.w; if (globals.page.w > screen_w) { - /* fprintf(stderr, "setting CWWidth constraint\n"); */ constraints.request_mode |= CWWidth; constraints.width = screen_w; } - /* fprintf(stderr, "setting constraints.height to %d\n", globals.page.h + global_statusline_h); */ - constraints.height = globals.page.h + global_statusline_h; +/* fprintf(stderr, "setting constraints.height to %d; screen_h = %d\n", globals.page.h, screen_h); */ + constraints.height = globals.page.h; if (constraints.height > screen_h) { - /* fprintf(stderr, "setting CWHeight constraint\n"); */ constraints.request_mode |= CWHeight; - /* if window too large, need to subtract height of toolbar etc. again */ - constraints.height = screen_h - add_h; + constraints.height = screen_h; } if (constraints.request_mode != 0 @@ -1626,16 +1145,24 @@ get_window_constraints(XtWidgetGeometry *reply, (void)XtQueryGeometry(globals.widgets.vport_widget, &constraints, reply); #endif } +/* fprintf(stderr, "reply height: %d; screen_h: %d; add_h: %d\n", reply->height, screen_h, *add_h); */ if (!(reply->request_mode & CWWidth)) reply->width = constraints.width; if (reply->width >= screen_w) reply->width = screen_w; - if (!(reply->request_mode & CWHeight)) - reply->height = constraints.height; - if (reply->height >= screen_h) - reply->height = screen_h; - /* fprintf(stderr, "width now: %d\n", reply.width); */ + if (!(reply->request_mode & CWHeight)) { + reply->height = constraints.height - 2 * bwidth; + } + if (reply->height + *add_h >= screen_h) { + reply->height = screen_h +#ifdef MOTIF + - 1.5 +#else + - 2 +#endif + * *add_h - 2 * bwidth; + } } void @@ -1657,10 +1184,10 @@ set_windowsize(Dimension *ret_w, Dimension *ret_h, int add_w, int add_h, Boolean currwin.shrinkfactor = ROUNDUP(globals.page.unshrunk_w, w); if (height_factor >= currwin.shrinkfactor) currwin.shrinkfactor = height_factor; -/* fprintf(stderr, "factor was 0, using %d\n", currwin.shrinkfactor); */ + /* fprintf(stderr, "factor was 0, using %d\n", currwin.shrinkfactor); */ } -/* else */ -/* fprintf(stderr, "factor != 0, using %d\n", currwin.shrinkfactor); */ + /* else */ + /* fprintf(stderr, "factor != 0, using %d\n", currwin.shrinkfactor); */ mane.shrinkfactor = currwin.shrinkfactor; init_page(); @@ -1689,7 +1216,8 @@ set_windowsize(Dimension *ret_w, Dimension *ret_h, int add_w, int add_h, Boolean screen_w = WidthOfScreen(SCRN) - 2 * bwidth; screen_w -= add_w; - screen_h = HeightOfScreen(SCRN) - 2 * bwidth - global_statusline_h - 6; + /* screen_h = HeightOfScreen(SCRN) - 2 * bwidth - get_statusline_height() - 6; */ + screen_h = HeightOfScreen(SCRN) - 2 * bwidth; for (;;) { /* actually, at most two passes */ Dimension height_factor; @@ -1700,7 +1228,9 @@ set_windowsize(Dimension *ret_w, Dimension *ret_h, int add_w, int add_h, Boolean if (resource.geometry == NULL && !resource.remember_windowsize) { /* geometry not set by user, try to find geometry that fits the shrink factor */ - get_window_constraints(&reply, screen_w, screen_h, add_h); + get_window_constraints(&reply, screen_w, screen_h, &add_h); + TRACE_GUI((stderr, "w: %d, h: %d, add_h: %d, reply: %d x %d", + screen_w, screen_h, add_h, reply.width, reply.height)); } else { int x, y; @@ -1715,14 +1245,14 @@ set_windowsize(Dimension *ret_w, Dimension *ret_h, int add_w, int add_h, Boolean if (!(flags & WidthValue) || !(flags & HeightValue)) { /* no geometry specified, use fallback */ - get_window_constraints(&reply, screen_w, screen_h, add_h); + get_window_constraints(&reply, screen_w, screen_h, &add_h); } /* warn about bad values */ if (flags & WidthValue) { if (width > (unsigned int)(2 * bwidth + add_w)) { - TRACE_FILES((stderr, "width: %hu, bwidth: %hu, add_w: %d", - width, bwidth, add_w)); + TRACE_GUI((stderr, "width: %hu, bwidth: %hu, add_w: %d", + width, bwidth, add_w)); reply.width = width - 2 * bwidth - add_w; } else { @@ -1731,38 +1261,38 @@ set_windowsize(Dimension *ret_w, Dimension *ret_h, int add_w, int add_h, Boolean } if (flags & HeightValue) { if (height > (unsigned int)(2 * bwidth + add_h)) { - TRACE_FILES((stderr, "height: %hu, bwidth: %hu, add_h: %d", - height, bwidth, add_h)); + TRACE_GUI((stderr, "height: %hu, bwidth: %hu, add_h: %d", + height, bwidth, add_h)); reply.height = height - 2 * bwidth - add_h; } else { reply.height = height; } } - TRACE_FILES((stderr, "setting geometry: %dx%d", (int)reply.width, (int)reply.height)); + TRACE_GUI((stderr, "setting geometry: %dx%d", (int)reply.width, (int)reply.height)); } /* now reply.{width,height} contain max. usable window size */ /* User didn't use `-s 0', use either default or other user-specified value */ if (currwin.shrinkfactor != 0) { -/* fprintf(stderr, "factor != 0, using %d\n", currwin.shrinkfactor); */ + /* fprintf(stderr, "factor != 0, using %d\n", currwin.shrinkfactor); */ break; } -/* else { */ -/* fprintf(stderr, "factor was 0, using %d\n", currwin.shrinkfactor); */ -/* } */ + /* else { */ + /* fprintf(stderr, "factor was 0, using %d\n", currwin.shrinkfactor); */ + /* } */ /* else, try to find a suitable shrink factor: */ currwin.shrinkfactor = ROUNDUP(globals.page.unshrunk_w, reply.width - 2); -/* fprintf(stderr, "factor w: %d\n", currwin.shrinkfactor); */ + /* fprintf(stderr, "factor w: %d\n", currwin.shrinkfactor); */ height_factor = ROUNDUP(globals.page.unshrunk_h, reply.height - 2); -/* fprintf(stderr, "factor h: %d\n", height_factor); */ + /* fprintf(stderr, "factor h: %d\n", height_factor); */ if (height_factor >= currwin.shrinkfactor) currwin.shrinkfactor = height_factor; -/* fprintf(stderr, "factor now is: %d\n", currwin.shrinkfactor); */ + /* fprintf(stderr, "factor now is: %d\n", currwin.shrinkfactor); */ mane.shrinkfactor = currwin.shrinkfactor; init_page(); @@ -1785,18 +1315,18 @@ set_windowsize(Dimension *ret_w, Dimension *ret_h, int add_w, int add_h, Boolean */ /* HACK ALERT: 4 for window decoration borders - FIXME: get actual values?? */ set_wh_args[0].value = reply.width + add_w + (test_geometry == NULL ? 4 : 0); - set_wh_args[1].value = reply.height + add_h - (test_geometry == NULL ? 4 : 0); + set_wh_args[1].value = reply.height + add_h + (test_geometry == NULL ? 4 : 0); XtSetValues(globals.widgets.top_level, set_wh_args, XtNumber(set_wh_args)); #else /* MOTIF */ - set_wh_args[0].value = reply.width + add_w + (test_geometry == NULL ? 15 : (2 * bwidth)); + set_wh_args[0].value = reply.width + add_w + 2 * bwidth; /* + (test_geometry == NULL ? 15 : (2 * bwidth)); */ /* FIXME: use real height of statusline here Somehow I didn't manage to use XtVaCreateWidget in a call to create_statusline() above, and XtManageChild() below. - In that case, we could do without global_statusline_h. - */ + In that case, we could do without get_statusline_height(). + */ set_wh_args[1].value = reply.height + (test_geometry == NULL ? (2 * bwidth + add_h) : 0); XtSetValues(globals.widgets.top_level, set_wh_args, XtNumber(set_wh_args)); set_wh_args[0].value -= add_w; @@ -1805,7 +1335,7 @@ set_windowsize(Dimension *ret_w, Dimension *ret_h, int add_w, int add_h, Boolean #endif /* MOTIF */ *ret_w = set_wh_args[0].value; *ret_h = set_wh_args[1].value; - TRACE_FILES((stderr, "returning: w=%d, h=%d", *ret_w, *ret_h)); + TRACE_GUI((stderr, "returning: w=%d, h=%d", *ret_w, *ret_h)); } } @@ -1818,7 +1348,7 @@ net_wm_toggle_fullscreen(int flag) XEvent ev; Atom NET_WM_STATE = XInternAtom(DISP, "_NET_WM_STATE", False); -/* XDVI_INFO((stdout, "trying _NET_WM_STATE_FULLSCREEN ...")); */ + /* XDVI_INFO((stdout, "trying _NET_WM_STATE_FULLSCREEN ...")); */ ev.type = ClientMessage; ev.xclient.serial = 0; @@ -1841,7 +1371,7 @@ net_wm_toggle_fullscreen(int flag) void reconfigure_window(Boolean fullscreen, Dimension width, Dimension height, - Boolean save_position) + Boolean save_position) { static int x_old = 5, y_old = 15; #ifdef SIZECONFIGURE_WORKS @@ -1888,7 +1418,7 @@ reconfigure_window(Boolean fullscreen, Dimension width, Dimension height, already mapped). */ if (save_position) { - /* save current window coordinates so that we can change them back */ + /* save current window coordinates so that we can change them back */ (void)XTranslateCoordinates(DISP, XtWindow(globals.widgets.top_level), RootWindowOfScreen(SCRN), 0, 0, @@ -1901,9 +1431,9 @@ reconfigure_window(Boolean fullscreen, Dimension width, Dimension height, XMoveWindow(DISP, XtWindow(globals.widgets.top_level), 0, 0); XSync(DISP, False); (void)XTranslateCoordinates(DISP, XtWindow(globals.widgets.top_level), - RootWindowOfScreen(SCRN), - 0, 0, &wm_x_offset, &wm_y_offset, - &dummy); + RootWindowOfScreen(SCRN), + 0, 0, &wm_x_offset, &wm_y_offset, + &dummy); fprintf(stderr, "wm offset = (%d,%d)\n", wm_x_offset, wm_y_offset); } @@ -1975,15 +1505,15 @@ reconfigure_window(Boolean fullscreen, Dimension width, Dimension height, #endif /* Note ZLB: Placing XResizeWindow before XUnmapWindow or after XMapWindow - makes the fullscreen window size smaller than the screen size when - using `mwm' of Lesstif */ + makes the fullscreen window size smaller than the screen size when + using `mwm' of Lesstif */ XSetWindowBorderWidth(DISP, XtWindow(globals.widgets.top_level), 0); XResizeWindow(DISP, XtWindow(globals.widgets.top_level), width, height); XMapRaised(DISP, XtWindow(globals.widgets.top_level)); /* Note ZLB: XMapWindow might change the window position with some WMs - (like Sawfish), so we place the window position after it's mapped. */ + (like Sawfish), so we place the window position after it's mapped. */ XMoveWindow(DISP, XtWindow(globals.widgets.top_level), x, y); #endif /* 0 */ @@ -1992,91 +1522,11 @@ reconfigure_window(Boolean fullscreen, Dimension width, Dimension height, XFlush(DISP); } -/* - a custom error handler that makes it easier to catch X errors in the debugger - (by setting a breakpoint to this function, plus using the -sync option). - There was an X error reported by Svend Tollak Munkejord when running remotly - on OSF1/V5.1 alpha with display on SuSE 9.1, after selecting some text with the - mouse and releasing the mouse button, which I couldn't track down: - - X Error of failed request: BadValue (integer parameter out of range for operation) - Major opcode of failed request: 18 (X_ChangeProperty) - Value in failed request: 0x40 - Serial number of failed request: 518 - Current serial number in output stream: 519 - - From the trace: - - signal IOT/Abort trap at >*[__kill, 0x3ff800e8908] beq a3, 0x3ff800e8920 - (dbx) where - > 0 __kill(0x0, 0x5, 0x3ff00000000, 0x11fffb188, 0x3ff801a9c14) [0x3ff800e8908] - 1 (unknown)() [0x3ff801ee108] - 2 __tis_raise(0x3ff801a9c14, 0x11fffb620, 0x3ff801229d8, 0x3ff00000006, 0x3ff801869b4) [0x3ff801229d4] - 3 raise(0x3ff801229d8, 0x3ff00000006, 0x3ff801869b4, 0x0, 0x3ff801a9c44) [0x3ff801869b0] - 4 abort(0x12006f858, 0x406f28ae75776627, 0x0, 0x0, 0x100000000) [0x3ff801a9c40] - 5 do_abort() ["util.c":442, 0x12006f854] - 6 x_error_handler(display = 0x140088800, error = 0x11fffb620) ["xdvi.c":1972, 0x1200764c8] - 7 (unknown)() [0x3ff8086caf0] - 8 _XError(0x11fffb758, 0x0, 0x36c, 0x24, 0x20) [0x3ff8044f7f0] - 9 _XReply(0x0, 0x3, 0x0, 0x11fffba40, 0x100000000) [0x3ff8044cec8] - 10 XSync(0x14019ea40, 0x40036b0200, 0x19170b000120000, 0x12, 0x43197900000000) [0x3ff80444910] - 11 _XSyncFunction(0x19170b000120000, 0x12, 0x43197900000000, 0x0, 0x3ff80408994) [0x3ff804449f0] - 12 XChangeProperty(0x3ff8086c9c0, 0x0, 0x2c, 0xb6, 0x4) [0x3ff80408990] - 13 (unknown)() [0x3ff8086d2d0] - 14 (unknown)() [0x3ff8086d654] - 15 XtDispatchEventToWidget(0x3ff80852834, 0x11fffbde8, 0x3ff80852974, 0x11fffbde8, 0x0) [0x3ff80852060] - 16 (unknown)() [0x3ff80852990] - 17 XtDispatchEvent(0x801, 0x4, 0x11fffc018, 0x0, 0x100000000) [0x3ff80852fb0] - 18 read_events(ret_mask = 131070) ["events.c":5048, 0x120046fa4] - 19 do_pages() ["events.c":5290, 0x120047e58] - 20 run_dvi_file(filename = 0x14005f370 = "/auto/home/vsl175/a/svendm/latex/a.dvi", data = 0x14005f778) - ["xdvi.c":3852, 0x12007a5e8] - 21 main(argc = 2, argv = 0x11fffc018) ["xdvi.c":4231, 0x12007b780] - - Since it seemed to work regardless of this error, I decided to enable the custom - error handler by default, at least until we've figured this problem out. -*/ -static int -x_error_handler(Display *display, XErrorEvent *error) -{ - char buf[1024], req_buf[1024]; - - if (error->request_code < 128) { - char num[LENGTH_OF_INT]; - sprintf(num, "%d", error->request_code); - XGetErrorDatabaseText(display, "XRequest", num, "", req_buf, 1024); - } - else { - req_buf[0] = '\0'; - } - - XGetErrorText(display, error->error_code, buf, sizeof buf); - /* XtCloseDisplay(DISP); */ - if (error->error_code == BadWindow - || error->error_code == BadPixmap - || error->error_code == BadCursor - || error->error_code == BadFont - || error->error_code == BadDrawable - || error->error_code == BadColor - || error->error_code == BadGC - || error->error_code == BadIDChoice - || error->error_code == BadValue - || error->error_code == BadAtom) { - XDVI_WARNING((stderr, "X protocol error: %s\n X Request %d (%s), Value=0x%x.", - buf, error->request_code, req_buf, (unsigned int)error->resourceid)); - } - else { - XDVI_WARNING((stderr, "X protocol error: %s\n X Request %d (%s).", - buf, error->request_code, req_buf)); - } - return 0; -} - /* * Parse colors from resource.{visited_}link_color, saving them * to g_{visited_}link_color and {visited_}link_pix. -*/ + */ static void get_link_colors(Pixel *link_pix, Pixel *visited_link_pix) { @@ -2202,201 +1652,33 @@ motif_translations_hack(void) } #endif /* MOTIF */ - -/* - Initialize internal data (most of them global ...) according to the values - of resources/command-line arguments, warning user about illegal values - etc. -*/ -static void -init_check_resources(void) +/* return an empty cursor. Lifted from unclutter.c */ +static Cursor +h_get_empty_cursor(Display *display, Window root) { - size_t i; - - if (resource.mfmode != NULL) { - char *p; - - p = strrchr(resource.mfmode, ':'); - if (p != NULL) { - unsigned int len; - char *p1; - - ++p; - len = p - resource.mfmode; - p1 = xmalloc(len); - memcpy(p1, resource.mfmode, len - 1); - p1[len - 1] = '\0'; - resource.mfmode = p1; - resource.pixels_per_inch = atoi(p); - } - } - if (currwin.shrinkfactor < 0) { - XDVI_ERROR((stderr, "Invalid shrink factor: %d.", currwin.shrinkfactor)); - usage(EXIT_FAILURE); - } - if (resource.density <= 0) { - XDVI_ERROR((stderr, "Invalid shrink density: %d.", resource.density)); - usage(EXIT_FAILURE); - } - if (resource.pixels_per_inch <= 0) { - XDVI_ERROR((stderr, "Invalid dpi value: %d.", resource.pixels_per_inch)); - usage(EXIT_FAILURE); - } - if (resource.link_style < 0 || resource.link_style > 3) { - XDVI_ERROR((stderr, "Unrecognized value %d for resource \"linkstyle\" (valid range is 0 - 3); assuming 3.", - resource.link_style)); - resource.link_style = 3; - } - if (currwin.shrinkfactor > 1) { - mane.shrinkfactor = currwin.shrinkfactor; /* otherwise it's 1 */ - } - -#ifdef RGB_ANTI_ALIASING -#warning Note: RGB Anti-aliasing enabled - /* subpixel rendering */ - resource.subpixel_order = SUBPIXEL_NONE; - if (resource.sub_pixels != NULL) { - int sum; - - if (memicmp(resource.sub_pixels, "rgb", 3) == 0) - resource.subpixel_order = SUBPIXEL_RGB; - else if (memicmp(resource.sub_pixels, "bgr", 3) == 0) - resource.subpixel_order = SUBPIXEL_BGR; - else if (memicmp(resource.sub_pixels, "none", 3) == 0) - resource.subpixel_order = SUBPIXEL_NONE; - else { - XDVI_ERROR((stderr, - "Unrecognized value \"%s\" for resource subpixels\n" - "(possible values are: \"rgb\" or \"bgr\").", - resource.sub_pixels)); - xdvi_exit(EXIT_FAILURE); - } - /* get the energy distribution */ - if (resource.subpixel_order == SUBPIXEL_RGB || resource.subpixel_order == SUBPIXEL_BGR) { - const char *ptr = resource.sub_pixels + 3; - while (isspace(*ptr)) - ptr++; - fprintf(stderr, "ptr: |%s|\n", ptr); - resource.subpixel_energy[0] = 33.333; - resource.subpixel_energy[1] = 33.333; - resource.subpixel_energy[2] = 0.0; - if (*ptr != '\0') { - if (sscanf(ptr, "%f %f %f", - &(resource.subpixel_energy[0]), - &(resource.subpixel_energy[1]), - &(resource.subpixel_energy[2])) - != 3) { - XDVI_ERROR((stderr, - "Illegal color mask `%s' for resource subpixels (should be: `n n n')\n", - ptr)); - } - } - - sum = (int)(resource.subpixel_energy[0] + - 2 * resource.subpixel_energy[1] + - 2 * resource.subpixel_energy[2]); - if (sum < 99 || sum > 100) { - XDVI_WARNING((stderr, "energy values %f + 2 * %f + 2 * %f don't sum up to 100%%!\n", - resource.subpixel_energy[0], resource.subpixel_energy[1], resource.subpixel_energy[2])); - exit(1); - } - - resource.subpixel_energy[0] /= 100.0; - resource.subpixel_energy[1] /= 100.0; - resource.subpixel_energy[2] /= 100.0; - fprintf(stderr, "subpixel order: %s = %d; [%f %f %f]\n", - resource.sub_pixels, resource.subpixel_order, - resource.subpixel_energy[0], resource.subpixel_energy[1], resource.subpixel_energy[2]); - } - } -#endif - - /* margins */ - if (resource.sidemargin) - resource.sidemargin_int = atopix(resource.sidemargin, False); - if (resource.topmargin) - resource.topmargin_int = atopix(resource.topmargin, False); - resource.xoffset_int = resource.xoffset ? atopix(resource.xoffset, True) - : resource.pixels_per_inch; - resource.yoffset_int = resource.yoffset ? atopix(resource.yoffset, True) - : resource.pixels_per_inch; - - /* paper type */ - if (!set_paper_type(resource.paper)) { - const char **p; - char *helpmsg = xstrdup("Possible paper types are:\n "); - for (p = paper_types; p < paper_types + XtNumber(paper_types); p += 2) { - if (**p == '\0') { /* next line of list */ - helpmsg = xstrcat(helpmsg, "\n "); - } - else { - helpmsg = xstrcat(helpmsg, *p); - helpmsg = xstrcat(helpmsg, " "); - } - } - helpmsg = xstrcat(helpmsg, - "\n(the names ending with `r' are `rotated' or `landscape' variants).\n" - "Alternatively, you can specify the dimensions as `WIDTHxHEIGHT', followed " - "by a dimension unit (one of: pt pc in bp cm mm dd cc sp)."); - /* also dump it to stderr ... */ - fprintf(stderr, - "Unrecognized value `%s' for paper type option; using a4 instead.\n%s\n", - resource.paper, helpmsg); - - popup_message(globals.widgets.top_level, - MSG_WARN, helpmsg, - "Unrecognized value `%s' for paper type option; using a4 instead.", resource.paper); - set_paper_type("a4"); - } - - /* magnifier sizes */ - for (i = 0; i < get_magglass_items(); ++i) { - if (resource.mg_arg[i] != NULL) { - char *s; - - mg_size[i].w = mg_size[i].h = atoi(resource.mg_arg[i]); - s = strchr(resource.mg_arg[i], 'x'); - if (s != NULL) { - mg_size[i].h = atoi(s + 1); - if (mg_size[i].h <= 0) - mg_size[i].w = 0; - } - } - } - -#ifdef PS - if (resource.safer) { - resource.allow_shell = False; -# ifdef PS_GS - resource.gs_safer = True; -# endif /* PS_GS */ - } -# ifdef PS_GS - { - const char *CGMcgm = "CGMcgm"; - const char *cgmp; - - cgmp = strchr(CGMcgm, resource.gs_palette[0]); - if (cgmp == NULL) - XDVI_FATAL((stderr, "Invalid value %s for gs palette option", resource.gs_palette)); - if (cgmp >= CGMcgm + 3) { - static char gsp[] = "x"; + Pixmap cursormask; + XGCValues xgc; + GC gc; + XColor dummycolour; + Cursor cursor; + + cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/); + xgc.function = GXclear; + gc = XCreateGC(display, cursormask, GCFunction, &xgc); + XFillRectangle(display, cursormask, gc, 0, 0, 1, 1); + dummycolour.pixel = 0; + dummycolour.red = 0; + dummycolour.flags = 04; + cursor = XCreatePixmapCursor(display, + cursormask, cursormask, + &dummycolour, &dummycolour, + 0, 0); + XFreePixmap(display, cursormask); + XFreeGC(display, gc); + return cursor; +} - gsp[0] = *(cgmp - 3); - resource.gs_palette = gsp; - } - } -# endif /* PS_GS */ -#endif /* PS */ - /* The old `-expert' flag overrides resource.expert_mode, `+expert' (or not - setting it) just uses expert_mode. - */ - if (resource.expert) - resource.expert_mode = XPRT_SHOW_NONE; -/* fprintf(stderr, "++++++++ initializing resource.expert_mode: %d\n", resource.expert_mode); */ - update_expert_mode(); -} static void create_cursors(void) @@ -2424,45 +1706,31 @@ create_cursors(void) } /* wait cursor */ -#if 0 /* this makes no big difference for #804294 */ - temp = XCreatePixmapFromBitmapData(DISP, RootWindowOfScreen(SCRN), - (char *)time16_bits, - time16_width, time16_height, - 1, 0, 1); - mask = XCreatePixmapFromBitmapData(DISP, RootWindowOfScreen(SCRN), - (char *)time16_mask_bits, - time16_mask_width, time16_mask_height, - 1, 0, 1); -#else - temp = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)time16_bits, - time16_width, time16_height); - mask = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)time16_mask_bits, - time16_mask_width, time16_mask_height); -#endif - globals.cursor.wait = XCreatePixmapCursor(DISP, temp, mask, - &m_cursor_color, &bg_Color, - time16_width / 2, time16_height / 2); - XFreePixmap(DISP, temp); - XFreePixmap(DISP, mask); - - /* ready cursor, magnifier by default */ - temp = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)magglass_bits, - magglass_width, magglass_height); - mask = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)magglass_mask_bits, - magglass_mask_width, magglass_mask_height); - - globals.cursor.ready = XCreatePixmapCursor(DISP, temp, mask, - &m_cursor_color, &bg_Color, - magglass_x_hot, magglass_y_hot); - XFreePixmap(DISP, temp); - XFreePixmap(DISP, mask); + globals.cursor.wait = XCreateFontCursor(DISP, XC_watch); + + if (resource.mouse_mode1_cursor == -1) { /* Use default ready cursor (custom bitmap) */ + temp = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), + (char *)magglass_bits, + magglass_width, magglass_height); + mask = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), + (char *)magglass_mask_bits, + magglass_mask_width, magglass_mask_height); + + globals.cursor.mode1 = XCreatePixmapCursor(DISP, temp, mask, + &m_cursor_color, &bg_Color, + magglass_x_hot, magglass_y_hot); + XFreePixmap(DISP, temp); + XFreePixmap(DISP, mask); + } + else { + globals.cursor.mode1 = XCreateFontCursor(DISP, resource.mouse_mode1_cursor); + } globals.cursor.corrupted = XCreateFontCursor(DISP, XC_watch); + /* empty cursor */ + globals.cursor.empty = h_get_empty_cursor(DISP, RootWindowOfScreen(SCRN)); + #if !COLOR XRecolorCursor(DISP, globals.cursor.ready, &m_cursor_color, &bg_Color); XRecolorCursor(DISP, globals.cursor.wait, &m_cursor_color, &bg_Color); @@ -2474,7 +1742,7 @@ create_cursors(void) mask = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), (char *)hand_mask_bits, hand_mask_width, hand_mask_height); globals.cursor.pause = XCreatePixmapCursor(DISP, temp, mask, - &m_cursor_color, &bg_Color, 6, 6); + &m_cursor_color, &bg_Color, 6, 6); XFreePixmap(DISP, temp); XFreePixmap(DISP, mask); #else @@ -2482,54 +1750,21 @@ create_cursors(void) #endif /* cursors indicating dragging direction */ - temp = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)drag_vert_bits, - drag_vert_width, drag_vert_height); - mask = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)drag_vert_mask_bits, - drag_vert_mask_width, drag_vert_mask_height); - globals.cursor.drag_v = XCreatePixmapCursor(DISP, temp, mask, - &m_cursor_color, &bg_Color, - drag_vert_x_hot, drag_vert_y_hot); - XFreePixmap(DISP, temp); - XFreePixmap(DISP, mask); + globals.cursor.drag_v = XCreateFontCursor(DISP, XC_sb_v_double_arrow); - temp = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)drag_horiz_bits, - drag_horiz_width, drag_horiz_height); - mask = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)drag_horiz_mask_bits, - drag_horiz_width, drag_horiz_height); - globals.cursor.drag_h = XCreatePixmapCursor(DISP, temp, mask, - &m_cursor_color, &bg_Color, - drag_horiz_x_hot, drag_horiz_y_hot); - XFreePixmap(DISP, temp); - XFreePixmap(DISP, mask); + globals.cursor.drag_h = XCreateFontCursor(DISP, XC_sb_h_double_arrow); - temp = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)drag_omni_bits, - drag_omni_width, drag_omni_height); - mask = XCreateBitmapFromData(DISP, RootWindowOfScreen(SCRN), - (char *)drag_omni_mask_bits, - drag_omni_mask_width, drag_omni_mask_height); - globals.cursor.drag_a = XCreatePixmapCursor(DISP, temp, mask, - &m_cursor_color, &bg_Color, - drag_omni_x_hot, drag_omni_y_hot); - XFreePixmap(DISP, temp); - XFreePixmap(DISP, mask); + globals.cursor.drag_a = XCreateFontCursor(DISP, XC_fleur); #ifdef VMS globals.cursor.link = globals.cursor.ready; - globals.cursor.rule = globals.cursor.ready; - globals.cursor.mag = globals.cursor.ready; - globals.cursor.text = globals.cursor.ready; + globals.cursor.mode2 = globals.cursor.ready; + globals.cursor.mode3 = globals.cursor.ready; #else globals.cursor.link = XCreateFontCursor(DISP, XC_hand2); - globals.cursor.rule = XCreateFontCursor(DISP, XC_crosshair); - globals.cursor.mag = XCreateFontCursor(DISP, XC_crosshair); - globals.cursor.text = XCreateFontCursor(DISP, XC_cross); + globals.cursor.mode2 = XCreateFontCursor(DISP, resource.mouse_mode2_cursor); + globals.cursor.mode3 = XCreateFontCursor(DISP, resource.mouse_mode3_cursor); /* globals.cursor.text = XCreateFontCursor(DISP, XC_tcross); */ - XRecolorCursor(DISP, globals.cursor.mag, &m_cursor_color, &bg_Color); #endif } @@ -2589,51 +1824,6 @@ do_forward_search(const char *source_position) } } -static void -check_early_arguments(int argc, char **argv) -{ - /* This checks arguments that need to work before the X machinery is - * started (e.g. if no display is available, or for information that is - * needed before the X defaults are evaluated), so the `options' structure - * can't be used for them. - * - * We need to loop through all arguments in case xdvi is aliased, - * or called via a shell script (like in teTeX) that adds things - * like `-name' at the beginning of the arglist. - */ - int i; - Boolean install_err_handler = True; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-help") == 0 - || strcmp(argv[i], "-h") == 0 - || strcmp(argv[i], "+help") == 0 - || strcmp(argv[i], "--help") == 0) { - printf("%s version %s\n", XDVIK_PROGNAME, XDVI_VERSION_INFO); - printf("A DVI file previewer for the X window system.\n\n"); - display_licensing_info(); - display_bug_reporting_info(); - usage(0); - } - else if (strcmp(argv[i], "-license") == 0) { - display_long_licensing_info(); - xdvi_exit(EXIT_SUCCESS); - } - else if (strcmp(argv[i], "--version") == 0 - || strcmp(argv[i], "-version") == 0 - || strcmp(argv[i], "-v") == 0) { - display_version_info(); - xdvi_exit(EXIT_SUCCESS); - } - else if (strcmp(argv[i], "--default-xerr-handler") == 0) { /* hook to disable custom handler */ - install_err_handler = False; - } - } - - if (install_err_handler) { - (void)XSetErrorHandler(x_error_handler); - } -} static void create_colormaps(void) @@ -2694,8 +1884,8 @@ create_colormaps(void) G_depth = best->depth; G_visual = best->visual; G_colormap = XCreateColormap(DISP, - RootWindowOfScreen(SCRN), - G_visual, AllocNone); + RootWindowOfScreen(SCRN), + G_visual, AllocNone); XInstallColormap(DISP, G_colormap); temp_args1[0].value = (XtArgVal) G_depth; temp_args1[1].value = (XtArgVal) G_visual; @@ -2820,67 +2010,51 @@ create_widgets( #endif int *add_w, int *add_h) { - static const char default_key_translations[] = - "\"0\":digit(0)\n" - "\"1\":digit(1)\n" - "\"2\":digit(2)\n" - "\"3\":digit(3)\n" - "\"4\":digit(4)\n" - "\"5\":digit(5)\n" - "\"6\":digit(6)\n" - "\"7\":digit(7)\n" - "\"8\":digit(8)\n" - "\"9\":digit(9)\n" - /* "\"-\":minus()\n" */ - ":motion()\n"; - - static const char default_mouse_translations[] = - ":release()"; #ifdef MOTIF Widget status_line; #if 0 - { - int i, n, longest_page = 0; - Dimension width, height; - char tmpbuf[1024]; - char *fontname; - XmString tmpstring; - Widget dummy_list; - XmRendition rendition; - XmRenderTable rtable; - Arg args[10]; - /* - * Try to determine width of longest page string: - */ - for (i = 0; i < total_pages; i++) { - int curr = abs(pageinfo_get_number(i)); - if (curr > longest_page) - longest_page = curr; + { + int i, n, longest_page = 0; + Dimension width, height; + char tmpbuf[1024]; + char *fontname; + XmString tmpstring; + Widget dummy_list; + XmRendition rendition; + XmRenderTable rtable; + Arg args[10]; + /* + * Try to determine width of longest page string: + */ + for (i = 0; i < total_pages; i++) { + int curr = abs(pageinfo_get_number(i)); + if (curr > longest_page) + longest_page = curr; + } + fprintf(stderr, "longest page number: %d\n", longest_page); + sprintf(tmpbuf, "* %d", longest_page); + tmpstring = XmStringCreateLocalized(tmpbuf); + dummy_list = XtCreateWidget("PageList", xmListWidgetClass, form, NULL, 0); + fprintf(stderr, "rendition table\n"); + n = 0; + /* XtVaGetValues(globals.widgets.top_level, XmNfontList, &fontname, NULL); */ + /* fprintf(stderr, "fontname: |%s|\n", fontname); */ + XtSetArg(args[n], XmNfontName, "8x16"); n++; + XtSetArg(args[n], XmNfontType, XmFONT_IS_FONT); n++; + rendition = XmRenditionCreate(dummy_list, XmFONTLIST_DEFAULT_TAG, args, n); + rtable = XmRenderTableAddRenditions(NULL, &rendition, 1, XmMERGE_REPLACE); + XtVaSetValues(dummy_list, XmNrenderTable, rtable, NULL); + + /* rendition = XmRenditionCreate(globals.widgets.top_level, XmFONTLIST_DEFAULT_TAG, NULL, 0); */ + fprintf(stderr, "extent\n"); + XmStringExtent(rtable, tmpstring, &width, &height); + fprintf(stderr, "string %s has width %d, height %d\n", tmpbuf, width, height); + XtDestroyWidget(dummy_list); + XmRenditionFree(rendition); + XmStringFree(tmpstring); } - fprintf(stderr, "longest page number: %d\n", longest_page); - sprintf(tmpbuf, "* %d", longest_page); - tmpstring = XmStringCreateLocalized(tmpbuf); - dummy_list = XtCreateWidget("PageList", xmListWidgetClass, form, NULL, 0); - fprintf(stderr, "rendition table\n"); - n = 0; -/* XtVaGetValues(globals.widgets.top_level, XmNfontList, &fontname, NULL); */ -/* fprintf(stderr, "fontname: |%s|\n", fontname); */ - XtSetArg(args[n], XmNfontName, "8x16"); n++; - XtSetArg(args[n], XmNfontType, XmFONT_IS_FONT); n++; - rendition = XmRenditionCreate(dummy_list, XmFONTLIST_DEFAULT_TAG, args, n); - rtable = XmRenderTableAddRenditions(NULL, &rendition, 1, XmMERGE_REPLACE); - XtVaSetValues(dummy_list, XmNrenderTable, rtable, NULL); - - /* rendition = XmRenditionCreate(globals.widgets.top_level, XmFONTLIST_DEFAULT_TAG, NULL, 0); */ - fprintf(stderr, "extent\n"); - XmStringExtent(rtable, tmpstring, &width, &height); - fprintf(stderr, "string %s has width %d, height %d\n", tmpbuf, width, height); - XtDestroyWidget(dummy_list); - XmRenditionFree(rendition); - XmStringFree(tmpstring); - } #endif { #define ARG_LEN 20 @@ -2894,7 +2068,7 @@ create_widgets( #else XtSetArg(list_args[n], XmNheight, globals.page.h); n++; #endif -/* XtSetArg(list_args[n], XmNspacing, 10); n++; */ + /* XtSetArg(list_args[n], XmNspacing, 10); n++; */ #if defined(USE_PANNER) && USE_XAW_PANNER XtSetArg(list_args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(list_args[n], XmNtopWidget, panner); n++; @@ -2922,21 +2096,21 @@ create_widgets( } globals.widgets.main_window = XtVaCreateManagedWidget("mainWindow", - xmScrolledWindowWidgetClass, form, - XmNscrollingPolicy, XmAUTOMATIC, - XmNleftAttachment, XmATTACH_WIDGET, - /* lesstif balks if we just use page_list, so use its parent, - the xmScrolledWindow, for alignment: */ - XmNleftWidget, XtParent(page_list), - XmNallowResize, True, -/* XmNtopOffset, 2, */ - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - /* XmNleftOffset, 10, */ - XmNresizable, True, - XmNborderWidth, 0, - NULL); + xmScrolledWindowWidgetClass, form, + XmNscrollingPolicy, XmAUTOMATIC, + XmNleftAttachment, XmATTACH_WIDGET, + /* lesstif balks if we just use page_list, so use its parent, + the xmScrolledWindow, for alignment: */ + XmNleftWidget, XtParent(page_list), + XmNallowResize, True, + /* XmNtopOffset, 2, */ + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + /* XmNleftOffset, 10, */ + XmNresizable, True, + XmNborderWidth, 0, + NULL); XtManageChild(form); globals.widgets.x_bar = XtNameToWidget(globals.widgets.main_window, "HorScrollBar"); @@ -2947,31 +2121,31 @@ create_widgets( /* TODO: try the following to prevent `flashing' effect - still breaks scrolling in its current form though */ globals.widgets.draw_background = XtVaCreateManagedWidget("drawing_bg", - xmFormWidgetClass, globals.widgets.main_window, - XmNwidth, globals.page.w, - XmNheight, globals.page.h, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNhighlightThickness, 0, - XmNbackground, resource.back_Pixel, - XmNrubberPositioning, True, - NULL); + xmFormWidgetClass, globals.widgets.main_window, + XmNwidth, globals.page.w, + XmNheight, globals.page.h, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNhighlightThickness, 0, + XmNbackground, resource.back_Pixel, + XmNrubberPositioning, True, + NULL); #endif globals.widgets.draw_widget = XtVaCreateWidget("drawing", - xmDrawingAreaWidgetClass, + xmDrawingAreaWidgetClass, #ifdef TEST_SCROLLING - globals.widgets.draw_background, + globals.widgets.draw_background, #else - globals.widgets.main_window, + globals.widgets.main_window, #endif - XmNwidth, globals.page.w, - XmNheight, globals.page.h, - XmNhighlightThickness, 0, - XmNrubberPositioning, True, - XtNbackground, resource.back_Pixel, - NULL); + XmNwidth, globals.page.w, + XmNheight, globals.page.h, + XmNhighlightThickness, 0, + XmNrubberPositioning, True, + XtNbackground, resource.back_Pixel, + NULL); #if !FIXED_FLUSHING_PAGING ASSERT(XtParent(globals.widgets.draw_widget) != NULL, ""); @@ -3007,7 +2181,7 @@ create_widgets( if ((resource.expert_mode & XPRT_SHOW_TOOLBAR) != 0) { if (resource.toolbar_unusable) - statusline_print(STATUS_LONG, + statusline_error(STATUS_LONG, "Error creating the toolbar pixmaps - toolbar is disabled!"); else XtManageChild(XtParent(tool_bar)); @@ -3017,7 +2191,7 @@ create_widgets( XtManageChild(globals.widgets.menu_bar); XmAddTabGroup(globals.widgets.draw_widget); - + /* note: a few more custom translations for page_list are defined in pagesel.c, since the actions are only known there. @@ -3028,7 +2202,7 @@ create_widgets( Widget widgets[WIDGETS_SIZE]; widgets[k++] = globals.widgets.main_row; -/* widgets[k++] = globals.widgets.menu_bar; */ + /* widgets[k++] = globals.widgets.menu_bar; */ widgets[k++] = tool_bar; widgets[k++] = page_list; widgets[k++] = globals.widgets.main_window; @@ -3039,28 +2213,30 @@ create_widgets( #undef WIDGETS_SIZE for (i = 0; i < k; i++) { XtOverrideTranslations(widgets[i], XtParseTranslationTable(base_key_translations)); - XtOverrideTranslations(widgets[i], XtParseTranslationTable(default_key_translations)); if (i > 3) { /* widgets for which we want to use our own mouse translations */ XtOverrideTranslations(widgets[i], XtParseTranslationTable(base_mouse_translations)); - XtOverrideTranslations(widgets[i], XtParseTranslationTable(default_mouse_translations)); + if (resource.mouse_translations != NULL) { + XtOverrideTranslations(widgets[i], XtParseTranslationTable(resource.mouse_translations)); + } } } } + if (resource.mouse_translations != NULL) { + TRACE_GUI((stderr, "merging in mouse translations |%s|", resource.mouse_translations)); + XtOverrideTranslations(globals.widgets.clip_widget, XtParseTranslationTable(resource.mouse_translations)); + } + if (resource.main_translations != NULL) { - XtOverrideTranslations(globals.widgets.draw_widget, XtParseTranslationTable(resource.main_translations)); - XtOverrideTranslations(globals.widgets.clip_widget, XtParseTranslationTable(resource.main_translations)); + XtTranslations xlats = XtParseTranslationTable(resource.main_translations); + XtOverrideTranslations(globals.widgets.draw_widget, xlats); + XtOverrideTranslations(globals.widgets.clip_widget, xlats); + XtOverrideTranslations(globals.widgets.main_row, xlats); + XtOverrideTranslations(globals.widgets.menu_bar, xlats); + XtOverrideTranslations(globals.widgets.main_window, xlats); /* don't do it for the page list, otherwise mouse customizations will break the default list bindings too. */ - /* XtOverrideTranslations(page_list, XtParseTranslationTable(resource.main_translations)); */ - } - /* widgets for which wheel mouse should scroll the drawing area */ - if (resource.wheel_unit != 0 && resource.wheel_translations != NULL) { - XtOverrideTranslations(globals.widgets.main_row, XtParseTranslationTable(resource.wheel_translations)); - XtOverrideTranslations(tool_bar, XtParseTranslationTable(resource.wheel_translations)); - XtOverrideTranslations(globals.widgets.main_window, XtParseTranslationTable(resource.wheel_translations)); - XtOverrideTranslations(globals.widgets.draw_widget, XtParseTranslationTable(resource.wheel_translations)); -/* XtOverrideTranslations(globals.widgets.draw_background, XtParseTranslationTable(resource.wheel_translations)); */ + /* XtOverrideTranslations(page_list, xlats); */ } #else /* MOTIF */ @@ -3090,12 +2266,12 @@ create_widgets( XtOverrideTranslations(globals.widgets.form_widget, XtParseTranslationTable(base_key_translations)); XtOverrideTranslations(globals.widgets.form_widget, XtParseTranslationTable(base_mouse_translations)); - XtOverrideTranslations(globals.widgets.form_widget, XtParseTranslationTable(default_key_translations)); - XtOverrideTranslations(globals.widgets.form_widget, XtParseTranslationTable(default_mouse_translations)); - if (resource.wheel_unit != 0 && resource.wheel_translations != NULL) - XtOverrideTranslations(globals.widgets.form_widget, XtParseTranslationTable(resource.wheel_translations)); - + if (resource.mouse_translations != NULL) { + TRACE_GUI((stderr, "merging in mouse translations |%s|", resource.mouse_translations)); + XtOverrideTranslations(globals.widgets.form_widget, XtParseTranslationTable(resource.mouse_translations)); + } + if (resource.main_translations != NULL) { XtOverrideTranslations(globals.widgets.form_widget, XtParseTranslationTable(resource.main_translations)); } @@ -3109,10 +2285,8 @@ create_widgets( #endif /* initialize add_w with width of button panel */ - if ((resource.expert_mode & XPRT_SHOW_BUTTONS) != 0) - create_menu_buttons(globals.widgets.form_widget, add_w); - else - *add_w = 0; + create_menu_buttons(globals.widgets.form_widget, add_w); + #endif /* MOTIF */ /* activate expert mode and related settings */ @@ -3123,27 +2297,37 @@ create_widgets( toggle_toolbar(); toggle_menubar(); #else - toggle_buttons(); + if ((resource.expert_mode & XPRT_SHOW_BUTTONS) == 0) + toggle_buttons(); #endif + *add_h = 0; #ifdef MOTIF *add_w = 0; if (resource.expert_mode & XPRT_SHOW_PAGELIST) *add_w += xm_get_width(page_list); -/* if (globals.widgets.y_bar != NULL) */ -/* add_w += xm_get_width(globals.widgets.y_bar); */ - *add_h = 0; +/* if (globals.widgets.y_bar != NULL) */ +/* add_w += xm_get_width(globals.widgets.y_bar); */ +/* if (globals.widgets.x_bar != NULL) */ +/* add_h += xm_get_width(globals.widgets.x_bar); */ if (resource.expert_mode & XPRT_SHOW_MENUBAR) *add_h += xm_get_height(globals.widgets.menu_bar); if (resource.expert_mode & XPRT_SHOW_TOOLBAR) *add_h += xm_get_height(tool_bar); if (resource.expert_mode & XPRT_SHOW_STATUSLINE) *add_h += xm_get_height(status_line); -/* if (globals.widgets.x_bar != NULL) */ -/* add_h += xm_get_width(globals.widgets.x_bar); */ #else - /* add_w has been initialized by create_menu_buttons() call above */ - *add_h = 0; + /* add_w has been initialized by create_menu_buttons() call above. + Reset to 0 if we're in expert mode. */ + if (!(resource.expert_mode & XPRT_SHOW_BUTTONS)) { + *add_w = 0; + } + if (resource.expert_mode & XPRT_SHOW_STATUSLINE) { + /* FIXME: Unfortunately the statusline hasn't been created at this point for Xaw, + so the value is still the built-in default. + */ + *add_h += get_statusline_height(); + } #endif } @@ -3156,10 +2340,9 @@ realize_widgets(Dimension main_win_w, Dimension main_win_h, int add_w) */ #ifndef MOTIF - if ((resource.expert_mode & XPRT_SHOW_BUTTONS) != 0) { - set_button_panel_height(main_win_h); - } + realize_button_panel(main_win_h); #endif + XtAddEventHandler( #ifdef MOTIF globals.widgets.clip_widget, @@ -3181,8 +2364,10 @@ realize_widgets(Dimension main_win_w, Dimension main_win_h, int add_w) /* for Xaw, event handlers for scrollbars are added inside get_geom(), events.c */ ASSERT(globals.widgets.x_bar != NULL, ""); ASSERT(globals.widgets.y_bar != NULL, ""); +#ifdef USE_PANNER XtAddEventHandler(globals.widgets.x_bar, ButtonPressMask | ButtonReleaseMask, False, handle_x_scroll, NULL); XtAddEventHandler(globals.widgets.y_bar, ButtonPressMask | ButtonReleaseMask, False, handle_y_scroll, NULL); +#endif XmAddWMProtocolCallback(globals.widgets.top_level, mainDeleteWindow, xdvi_exit_callback, NULL); #else wmProtocols = XInternAtom(DISP, "WM_PROTOCOLS", False); @@ -3248,34 +2433,34 @@ create_gcs(void) init_pix(); else #endif - { /* not #defined GREY, or not resource.use_grey */ - XGCValues values; - Pixel set_bits = (Pixel) (resource.fore_Pixel & ~resource.back_Pixel); - Pixel clr_bits = (Pixel) (resource.back_Pixel & ~resource.fore_Pixel); - Boolean copy_tmp = resource.copy; + { /* not #defined GREY, or not resource.use_grey */ + XGCValues values; + Pixel set_bits = (Pixel) (resource.fore_Pixel & ~resource.back_Pixel); + Pixel clr_bits = (Pixel) (resource.back_Pixel & ~resource.fore_Pixel); + Boolean copy_tmp = resource.copy; - globals.gc.copy = set_or_make_gc(NULL, GXcopy, resource.fore_Pixel, resource.back_Pixel); - if (copy_tmp || (set_bits && clr_bits)) { - globals.gc.rule = globals.gc.copy; - if (!resource.thorough) - copy_tmp = True; - } - if (copy_tmp) { - globals.gc.fore = globals.gc.rule; - if (!resource.copy) { - warn_overstrike(); - } + globals.gc.copy = set_or_make_gc(NULL, GXcopy, resource.fore_Pixel, resource.back_Pixel); + if (copy_tmp || (set_bits && clr_bits)) { + globals.gc.rule = globals.gc.copy; + if (!resource.thorough) + copy_tmp = True; + } + if (copy_tmp) { + globals.gc.fore = globals.gc.rule; + if (!resource.copy) { + warn_overstrike(); } - else { - if (set_bits) { - globals.gc.fore = set_or_make_gc(NULL, GXor, set_bits, 0); - } - if (clr_bits || !set_bits) - *(globals.gc.fore ? &globals.gc.fore2 : &globals.gc.fore) = set_or_make_gc(NULL, GXandInverted, clr_bits, 0); - if (!globals.gc.rule) - globals.gc.rule = globals.gc.fore; + } + else { + if (set_bits) { + globals.gc.fore = set_or_make_gc(NULL, GXor, set_bits, 0); } + if (clr_bits || !set_bits) + *(globals.gc.fore ? &globals.gc.fore2 : &globals.gc.fore) = set_or_make_gc(NULL, GXandInverted, clr_bits, 0); + if (!globals.gc.rule) + globals.gc.rule = globals.gc.fore; } + } #endif /* !COLOR */ { @@ -3330,6 +2515,7 @@ panner_cb(Widget widget, XtPointer closure, XtPointer report_ptr) } #endif +#if !DELAYED_MKTEXPK static XtIntervalId m_font_popup_id = 0; static Widget m_font_popup = 0; @@ -3361,10 +2547,12 @@ create_font_popup(XtPointer client_data, XtIntervalId *id) UNUSED(client_data); UNUSED(id); +/* fprintf(stderr, "+++++++++++++++ create_font_popup\n"); */ + if (m_font_popup_id) { if (*curr_timeout > 0) { XtRemoveTimeOut(m_font_popup_id); - m_font_popup_id = XtAppAddTimeOut(app, *curr_timeout, create_font_popup, (XtPointer)&new_timeout); + m_font_popup_id = XtAppAddTimeOut(globals.app, *curr_timeout, create_font_popup, (XtPointer)&new_timeout); } else { m_font_popup = choice_dialog(globals.widgets.top_level, @@ -3381,7 +2569,7 @@ create_font_popup(XtPointer client_data, XtIntervalId *id) } } -static void +void register_font_popup(void) { /* Use a two-step process, so that when the timeout is removed by unregister_font_popup(), @@ -3389,147 +2577,61 @@ register_font_popup(void) with new_timeout = 0. */ static int new_timeout = 50; - m_font_popup_id = XtAppAddTimeOut(app, 700, create_font_popup, (XtPointer)&new_timeout); +/* fprintf(stderr, "+++++++++++++++ registered font popup\n"); */ + m_font_popup_id = XtAppAddTimeOut(globals.app, 100, create_font_popup, (XtPointer)&new_timeout); } -static void +void unregister_font_popup(void) { +/* fprintf(stderr, "+++++++++++++++ unregister_font_popup\n"); */ if (m_font_popup_id) { XtRemoveTimeOut(m_font_popup_id); m_font_popup_id = 0; /* FIXME: calling this directly crashes xdvi?? */ - /* m_font_popup_id = XtAppAddTimeOut(app, 1, remove_font_popup, (XtPointer)NULL); */ + /* m_font_popup_id = XtAppAddTimeOut(globals.app, 1, remove_font_popup, (XtPointer)NULL); */ remove_font_popup(NULL, NULL); } } - -/* initialize global variables with default values. */ -static void -init_globals(void) { - globals.program_name = NULL; - globals.dvi_name = NULL; - globals.xdvi_dir = xgetcwd(); - globals.orig_locale = NULL; - globals.debug = 0L; - globals.pageno_correct = 1; - - globals.curr_paper = NULL; - globals.curr_editor = NULL; - globals.curr_browser = NULL; - - globals.ev.flags = EV_IDLE; - globals.ev.ctr = 0; - - globals.pausing.num = 0; - globals.pausing.num_save = NULL; - globals.pausing.flag = False; - - globals.win_expose.min_x = 0; - globals.win_expose.max_x = 0; - globals.win_expose.min_y = 0; - globals.win_expose.max_y = 0; - - globals.gc.rule = NULL; - globals.gc.fore = NULL; - globals.gc.inverted = NULL; - globals.gc.high = NULL; - globals.gc.linkcolor = NULL; - globals.gc.visited_linkcolor = NULL; - globals.gc.fore2 = NULL; - globals.gc.fore2_bak = NULL; - globals.gc.fore2_bak1 = NULL; - globals.gc.copy = NULL; - globals.gc.ruler = NULL; - - globals.gc.do_copy = False; - - globals.cursor.flags = 0; - - globals.src.fwd_box_page = -1; /* -1 means no box */ - globals.src.fwd_string = NULL; - - globals.widgets.top_level = 0; - globals.widgets.draw_widget = 0; - globals.widgets.draw_background = 0; - globals.widgets.clip_widget = 0; - globals.widgets.x_bar = 0; - globals.widgets.y_bar = 0; -#ifdef MOTIF - globals.widgets.main_window = 0; - globals.widgets.main_row = 0; - globals.widgets.tool_bar = 0; - globals.widgets.top_row = 0; - globals.widgets.menu_bar = 0; -#else - globals.widgets.vport_widget = 0; - globals.widgets.form_widget = 0; - globals.widgets.paned = 0; -#endif - - globals.page.w = 0; - globals.page.h = 0; - globals.page.unshrunk_w = 0; - globals.page.unshrunk_h = 0; - - globals.dvi_file.dirname = NULL; - globals.dvi_file.dirlen = 0; - globals.dvi_file.bak_fp = NULL; - globals.dvi_file.time = 0; - -#if defined(LESSTIF_VERSION) - globals.broken_motif_event_handling = True; -#elif defined(MOTIF) /* was: && XmVersion <= 1002 - better use runtime information:*/ - if (xmUseVersion <= 1002) - globals.broken_motif_event_handling = True; - else - globals.broken_motif_event_handling = False; -#else - globals.broken_motif_event_handling = False; -#endif - -} +#endif /* !DELAYED_MKTEXPK */ /* revert resources */ void -reload_app_resources(void) +load_app_resources(Boolean also_pixels) { -/* /\* reset some resources to built-in defaults *\/ */ -/* resource.browser = NULL; */ -/* resource.editor = NULL; */ -/* resource.gamma = 1; */ -/* resource.link_style = 3; */ -/* resource.link_color = LINK_COLOR_FALLBACK; */ -/* resource.visited_link_color = VISITED_LINK_COLOR_FALLBACK; */ -/* resource.expert_mode = 31; */ -/* resource.use_color = True; */ -/* resource.match_highlight_inverted = True; */ + /* /\* reset some resources to built-in defaults *\/ */ + /* resource.browser = NULL; */ + /* resource.editor = NULL; */ + /* resource.gamma = 1; */ + /* resource.link_style = 3; */ + /* resource.link_color = LINK_COLOR_FALLBACK; */ + /* resource.visited_link_color = VISITED_LINK_COLOR_FALLBACK; */ + /* resource.expert_mode = 31; */ + /* resource.use_color = True; */ + /* resource.match_highlight_inverted = True; */ XtGetApplicationResources(globals.widgets.top_level, (XtPointer)&resource, application_resources, XtNumber(application_resources), (ArgList)NULL, 0); - XtGetApplicationResources(globals.widgets.top_level, (XtPointer)&resource, - app_pixel_resources, XtNumber(app_pixel_resources), - (ArgList)NULL, 0); -/* fprintf(stderr, "gamma: %f\n", resource.gamma); */ -} - -struct filehist_info { - int file_idx; - char *page_arg; -}; + if (also_pixels) { + XtGetApplicationResources(globals.widgets.top_level, (XtPointer)&resource, + app_pixel_resources, XtNumber(app_pixel_resources), + (ArgList)NULL, 0); + } + /* fprintf(stderr, "gamma: %f\n", resource.gamma); */ +} /* * Unfortunately this must be a callback, for the file selector ... * This is the second part of Main: Create all widgets, initialize the DVI file, * and enter the main event loop. */ -static void +void run_dvi_file(const char *filename, void *data) { Boolean tried_dvi_ext = False; - struct filehist_info *cb = (struct filehist_info *)data; + struct startup_info *cb = (struct startup_info *)data; #ifdef MOTIF Widget tool_bar = 0; @@ -3540,7 +2642,7 @@ run_dvi_file(const char *filename, void *data) char *icon_name = NULL; dviErrFlagT errflag = NO_ERROR; - int add_w, add_h; + int add_w = 0, add_h = 0; Dimension main_win_w, main_win_h; UNUSED(data); @@ -3552,34 +2654,42 @@ run_dvi_file(const char *filename, void *data) TRACE_FILES((stderr, "globals.dvi_name is: |%s| %p\n", globals.dvi_name, globals.dvi_name)); globals.dvi_file.dirname = get_dir_component(globals.dvi_name); - ASSERT(globals.dvi_file.dirname != NULL, "dvi_name must contain a dir component"); + xdvi_assert(XDVI_VERSION_INFO, __FILE__, __LINE__, + globals.dvi_file.dirname != NULL, + "globals.dvi_name (%s) must contain a dir component", + globals.dvi_name); globals.dvi_file.dirlen = strlen(globals.dvi_file.dirname); form_dvi_property(); /* - If `unique' is active, we may need to pass the file - to a different instance of xdvi: + If `unique' is active, we may need to pass the file to a different instance of xdvi: */ if (resource.unique) { Window w1 = 0, w2 = 0; if ((w1 = get_xdvi_window_id(True, NULL)) != 0 || (w2 = get_xdvi_window_id(False, NULL)) != 0) { - if (w1 != 0) { /* another xdvi, and same file: reload and raise */ + if (w1 != 0) { /* another xdvi instance, same file: reload */ w2 = w1; set_string_property("", atom_reload(), w2); - set_string_property("", atom_raise(), w2); } - else { /* another xdvi, and different file: load new file and raise */ + else { /* another xdvi instance, different file: load new file */ set_string_property(globals.dvi_name, atom_newdoc(), w2); - set_string_property("", atom_raise(), w2); } - if (cb->page_arg != NULL) { /* switch to different page and raise */ - if (strlen(cb->page_arg) == 0) /* special case: treat `+' as last page */ + if (cb->page_arg != NULL) { /* switch to different page */ + if (strlen(cb->page_arg) == 0) { /* special case: treat `+' as last page */ set_string_property("+", atom_newpage(), w2); - else + } + else { set_string_property(cb->page_arg, atom_newpage(), w2); - set_string_property("", atom_raise(), w2); + } + } + else { + /* if page_arg is empty, go to 1st page so that this page is + inserted into the page history (fix for #1044891) */ + set_string_property("1", atom_newpage(), w2); } + /* in all cases, raise the window of the other instance */ + set_string_property("", atom_raise(), w2); xdvi_exit(EXIT_SUCCESS); } else if (resource.src_fork) { @@ -3589,7 +2699,7 @@ run_dvi_file(const char *filename, void *data) /* Similar for forward search or string search: - */ + */ if (resource.src_pos != NULL || resource.find_string != NULL) { Window w; if ((w = get_xdvi_window_id(True, NULL)) != 0) { @@ -3672,7 +2782,7 @@ run_dvi_file(const char *filename, void *data) /* toolbar code may open files, but we have no check close_a_file() in the toolbar code; so do this before prescan() possibly opens lots of files. - */ + */ #ifdef MOTIF globals.widgets.main_row = XmCreateMainWindow(globals.widgets.top_level, "main", NULL, 0); @@ -3685,6 +2795,12 @@ run_dvi_file(const char *filename, void *data) form = XtVaCreateWidget("form", xmFormWidgetClass, globals.widgets.main_row, XmNshadowThickness, 0, NULL); + + if (resource.main_translations != NULL) { + XtOverrideTranslations(form, XtParseTranslationTable(resource.main_translations)); + } + + #if defined(USE_PANNER) && USE_XAW_PANNER panner = XtVaCreateWidget("panner", pannerWidgetClass, form, XmNtopAttachment, XmATTACH_FORM, @@ -3724,38 +2840,64 @@ run_dvi_file(const char *filename, void *data) */ if (resource.t1lib) { - init_t1(); + init_t1(); } #endif /* T1LIB */ +#if DELAYED_MKTEXPK + /* Open and initialize the DVI file. First, disable creation of PK fonts + * so that we can count the missing fonts that are to be generated. */ + kpse_set_program_enabled(kpse_any_glyph_format, False, kpse_src_compile); +#endif + + setup_signal_handlers(False); - setup_signal_handlers(); - +#if !DELAYED_MKTEXPK /* Notify users that fonts are being created. This is just a hack - and no replacement for true asynchronous font creation (see - EXPERIMENTAL_DELAYED_MTKEXPK in font-open.c for that approach) - since it doesn't give details (is just invoked if startup takes - somewhat longer) and freezes during font creation. + and no replacement for true asynchronous font creation since it + doesn't give details (is just invoked if startup takes somewhat + longer) and freezes during font creation. */ register_font_popup(); +#endif /* open and initialize the DVI file, but don't read the fonts yet */ - if (!internal_open_dvi(globals.dvi_name, &errflag, -#ifdef EXPERIMENTAL_DELAYED_MTKEXPK - False -#else - True + if (!internal_open_dvi(globals.dvi_name, &errflag, True +#if DELAYED_MKTEXPK + , False /* read fonts, but don't initialize data structures */ #endif )) { - if (tried_dvi_ext) + if (tried_dvi_ext) { XDVI_FATAL((stderr, "Could not open %s: %s, and %s.dvi doesn't exist either - exiting.", globals.dvi_name, get_dvi_error(errflag), globals.dvi_name)); - else + } + else { XDVI_FATAL((stderr, "Could not open %s: %s.", globals.dvi_name, get_dvi_error(errflag))); + } } - + +#if DELAYED_MKTEXPK + fprintf(stderr, "after opening ...\n"); + /* Now re-enable PK creation and read the postamble for a second time. + * FIXME: Actually we don't need this re-reading, could as well read the + * entire thing in the first run, not quit early and correctly initialize + * the fonts without creating them. */ + kpse_set_program_enabled(kpse_any_glyph_format, resource.makepk, kpse_src_compile); + + if (!internal_open_dvi(globals.dvi_name, &errflag, True, True)) { + if (tried_dvi_ext) { + XDVI_FATAL((stderr, "Could not open %s: %s, and %s.dvi doesn't exist either - exiting.", + globals.dvi_name, get_dvi_error(errflag), globals.dvi_name)); + } + else { + XDVI_FATAL((stderr, "Could not open %s: %s.", + globals.dvi_name, get_dvi_error(errflag))); + } + } +#else unregister_font_popup(); +#endif if (cb->page_arg != NULL) { if (cb->page_arg[0] == '\0') { /* empty page_arg -> goto last page */ @@ -3768,10 +2910,12 @@ run_dvi_file(const char *filename, void *data) if (*testptr != '\0') { XDVI_FATAL((stderr, "Invalid page number: `%s'.", cb->page_arg)); } - current_page = check_goto_page(current_page); + current_page = check_goto_page(current_page, True); } } - + else { + page_history_insert(current_page); + } file_history_set_page(current_page); ASSERT(globals.dvi_file.bak_fp != NULL, "Backup file pointer must have been initialized here"); @@ -3781,10 +2925,10 @@ run_dvi_file(const char *filename, void *data) globals.page.unshrunk_w = pageinfo_get_page_width(current_page); globals.page.unshrunk_h = pageinfo_get_page_height(current_page); - TRACE_FILES((stderr, "globals.page.unshrunk_w: %d, h: %d; window: %d, %d", - globals.page.unshrunk_w, globals.page.unshrunk_h, - pageinfo_get_window_width(current_page), - pageinfo_get_window_height(current_page))); + TRACE_GUI((stderr, "globals.page.unshrunk_w: %d, h: %d; window: %d, %d", + globals.page.unshrunk_w, globals.page.unshrunk_h, + pageinfo_get_window_width(current_page), + pageinfo_get_window_height(current_page))); init_page(); @@ -3802,10 +2946,13 @@ run_dvi_file(const char *filename, void *data) resource.expert_mode |= XPRT_SHOW_STATUSLINE; } -/* XtRealizeWidget(globals.widgets.top_level); */ + /* XtRealizeWidget(globals.widgets.top_level); */ #ifdef MOTIF tool_bar = create_toolbar(globals.widgets.main_row, globals.widgets.menu_bar); + if (resource.main_translations != NULL) { + XtOverrideTranslations(tool_bar, XtParseTranslationTable(resource.main_translations)); + } #endif create_widgets( @@ -3814,9 +2961,9 @@ run_dvi_file(const char *filename, void *data) #endif &add_w, &add_h); + TRACE_GUI((stderr, "add_w = %d, add_h = %d\n", add_w, add_h)); /* fprintf(stderr, "geometry xdvirc: |%s|, orig: |%s|\n", resource.xdvirc_geometry, resource.geometry); */ - /* * Set initial window size. * This needs to be done before colors are assigned because if @@ -3852,7 +2999,7 @@ run_dvi_file(const char *filename, void *data) /* Store window id for use by src_client_check(). */ { -#ifndef WORD64 +#if !(defined(WORD64) || defined(LONG64)) xuint32 data = XtWindow(globals.widgets.top_level); XChangeProperty(DISP, DefaultRootWindow(DISP), atom_xdvi_windows(), atom_xdvi_windows(), 32, @@ -3876,18 +3023,6 @@ run_dvi_file(const char *filename, void *data) create_cursors(); -#ifdef EXPERIMENTAL_DELAYED_MTKEXPK - /* Only now, we initialize the fonts. First update the window: */ - force_statusline_update(); - printlog_create("test", "Close", NULL, NULL, NULL, NULL); - printlog_popup(); - - printlog_append_str("\nTrying to create font(s)\n"); - if (!find_postamble(globals.dvi_file.bak_fp, &errflag) || !read_postamble(globals.dvi_file.bak_fp, &errflag, True)) { - XDVI_ERROR((stderr, "Couldn't read fonts from postamble: %s\n", get_dvi_error(errflag))); - } -#endif /* EXPERIMENTAL_DELAYED_MTKEXPK */ - #ifdef MOTIF #if defined(USE_PANNER) && USE_XAW_PANNER XtVaSetValues(panner, XtNsliderWidth, globals.page.w / 2, @@ -3941,402 +3076,18 @@ run_dvi_file(const char *filename, void *data) /* raise `early' message windows */ raise_message_windows(); - if (resource.mouse_mode == MOUSE_RULER_MODE) { - show_ruler(NULL); - } - - /* insert this page into the history */ - globals.ev.flags |= EV_PAGEHIST_INSERT; - - do_pages(); -} - -static char * -is_good_dvi_file(const char *filename, Boolean from_history) -{ - static char canonical_path[MAXPATHLEN + 1]; - Boolean tried_dvi_extension = False; - /* following allocates real_filename */ - char *real_filename = find_dvi_file(filename, &tried_dvi_extension, from_history); - char *ret; - FILE *f = NULL; - dviErrFlagT errflag; - - if (real_filename == NULL) - return NULL; - - if ((ret = REALPATH(real_filename, canonical_path)) == NULL) { - /* REALPATH failed, use real_filename */ - strncpy(canonical_path, real_filename, MAXPATHLEN); - canonical_path[MAXPATHLEN] = '\0'; - ret = canonical_path; - } - free(real_filename); - - /* check for correct DVI files */ - if ((f = XFOPEN(ret, OPEN_MODE)) != NULL) { - TRACE_EVENTS((stderr, "watching: new file opened successfully.")); - if (process_preamble(f, &errflag) - && find_postamble(f, &errflag) - && read_postamble(f, &errflag, False)) { - fclose(f); - return ret; - } - fclose(f); - if (!from_history) - XDVI_FATAL((stderr, "%s: %s.", filename, get_dvi_error(errflag))); - return NULL; - } - else { - if (!from_history) - XDVI_FATAL((stderr, "Could not open `%s': %s.", filename, strerror(errno))); - return NULL; - } -} - -static char * -get_filename_from_history(int *pageno) -{ - size_t i; - /* loop through history, trying to get a good file */ - for (i = 0; i < file_history_size(); i++) { - char *ret, *test; - - if ((test = file_history_get_elem(i, pageno)) == NULL) - return NULL; - TRACE_FILES((stderr, "HISTORY %lu: |%s|", (unsigned long)i, test)); - if ((ret = is_good_dvi_file(test, True)) != NULL) { - TRACE_FILES((stderr, "SUCCESS: |%s|", test)); - return ret; - } - } - return NULL; -} - - -/* - ************************************************************ - ************************************************************ - main routine - ************************************************************ - ************************************************************ -*/ - -int -main(int argc, char **argv) -{ - int i; - static struct filehist_info info; - const char *file_name = NULL; - const char *file_name2 = NULL; - - /* Hack to have command-line options override ~/.xdvirc stuff: - * Parse and merge them again from argv_bak, a copy of the command-line options, - * via XrmParseCommand(). I think the only alternative would be to merge in all - * resources manually instead of using XtInitialize(), similar to what's done in gv, - * but that looks like too much trouble. - */ -#define COMMANDLINE_OVERRIDE_HACK 1 - -#if COMMANDLINE_OVERRIDE_HACK - int argc_bak; - char **argv_bak; -#endif - - info.file_idx = 0; - info.page_arg = NULL; - - /* BEGIN_TIMER_LOOP; */ - - init_globals(); - - /* - * Step 1: Process command-line options and resources. - */ - - globals.program_name = xstrdup(argv[0]); - { /* get filename from program_name if it contains a path */ - char sep; - char *ptr; -#ifdef VMS - sep = ']'; -#else - sep = '/'; -#endif - if ((ptr = strrchr(globals.program_name, sep)) != NULL) { - globals.program_name = ++ptr; - } -#ifdef VMS - if ((ptr = strchr(globals.program_name, '.')) != NULL) - *ptr = '\0'; -#endif - } - -#if COMMANDLINE_OVERRIDE_HACK - /* create a copy of argv[] */ - argc_bak = argc; - argv_bak = xmalloc((1 + argc_bak) * sizeof *argv_bak); - for (i = 0; i < argc_bak; i++) { - argv_bak[i] = xstrdup(argv[i]); - } - argv_bak[i] = NULL; -#endif - - /* - Arguments that need to be checked early, like `help', `version' and `sync'. - The former don't even require an X connection. - */ - check_early_arguments(argc, argv); - - warn_about_prerelease_versions(); - - /* We need to set up SIGALRM before calling XtAppAddTimeOut() (inside sfSelFile, or - called from XtInitialize() in Motif), else and we'll die with the error message - `Alarm clock'. However, we mustn't install SIGPOLL before the forking is done - below, else xdvi may hang forever waiting for input. So the signal handler setup - is split in 2 parts: setup_sigalarm(), and setup_signal_handlers() below. - */ - setup_sigalarm(); - - /* get the debug value (if any) from the environment - (it's too early to get it from the command line) */ - globals.debug = parse_debugging_option(getenv("XDVIDEBUG")); - - /* to make input of non-latin characters work */ - XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); - globals.widgets.top_level = XtInitialize(globals.program_name, "XDvi", options, XtNumber(options), - &argc, argv); - - app = XtWidgetToApplicationContext(globals.widgets.top_level); - - XtAppAddActions(app, get_actions(), get_num_actions()); - - create_magnifier(); - - if ((globals.orig_locale = setlocale(LC_ALL, "")) != NULL) - globals.orig_locale = xstrdup(globals.orig_locale); /* note: never free'd */ - else /* fallback */ - globals.orig_locale = xstrdup(setlocale(LC_ALL, NULL)); - - /* Override LC_NUMERIC, else sscanf(), strtod() etc. will stop working on floats - inside specials for locales like LANG=de_DE which uses `,' not `.' - as fractional part separator. (Strangely, using - LC_CTYPE | LC_COLLATE - above doesn't work?) - Regression: - xdvik/regression/special-pics/pictest.dvi - */ - setlocale(LC_NUMERIC, "C"); - - /* at this point, all known options will have been consumed; so the - only ones remaining should be: +pageno, and the dvi name. Exit with - usage message if this is not the case. The following rather complicated - looping logic ensures that the first unknown option is regarded as dvi_name, - unless it's followed by another option, in which case it will result in an - `Unrecognized option' error. - */ - for (i = 0; i < argc - 1; i++) { /* argc - 1 because we're going to look at - argv[i + 1] to skip argv[0] */ - if (*(argv[i + 1]) == '+') { - if (info.page_arg != NULL) { - XDVI_ERROR((stderr, "Unrecognized option `%s'.", argv[i + 1])); - usage(EXIT_FAILURE); - } - else { - info.page_arg = argv[i + 1] + 1; - } - } - else if (file_name == NULL) { - file_name = xstrdup(argv[i + 1]); /* LEAK */ - } - else { - XDVI_ERROR((stderr, "Unrecognized option `%s'.", argv[i])); - usage(EXIT_FAILURE); - } - } - - DISP = XtDisplay(globals.widgets.top_level); - SCRN = XtScreen(globals.widgets.top_level); - -#ifdef GREY - XtSetTypeConverter(XtRString, XtRBool3, XdviCvtStringToBool3, - NULL, 0, XtCacheNone, NULL); -#endif - -#ifdef MOTIF - /* we'll take care of that ourselves */ - XtVaSetValues(globals.widgets.top_level, XmNdeleteResponse, XmDO_NOTHING, NULL); - - { - /* Hack to work around #884290 (drag&drop freezes file selector, see comment - in xm_filesel.c): Disable drag&drop altogether (we don't need it). - Could also be done via Xdefaults as follows: - XDvi*dragInitiatorProtocolStyle: XmDRAG_NONE - XDvi*dragReceiverProtocolStyle: XmDRAG_NONE - */ - Widget display = XmGetXmDisplay(DISP); - XtVaSetValues(display, - XmNdragInitiatorProtocolStyle, XmDRAG_NONE, - XmNdragReceiverProtocolStyle, XmDRAG_NONE, - NULL); - } -#else - G_accels_cr = XtParseAcceleratorTable("Return:set()notify()unset()\n" - "q:set()notify()unset()\n" - "Escape: set()notify()unset()"); -#endif - - /* get the no_init_file resource first: This needs to be done - * before the call to XtGetApplicationResources() below, which populates - * the `resource' struct with the actual application resources (which - * may be merged from ~/.xdvirc). */ - XtGetApplicationResources(globals.widgets.top_level, (XtPointer)&resource, - xdvirc_resources, XtNumber(xdvirc_resources), - (ArgList)NULL, 0); - - if (!resource.no_init_file) { /* Read user preferences from ~/.xdvirc. */ - read_user_preferences(globals.widgets.top_level, ".xdvirc"); - } - -#if COMMANDLINE_OVERRIDE_HACK /* see above */ - { - XrmDatabase cmdline_db = XrmGetDatabase(DISP); - XrmParseCommand(&cmdline_db, options, XtNumber(options), - "xdvi", &argc_bak, argv_bak); - - for (i = 0; i < argc_bak; i++) { - free(argv_bak[i]); - } - free(argv_bak); - argc_bak = 0; + { + String args[1]; + char mmode[LENGTH_OF_INT]; + snprintf(mmode, LENGTH_OF_INT, "%d", resource.mouse_mode); + args[0] = mmode; + XtCallActionProc(globals.widgets.top_level, "switch-mode", NULL, args, 1); } -#endif /* COMMANDLINE_OVERRIDE_HACK */ - - XtGetApplicationResources(globals.widgets.top_level, (XtPointer)&resource, - application_resources, XtNumber(application_resources), - (ArgList)NULL, 0); - if (resource.shrinkfactor == 0) /* protect against division by 0 */ - resource.shrinkfactor = 1; - currwin.shrinkfactor = resource.shrinkfactor; - globals.curr_use_color = resource.use_color; - globals.curr_gamma = resource.gamma; - globals.curr_paper = xstrdup(resource.paper); /* never free()d */ - globals.curr_editor = NULL; - globals.curr_browser = NULL; - - /* Initialize `globals.debug' as early as possible. Note: earlier - * calls to TRACE_* or tests for `if (globals.debug)' will only work if the - * XDVIDEBUG environment variable is set! - */ - globals.debug |= parse_debugging_option(resource.debug_arg); - kpathsea_debug = globals.debug / DBG_STAT; + /* go to home position on first page to honor -(side|top)margin flags */ + if (!resource.keep_flag) + home(False); - if (globals.debug) - fprintf(stderr, "KPATHSEA_DEBUG = %d\n", kpathsea_debug); - - kpse_init_prog("XDVI", resource.pixels_per_inch, resource.mfmode, resource.alt_font); - - kpse_set_program_name(argv[0], "xdvi"); - - - if (globals.debug & DBG_EXPAND) { - const char *texmfcnf = kpse_path_expand("$TEXMFCNF"); - const char *texmfmain = kpse_path_expand("$TEXMFMAIN"); - fprintf(stderr, "\n%s:%d: KPATHSEA variables:\n", __FILE__, __LINE__); - fprintf(stderr, "%s:%d: SELFAUTOLOC=\"%s\"\n", __FILE__, __LINE__, getenv("SELFAUTOLOC")); - fprintf(stderr, "%s:%d: SELFAUTODIR=\"%s\"\n", __FILE__, __LINE__, getenv("SELFAUTODIR")); - fprintf(stderr, "%s:%d: SELFAUTOPARENT=\"%s\"\n", __FILE__, __LINE__, getenv("SELFAUTOPARENT")); - fprintf(stderr, "%s:%d: TEXMFCNF=\"%s\"\n", __FILE__, __LINE__, texmfcnf); - fprintf(stderr, "%s:%d: TEXMFMAIN=\"%s\"\n\n", __FILE__, __LINE__, texmfmain); - } - - if (resource.regression) { - /* currently it just turns on everything; what we'd like here is - output that's usable for automatic diffs (e.g. independent - of window manager state) */ - globals.debug = DBG_ALL; - } - - /* Check early for whether to pass off to a different xdvi process - * (-sourceposition argument for reverse source special lookup). - */ - property_initialize(); - -#if 0 /* def RGB_ANTI_ALIASING */ - /* error checking and setting of resources according to command line arguments */ - if (resource.sub_pixels != NULL && memicmp(resource.sub_pixels, "unknown", 4) == 0) { -#ifdef __GNUC__ -#warning TODO: implement callbacks -#endif - choice_dialog_sized(globals.widgets.top_level, - MSG_QUESTION, - SIZE_MEDIUM, - NULL, -#ifndef MOTIF - NULL, /* TODO: xaw ret_action_str */ -#endif - NULL, NULL, /* pre callback */ - "Enable", NULL, NULL, - "Disable", NULL, NULL, - "This version of xdvi can optimize the anti-aliased font display " - "when running on an LCD monitor, such as a notebook screen or a TFT flat screen." - "\n\n" - "If you are using such a monitor, click `Enable' to enable optimized display; otherwise click `Disable'." - "\n\n" - "You can change this setting later via the Menu `Options -> Anti-Aliasing'."); - /* enter event loop */ - do_pages(); - } - else { -#endif - init_check_resources(); - - TRACE_FILES((stderr, "file history: |%s|", resource.file_history)); - file_history_init(); - - if (file_name == NULL) { /* no filename argument */ - - if (resource.no_file_arg_use_history) { - static char buf[LENGTH_OF_INT]; /* so that we can pass its address */ - int pageno; - if ((file_name = get_filename_from_history(&pageno)) != NULL) { - SNPRINTF(buf, LENGTH_OF_INT, "%d", pageno + 1); /* pageno is 0-based */ - info.page_arg = buf; - } - } - - TRACE_FILES((stderr, "got from history: |%s|", file_name)); - - if (file_name != NULL) { - run_dvi_file(file_name, &info); - } - else { /* get filename from file selector */ - static struct filesel_callback cb; /* static so that we can pass its address */ - cb.title = "Xdvi: Open file"; - cb.prompt = "Open file:"; - cb.ok = "OK"; - cb.cancel = "Cancel"; - cb.init_path = NULL; - cb.filemask = "*.dvi"; - cb.must_exist = True; - cb.exit_on_cancel = True; - cb.func_ptr = run_dvi_file; - cb.data = &info; - - XsraSelFile(globals.widgets.top_level, &cb); - /* enter event loop */ - do_pages(); - } - } - else if ((file_name2 = is_good_dvi_file(file_name, False)) != NULL) { - run_dvi_file(file_name2, &info); - } -#if 0 /* def RGB_ANTI_ALIASING */ - } -#endif - /* notreached */ - return 0; + do_pages(); } - diff --git a/Build/source/texk/xdvik/xdvi.h b/Build/source/texk/xdvik/xdvi.h index d029b887adf..e7d8c2e198e 100644 --- a/Build/source/texk/xdvik/xdvi.h +++ b/Build/source/texk/xdvik/xdvi.h @@ -52,35 +52,46 @@ in xdvi.c. /* in case stdlib.h doesn't define these ... */ #ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 +# define EXIT_SUCCESS 0 #endif + #ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 +# define EXIT_FAILURE 1 #endif #ifdef HAVE_WORKING_NL_LANGINFO_CODESET -# define USE_LANGINFO 1 +# define USE_LANGINFO 1 #else -# define USE_LANGINFO 0 +# define USE_LANGINFO 0 #endif #if HAVE_SYS_WAIT_H -# include +# include #endif + #ifndef WIFEXITED -# define WIFEXITED(status) (((status) & 255) == 0) +# define WIFEXITED(status) (((status) & 255) == 0) #endif + #ifndef WEXITSTATUS -# define WEXITSTATUS(status) ((unsigned)(status) >> 8) +# define WEXITSTATUS(status) ((unsigned)(status) >> 8) #endif + #ifndef WIFSIGNALED -# ifndef WIFSTOPPED -# define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) -# endif -# define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) +# ifndef WIFSTOPPED +# define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) +# endif +# define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) #endif + #ifndef WTERMSIG -# define WTERMSIG(status) ((status) & 0x7f) +# define WTERMSIG(status) ((status) & 0x7f) +#endif + +#if A4 +# define DEFAULT_PAPER "a4" +#else +# define DEFAULT_PAPER "us" #endif /* @@ -95,56 +106,58 @@ in xdvi.c. */ #define GS_PIXMAP_CLEARING_HACK 1 +/* + * Define to 1 if you want to use the experimental font creation code + */ +#define DELAYED_MKTEXPK 0 + #ifdef __hpux /* On HP-UX 10.10 B and 20.10, compiling with _XOPEN_SOURCE + ..._EXTENDED * leads to poll() not realizing that a file descriptor is writable in psgs.c. */ -# define _HPUX_SOURCE 1 +# define _HPUX_SOURCE 1 #else -# ifndef _XOPEN_SOURCE -# define _XOPEN_SOURCE 600 -# endif -# define _XOPEN_SOURCE_EXTENDED 1 -# define __EXTENSIONS__ 1 /* needed to get struct timeval on SunOS 5.5 */ -# define _SVID_SOURCE 1 /* needed to get S_IFLNK in glibc */ -# define _BSD_SOURCE 1 /* needed to get F_SETOWN in glibc-2.1.3 */ +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 600 +# endif +# define _XOPEN_SOURCE_EXTENDED 1 +# define __EXTENSIONS__ 1 /* needed to get struct timeval on SunOS 5.5 */ +# define _SVID_SOURCE 1 /* needed to get S_IFLNK in glibc */ +# define _BSD_SOURCE 1 /* needed to get F_SETOWN in glibc-2.1.3 */ #endif /* Some O/S dependent kludges. */ #ifdef _AIX -# define _ALL_SOURCE 1 +# define _ALL_SOURCE 1 #endif /* just a kludge, no real portability here ... */ #define DIR_SEPARATOR '/' #if STDC_HEADERS -# include -# include +# include +# include /* the following works around the wchar_t problem */ -# include -# if HAVE_X11_XOSDEFS_H -# include -# endif -# ifdef X_NOT_STDC_ENV -# undef X_NOT_STDC_ENV -# undef X_WCHAR -# include -# define X_NOT_STDC_ENV -# endif +# include +# if HAVE_X11_XOSDEFS_H +# include +# endif +# ifdef X_NOT_STDC_ENV +# undef X_NOT_STDC_ENV +# undef X_WCHAR +# include +# define X_NOT_STDC_ENV +# endif #endif /* STDC_HEADERS */ -#ifdef HAVE_STDINT_H -# include -#endif - /* For wchar_t et al., that the X files might want. */ #include "kpathsea/systypes.h" #include "kpathsea/c-memstr.h" #ifdef HAVE_SYS_PARAM_H -#include /* this should define MAXPATHLEN */ +# include /* this should define MAXPATHLEN */ #endif + #include "kpathsea/c-pathmx.h" /* get fallback for PATH_MAX if all else fails */ #include /* include Xfuncs.h, if available */ @@ -155,75 +168,72 @@ in xdvi.c. #include #ifndef MAXPATHLEN -# ifdef PATH_MAX -# define MAXPATHLEN PATH_MAX -# else -# define MAXPATHLEN 1024 -# endif -#endif - -#if defined(CFG2RES) && !defined(SELFAUTO) -# define SELFAUTO 1 -#endif - -#if defined(SELFAUTO) && !defined(DEFAULT_CONFIG_PATH) -# define DEFAULT_CONFIG_PATH "$SELFAUTODIR:$SELFAUTOPARENT" +# ifdef PATH_MAX +# define MAXPATHLEN PATH_MAX +# else +# define MAXPATHLEN 1024 +# endif #endif -/* NOTE: we don't use CFGFILE */ - -typedef char Bool3; /* Yes/No/Maybe */ - +typedef char Bool3; /* Yes/No/Maybe */ #define True 1 #define False 0 #define Maybe 2 #ifdef DEBUG -#include +# include extern unsigned long time_start, time_end; #endif #include /* get WORD64 and LONG64 */ #ifndef WORD64 -# ifdef LONG64 +# ifdef LONG64 typedef unsigned int xuint32; -# else +# else typedef unsigned long xuint32; -# endif +# endif +#endif + +#if defined(HAVE_STDINT_H) +#include +#elif defined(HAVE_INTTYPES_H) +#include #endif /* for unused parameters */ #ifndef UNUSED -#define UNUSED(x) ((void)(x)) +# define UNUSED(x) ((void)(x)) #endif #include #ifdef VMS -#define index strchr -#define rindex strrchr -#define bzero(a, b) (void) memset ((void *) (a), 0, (size_t) (b)) -#define bcopy(a, b, c) (void) memmove ((void *) (b), (void *) (a), (size_t) (c)) +# define index strchr +# define rindex strrchr +# define bzero(a, b) (void) memset ((void *) (a), 0, (size_t) (b)) +# define bcopy(a, b, c) (void) memmove ((void *) (b), (void *) (a), (size_t) (c)) #endif #include #include #if HAVE_UNISTD_H -# include +# include #endif /* all of these are POSIX and should have been defined by unistd.h: */ #ifndef STDIN_FILENO -#define STDIN_FILENO 0 +# define STDIN_FILENO 0 #endif + #ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 +# define STDOUT_FILENO 1 #endif + #ifndef STDERR_FILENO -#define STDERR_FILENO 2 +# define STDERR_FILENO 2 #endif /* see C FAQ; additional +1 for '\0' */ @@ -236,26 +246,27 @@ typedef unsigned long xuint32; extern KPSEDLL char *kpathsea_version_string; #ifndef NeedFunctionPrototypes -# if __STDC__ -# define NeedFunctionPrototypes 1 -# else -# define NeedFunctionPrototypes 0 -# endif +# if __STDC__ +# define NeedFunctionPrototypes 1 +# else +# define NeedFunctionPrototypes 0 +# endif #endif #ifndef NeedWidePrototypes -# define NeedWidePrototypes NeedFunctionPrototypes +# define NeedWidePrototypes NeedFunctionPrototypes #endif #ifndef NeedVarargsPrototypes -# define NeedVarargsPrototypes NeedFunctionPrototypes +# define NeedVarargsPrototypes NeedFunctionPrototypes #endif #include "kpathsea/c-vararg.h" +#include "kpathsea/c-fopen.h" #ifndef _XFUNCPROTOBEGIN -# define _XFUNCPROTOBEGIN -# define _XFUNCPROTOEND +# define _XFUNCPROTOBEGIN +# define _XFUNCPROTOEND #endif @@ -270,27 +281,15 @@ extern KPSEDLL char *kpathsea_version_string; /* FUNCPROTO is a bitmask specifying ANSI conformance (see Xfuncproto.h). The single bits specify varargs, const availability, prototypes etc.; we enable everything here. */ -# define FUNCPROTO (-1) +# define FUNCPROTO (-1) #endif #ifndef VOLATILE -# if __STDC__ || (defined(__stdc__) && defined(__convex__)) -# define VOLATILE volatile -# else -# define VOLATILE /* as nothing */ -# endif -#endif - -#ifndef NORETURN -# ifdef __GNUC__ -# ifndef __STRICT_ANSI__ -# define NORETURN volatile +# if __STDC__ || (defined(__stdc__) && defined(__convex__)) +# define VOLATILE volatile # else -# define NORETURN /* as nothing */ +# define VOLATILE /* as nothing */ # endif -# else -# define NORETURN /* as nothing */ -# endif #endif #ifndef OPEN_MODE @@ -298,49 +297,49 @@ extern KPSEDLL char *kpathsea_version_string; * SU, 2001/01/07: xdvi defines OPEN_MODE as "r" or as "r", "ctx=stm" (for VMS), * but we use the definition of FOPEN_R_MODE from kpathsea/c-fopen.h instead: */ -# define OPEN_MODE FOPEN_R_MODE +# define OPEN_MODE FOPEN_R_MODE #endif /* OPEN_MODE */ #ifndef VMS -# define OPEN_MODE_ARGS const char * +# define OPEN_MODE_ARGS const char * #else -# define OPEN_MODE_ARGS const char *, const char * +# define OPEN_MODE_ARGS const char *, const char * #endif #ifndef __LINE__ -# define __LINE__ 0 +# define __LINE__ 0 #endif #ifndef __FILE__ -# define __FILE__ "?" +# define __FILE__ "?" #endif #define MAXDIM 32767 typedef unsigned char ubyte; -#if NeedWidePrototypes +/* #if NeedWidePrototypes */ /* bug #1570481 */ typedef unsigned int wide_ubyte; typedef int wide_bool; -#else -typedef ubyte wide_ubyte; -typedef Boolean wide_bool; -#endif +/* #else */ +/* typedef ubyte wide_ubyte; */ +/* typedef Boolean wide_bool; */ +/* #endif */ #if defined(MAKEPK) && !defined(MKTEXPK) -# define MKTEXPK 1 +# define MKTEXPK 1 #endif -#define spell_conv0(n, f) ((long) (n * f)) -#define spell_conv(n) spell_conv0(n, dimconv) +#define spell_conv0(n, f) ((long) (n * f)) +#define spell_conv(n) spell_conv0(n, dimconv) typedef BMTYPE bmTypeT; typedef unsigned BMTYPE bmUnitT; /* #define BMUNIT unsigned BMTYPE */ -#define BMBITS (8 * BMBYTES) /* number of bits in a bmTypeT */ +#define BMBITS (8 * BMBYTES) /* number of bits in a bmTypeT */ -#define ADD(a, b) ((bmUnitT *) (((char *) a) + b)) -#define SUB(a, b) ((bmUnitT *) (((char *) a) - b)) +#define ADD(a, b) ((bmUnitT *) (((char *) a) + b)) +#define SUB(a, b) ((bmUnitT *) (((char *) a) - b)) extern bmUnitT bit_masks[BMBITS + 1]; @@ -349,6 +348,7 @@ extern bmUnitT bit_masks[BMBITS + 1]; #define INSIDE_MANE_WIN ((currwin.win == mane.win)) #define MAGNIFIER_ACTIVE ((magnifier.win != 0)) +/* #define MAGNIFIER_ACTIVE ((globals.cursor.flags & CURSOR_MAG)) */ #define mane_base_x 0 #define mane_base_y 0 @@ -380,19 +380,54 @@ typedef setcharRetvalT (*set_char_proc) ( #define ROUNDUP(x,y) (((x)+(y)-1)/(y)) #ifndef BDPI -#define BDPI 600 +# define BDPI 600 #endif #if defined(GS_PATH) && !defined(PS_GS) -# define PS_GS 1 +# define PS_GS 1 #endif #if defined(PS_DPS) || defined(PS_NEWS) || defined(PS_GS) -# define PS 1 +# define PS 1 #else -# define PS 0 +# define PS 0 #endif +#ifdef MOTIF +# include + +/* Note: non-k xdvi has MOTIF_TIMERS here, we use XDVI_XT_TIMER_HACK instead (see above) */ + +# ifndef DDIST +# define DDIST 4 +# endif +# ifndef DDIST_MAJOR +# define DDIST_MAJOR 10 +# endif +# ifndef DDIST_MINOR +# define DDIST_MINOR 5 +# endif + +extern XmStringCharSet G_charset; + +/* + * Whether to use some widgets which are only available with Motif 2.0. + * In these cases, the LessTif versions are either buggy or visually + * inferior (as of lesstif-0.93.18), in which case suitable replacements + * should be used; e.g. cascade button or a textfield plus button for + * a combobox, or a textfield plus button for a spinbox. + */ +# if XmVersion >= 2000 && !defined(LESSTIF_VERSION) +# define USE_COMBOBOX 1 +# define Xdvi_COMBO_BOX_ARROW_SIZE 15 /* the default arrows are *way* too big */ +# define USE_SPINBOX 1 +# else +# define USE_COMBOBOX 0 +# define USE_SPINBOX 0 +# endif + +#endif /* MOTIF */ + typedef enum { XPRT_SHOW_NONE = 0U, XPRT_SHOW_STATUSLINE = 1, @@ -405,16 +440,22 @@ typedef enum { #else XPRT_SHOW_BUTTONS = 4, XPRT_SHOW_ALL = 7 -#endif +#endif /* MOTIF */ } expertFlagT; typedef enum { - MOUSE_MAGNIFIER_MODE, - MOUSE_TEXT_MODE, - MOUSE_RULER_MODE, - MOUSE_MAX_MODE + MOUSE_MODE1, + MOUSE_MODE2, + MOUSE_MODE3, + MOUSE_MODE_MAX } mouseModeT; +typedef enum { + NO_MODE_ACTIVE, + RULER_MODE_ACTIVE, + TEXT_MODE_ACTIVE +} modeFlagT; + /* SUBPIXEL_NONE for no subpixel rendering, otherwise order of subpixels (from option/resource subPixels) */ typedef enum { SUBPIXEL_NONE, SUBPIXEL_RGB, SUBPIXEL_BGR } subpixelOrderT; @@ -430,14 +471,24 @@ extern struct x_resources { const char *windowsize; Boolean remember_windowsize; int app_defaults_fileversion; - int mouse_mode; + mouseModeT mouse_mode; Boolean use_tex_pages; int shrinkfactor; const char *main_translations; - const char *wheel_translations; + const char *mouse_translations; +/* const char *wheel_translations; */ int wheel_unit; int density; Boolean omega; + const char *mouse_mode1_name; + const char *mouse_mode1_description; + int mouse_mode1_cursor; + const char *mouse_mode2_name; + const char *mouse_mode2_description; + int mouse_mode2_cursor; + const char *mouse_mode3_name; + const char *mouse_mode3_description; + int mouse_mode3_cursor; #ifdef GREY float gamma; /* float inverted_factor; */ @@ -481,9 +532,11 @@ extern struct x_resources { Boolean list_fonts; Boolean reverse; Boolean warn_spec; + Boolean hush; Boolean hush_chars; Boolean hush_chk; Boolean hush_stdout; + Boolean hush_bell; Boolean safer; #ifdef VMS const char *fore_color; @@ -504,24 +557,24 @@ extern struct x_resources { #ifdef PS int postscript; Boolean allow_shell; -# ifdef PS_DPS +# ifdef PS_DPS Boolean useDPS; -# endif -# ifdef PS_NEWS +# endif +# ifdef PS_NEWS Boolean useNeWS; -# endif -# ifdef PS_GS +# endif +# ifdef PS_GS Boolean useGS; Boolean gs_safer; Boolean gs_alpha; const char *gs_path; const char *gs_palette; int gs_timeout; -# endif -# ifdef MAGICK +# endif +# ifdef MAGICK Boolean useMAGICK; const char *magick_cache; -# endif +# endif #endif /* PS */ Boolean prescan; Boolean use_temp_fp; @@ -551,7 +604,7 @@ extern struct x_resources { int tooltips_wait_period; /* used for communication with Tip.c */ int tooltips_wait_period_bak; /* uncustomized value */ Boolean show_tooltips; -#endif +#endif /* MOTIF */ Boolean pagelist_highlight_current; Dimension pagelist_width; const char *mg_arg[5]; @@ -571,6 +624,7 @@ extern struct x_resources { const char *dvips_options_str; int default_saving_format; int default_printing_target; + int grid_mode; char *rule_color; Pixel rule_pixel; int link_style; @@ -579,10 +633,16 @@ extern struct x_resources { char *browser; #ifdef MOTIF char *prefs_browser_list; -#endif +# if USE_COMBOBOX + char *search_history; + int search_history_size; +# endif +#endif /* MOTIF */ char *unknown_mime_suffix; char *no_mime_suffix; char *anchor_pos; + /* whether to open file in new window from file selector (only for DVI files) */ + Boolean filesel_open_new_window; /* bitmask of current search window settings */ unsigned int search_window_defaults; /* char * _scroll_pages; */ @@ -598,7 +658,7 @@ extern struct x_resources { int page_history_size; } resource; -extern void reload_app_resources(void); +extern void load_app_resources(Boolean also_pixels); struct WindowRec { @@ -643,31 +703,34 @@ struct gc_info { Boolean do_copy; }; -/* values of cursor flags */ -#define CURSOR_LINK 1 -#define CURSOR_MAG 2 -/* flags for drag cursors */ -#define CURSOR_DRAG_V 4 -#define CURSOR_DRAG_H 8 -#define CURSOR_DRAG_A 16 -#define CURSOR_CORRUPTED 32 /* if file is corrupted */ -#define CURSOR_TEXT 64 - +/* flags for special cursor states */ +#define CURSOR_LINK 1 /* hyperlink */ +#define CURSOR_MAG 2 /* magnifier is mapped */ +#define CURSOR_DRAG_V 4 /* vertical dragging */ +#define CURSOR_DRAG_H 8 /* horizontal dragging */ +#define CURSOR_DRAG_A 16 /* dragging in any direction */ +#define CURSOR_CORRUPTED 32 /* DVI file corrupted */ +#define CURSOR_TEXT 64 /* DVI file corrupted */ +#define CURSOR_RULER 128 /* DVI file corrupted */ + +/* cursors for all states */ struct cursor_info { + Cursor mode1; + Cursor mode2; + Cursor mode3; + Cursor wait; - Cursor ready; Cursor corrupted; + /* hyperlink */ Cursor link; - Cursor rule; - Cursor mag; /* horizontal/vertical/all directions drag */ Cursor drag_h; Cursor drag_v; Cursor drag_a; /* support for `pause' feature */ Cursor pause; - /* text selection */ - Cursor text; + /* empty cursor */ + Cursor empty; /* one of the flags defined above */ unsigned long flags; @@ -710,8 +773,9 @@ struct dvi_file_info { * as a replacement for global variables: */ extern struct program_globals { + XtAppContext app; const char *program_name; /* argv[0] without the directory part */ - const char *xdvi_dir; /* directory where xdvi is running in (for childs who need to change back to it) */ + const char *cwd; /* directory where xdvi is running in (for childs who need to change back to it) */ char *dvi_name; /* dvi file name, fully expanded with REALPATH */ Boolean load_init_file; /* whether to read/save ~/.xdvirc */ char *orig_locale; /* original locale we are running in */ @@ -725,6 +789,9 @@ extern struct program_globals { also contains the offset that user has set via Act_declare_page_number() */ int pageno_correct; + /* paper unit used for grid mode */ + unsigned int grid_paper_unit; + /* whether we warn about unrecognized specials. Copy of resource.warn_spec value, set to False in the drawing routine to reduce the amount of warnings given. Better maybe replace with hash lookup similar to fonts warnings? */ @@ -737,6 +804,7 @@ extern struct program_globals { float curr_gamma; Boolean curr_use_color; + modeFlagT curr_mode; /* forward search info */ struct src_info src; @@ -772,10 +840,6 @@ extern struct WindowRec mane; extern struct WindowRec currwin; extern struct WindowRec magnifier; -#ifdef MOTIF -#include -extern XmStringCharSet G_charset; -#endif extern XtAppContext app; extern char *dvi_property; /* for setting in window */ @@ -793,9 +857,9 @@ extern Visual *G_visual; extern unsigned int G_depth; extern Colormap G_colormap; #else -# define G_depth (unsigned int) DefaultDepthOfScreen(SCRN) -# define G_visual DefaultVisualOfScreen(SCRN) -# define G_colormap DefaultColormapOfScreen(SCRN) +# define G_depth (unsigned int) DefaultDepthOfScreen(SCRN) +# define G_visual DefaultVisualOfScreen(SCRN) +# define G_colormap DefaultColormapOfScreen(SCRN) #endif @@ -888,10 +952,10 @@ struct fgrec { struct rgb color; Boolean pixel_good; /* if the pixel entry is valid */ Pixel pixel; -#if GREY +# if GREY Boolean palette_good; /* if the palette entry is valid */ Pixel palette[16]; /* non-TrueColor only */ -#endif +# endif }; extern struct rgb fg_initial; /* Initial fg (from command line) */ @@ -914,6 +978,8 @@ extern Boolean dvi_file_corrupted; extern short magnifier_stat; /* 1 = wait for expose, -1 = destroy upon expose */ +extern void run_dvi_file(const char *filename, void *data); + /* ================================================================================ globals from dvi-draw.c @@ -965,9 +1031,9 @@ extern Boolean ignore_papersize_specials; extern Boolean have_raw_postscript; #if PS extern struct psprocs psp, no_ps_procs; -#ifdef PS_GS +# ifdef PS_GS extern Boolean had_ps_specials; -#endif +# endif #endif #ifdef MAGICK @@ -980,7 +1046,6 @@ extern int bbox_voffset; #endif /* globals from statusline.h */ -extern int global_statusline_h; /* height of statusline, or 0 */ extern Widget statusline; @@ -990,10 +1055,10 @@ extern Widget statusline; * under XAW, it's the parent of mane.win. */ #ifdef MOTIF -# define CURSORWIN mane.win +# define CURSORWIN mane.win #else /* # define CURSORWIN XtWindow(globals.widgets.form_widget) */ -# define CURSORWIN mane.win +# define CURSORWIN mane.win #endif @@ -1003,38 +1068,25 @@ extern Widget statusline; * See the comment in events.c for further explanations. */ #if LD_ALLOWS_MULTIPLE_DEFINITIONS -# define XDVI_XT_TIMER_HACK 1 +# define XDVI_XT_TIMER_HACK 1 #else -# define XDVI_XT_TIMER_HACK 0 -#endif - -/* globally used GUI stuff */ -#ifdef MOTIF -#include -/* Note: non-k xdvi has MOTIF_TIMERS here, we use XDVI_XT_TIMER_HACK instead (see above) */ - -# ifndef DDIST -# define DDIST 4 -# endif -# ifndef DDIST_MAJOR -# define DDIST_MAJOR 10 -# endif -# ifndef DDIST_MINOR -# define DDIST_MINOR 5 -# endif +# define XDVI_XT_TIMER_HACK 0 #endif extern const char **get_paper_types(void); extern size_t get_paper_types_size(void); -extern size_t get_magglass_items(void); -extern int get_magglass_width(int idx); -extern int get_magglass_height(int idx); +extern void register_font_popup(void); +extern void unregister_font_popup(void); +struct startup_info { + int file_idx; + char *page_arg; +}; #ifdef STATUSLINE /* this is only for the initialization; the statusline will reset it to a more adequate value: */ -# define XTRA_H 17 +# define XTRA_H 17 #endif /* @@ -1058,14 +1110,6 @@ struct geom_info { void *geom_data; }; -#ifdef CFG2RES -struct cfg2res { - const char *cfgname; /* name in config file */ - const char *resname; /* name of resource */ - Boolean numeric; /* if numeric */ -}; -#endif - #define get_byte(fp) ((unsigned char)getc(fp)) #define get_lbyte(fp) ((long)get_byte(fp)) @@ -1095,25 +1139,45 @@ extern void motif_translations_hack(void); http://sourceforge.net/tracker/?group_id=23164&atid=377580\n" #if HAVE_ICONV && HAVE_ICONV_H -#undef HAVE_ICONV_H -#define HAVE_ICONV_H 1 +# undef HAVE_ICONV_H +# define HAVE_ICONV_H 1 #else -#undef HAVE_ICONV_H -#define HAVE_ICONV_H 0 +# undef HAVE_ICONV_H +# define HAVE_ICONV_H 0 #endif #if HAVE_GOOD_SETSID_VFORK -# if HAVE_VFORK_H -# include -# endif +# if HAVE_VFORK_H +# include +# endif #else /* HAVE_GOOD_SETSID_VFORK */ /* Mac OS X 10.3 (Panther) (11/2003) doesn't allow setsid() within vfork() */ -# undef vfork -# define vfork fork +# undef vfork +# define vfork fork #endif /* HAVE_GOOD_SETSID_VFORK */ -/* enable following if you get unresolved messages about `iconv_open' etc.: */ + +/* XawtextScrollWhenNeeded has been ditched in Xaw7 + (e.g. Xfree >= 4.x); from the man page: + + The value XawtextScrollWhenNeeded (and whenNeeded, recognized by + the converter), is accepted for backwards compatibilty with + resource specifications written for the Xaw6 Text widget, but + ignored (effectively treated as XawtextScrollNever). + + So we're forced to use `scrollAlways' here. +*/ +#define XAW_SCROLL_ALWAYS XawtextScrollAlways + +/* the reconfig stuff has been fixed in XFree 4.1.0, vendor release 6510 (Slackware 8.0) */ +#define BROKEN_RECONFIG (( \ + (strstr(ServerVendor(DISP), "XFree") != NULL) \ + && VendorRelease(DISP) >= 4000 \ + && VendorRelease(DISP) < 4002 \ + )) + +/* enable the following if you're getting unresolved messages about `iconv_open' etc.: */ #if 0 #define LIBICONV_PLUG #define iconv_open libiconv_open diff --git a/Build/source/texk/xdvik/xdvizilla b/Build/source/texk/xdvik/xdvizilla index 54f4b03ddfe..fb0005085af 100755 --- a/Build/source/texk/xdvik/xdvizilla +++ b/Build/source/texk/xdvik/xdvizilla @@ -36,6 +36,7 @@ progname=xdvizilla do_cleanup() { +exit 0 exitval=$? if [ -z "$NO_RM" -a -n "$IN_FILE" ] ; then rm -f "$IN_FILE" @@ -58,11 +59,48 @@ usage() exit 1 } + +# Solaris' file command fails to identify DVI files (bug #1508963), +# so add an extra check for these; otherwise, output result of 'file' command. +get_filetype() +{ + f="$1" + have_solaris=`uname -a | grep -i sunos` + if [ "$have_solaris"xxx = "xxx" ] + then + ret=`file "$f"` + else + # we're on solaris, get first 2 bytes of file + magic=`od -N 2 -x "$f" | cut -d ' ' -f 2 | sed 1q | tr 'ABCDEF' 'abcdef'` + case "$magic" in + "f702" | "02f7") + ret="TeX DVI file" + ;; + *) + ret=`file "$f"` + ;; + esac + fi + echo "$ret" +} + trap 'do_cleanup' 1 2 3 7 13 15 ### create a temporary directory only read/writable by user -TMP_DIR=${TMPDIR-${TEMP-${TMP-/tmp}}}/$progname.$$ -(umask 077; mkdir "$TMP_DIR") || do_abort "Could not create directory \`$TMP_DIR'" +### try mktemp if it's available +TMP_DIR=${TMPDIR-${TEMP-${TMP-/tmp}}}/${progname}.XXXXXX +TMP_DIR=`mktemp -d "$TMP_DIR" 2> /dev/null` +if [ $? -ne 0 ]; then + ### fall back to unsafe creation + TMP_DIR=${TMPDIR-${TEMP-${TMP-/tmp}}}/${progname}.$$ + (umask 077; mkdir "$TMP_DIR") || do_abort "Could not create directory \`$TMP_DIR'" +fi + +### we hard-wire the magic for DVI files here since some "file" implementations +### (e.g. on Solaris 9) don't recognize DVI files (bug #1508963) +TMP_MAGIC_FILE="$TMP_DIR"/tmp-magic +### Note: 3 tabs in the following line! +echo '0 string \367\002 TeX DVI file' > "$TMP_MAGIC_FILE" if [ $# -gt 1 -a "x$1" = "x-no-rm" ]; then NO_RM=y @@ -83,13 +121,16 @@ else DIR= fi +# set -x + # need to preserve IN_FILE for eventual deletion IN_FILE="$1" TMP_FILE="$IN_FILE" while [ 1 ]; do [ -f "$TMP_FILE" ] || do_abort "$TMP_FILE: File not found." - FILETYPE=`file "$TMP_FILE"` + #FILETYPE=`file -m "$TMP_MAGIC_FILE" "$TMP_FILE"` + FILETYPE=`get_filetype "$TMP_FILE"` case "$FILETYPE" in *"gzip compressed data"*) out="$TMP_DIR"/tmp-gz diff --git a/Build/source/texk/xdvik/xserver-info.c b/Build/source/texk/xdvik/xserver-info.c index 328df938161..c4ca96ec7e2 100644 --- a/Build/source/texk/xdvik/xserver-info.c +++ b/Build/source/texk/xdvik/xserver-info.c @@ -3,30 +3,30 @@ */ /* -Copyright 1988, 1998 The Open Group + Copyright 1988, 1998 The Open Group -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Jim Fulton, MIT X Consortium - */ + Except as contained in this notice, the name of The Open Group shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from The Open Group. + * + * Author: Jim Fulton, MIT X Consortium + */ #include "xdvi.h" #include "xserver-info.h" -- cgit v1.2.3