# This is a patch for xemacs-21.5.6 to update it to xemacs-21.5.7 # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # If you have a decent Bourne-type shell: # STEP 2: Run the shell with this file as input. # If you don't have such a shell, you may need to manually create/delete # the files as shown below. # STEP 3: Run the 'patch' program with this file as input. # # These are the commands needed to create/delete files/directories: # rm -f './src/ntproc.c' rm -f './src/README.integral-types' rm -f './nt/xemacs-vc50.dsw' rm -f './nt/xemacs-vc50.dsp' rm -f './nt/minitar.mak' rm -f './lisp/mule/custom-load.el' rm -f './lisp/mule/auto-autoloads.el' rm -f './lisp/custom-load.el' rm -f './lisp/auto-autoloads.el' rm -f './.#version.sh.1.173' touch './lib-src/winclient.c' chmod 0644 './lib-src/winclient.c' touch './lisp/post-gc.el' chmod 0644 './lisp/post-gc.el' touch './netinstall/init.cc' chmod 0644 './netinstall/init.cc' touch './src/README.global-renaming' chmod 0644 './src/README.global-renaming' touch './src/console-gtk-impl.h' chmod 0644 './src/console-gtk-impl.h' touch './src/console-impl.h' chmod 0644 './src/console-impl.h' touch './src/console-msw-impl.h' chmod 0644 './src/console-msw-impl.h' touch './src/console-stream-impl.h' chmod 0644 './src/console-stream-impl.h' touch './src/console-tty-impl.h' chmod 0644 './src/console-tty-impl.h' touch './src/console-x-impl.h' chmod 0644 './src/console-x-impl.h' touch './src/device-impl.h' chmod 0644 './src/device-impl.h' touch './src/extents-impl.h' chmod 0644 './src/extents-impl.h' touch './src/frame-impl.h' chmod 0644 './src/frame-impl.h' touch './src/libinterface.c' chmod 0644 './src/libinterface.c' touch './src/libinterface.h' chmod 0644 './src/libinterface.h' touch './src/objects-gtk-impl.h' chmod 0644 './src/objects-gtk-impl.h' touch './src/objects-impl.h' chmod 0644 './src/objects-impl.h' touch './src/objects-msw-impl.h' chmod 0644 './src/objects-msw-impl.h' touch './src/objects-tty-impl.h' chmod 0644 './src/objects-tty-impl.h' touch './src/objects-x-impl.h' chmod 0644 './src/objects-x-impl.h' touch './src/window-impl.h' chmod 0644 './src/window-impl.h' touch './tests/automated/weak-tests.el' chmod 0644 './tests/automated/weak-tests.el' touch './version.sh~' chmod 0644 './version.sh~' # # This command terminates the shell and need not be executed manually. exit # #### End of Preamble #### #### Patch data follows #### diff --text -u 'xemacs-21.5.6/CHANGES-beta' 'xemacs-21.5.7/CHANGES-beta' Index: ././CHANGES-beta --- ././CHANGES-beta Fri Apr 5 16:36:18 2002 +++ ././CHANGES-beta Tue Jul 2 21:12:13 2002 @@ -1,3 +1,183 @@ +to 21.5.7 "broccoflower" + +CHANGES now uses @xemacs.org alias to identify contributors. If the +contributor doesn't have one (that I know about), the full name from +the ChangeLog is used. + +UI changes and runtime bugs + +-- Add: ask "yes/no/diff" question when recovering; known problem: dialog + is modal, so you can't scroll the diff -- ben +-- Add: balloon help for package-ui -- youngs +-- Add: global-abbrev-mode, defining-abbrev-turns-on-abbrev-mode -- ben +-- Add: lots of new menubar items -- ben +-- Add: new winclient for MS Windows -- acs +-- Add: option kill-word-into-kill-ring controls whether words are "cut" + into the kill ring, or "cleared" into nothingness -- ben +-- Add: revert-buffer optimization for unchanged files -- andy +-- Add: undo-all-changes back to the beginning -- ben +-- Fix: M-C-backslash does indent-region-or-balanced-expression, S-Tab + inserts a TAB char -- ben +-- Fix: Cmds menu so that most used commands appear directly on the menu and + less used commands appear in submenus -- ben +-- Fix: NILP(lim) crash in search.c -- mike +-- Fix: STACK_TRACE_EYE_CATCHER now visible in MS Windows traces -- jonathan +-- Fix: XmProcessTraversal crash -- stephen +-- Fix: avoid infinite loop in extent code -- ben +-- Fix: crash due to errant xfree() -- ben +-- Fix: crash in gtk_popup_menu -- wmperry +-- Fix: crashes due to excessive alloca -- ben +-- Fix: detection of metric units on MS Windows -- jonathan +-- Fix: don't output bell as ^G in console-stream when not a TTY -- ben +-- Fix: improve MS Windows printer support -- andy +-- Fix: improve appearance for gutters and dialogs -- andy +-- Fix: improve lisp-mode indentation handling -- ben +-- Fix: interprogram cut functions now don't add selection twice -- stephen +-- Fix: many netinstaller improvements -- andy +-- Fix: popup dialogs on MS Windows -- andy +-- Fix: recover-session only shows session files with recoverable files, + and in chronological order -- ben +-- Fix: save customized values MUCH faster and in alphabetic order, + custom-save-pretty-print turns on/off pretty-printing values + -- Nickolay Pakoulin +-- Fix: semicolons inside strings are not comments in lisp-mode -- ben +-- Fix: short filename handling on Windows -- Peter Arius +-- Fix: some crashes in syntax code -- ben +-- Fix: some crashes with multibyte text -- ben +-- Fix: two frames displaying the buffer, in different places; in one, + temporarily switch away to another buffer and then back, and your position + has been reset to the other one in the other frame -- ben +-- Fix: update installed.db after updating packages -- andy + +Documentation + +-- Add: New FAQs -- stephen, adrian +-- Add: New or improved code and documentation in sample.init.el -- ben, + stephen +-- Add: PROBLEMS: Hannibal Lecter crash, EFS AUTH failure, mail locking + -- stephen +-- Add: etc/TUTORIAL.se -- Mats Lidell +-- Add: new Internals manual nodes -- ben, stephen, darrylo +-- Add: why modules don't use RTLD_GLOBAL -- james +-- Fix: README.integral-types doc moved to Internals, code moved to + README.global-renaming -- ben +-- Fix: README.packages: info about --package-path -- ben +-- Fix: improve docstrings and comments -- ben, stephen, adrian, + John H. Palmieri +-- Fix: typos, minor updates -- stephen, I. N. Golubev, Frank Schmitt, + adrian, youngs +-- Fix: update etc/BETA -- Jarl Friis +-- Fix: update etc/package-index.LATEST.pgp -- youngs +-- Fix: update photos -- hniksic + +Lisp API + +-- Add: functions: args-out-of-range, argument-in-range-p, + check-argument-range, indent-balanced-expression-function, + indent-balanced-expression, indent-region-or-balanced-expression, + image-instance-instantiator, truncate-string-with-continuation-dots, + get-user-response, unicode-precedence-list -- ben, stephen +-- Fix: GNU synchs of frame-parameter, makehash, buffer-local-value, + line-beginning-position, line-end-position, with-temp-message, + bound-and-true-p, propertize, delete-and-extract-region, add-to-list, + string-to-char-list, find-non-ascii-charset-region, + find-non-ascii-charset-string, truncate-string-to-width, plist-to-alist, + kill-ring-max, kill-new + -- John Paul Wallington, youngs, ben, james + set-frame-pixel-width, set-frame-pixel-size -- andy +-- Add: args to map-specifier, various "heuristic" specifier functions -- ben +-- Fix: call-process moves to Lisp -- ben + -- allows a buffer to be specified for input and stderr output + -- use it on all systems + -- implement C-g as documented + -- clean up and comment + -- call-process-region uses new call-process facilities; no temp file. + -- remove duplicate funs +-- Add: compat.el, preliminary (not working) code -- ben +-- Add: handle subprocess stderr separately (src/ChangeLog 2002-05-28) -- ben +-- Add: new error trapping mechanism (src/ChangeLog 2002-05-28) -- ben +-- Add: pixel-based sizing APIs: set-frame-pixel-height, +-- Add: preliminary support for ELL autoloads -- james +-- Add: toolbar face -- wmperry +-- Add: widget "logical-unit" sizing APIs: widget-logical-to-character-width, + widget-logical-to-character-height -- andy +-- Fix: paths-find-architecture-directory searches in + `system-configuration'/`base', not `base'`system-configuration' -- james +-- Fix: default CRLF conversion of process output off -- ben +-- Fix: default value of gethash to Qunbound -- ben +-- Fix: face-handling code (superseded by ben's overhaul) -- jan, andy +-- Fix: layout improvements -- andy +-- Fix: major overhaul of face-handling code -- ben + -- avoid truenaming fonts + -- msw-faces.el APIs now accept names and font instances, return names + -- rewrite frobbing functions in faces.el + -- don't duplicatively set a global specification for the default font + -- remove redundant face lists from x-faces.el and msw-faces.el + -- call init-global-faces under MS Windows! + -- correct weight names in font.el. + +Internals + +-- Add: new APIs -- ben + -- macros to GCPRO arrays + -- default argument for char tables + -- signal extent changes + -- internal_bind_*, check_specbind_stack_sanity + -- partial support for 8-, 16-, and 32-bit fixed-width text + -- new cons treatment (src/ChangeLog 2002-05-28) + -- rename character types to Itext, Ibyte, Ichar (src/ChangeLog 2002-06-05) + -- rename various identifiers for consistency +-- Add: New GC preparation -- mike, Martin Köbele, Jens Müller +-- Add: support for fastcall in MS Windows -- ben +-- Fix: ELL APIs -- james + -- load only once + -- no longer use RTLD_GLOBAL +-- Fix: ELLs now use RTLD_NOW instead of RTLD_LAZY -- Andrew Begel +-- Fix: Many Mule changes -- ben +-- Fix: call-process ensures that the argument to `symbol-value-in-buffer' + is a buffer even if `buffer' is a string -- mike +-- Fix: code that outputs into a buffer, use unwind protects, etc. -- ben +-- Fix: complete implementation of some Unicode functions, S-caron test + failure -- stephen +-- Fix: conditionalize code depending on features like toolbar -- jonathan, + Mike Alexander +-- Fix: create new process-synchronize-point to avoid dynamic binding + problems; fix bogosity in setting process sentinels -- ben, mike +-- Fix: make a lot of code use common includes and implementations + (see 2002-06-20 src/ChangeLog) -- ben +-- Fix: move global-map to keydefs.el -- ben +-- Fix: new signal/C-g handling (src/ChangeLog 2002-05-28) -- ben +-- Fix: numerous problems with the case-table implementation -- ben +-- Fix: quoting of native-coding-system in CJK files -- Daiki Ueno +-- Fix: race condition in process handling -- Nix +-- Fix: recover gracefully from internal XOpenDevice failure -- mike +-- Fix: redo syntax cache code -- ben +-- Fix: save-restriction now uses markers -- ben +-- Fix: small bugs -- stephen, ben, andy, martin, Eric Gillespie Jr + +Build + +-- Add: basic support for handling ISO 2022 doc strings in make-docfile -- ben +-- Add: tmpdir for install, allowing simultaneous run & build -- andy +-- Fix: "Stop Build" in VC++ now works -- Ben +-- Fix: #undef INTERNET_DOMAIN_SOCKETS build of gnuserv -- Greg Steuck +-- Fix: --with-widgets autodetection -- jan +-- Fix: 64-bit support -- Andreas Jaeger, Gregory Steuck +-- Fix: MS Windows Makefile cleanups -- ben, jonathan +-- Fix: MS Windows builds default to pdump -- ben +-- Fix: assorted build breakage -- ben, mike, andy, Malcolm Purvis +-- Fix: check for EOF in make-docfile -- ben +-- Fix: config.h.in organization -- ben +-- Fix: ensure combined X and windows build gets widgets -- andy +-- Fix: implement configure option moduledir -- Mike Fabian +-- Fix: spurious failures in tests -- ben, stephen +-- Fix: test harness now outputs FAIL messages to stderr in batch mode -- ben +-- Fix: test-harness.el now cleans up Check-Message and Check-Error-Message + when done -- stephen +-- Fix: typos and platform specific bugs in configure -- Malcolm Purvis, + galibert, Paul Stodghill +-- Fix: warnings -- ben, wmperry, stephen, didier + to 21.5.6 "bok choi" UI changes and runtime bugs @@ -8,7 +188,7 @@ -- Fix: add_charsets_to_precedence_list -- IKEYAMA Tomonori -- Change: misc menubar -- John Paul Wallington -- Add: auto-mode-alist: GNUmakefile is a Makefile, "system default" - Xdefaults and friends get xrdb-mode -- Ville Skytt,Ad(B + Xdefaults and friends get xrdb-mode -- Ville Skyttä -- From Ben Wing . -- Fix: init_process_io_handles obeys coding-system-for-{read,write}. -- Fix: bug in md5 handling. @@ -155,7 +335,7 @@ defining-kbd-macro-mode-line-string -- John Paul Wallington -- improve GTK clipboard handling -- Eric Gillespie, Jr. -- improve Info dir - generate file if non-existent -- Michael Sperber --- improve printer handling -- Adrian Aichner, Bj,Av(Brn Torkelsson +-- improve printer handling -- Adrian Aichner, Björn Torkelsson -- support GUI toolbar shadow thickness adjustment -- Bill Perry -- support ISO 8859/15 (Euro) -- Stephen Turnbull -- support Sieve in auto-mode-alist -- Simon Josefsson diff --text -u 'xemacs-21.5.6/CHANGES-msw' 'xemacs-21.5.7/CHANGES-msw' Index: ././CHANGES-msw --- ././CHANGES-msw Thu Dec 20 15:08:09 2001 +++ ././CHANGES-msw Tue Jun 4 15:11:31 2002 @@ -10,6 +10,23 @@ See the file 'CHANGES-release' for a full list of mainline changes. +to XEmacs 21.4.8 "Honest Recruiter (Windows)" + + - All changes from 21.4.6 and 21.4.7. + - Make sure revert temporaries are not visiting files. Suggested by + Mike Alexander. + - File renaming fix from Mathias Grimmberger. + - Fix printer metrics on windows 95 from Jonathan Harris. + - Fix layout of widgets so that the search dialog works. + - Fix focus capture of widgets under X. + +to XEmacs 21.4.7 "Economic Science (Windows)" + + - All changes from 21.4.6. + - Fix problems with auto-revert with noconfirm. + - Undo autoconf 2.5x changes. + - Undo 21.4.7 process change. + to XEmacs 21.4.6 "Common Lisp (Windows)" - Made native registry entries match the installer. @@ -21,6 +38,22 @@ - Fixed problems wiht too many dialog popups. - Netinstaller fixed to correctly upgrade shortcuts when upgrading core XEmacs. + - Fix for virtual window managers from Adrian Aichner. + - Installer registers all C++ file types. + - Short-filename fix from Peter Arius. + - Fix for GC assertions from Adrian Aichner. + - Winclient DDE client from Alastair Houghton. + - Fix event assert from Mike Alexander. + - Warning removal noticed by Ben Wing. + - Redisplay glyph height fix from Ben Wing. + - Printer margin fix from Jonathan Harris. + - Error dialog fix suggested by Thomas Vogler. + - Fixed revert-buffer to not revert in the case that there is + nothing to be done. + - Glyph-baseline fix from Nix. + - Fixed clipping of wide glyphs in non-zero-length extents. + - Windows build fixes. + - Fixed :initial-focus so that it works. to XEmacs 21.4.5 "Civil Service (Windows)" diff --text -u 'xemacs-21.5.6/ChangeLog' 'xemacs-21.5.7/ChangeLog' Index: ././ChangeLog --- ././ChangeLog Fri Apr 5 16:43:06 2002 +++ ././ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,111 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-07-02 Stephen J. Turnbull + + * PROBLEMS (Running XEmacs; General): Xref FAQ Q3.10.6. + +2002-05-22 Andy Piper + + * build-msw-release.sh (TMPINSTALL): install to a tmpdir so that + xemacs can be running while we build a dist. + +2002-05-07 Andy Piper + + * configure.in: undo autoconf 2.5x change. + +2002-04-26 Andy Piper + + * configure.in: make sure that a combined X and windows build gets + widgets. + +2002-04-26 Andy Piper + + * configure.in: update to support autoconf 2.5x from Andreas + Schwab and/or Werner Fink . + +2002-05-04 Stephen J. Turnbull + + * etc/sample.init.el: Fix comment typo about resize-minibuffer. + + * etc/sample.init.el: Add description of initialization process, + the custom.el file, and code to load custom.el early instead of + late. + +2002-04-22 Hrvoje Niksic + + * etc/photos/hniksic.png, etc/photos/hniksic.png: Update. + +2002-04-25 Mike Fabian + + * configure.in: add option moduledir as mentioned in ./configure + --help + +2001-04-21 Martin Buchholz + + * configure.in: Detect MacOS/X "Darwin". + Thanks to Greg Parker . + +2002-03-30 Steve Youngs + + * etc/package-index.LATEST.pgp: Update to current reality. + +2002-02-28 Stephen J. Turnbull + + * etc/TUTORIAL.se: New from Mats Lidell. + +2002-01-07 Jan Vroonhof + + * configure.in: Make explicit "--with-widgets" mean "=yes". + If "--with-widgets=yes" autodetect athena. + +2001-12-29 Steve Youngs + + * etc/package-index.LATEST.pgp: Update. + +2001-12-13 William M. Perry + + * configure.in (GTK): add -Wno-shadow. + +2002-01-23 Jarl Friis + + * etc/BETA (http): Informing of xemacs-patches mailing list. Added + note on patch etiquette. + +2001-03-26 Paul Stodghill + + * configure.in: Don't #define __STDC__ in confdefs.h + +2002-02-28 Malcolm Purvis + + * configure.in: Protect nocomboreloc linker arguments to avoid + problem on the ppc. + +2002-05-17 Stephen J. Turnbull + + * PROBLEMS: Describe "Hannibal Lecter" crash on Linux. Reorder + Linux runtime issues section. + * INSTALL: Improve description of mail locking. + +2002-05-04 Stephen J. Turnbull + + * PROBLEMS (General): Decribe failed AUTH with EFS. + +2002-04-23 Olivier Galibert + + * configure.in: Fix the "error checking" warning. + +2002-05-05 Ben Wing + + * README.packages: Update info about --package-path. + +2002-04-14 Ben Wing + + * TODO.ben-mule-21-5: + * TODO.ben-mule-21-5 (Priority): New. + Update. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. diff --text -u 'xemacs-21.5.6/INSTALL' 'xemacs-21.5.7/INSTALL' Index: ././INSTALL --- ././INSTALL Thu May 31 21:47:21 2001 +++ ././INSTALL Fri May 17 00:11:23 2002 @@ -379,11 +379,16 @@ MAIL LOCKING ============ -Find out what the preferred method for locking mail spool files is in -your environment. Presently, XEmacs supports lockf, flock, and dot -locking. Specify the locking method via the --mail-locking=METHOD -option to configure. Valid values for METHOD are --mail-locking are -`lockf', `flock', and `dot'. +For most platforms, configure or the src/s file have the preferred +method for locking mail spool files preconfigured. Otherwise you must +find out for youself. Do not choose a locking protocol "on the +objective merits." XEmacs must use the same method as other mail +utilities on your system, or you will lose mail. + +Presently, XEmacs supports lockf, flock, and dot locking. Specify the +locking method via the --mail-locking=METHOD option to configure. +Valid values for METHOD are --mail-locking are `lockf', `flock', and +`dot'. RUNNING CONFIGURE ================= diff --text -u 'xemacs-21.5.6/PROBLEMS' 'xemacs-21.5.7/PROBLEMS' Index: ././PROBLEMS --- ././PROBLEMS Sat Jan 5 16:33:11 2002 +++ ././PROBLEMS Tue Jul 2 21:27:54 2002 @@ -631,6 +631,23 @@ * Problems with running XEmacs ============================== ** General +*** Starting with 21.4.x, killing text is absurdly slow. + +See FAQ Q3.10.6. Should be available on the web near +http://www.xemacs.org/faq/xemacs-faq.html#SEC160. + +*** Whenever I try to retrieve a remote file, I have problems. + +A typical error: FTP Error: USER request failed; 500 AUTH not understood. +Thanks to giacomo boffi on comp.emacs.xemacs: + + tell your ftp client to not attempt AUTH authentication (or do not + use FTP servers that don't understand AUTH) + +and notes that you need to add an element (often "-u") to +`efs-ftp-program-args'. Use M-x customize-variable, and verify the +needed flag with `man ftp' or other local documentation. + *** gnuserv is running, some clients can connect, but others cannot. The code in gnuslib.c respects the value of TMPDIR. If the server and @@ -1325,23 +1342,24 @@ ** Linux -*** Mandrake +*** XEmacs crashes on startup, in make-frame. -The Mandrake Linux distribution is attempting to comprehensively -update the user interface, and make it consistent across -applications. This is very difficult, and will occasionally cause -conflicts with applications like Emacs with their own long-established -interfaces. Known issues specific to Mandrake or especially common: +Typically the Lisp backtrace includes -Some versions of XEmacs (21.1.9 is known) distributed with Mandrake -were patched to make the Meta and Alt keysyms synonymous. These -normally work as expected in the Mandrake environment. However, -custom-built XEmacsen (including all 21.2 betas) will "inexplicably" -not respect the "Alt-invokes-Meta-commands" convention. See "I want -XEmacs to use the Alt key" below. + make-frame(nil #) -The color-gcc wrapper (see below) is in common use on the Mandrake -platform. +somewhere near the top. The problem is due to an improvement in GNU +ld that sorts the ELF reloc sections in the executable, giving +dramatic speedups in startup for large executables. It also confuses +the traditional unexec code in XEmacs, leading to the core dump. The +solution is to use the --pdump or --ldflags='-z nocombreloc' options +to configure. Recent 21.4 and 12.5 autodetect this in configure. + +Red Hat and SuSE (at least) distributed a prerelease version of ld +(versions around 2.11.90.x.y) where autodetection is impossible. The +recommended procedure is to upgrade to binutils >= 2.12 and rerun +configure. Otherwise you must apply the flags by hand. --pdump is +recommended. *** I want XEmacs to use the Alt key, not the XXX key, for Meta commands @@ -1385,30 +1403,6 @@ This is written for the mainline GNU Emacs but the author has made efforts to adapt it to XEmacs. YMMV. -*** You get crashes in a non-C locale with Linux GNU Libc 2.0. - -Internationalization was not the top priority for GNU Libc 2.0. -As of this writing (1998-12-28) you may get crashes while running -XEmacs in a non-C locale. For example, `LC_ALL=en_US xemacs' crashes -while `LC_ALL=C xemacs' runs fine. This happens for example with GNU -libc 2.0.7. Installing libintl.a and libintl.h built from gettext -0.10.35 and re-building XEmacs solves the crashes. Presumably soon -everyone will upgrade to GNU Libc 2.1 and this problem will go away. - -*** `C-z', or `M-x suspend-emacs' hangs instead of suspending. - -If you build with `gpm' support on Linux, you cannot suspend XEmacs -because gpm installs a buggy SIGTSTP handler. Either compile with -`--with-gpm=no', or don't suspend XEmacs on the Linux console until -this bug is fixed. - -*** With certain fonts, when the cursor appears on a character, the -character doesn't appear--you get a solid box instead. - -One user on a Linux system reported that this problem went away with -installation of a new X server. The failing server was XFree86 3.1.1. -XFree86 3.1.2 works. - *** Slow startup on Linux. People using systems based on the Linux kernel sometimes report that @@ -1478,6 +1472,48 @@ If you cannot or do not want to do that, you can hard code IPv4 behavior in src/process-unix.c. This is bad[tm], on your own head be it. Use the configure option `--with-ipv6-cname=no'. + +*** Mandrake + +The Mandrake Linux distribution is attempting to comprehensively +update the user interface, and make it consistent across +applications. This is very difficult, and will occasionally cause +conflicts with applications like Emacs with their own long-established +interfaces. Known issues specific to Mandrake or especially common: + +Some versions of XEmacs (21.1.9 is known) distributed with Mandrake +were patched to make the Meta and Alt keysyms synonymous. These +normally work as expected in the Mandrake environment. However, +custom-built XEmacsen (including all 21.2 betas) will "inexplicably" +not respect the "Alt-invokes-Meta-commands" convention. See "I want +XEmacs to use the Alt key" below. + +The color-gcc wrapper (see below) is in common use on the Mandrake +platform. + +*** You get crashes in a non-C locale with Linux GNU Libc 2.0. + +Internationalization was not the top priority for GNU Libc 2.0. +As of this writing (1998-12-28) you may get crashes while running +XEmacs in a non-C locale. For example, `LC_ALL=en_US xemacs' crashes +while `LC_ALL=C xemacs' runs fine. This happens for example with GNU +libc 2.0.7. Installing libintl.a and libintl.h built from gettext +0.10.35 and re-building XEmacs solves the crashes. Presumably soon +everyone will upgrade to GNU Libc 2.1 and this problem will go away. + +*** `C-z', or `M-x suspend-emacs' hangs instead of suspending. + +If you build with `gpm' support on Linux, you cannot suspend XEmacs +because gpm installs a buggy SIGTSTP handler. Either compile with +`--with-gpm=no', or don't suspend XEmacs on the Linux console until +this bug is fixed. + +*** With certain fonts, when the cursor appears on a character, the +character doesn't appear--you get a solid box instead. + +One user on a Linux system reported that this problem went away with +installation of a new X server. The failing server was XFree86 3.1.1. +XFree86 3.1.2 works. ** IRIX *** On Irix, I don't see the toolbar icons and I'm getting lots of diff --text -u 'xemacs-21.5.6/README.packages' 'xemacs-21.5.7/README.packages' Index: ././README.packages --- ././README.packages Fri Apr 13 03:20:32 2001 +++ ././README.packages Sun May 5 20:33:57 2002 @@ -10,27 +10,41 @@ The XEmacs Packages Quick Start Guide ------------------------------------- -This text is intended to help you get started installing a new XEmacs -and its packages from start. For details see the 'Startup Paths' and -'Packages' sections of the XEmacs info manual. +This text is intended to help you get started installing a new XEmacs and +its packages. For more details see the 'Startup Paths' and 'Packages' +sections of the XEmacs info manual. * Real Real Quickstart FAQ -------------------------- Q. Do I need to have the packages to compile XEmacs? -A. No, XEmacs will build and install just fine without any packages - installed. However, only the most basic editing functions will be - available with no packages installed, so installing packages is an + +A. Theoretically, no -- XEmacs will build and install just fine without any + packages installed. However, only the most basic editing functions will + be available with no packages installed, so installing packages is an essential part of making your installed XEmacs _useful_. Q. I really liked the old way that packages were bundled and do not want to mess with packages at all. + A. You can grab all the packages at once like you used to with old XEmacs versions, skip to the 'Sumo Tarball' section below. +Q. How do I tell XEmacs where to find the packages? + +A. Normally, you put the packages under $prefix/lib/packages, where + $prefix is specified using the `--prefix' parameter to `configure'. + (See `Package hierarchies' below). However, if you have the packages + somewhere else (e.g. you're a developer and are compiling the packages + yourself, and want your own private copy of everything), use the + `--package-path' parameter, something like this: + + configure --package-path="~/.xemacs::/src/xemacs/site-packages:/src/xemacs/xemacs-packages:/src/xemacs/mule-packages" ... + Q. After installing, I want XEmacs to do `foo', but when I invoke it (or click the toolbar button or select the menu item), nothing (or an error) happens, and it used to work. + A. See the first FAQ; you may be missing a package that is essential to you. You can either track it down and install it, or install the `Sumo Tarball' (see the second FAQ). @@ -44,7 +58,7 @@ backwards compatibility as quirks are worked out over the coming releases. -* Some Package Theory +* Some package theory --------------------- In order to reduce the size and increase the maintainability of XEmacs, @@ -60,20 +74,35 @@ * Package hierarchies --------------------- -On Startup XEmacs looks for packages in so called package hierarchies. -These can be specified by the 'package-path' parameter to the -'configure' script. However by default there are three system wide -hierarchies. ("$prefix" defaults to "/usr/local") +On Startup XEmacs looks for packages in so-called package hierarchies. +Normally, there are three system wide hierarchies, like this: -$prefix/lib/xemacs/xemacs-packages +$prefix/lib/xemacs/xemacs-packages/ Normal packages go here. -$prefix/lib/xemacs/mule-packages +$prefix/lib/xemacs/mule-packages/ Mule packages go here and are only searched by MULE-enabled XEmacsen. $prefix/lib/xemacs/site-packages/ Local and 3rd party packages go here. +This is what you get when you untar the SUMO tarballs under +$prefix/lib/xemacs. + +$prefix is specified using the `--prefix' parameter to `configure', and +defaults to `usr/local'. + +If your packages are located in the above directories, XEmacs will +automatically find them at startup; however, if you have your packages +somewhere else (e.g. you're a developer and are compiling the packages +yourself, and want your own private copy of everything), you can tell +XEmacs specifically where to look for the packages by using the +`--package-path' parameter to the 'configure' script. Normally, it looks +like this: + +configure --package-path="~/.xemacs::/src/xemacs/site-packages:/src/xemacs/xemacs-packages:/src/xemacs/mule-packages" ... + +See `configure.usage' for more info about the format of this parameter. * Where to get the packages --------------------------- diff --text -u 'xemacs-21.5.6/TODO.ben-mule-21-5' 'xemacs-21.5.7/TODO.ben-mule-21-5' Index: ././TODO.ben-mule-21-5 --- ././TODO.ben-mule-21-5 Mon Apr 1 12:59:04 2002 +++ ././TODO.ben-mule-21-5 Sun Apr 14 21:43:30 2002 @@ -1,3 +1,15 @@ +April 11, 2002: + +Priority: + +1. Finish checking in current mule ws. +2. Start working on bugs reported by others and noticed by me: + -- problems cutting and pasting binary data, e.g. from byte-compiler instructions + -- test suite failures + -- process i/o problems w.r.t. eol: |uniq (e.g.) leaves ^M's at end of + line; running "bash" as shell-file-name doesn't work because it doesn't + like the extra ^M's. + March 20, 2002: bugs: diff --text -u 'xemacs-21.5.6/build-msw-release.sh' 'xemacs-21.5.7/build-msw-release.sh' Index: ././build-msw-release.sh --- ././build-msw-release.sh Thu Dec 20 15:10:13 2001 +++ ././build-msw-release.sh Tue Jun 4 15:12:31 2002 @@ -7,6 +7,7 @@ # configuration NATIVE_ZLIB_DIR=/usr/local/mingw/lib PROGRAM_FILES='c:/Program Files/XEmacs' +TMPINSTALL=/tmp/local # no configuration past this point INSTALL= @@ -52,6 +53,7 @@ mkdir -p windows/cygwin32 mkdir -p windows/win32 mkdir -p /usr/local +mkdir -p ${TMPINSTALL} # first build win32 (cd nt; @@ -84,8 +86,8 @@ ./XEmacs-${emacs_ver}) # make the tarball -make install -(cd /usr/local; +make prefix=${TMPINSTALL} bindir=${TMPINSTALL}/bin/i686-pc-cygwin install +(cd ${TMPINSTALL}; tar czvf ${DISTDIR}/cygwin32/${cygwin_tarball} \ ./bin/i686-pc-cygwin \ ./lib/xemacs-${emacs_ver} \ @@ -96,7 +98,8 @@ ./man/man1/gnuclient.1 \ ./man/man1/gnudoit.1 \ ./man/man1/gnuserv.1 \ - ./man/man1/xemacs.1) + ./man/man1/xemacs.1; + rm -rf bin lib man) # figure out the ini file. cygwin_tarball_size=`ls -l windows/cygwin32/${cygwin_tarball} | awk '{ print $5; }'` diff --text -u 'xemacs-21.5.6/configure' 'xemacs-21.5.7/configure' Index: ././configure --- ././configure Fri Apr 5 16:42:46 2002 +++ ././configure Wed Jul 3 00:19:41 2002 @@ -591,7 +591,7 @@ prefix | exec_prefix | bindir | datadir | statedir | libdir | \ mandir | infodir | infopath | lispdir | etcdir | pkgdir | \ - archlibdir | docdir | package_path ) + archlibdir | docdir | package_path | moduledir ) if test "$valomitted" = "yes"; then if test "$#" = 0; then (echo "$progname: Usage error:" @@ -1262,6 +1262,10 @@ i[3-9]86-cubix-sysv* ) machine=intel386 opsys=usg5-3 ;; + *-*-darwin*) + opsys=darwin + RANLIB="ranlib -c" pdump=yes ;; + i586-dg-dgux*R4* | i586-dg-dgux5.4.4* ) machine=aviion opsys=dgux5-4r4 ;; m88k-dg-dgux5.4R3* | m88k-dg-dgux5.4.3* ) opsys=dgux5-4r3 ;; m88k-dg-dgux5.4R2* | m88k-dg-dgux5.4.2* ) opsys=dgux5-4r2 ;; @@ -1641,7 +1645,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1645: checking for $ac_word" >&5 +echo "configure:1649: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1668,7 +1672,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1672: checking for $ac_word" >&5 +echo "configure:1676: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1716,7 +1720,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1720: checking for $ac_word" >&5 +echo "configure:1724: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1745,7 +1749,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1749: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1753: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS' @@ -1758,12 +1762,12 @@ cat > conftest.$ac_ext << EOF -#line 1762 "configure" +#line 1766 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1791,19 +1795,19 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1795: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1799: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1800: checking whether we are using GNU C" >&5 +echo "configure:1804: checking whether we are using GNU C" >&5 cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1821,7 +1825,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1825: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1829: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -1854,7 +1858,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1858: checking for $ac_word" >&5 +echo "configure:1862: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1881,7 +1885,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1885: checking for $ac_word" >&5 +echo "configure:1889: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1929,7 +1933,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1933: checking for $ac_word" >&5 +echo "configure:1937: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1958,7 +1962,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1962: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1966: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS' @@ -1971,12 +1975,12 @@ cat > conftest.$ac_ext << EOF -#line 1975 "configure" +#line 1979 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2004,19 +2008,19 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2008: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2012: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2013: checking whether we are using GNU C" >&5 +echo "configure:2017: checking whether we are using GNU C" >&5 cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2034,7 +2038,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2038: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2042: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -2067,7 +2071,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2071: checking for $ac_word" >&5 +echo "configure:2075: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2094,7 +2098,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2098: checking for $ac_word" >&5 +echo "configure:2102: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2142,7 +2146,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2146: checking for $ac_word" >&5 +echo "configure:2150: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2171,7 +2175,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2175: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2179: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS' @@ -2184,12 +2188,12 @@ cat > conftest.$ac_ext << EOF -#line 2188 "configure" +#line 2192 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2217,19 +2221,19 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2221: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2225: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2226: checking whether we are using GNU C" >&5 +echo "configure:2230: checking whether we are using GNU C" >&5 cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2237: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2247,7 +2251,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2251: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2255: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -2284,7 +2288,7 @@ test -n "$NON_GNU_CPP" -a "$GCC" != "yes" -a -z "$CPP" && CPP="$NON_GNU_CPP" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2288: checking how to run the C preprocessor" >&5 +echo "configure:2292: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2297,13 +2301,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2311: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2314,13 +2318,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2331,13 +2335,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2363,9 +2367,9 @@ echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:2367: checking for AIX" >&5 +echo "configure:2371: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:2396: checking for GNU libc" >&5 +echo "configure:2400: checking for GNU libc" >&5 cat > conftest.$ac_ext < int main() { @@ -2406,7 +2410,7 @@ ; return 0; } EOF -if { (eval echo configure:2410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* have_glibc=yes else @@ -2483,7 +2487,7 @@ esac cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:2505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then : else @@ -2749,17 +2753,17 @@ if test "$__USLC__" = yes; then echo $ac_n "checking for whether the -Kalloca compiler flag is needed""... $ac_c" 1>&6 -echo "configure:2753: checking for whether the -Kalloca compiler flag is needed" >&5 +echo "configure:2757: checking for whether the -Kalloca compiler flag is needed" >&5 need_kalloca=no cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* : else @@ -2770,14 +2774,14 @@ xe_save_c_switch_system="$c_switch_system" c_switch_system="$c_switch_system -Kalloca" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* need_kalloca=yes else @@ -2815,7 +2819,7 @@ if test "$GCC" = "yes"; then echo $ac_n "checking for buggy gcc versions""... $ac_c" 1>&6 -echo "configure:2819: checking for buggy gcc versions" >&5 +echo "configure:2823: checking for buggy gcc versions" >&5 GCC_VERSION=`$CC --version` case `uname -s`:`uname -m`:$GCC_VERSION in *:sun4*:2.8.1|*:sun4*:egcs-2.90.*) @@ -2871,6 +2875,17 @@ echo "$ac_t""no" 1>&6 fi +if test "$pdump" != "yes"; then + echo $ac_n "checking for \"-z nocombreloc\" linker flag""... $ac_c" 1>&6 +echo "configure:2881: checking for \"-z nocombreloc\" linker flag" >&5 + case "`ld --help 2>&1`" in + *-z\ nocombreloc* ) echo "$ac_t""yes" 1>&6 + ld_switch_site="-z nocombreloc $ld_switch_site" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-z nocombreloc\" to \$ld_switch_site"; fi ;; + *) echo "$ac_t""no" 1>&6 ;; + esac +fi + + if test "$GCC" = "yes"; then set x $ld_switch_system; shift; ld_switch_system="" @@ -2899,6 +2914,19 @@ fi if test "$GCC" = "yes"; then + set x $ld_switch_site; shift; ld_switch_site="" + while test -n "$1"; do + case $1 in + -L | -l | -u ) ld_switch_site="$ld_switch_site $1 $2"; shift ;; + -L* | -l* | -u* | -Wl* | -pg ) ld_switch_site="$ld_switch_site $1" ;; + -Xlinker* ) ;; + * ) ld_switch_site="$ld_switch_site -Xlinker $1" ;; + esac + shift + done +fi + +if test "$GCC" = "yes"; then set x $LDFLAGS; shift; LDFLAGS="" while test -n "$1"; do case $1 in @@ -2938,7 +2966,7 @@ fi echo $ac_n "checking for dynodump""... $ac_c" 1>&6 -echo "configure:2942: checking for dynodump" >&5 +echo "configure:2970: checking for dynodump" >&5 if test "$unexec" != "unexsol2.o"; then echo "$ac_t""no" 1>&6 else @@ -2976,12 +3004,12 @@ done echo $ac_n "checking for terminateAndUnload in -lC""... $ac_c" 1>&6 -echo "configure:2980: checking for terminateAndUnload in -lC" >&5 +echo "configure:3008: checking for terminateAndUnload in -lC" >&5 ac_lib_var=`echo C'_'terminateAndUnload | sed 'y%./+-%__p_%'` xe_check_libs=" -lC " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3100,7 +3128,7 @@ if test "$add_runtime_path" = "yes"; then echo $ac_n "checking "for runtime libraries flag"""... $ac_c" 1>&6 -echo "configure:3104: checking "for runtime libraries flag"" >&5 +echo "configure:3132: checking "for runtime libraries flag"" >&5 case "$opsys" in sol2 ) dash_r="-R" ;; decosf* | linux* | irix*) dash_r="-rpath " ;; @@ -3122,14 +3150,14 @@ done fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* dash_r="$try_dash_r" else @@ -3230,10 +3258,10 @@ fi after_morecore_hook_exists=yes echo $ac_n "checking for malloc_set_state""... $ac_c" 1>&6 -echo "configure:3234: checking for malloc_set_state" >&5 +echo "configure:3262: checking for malloc_set_state" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_malloc_set_state=yes" else @@ -3276,16 +3304,16 @@ fi echo $ac_n "checking whether __after_morecore_hook exists""... $ac_c" 1>&6 -echo "configure:3280: checking whether __after_morecore_hook exists" >&5 +echo "configure:3308: checking whether __after_morecore_hook exists" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3341,7 +3369,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3345: checking for $ac_word" >&5 +echo "configure:3373: checking for $ac_word" >&5 if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -3396,7 +3424,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:3400: checking for a BSD compatible install" >&5 +echo "configure:3428: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" @@ -3450,7 +3478,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3454: checking for $ac_word" >&5 +echo "configure:3482: checking for $ac_word" >&5 if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. @@ -3482,15 +3510,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3486: checking for $ac_hdr" >&5 +echo "configure:3514: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3520,10 +3548,10 @@ done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:3524: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:3552: checking for sys/wait.h that is POSIX.1 compatible" >&5 cat > conftest.$ac_ext < #include @@ -3539,7 +3567,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:3543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -3563,10 +3591,10 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3567: checking for ANSI C header files" >&5 +echo "configure:3595: checking for ANSI C header files" >&5 cat > conftest.$ac_ext < #include @@ -3574,7 +3602,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3591,7 +3619,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3609,7 +3637,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3627,7 +3655,7 @@ if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3638,7 +3666,7 @@ exit (0); } EOF -if { (eval echo configure:3642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:3670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then : else @@ -3664,10 +3692,10 @@ fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3668: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3696: checking whether time.h and sys/time.h may both be included" >&5 cat > conftest.$ac_ext < #include @@ -3676,7 +3704,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3708: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3700,10 +3728,10 @@ fi echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:3704: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:3732: checking for sys_siglist declaration in signal.h or unistd.h" >&5 cat > conftest.$ac_ext < #include @@ -3715,7 +3743,7 @@ char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:3719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -3741,9 +3769,9 @@ echo $ac_n "checking for utime""... $ac_c" 1>&6 -echo "configure:3745: checking for utime" >&5 +echo "configure:3773: checking for utime" >&5 cat > conftest.$ac_ext < #include @@ -3751,7 +3779,7 @@ struct utimbuf x; x.actime = x.modtime = 0; utime ("/", &x); ; return 0; } EOF -if { (eval echo configure:3755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 { test "$extra_verbose" = "yes" && cat << \EOF @@ -3770,10 +3798,10 @@ for ac_func in utimes do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3774: checking for $ac_func" >&5 +echo "configure:3802: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3828,10 +3856,10 @@ echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3832: checking return type of signal handlers" >&5 +echo "configure:3860: checking return type of signal handlers" >&5 cat > conftest.$ac_ext < #include @@ -3848,7 +3876,7 @@ int i; ; return 0; } EOF -if { (eval echo configure:3852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3870,10 +3898,10 @@ echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3874: checking for size_t" >&5 +echo "configure:3902: checking for size_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3904,10 +3932,10 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:3908: checking for pid_t" >&5 +echo "configure:3936: checking for pid_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3938,10 +3966,10 @@ fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3942: checking for uid_t in sys/types.h" >&5 +echo "configure:3970: checking for uid_t in sys/types.h" >&5 cat > conftest.$ac_ext < EOF @@ -3977,10 +4005,10 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:3981: checking for mode_t" >&5 +echo "configure:4009: checking for mode_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4011,10 +4039,10 @@ fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:4015: checking for off_t" >&5 +echo "configure:4043: checking for off_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4045,10 +4073,10 @@ fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:4049: checking for ssize_t" >&5 +echo "configure:4077: checking for ssize_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4080,9 +4108,9 @@ echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 -echo "configure:4084: checking for socklen_t" >&5 +echo "configure:4112: checking for socklen_t" >&5 cat > conftest.$ac_ext < socklen_t x; @@ -4091,7 +4119,7 @@ ; return 0; } EOF -if { (eval echo configure:4095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4123: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -4100,7 +4128,7 @@ rm -rf conftest* cat > conftest.$ac_ext < int accept (int, struct sockaddr *, size_t *); @@ -4109,7 +4137,7 @@ ; return 0; } EOF -if { (eval echo configure:4113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""size_t" 1>&6 @@ -4141,9 +4169,9 @@ rm -f conftest* echo $ac_n "checking for struct timeval""... $ac_c" 1>&6 -echo "configure:4145: checking for struct timeval" >&5 +echo "configure:4173: checking for struct timeval" >&5 cat > conftest.$ac_ext < @@ -4159,7 +4187,7 @@ static struct timeval x; x.tv_sec = x.tv_usec; ; return 0; } EOF -if { (eval echo configure:4163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 HAVE_TIMEVAL=yes @@ -4181,10 +4209,10 @@ rm -f conftest* echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:4185: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:4213: checking whether struct tm is in sys/time.h or time.h" >&5 cat > conftest.$ac_ext < #include @@ -4192,7 +4220,7 @@ struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:4196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -4216,10 +4244,10 @@ fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:4220: checking for tm_zone in struct tm" >&5 +echo "configure:4248: checking for tm_zone in struct tm" >&5 cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -4227,7 +4255,7 @@ struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:4231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -4250,10 +4278,10 @@ else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:4254: checking for tzname" >&5 +echo "configure:4282: checking for tzname" >&5 cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -4263,7 +4291,7 @@ atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:4267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -4289,10 +4317,10 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:4293: checking for working const" >&5 +echo "configure:4321: checking for working const" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -4366,7 +4394,7 @@ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:4370: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:4398: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` cat > conftestmake <<\EOF @@ -4391,12 +4419,12 @@ echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:4395: checking whether byte ordering is bigendian" >&5 +echo "configure:4423: checking whether byte ordering is bigendian" >&5 ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -4407,11 +4435,11 @@ #endif ; return 0; } EOF -if { (eval echo configure:4411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -4422,7 +4450,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:4426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -4439,7 +4467,7 @@ rm -f conftest* if test $ac_cv_c_bigendian = unknown; then cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_c_bigendian=no else @@ -4479,10 +4507,10 @@ echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:4483: checking size of short" >&5 +echo "configure:4511: checking size of short" >&5 cat > conftest.$ac_ext < #include @@ -4494,7 +4522,7 @@ exit(0); } EOF -if { (eval echo configure:4498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_short=`cat conftestval` else @@ -4522,10 +4550,10 @@ exit 1 fi echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:4526: checking size of int" >&5 +echo "configure:4554: checking size of int" >&5 cat > conftest.$ac_ext < #include @@ -4537,7 +4565,7 @@ exit(0); } EOF -if { (eval echo configure:4541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_int=`cat conftestval` else @@ -4559,10 +4587,10 @@ echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:4563: checking size of long" >&5 +echo "configure:4591: checking size of long" >&5 cat > conftest.$ac_ext < #include @@ -4574,7 +4602,7 @@ exit(0); } EOF -if { (eval echo configure:4578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_long=`cat conftestval` else @@ -4596,10 +4624,10 @@ echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:4600: checking size of long long" >&5 +echo "configure:4628: checking size of long long" >&5 cat > conftest.$ac_ext < #include @@ -4611,7 +4639,7 @@ exit(0); } EOF -if { (eval echo configure:4615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_long_long=`cat conftestval` else @@ -4633,10 +4661,10 @@ echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:4637: checking size of void *" >&5 +echo "configure:4665: checking size of void *" >&5 cat > conftest.$ac_ext < #include @@ -4648,7 +4676,7 @@ exit(0); } EOF -if { (eval echo configure:4652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_void_p=`cat conftestval` else @@ -4671,7 +4699,7 @@ echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:4675: checking for long file names" >&5 +echo "configure:4703: checking for long file names" >&5 ac_cv_sys_long_file_names=yes # Test for long file names in all the places we know might matter: @@ -4717,10 +4745,10 @@ echo $ac_n "checking for sin""... $ac_c" 1>&6 -echo "configure:4721: checking for sin" >&5 +echo "configure:4749: checking for sin" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_sin=yes" else @@ -4761,12 +4789,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6 -echo "configure:4765: checking for sin in -lm" >&5 +echo "configure:4793: checking for sin in -lm" >&5 ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'` xe_check_libs=" -lm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4821,14 +4849,14 @@ cat > conftest.$ac_ext < int main() { return atanh(1.0) + asinh(1.0) + acosh(1.0); ; return 0; } EOF -if { (eval echo configure:4832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_INVERSE_HYPERBOLIC @@ -4847,10 +4875,10 @@ for ac_func in mkstemp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4851: checking for $ac_func" >&5 +echo "configure:4879: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4902,14 +4930,14 @@ echo "checking type of mail spool file locking" 1>&6 -echo "configure:4906: checking type of mail spool file locking" >&5 +echo "configure:4934: checking type of mail spool file locking" >&5 for ac_func in lockf flock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4910: checking for $ac_func" >&5 +echo "configure:4938: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5014,12 +5042,12 @@ case "$opsys" in decosf*) echo $ac_n "checking for cma_open in -lpthreads""... $ac_c" 1>&6 -echo "configure:5018: checking for cma_open in -lpthreads" >&5 +echo "configure:5046: checking for cma_open in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'cma_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lpthreads " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5067,7 +5095,7 @@ echo $ac_n "checking whether the -xildoff compiler flag is required""... $ac_c" 1>&6 -echo "configure:5071: checking whether the -xildoff compiler flag is required" >&5 +echo "configure:5099: checking whether the -xildoff compiler flag is required" >&5 if ${CC-cc} '-###' -xildon no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ; then if ${CC-cc} '-###' -xildoff no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ; then echo "$ac_t""no" 1>&6; @@ -5079,7 +5107,7 @@ if test "$opsys" = "sol2"; then if test "$os_release" -ge 56; then echo $ac_n "checking for \"-z ignore\" linker flag""... $ac_c" 1>&6 -echo "configure:5083: checking for \"-z ignore\" linker flag" >&5 +echo "configure:5111: checking for \"-z ignore\" linker flag" >&5 case "`ld -h 2>&1`" in *-z\ ignore\|record* ) echo "$ac_t""yes" 1>&6 ld_switch_site="-z ignore $ld_switch_site" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-z ignore\" to \$ld_switch_site"; fi ;; @@ -5088,19 +5116,9 @@ fi fi -if test "$pdump" != "yes"; then - echo $ac_n "checking for \"-z nocombreloc\" linker flag""... $ac_c" 1>&6 -echo "configure:5094: checking for \"-z nocombreloc\" linker flag" >&5 - case "`ld --help 2>&1`" in - *-z\ nocombreloc* ) echo "$ac_t""yes" 1>&6 - ld_switch_site="-z nocombreloc $ld_switch_site" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-z nocombreloc\" to \$ld_switch_site"; fi ;; - *) echo "$ac_t""no" 1>&6 ;; - esac -fi - echo "checking "for specified window system"" 1>&6 -echo "configure:5104: checking "for specified window system"" >&5 +echo "configure:5122: checking "for specified window system"" >&5 GNOME_CONFIG=no @@ -5108,7 +5126,7 @@ if test "$with_gnome" != "no"; then echo $ac_n "checking for GNOME configuration script""... $ac_c" 1>&6 -echo "configure:5112: checking for GNOME configuration script" >&5 +echo "configure:5130: checking for GNOME configuration script" >&5 for possible in gnome-config do possible_version=`${possible} --version 2> /dev/null` @@ -5139,7 +5157,7 @@ if test "$with_gtk" != "no";then echo $ac_n "checking for GTK configuration script""... $ac_c" 1>&6 -echo "configure:5143: checking for GTK configuration script" >&5 +echo "configure:5161: checking for GTK configuration script" >&5 for possible in gtk12-config gtk14-config gtk-config do possible_version=`${possible} --version 2> /dev/null` @@ -5161,18 +5179,18 @@ if test "${GTK_CONFIG}" != "no"; then echo $ac_n "checking gtk version""... $ac_c" 1>&6 -echo "configure:5165: checking gtk version" >&5 +echo "configure:5183: checking gtk version" >&5 GTK_VERSION=`${GTK_CONFIG} --version` echo "$ac_t""${GTK_VERSION}" 1>&6 echo $ac_n "checking gtk libs""... $ac_c" 1>&6 -echo "configure:5170: checking gtk libs" >&5 +echo "configure:5188: checking gtk libs" >&5 GTK_LIBS=`${GTK_CONFIG} --libs` libs_gtk="$libs_gtk ${GTK_LIBS}" && if test "$extra_verbose" = "yes"; then echo " Appending \"${GTK_LIBS}\" to \$libs_gtk"; fi echo "$ac_t""${GTK_LIBS}" 1>&6 echo $ac_n "checking gtk cflags""... $ac_c" 1>&6 -echo "configure:5176: checking gtk cflags" >&5 +echo "configure:5194: checking gtk cflags" >&5 GTK_CFLAGS=`${GTK_CONFIG} --cflags` if test "$GCC" = "yes"; then GTK_CFLAGS="${GTK_CFLAGS} -Wno-shadow" @@ -5182,19 +5200,19 @@ echo $ac_n "checking for main in -lgdk_imlib""... $ac_c" 1>&6 -echo "configure:5186: checking for main in -lgdk_imlib" >&5 +echo "configure:5204: checking for main in -lgdk_imlib" >&5 ac_lib_var=`echo gdk_imlib'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lgdk_imlib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5216,12 +5234,12 @@ echo $ac_n "checking for Imlib_init in -lImlib""... $ac_c" 1>&6 -echo "configure:5220: checking for Imlib_init in -lImlib" >&5 +echo "configure:5238: checking for Imlib_init in -lImlib" >&5 ac_lib_var=`echo Imlib'_'Imlib_init | sed 'y%./+-%__p_%'` xe_check_libs=" -lImlib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5255,10 +5273,10 @@ for ac_func in gdk_imlib_init do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5259: checking for $ac_func" >&5 +echo "configure:5277: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5347,15 +5365,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5351: checking for $ac_hdr" >&5 +echo "configure:5369: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5386,19 +5404,19 @@ echo $ac_n "checking for main in -lxml""... $ac_c" 1>&6 -echo "configure:5390: checking for main in -lxml" >&5 +echo "configure:5408: checking for main in -lxml" >&5 ac_lib_var=`echo xml'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lxml " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5420,19 +5438,19 @@ echo $ac_n "checking for main in -lglade""... $ac_c" 1>&6 -echo "configure:5424: checking for main in -lglade" >&5 +echo "configure:5442: checking for main in -lglade" >&5 ac_lib_var=`echo glade'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lglade " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5454,19 +5472,19 @@ echo $ac_n "checking for main in -lglade-gnome""... $ac_c" 1>&6 -echo "configure:5458: checking for main in -lglade-gnome" >&5 +echo "configure:5476: checking for main in -lglade-gnome" >&5 ac_lib_var=`echo glade-gnome'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lglade-gnome " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5487,7 +5505,7 @@ cat > conftest.$ac_ext < EOF @@ -5546,7 +5564,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:5550: checking for X" >&5 +echo "configure:5568: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5606,12 +5624,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5633: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5680,14 +5698,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -5796,17 +5814,17 @@ case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:5800: checking whether -R must be followed by a space" >&5 +echo "configure:5818: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -5822,14 +5840,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -5865,12 +5883,12 @@ else echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:5869: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:5887: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` xe_check_libs=" -ldnet " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5905,12 +5923,12 @@ if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:5909: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:5927: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` xe_check_libs=" -ldnet_stub " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5950,10 +5968,10 @@ # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:5954: checking for gethostbyname" >&5 +echo "configure:5972: checking for gethostbyname" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5997,12 +6015,12 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:6001: checking for gethostbyname in -lnsl" >&5 +echo "configure:6019: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` xe_check_libs=" -lnsl " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6043,10 +6061,10 @@ # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:6047: checking for connect" >&5 +echo "configure:6065: checking for connect" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -6092,12 +6110,12 @@ xe_msg_checking="for connect in -lsocket" test -n "$X_EXTRA_LIBS" && xe_msg_checking="$xe_msg_checking using extra libs $X_EXTRA_LIBS" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:6096: checking "$xe_msg_checking"" >&5 +echo "configure:6114: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` xe_check_libs=" -lsocket $X_EXTRA_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6132,10 +6150,10 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:6136: checking for remove" >&5 +echo "configure:6154: checking for remove" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -6179,12 +6197,12 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:6183: checking for remove in -lposix" >&5 +echo "configure:6201: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` xe_check_libs=" -lposix " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6219,10 +6237,10 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:6223: checking for shmat" >&5 +echo "configure:6241: checking for shmat" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -6266,12 +6284,12 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:6270: checking for shmat in -lipc" >&5 +echo "configure:6288: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` xe_check_libs=" -lipc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6318,12 +6336,12 @@ xe_msg_checking="for IceConnectionNumber in -lICE" test -n "$X_EXTRA_LIBS" && xe_msg_checking="$xe_msg_checking using extra libs $X_EXTRA_LIBS" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:6322: checking "$xe_msg_checking"" >&5 +echo "configure:6340: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` xe_check_libs=" -lICE $X_EXTRA_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6501,7 +6519,7 @@ echo "checking for X defines extracted by xmkmf" 1>&6 -echo "configure:6505: checking for X defines extracted by xmkmf" >&5 +echo "configure:6523: checking for X defines extracted by xmkmf" >&5 rm -fr conftestdir if mkdir conftestdir; then cd conftestdir @@ -6550,15 +6568,15 @@ ac_safe=`echo "X11/Intrinsic.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Intrinsic.h""... $ac_c" 1>&6 -echo "configure:6554: checking for X11/Intrinsic.h" >&5 +echo "configure:6572: checking for X11/Intrinsic.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6582,12 +6600,12 @@ echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:6586: checking for XOpenDisplay in -lX11" >&5 +echo "configure:6604: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6623,12 +6641,12 @@ xe_msg_checking="for XGetFontProperty in -lX11" test -n "-b i486-linuxaout" && xe_msg_checking="$xe_msg_checking using extra libs -b i486-linuxaout" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:6627: checking "$xe_msg_checking"" >&5 +echo "configure:6645: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo X11'_'XGetFontProperty | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 -b i486-linuxaout" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6666,12 +6684,12 @@ echo $ac_n "checking for XShapeSelectInput in -lXext""... $ac_c" 1>&6 -echo "configure:6670: checking for XShapeSelectInput in -lXext" >&5 +echo "configure:6688: checking for XShapeSelectInput in -lXext" >&5 ac_lib_var=`echo Xext'_'XShapeSelectInput | sed 'y%./+-%__p_%'` xe_check_libs=" -lXext " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6705,12 +6723,12 @@ echo $ac_n "checking for XtOpenDisplay in -lXt""... $ac_c" 1>&6 -echo "configure:6709: checking for XtOpenDisplay in -lXt" >&5 +echo "configure:6727: checking for XtOpenDisplay in -lXt" >&5 ac_lib_var=`echo Xt'_'XtOpenDisplay | sed 'y%./+-%__p_%'` xe_check_libs=" -lXt " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6744,14 +6762,14 @@ echo $ac_n "checking the version of X11 being used""... $ac_c" 1>&6 -echo "configure:6748: checking the version of X11 being used" >&5 +echo "configure:6766: checking the version of X11 being used" >&5 cat > conftest.$ac_ext < int main(int c, char *v[]) { return c>1 ? XlibSpecificationRelease : 0; } EOF -if { (eval echo configure:6755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:6773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ./conftest foobar; x11_release=$? else @@ -6782,10 +6800,10 @@ for ac_func in XConvertCase do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6786: checking for $ac_func" >&5 +echo "configure:6804: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6840,15 +6858,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6844: checking for $ac_hdr" >&5 +echo "configure:6862: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6881,10 +6899,10 @@ for ac_func in XRegisterIMInstantiateCallback do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6885: checking for $ac_func" >&5 +echo "configure:6903: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6935,9 +6953,9 @@ done echo $ac_n "checking for standard XRegisterIMInstantiateCallback prototype""... $ac_c" 1>&6 -echo "configure:6939: checking for standard XRegisterIMInstantiateCallback prototype" >&5 +echo "configure:6957: checking for standard XRegisterIMInstantiateCallback prototype" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -6970,12 +6988,12 @@ test -z "$with_xmu" && { echo $ac_n "checking for XmuReadBitmapDataFromFile in -lXmu""... $ac_c" 1>&6 -echo "configure:6974: checking for XmuReadBitmapDataFromFile in -lXmu" >&5 +echo "configure:6992: checking for XmuReadBitmapDataFromFile in -lXmu" >&5 ac_lib_var=`echo Xmu'_'XmuReadBitmapDataFromFile | sed 'y%./+-%__p_%'` xe_check_libs=" -lXmu " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7025,19 +7043,19 @@ echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6 -echo "configure:7029: checking for main in -lXbsd" >&5 +echo "configure:7047: checking for main in -lXbsd" >&5 ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lXbsd " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7074,22 +7092,22 @@ fi if test "$with_msw" != "no"; then echo "checking for MS-Windows" 1>&6 -echo "configure:7078: checking for MS-Windows" >&5 +echo "configure:7096: checking for MS-Windows" >&5 echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6 -echo "configure:7081: checking for main in -lgdi32" >&5 +echo "configure:7099: checking for main in -lgdi32" >&5 ac_lib_var=`echo gdi32'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lgdi32 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7140,12 +7158,12 @@ test "$with_widgets" != "no" && with_widgets=msw fi cat > conftest.$ac_ext < int main() { return (open("/dev/windows", O_RDONLY, 0) > 0)? 0 : 1; } EOF -if { (eval echo configure:7149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:7167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_MSG_SELECT @@ -7206,15 +7224,15 @@ if test "$with_x11" = "yes"; then ac_safe=`echo "X11/extensions/shape.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/shape.h""... $ac_c" 1>&6 -echo "configure:7210: checking for X11/extensions/shape.h" >&5 +echo "configure:7228: checking for X11/extensions/shape.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7218: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7264,7 +7282,7 @@ esac echo "checking for WM_COMMAND option" 1>&6 -echo "configure:7268: checking for WM_COMMAND option" >&5; +echo "configure:7286: checking for WM_COMMAND option" >&5; if test "$with_wmcommand" != "no"; then { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_WMCOMMAND @@ -7279,15 +7297,15 @@ test -z "$with_xauth" && test "$window_system" = "none" && with_xauth=no test -z "$with_xauth" && { ac_safe=`echo "X11/Xauth.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xauth.h""... $ac_c" 1>&6 -echo "configure:7283: checking for X11/Xauth.h" >&5 +echo "configure:7301: checking for X11/Xauth.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7291: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7309: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7310,12 +7328,12 @@ } test -z "$with_xauth" && { echo $ac_n "checking for XauGetAuthByAddr in -lXau""... $ac_c" 1>&6 -echo "configure:7314: checking for XauGetAuthByAddr in -lXau" >&5 +echo "configure:7332: checking for XauGetAuthByAddr in -lXau" >&5 ac_lib_var=`echo Xau'_'XauGetAuthByAddr | sed 'y%./+-%__p_%'` xe_check_libs=" -lXau " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7371,15 +7389,15 @@ for dir in "" "Tt/" "desktop/" ; do ac_safe=`echo "${dir}tt_c.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ${dir}tt_c.h""... $ac_c" 1>&6 -echo "configure:7375: checking for ${dir}tt_c.h" >&5 +echo "configure:7393: checking for ${dir}tt_c.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7415,12 +7433,12 @@ xe_msg_checking="for tt_message_create in -ltt" test -n "$extra_libs" && xe_msg_checking="$xe_msg_checking using extra libs $extra_libs" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7419: checking "$xe_msg_checking"" >&5 +echo "configure:7437: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo tt'_'tt_message_create | sed 'y%./+-%__p_%'` xe_check_libs=" -ltt $extra_libs" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7485,15 +7503,15 @@ test -z "$with_cde" && { ac_safe=`echo "Dt/Dt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Dt/Dt.h""... $ac_c" 1>&6 -echo "configure:7489: checking for Dt/Dt.h" >&5 +echo "configure:7507: checking for Dt/Dt.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7497: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7516,12 +7534,12 @@ } test -z "$with_cde" && { echo $ac_n "checking for DtDndDragStart in -lDtSvc""... $ac_c" 1>&6 -echo "configure:7520: checking for DtDndDragStart in -lDtSvc" >&5 +echo "configure:7538: checking for DtDndDragStart in -lDtSvc" >&5 ac_lib_var=`echo DtSvc'_'DtDndDragStart | sed 'y%./+-%__p_%'` xe_check_libs=" -lDtSvc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7613,7 +7631,7 @@ if test "$with_dragndrop" != "no" ; then echo $ac_n "checking if drag and drop API is needed""... $ac_c" 1>&6 -echo "configure:7617: checking if drag and drop API is needed" >&5 +echo "configure:7635: checking if drag and drop API is needed" >&5 if test -n "$dragndrop_proto" ; then with_dragndrop=yes echo "$ac_t""yes (${dragndrop_proto} )" 1>&6 @@ -7633,18 +7651,18 @@ fi echo "checking for LDAP" 1>&6 -echo "configure:7637: checking for LDAP" >&5 +echo "configure:7655: checking for LDAP" >&5 test -z "$with_ldap" && { ac_safe=`echo "ldap.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ldap.h""... $ac_c" 1>&6 -echo "configure:7640: checking for ldap.h" >&5 +echo "configure:7658: checking for ldap.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7666: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7667,15 +7685,15 @@ } test -z "$with_ldap" && { ac_safe=`echo "lber.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for lber.h""... $ac_c" 1>&6 -echo "configure:7671: checking for lber.h" >&5 +echo "configure:7689: checking for lber.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7679: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7699,12 +7717,12 @@ if test "$with_ldap" != "no"; then echo $ac_n "checking for ldap_search in -lldap""... $ac_c" 1>&6 -echo "configure:7703: checking for ldap_search in -lldap" >&5 +echo "configure:7721: checking for ldap_search in -lldap" >&5 ac_lib_var=`echo ldap'_'ldap_search | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7740,12 +7758,12 @@ xe_msg_checking="for ldap_open in -lldap" test -n "-llber" && xe_msg_checking="$xe_msg_checking using extra libs -llber" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7744: checking "$xe_msg_checking"" >&5 +echo "configure:7762: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ldap'_'ldap_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap -llber" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7781,12 +7799,12 @@ xe_msg_checking="for ldap_open in -lldap" test -n "-llber -lkrb" && xe_msg_checking="$xe_msg_checking using extra libs -llber -lkrb" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7785: checking "$xe_msg_checking"" >&5 +echo "configure:7803: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ldap'_'ldap_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap -llber -lkrb" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7822,12 +7840,12 @@ xe_msg_checking="for ldap_open in -lldap" test -n "-llber -lkrb -ldes" && xe_msg_checking="$xe_msg_checking using extra libs -llber -lkrb -ldes" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7826: checking "$xe_msg_checking"" >&5 +echo "configure:7844: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ldap'_'ldap_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap -llber -lkrb -ldes" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7886,10 +7904,10 @@ for ac_func in ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7890: checking for $ac_func" >&5 +echo "configure:7908: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7943,20 +7961,20 @@ if test "$with_postgresql" != "no"; then echo "checking for PostgreSQL" 1>&6 -echo "configure:7947: checking for PostgreSQL" >&5 +echo "configure:7965: checking for PostgreSQL" >&5 for header_dir in "" "pgsql/" "postgresql/"; do ac_safe=`echo "${header_dir}libpq-fe.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ${header_dir}libpq-fe.h""... $ac_c" 1>&6 -echo "configure:7952: checking for ${header_dir}libpq-fe.h" >&5 +echo "configure:7970: checking for ${header_dir}libpq-fe.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7980,12 +7998,12 @@ test -n "$libpq_fe_h_file" && { echo $ac_n "checking for PQconnectdb in -lpq""... $ac_c" 1>&6 -echo "configure:7984: checking for PQconnectdb in -lpq" >&5 +echo "configure:8002: checking for PQconnectdb in -lpq" >&5 ac_lib_var=`echo pq'_'PQconnectdb | sed 'y%./+-%__p_%'` xe_check_libs=" -lpq " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8029,12 +8047,12 @@ echo $ac_n "checking for PQconnectStart in -lpq""... $ac_c" 1>&6 -echo "configure:8033: checking for PQconnectStart in -lpq" >&5 +echo "configure:8051: checking for PQconnectStart in -lpq" >&5 ac_lib_var=`echo pq'_'PQconnectStart | sed 'y%./+-%__p_%'` xe_check_libs=" -lpq " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8090,7 +8108,7 @@ if test "$window_system" != "none"; then echo "checking for graphics libraries" 1>&6 -echo "configure:8094: checking for graphics libraries" >&5 +echo "configure:8112: checking for graphics libraries" >&5 libpath_xpm= incpath_xpm= @@ -8116,10 +8134,10 @@ CFLAGS=""$incpath_xpm" $CFLAGS" && if test "$extra_verbose" = "yes"; then echo " Prepending \""$incpath_xpm"\" to \$CFLAGS"; fi LDFLAGS=""$libpath_xpm" $LDFLAGS" && if test "$extra_verbose" = "yes"; then echo " Prepending \""$libpath_xpm"\" to \$LDFLAGS"; fi echo $ac_n "checking for Xpm - no older than 3.4f""... $ac_c" 1>&6 -echo "configure:8120: checking for Xpm - no older than 3.4f" >&5 +echo "configure:8138: checking for Xpm - no older than 3.4f" >&5 xe_check_libs=-lXpm cat > conftest.$ac_ext < @@ -8128,7 +8146,7 @@ XpmIncludeVersion != XpmLibraryVersion() ? 1 : XpmIncludeVersion < 30406 ? 2 : 0 ;} EOF -if { (eval echo configure:8132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:8150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ./conftest dummy_arg; xpm_status=$?; if test "$xpm_status" = "0"; then @@ -8172,17 +8190,17 @@ libs_x="-lXpm $libs_x" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-lXpm\" to \$libs_x"; fi CFLAGS=""$incpath_xpm" $CFLAGS" && if test "$extra_verbose" = "yes"; then echo " Prepending \""$incpath_xpm"\" to \$CFLAGS"; fi echo $ac_n "checking for \"FOR_MSW\" xpm""... $ac_c" 1>&6 -echo "configure:8176: checking for \"FOR_MSW\" xpm" >&5 +echo "configure:8194: checking for \"FOR_MSW\" xpm" >&5 xe_check_libs=-lXpm cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xpm_for_msw=no else @@ -8208,15 +8226,15 @@ test -z "$with_xface" && { ac_safe=`echo "compface.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for compface.h""... $ac_c" 1>&6 -echo "configure:8212: checking for compface.h" >&5 +echo "configure:8230: checking for compface.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8238: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8239,12 +8257,12 @@ } test -z "$with_xface" && { echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6 -echo "configure:8243: checking for UnGenFace in -lcompface" >&5 +echo "configure:8261: checking for UnGenFace in -lcompface" >&5 ac_lib_var=`echo compface'_'UnGenFace | sed 'y%./+-%__p_%'` xe_check_libs=" -lcompface " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8304,12 +8322,12 @@ if test "$with_png $with_tiff" != "no no"; then echo $ac_n "checking for inflate in -lc""... $ac_c" 1>&6 -echo "configure:8308: checking for inflate in -lc" >&5 +echo "configure:8326: checking for inflate in -lc" >&5 ac_lib_var=`echo c'_'inflate | sed 'y%./+-%__p_%'` xe_check_libs=" -lc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8339,12 +8357,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for inflate in -lz""... $ac_c" 1>&6 -echo "configure:8343: checking for inflate in -lz" >&5 +echo "configure:8361: checking for inflate in -lz" >&5 ac_lib_var=`echo z'_'inflate | sed 'y%./+-%__p_%'` xe_check_libs=" -lz " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8374,12 +8392,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for inflate in -lgz""... $ac_c" 1>&6 -echo "configure:8378: checking for inflate in -lgz" >&5 +echo "configure:8396: checking for inflate in -lgz" >&5 ac_lib_var=`echo gz'_'inflate | sed 'y%./+-%__p_%'` xe_check_libs=" -lgz " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8420,15 +8438,15 @@ test -z "$with_jpeg" && { ac_safe=`echo "jpeglib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6 -echo "configure:8424: checking for jpeglib.h" >&5 +echo "configure:8442: checking for jpeglib.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8451,12 +8469,12 @@ } test -z "$with_jpeg" && { echo $ac_n "checking for jpeg_destroy_decompress in -ljpeg""... $ac_c" 1>&6 -echo "configure:8455: checking for jpeg_destroy_decompress in -ljpeg" >&5 +echo "configure:8473: checking for jpeg_destroy_decompress in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_destroy_decompress | sed 'y%./+-%__p_%'` xe_check_libs=" -ljpeg " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8503,10 +8521,10 @@ png_problem="" test -z "$with_png" && { echo $ac_n "checking for pow""... $ac_c" 1>&6 -echo "configure:8507: checking for pow" >&5 +echo "configure:8525: checking for pow" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pow=yes" else @@ -8550,15 +8568,15 @@ } test -z "$with_png" && { ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for png.h""... $ac_c" 1>&6 -echo "configure:8554: checking for png.h" >&5 +echo "configure:8572: checking for png.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8581,12 +8599,12 @@ } test -z "$with_png" && { echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6 -echo "configure:8585: checking for png_read_image in -lpng" >&5 +echo "configure:8603: checking for png_read_image in -lpng" >&5 ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'` xe_check_libs=" -lpng " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8620,10 +8638,10 @@ } if test -z "$with_png"; then echo $ac_n "checking for workable png version information""... $ac_c" 1>&6 -echo "configure:8624: checking for workable png version information" >&5 +echo "configure:8642: checking for workable png version information" >&5 xe_check_libs="-lpng -lz" cat > conftest.$ac_ext < int main(int c, char **v) { @@ -8631,7 +8649,7 @@ if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING) != 0) return 1; return (PNG_LIBPNG_VER < 10002) ? 2 : 0 ;} EOF -if { (eval echo configure:8635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:8653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ./conftest dummy_arg; png_status=$?; if test "$png_status" = "0"; then @@ -8674,15 +8692,15 @@ test -z "$with_tiff" && { ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6 -echo "configure:8678: checking for tiffio.h" >&5 +echo "configure:8696: checking for tiffio.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8705,12 +8723,12 @@ } test -z "$with_tiff" && { echo $ac_n "checking for TIFFClientOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:8709: checking for TIFFClientOpen in -ltiff" >&5 +echo "configure:8727: checking for TIFFClientOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFClientOpen | sed 'y%./+-%__p_%'` xe_check_libs=" -ltiff " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8760,15 +8778,15 @@ if test "$with_gtk" = "yes"; then test -z "$with_xface" && { ac_safe=`echo "compface.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for compface.h""... $ac_c" 1>&6 -echo "configure:8764: checking for compface.h" >&5 +echo "configure:8782: checking for compface.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8772: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8790: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8791,12 +8809,12 @@ } test -z "$with_xface" && { echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6 -echo "configure:8795: checking for UnGenFace in -lcompface" >&5 +echo "configure:8813: checking for UnGenFace in -lcompface" >&5 ac_lib_var=`echo compface'_'UnGenFace | sed 'y%./+-%__p_%'` xe_check_libs=" -lcompface " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8846,7 +8864,7 @@ if test "$with_x11" = "yes"; then echo "checking for X11 graphics libraries" 1>&6 -echo "configure:8850: checking for X11 graphics libraries" >&5 +echo "configure:8868: checking for X11 graphics libraries" >&5 fi case "$with_widgets" in @@ -8856,7 +8874,7 @@ if test "$with_x11" = "yes" -a "$detect_athena" = "yes" ; then echo "checking for the Athena widgets" 1>&6 -echo "configure:8860: checking for the Athena widgets" >&5 +echo "configure:8878: checking for the Athena widgets" >&5 case "$with_athena" in "xaw" | "") athena_variant=Xaw athena_3d=no ;; @@ -8870,12 +8888,12 @@ if test "$athena_3d" = "no"; then echo $ac_n "checking for XawScrollbarSetThumb in -l$athena_variant""... $ac_c" 1>&6 -echo "configure:8874: checking for XawScrollbarSetThumb in -l$athena_variant" >&5 +echo "configure:8892: checking for XawScrollbarSetThumb in -l$athena_variant" >&5 ac_lib_var=`echo $athena_variant'_'XawScrollbarSetThumb | sed 'y%./+-%__p_%'` xe_check_libs=" -l$athena_variant " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8902,12 +8920,12 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking for threeDClassRec in -l$athena_variant""... $ac_c" 1>&6 -echo "configure:8906: checking for threeDClassRec in -l$athena_variant" >&5 +echo "configure:8924: checking for threeDClassRec in -l$athena_variant" >&5 ac_lib_var=`echo $athena_variant'_'threeDClassRec | sed 'y%./+-%__p_%'` xe_check_libs=" -l$athena_variant " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8949,12 +8967,12 @@ else echo $ac_n "checking for threeDClassRec in -l$athena_variant""... $ac_c" 1>&6 -echo "configure:8953: checking for threeDClassRec in -l$athena_variant" >&5 +echo "configure:8971: checking for threeDClassRec in -l$athena_variant" >&5 ac_lib_var=`echo $athena_variant'_'threeDClassRec | sed 'y%./+-%__p_%'` xe_check_libs=" -l$athena_variant " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8983,12 +9001,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for threeDClassRec in -lXaw""... $ac_c" 1>&6 -echo "configure:8987: checking for threeDClassRec in -lXaw" >&5 +echo "configure:9005: checking for threeDClassRec in -lXaw" >&5 ac_lib_var=`echo Xaw'_'threeDClassRec | sed 'y%./+-%__p_%'` xe_check_libs=" -lXaw " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9030,15 +9048,15 @@ if test "$athena_3d" = "no"; then ac_safe=`echo "X11/Xaw/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9034: checking for X11/Xaw/ThreeD.h" >&5 +echo "configure:9052: checking for X11/Xaw/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9058,15 +9076,15 @@ echo "$ac_t""no" 1>&6 ac_safe=`echo "X11/Xaw/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/XawInit.h""... $ac_c" 1>&6 -echo "configure:9062: checking for X11/Xaw/XawInit.h" >&5 +echo "configure:9080: checking for X11/Xaw/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9070: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9092,15 +9110,15 @@ else ac_safe=`echo "X11/$athena_variant/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/$athena_variant/XawInit.h""... $ac_c" 1>&6 -echo "configure:9096: checking for X11/$athena_variant/XawInit.h" >&5 +echo "configure:9114: checking for X11/$athena_variant/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9122: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9117,15 +9135,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "X11/$athena_variant/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/$athena_variant/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9121: checking for X11/$athena_variant/ThreeD.h" >&5 +echo "configure:9139: checking for X11/$athena_variant/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9147: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9153,15 +9171,15 @@ if test -z "$athena_h_path"; then ac_safe=`echo "$athena_variant/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $athena_variant/XawInit.h""... $ac_c" 1>&6 -echo "configure:9157: checking for $athena_variant/XawInit.h" >&5 +echo "configure:9175: checking for $athena_variant/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9165: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9178,15 +9196,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "$athena_variant/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $athena_variant/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9182: checking for $athena_variant/ThreeD.h" >&5 +echo "configure:9200: checking for $athena_variant/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9215,15 +9233,15 @@ if test -z "$athena_h_path" -a "$athena_variant" != "Xaw3d"; then ac_safe=`echo "X11/Xaw3d/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw3d/XawInit.h""... $ac_c" 1>&6 -echo "configure:9219: checking for X11/Xaw3d/XawInit.h" >&5 +echo "configure:9237: checking for X11/Xaw3d/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9240,15 +9258,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "X11/Xaw3d/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw3d/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9244: checking for X11/Xaw3d/ThreeD.h" >&5 +echo "configure:9262: checking for X11/Xaw3d/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9280,15 +9298,15 @@ if test -z "$athena_h_path" -a "$athena_variant" != "Xaw3d"; then ac_safe=`echo "Xaw3d/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xaw3d/XawInit.h""... $ac_c" 1>&6 -echo "configure:9284: checking for Xaw3d/XawInit.h" >&5 +echo "configure:9302: checking for Xaw3d/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9305,15 +9323,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "Xaw3d/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xaw3d/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9309: checking for Xaw3d/ThreeD.h" >&5 +echo "configure:9327: checking for Xaw3d/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9345,15 +9363,15 @@ if test -z "$athena_h_path"; then ac_safe=`echo "X11/Xaw/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9349: checking for X11/Xaw/ThreeD.h" >&5 +echo "configure:9367: checking for X11/Xaw/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9357: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9375: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9392,15 +9410,15 @@ if test "$with_x11" = "yes"; then ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6 -echo "configure:9396: checking for Xm/Xm.h" >&5 +echo "configure:9414: checking for Xm/Xm.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9417,12 +9435,12 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking for XmStringFree in -lXm""... $ac_c" 1>&6 -echo "configure:9421: checking for XmStringFree in -lXm" >&5 +echo "configure:9439: checking for XmStringFree in -lXm" >&5 ac_lib_var=`echo Xm'_'XmStringFree | sed 'y%./+-%__p_%'` xe_check_libs=" -lXm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9462,9 +9480,9 @@ if test "$have_motif" = "yes"; then echo $ac_n "checking for Lesstif""... $ac_c" 1>&6 -echo "configure:9466: checking for Lesstif" >&5 +echo "configure:9484: checking for Lesstif" >&5 cat > conftest.$ac_ext < #ifdef LESSTIF_VERSION @@ -9837,7 +9855,7 @@ if test "$with_mule" = "yes" ; then echo "checking for Mule-related features" 1>&6 -echo "configure:9841: checking for Mule-related features" >&5 +echo "configure:9859: checking for Mule-related features" >&5 { test "$extra_verbose" = "yes" && cat << \EOF Defining MULE EOF @@ -9851,15 +9869,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:9855: checking for $ac_hdr" >&5 +echo "configure:9873: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9863: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9890,12 +9908,12 @@ echo $ac_n "checking for strerror in -lintl""... $ac_c" 1>&6 -echo "configure:9894: checking for strerror in -lintl" >&5 +echo "configure:9912: checking for strerror in -lintl" >&5 ac_lib_var=`echo intl'_'strerror | sed 'y%./+-%__p_%'` xe_check_libs=" -lintl " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9939,18 +9957,18 @@ echo "checking for Mule input methods" 1>&6 -echo "configure:9943: checking for Mule input methods" >&5 +echo "configure:9961: checking for Mule input methods" >&5 case "$with_xim" in "" | "yes" ) echo "checking for XIM" 1>&6 -echo "configure:9946: checking for XIM" >&5 +echo "configure:9964: checking for XIM" >&5 echo $ac_n "checking for XOpenIM in -lX11""... $ac_c" 1>&6 -echo "configure:9949: checking for XOpenIM in -lX11" >&5 +echo "configure:9967: checking for XOpenIM in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenIM | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9985,12 +10003,12 @@ if test "$have_motif $have_lesstif" = "yes no"; then echo $ac_n "checking for XmImMbLookupString in -lXm""... $ac_c" 1>&6 -echo "configure:9989: checking for XmImMbLookupString in -lXm" >&5 +echo "configure:10007: checking for XmImMbLookupString in -lXm" >&5 ac_lib_var=`echo Xm'_'XmImMbLookupString | sed 'y%./+-%__p_%'` xe_check_libs=" -lXm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10066,15 +10084,15 @@ if test "$with_xfs" = "yes" ; then echo "checking for XFontSet" 1>&6 -echo "configure:10070: checking for XFontSet" >&5 +echo "configure:10088: checking for XFontSet" >&5 echo $ac_n "checking for XmbDrawString in -lX11""... $ac_c" 1>&6 -echo "configure:10073: checking for XmbDrawString in -lX11" >&5 +echo "configure:10091: checking for XmbDrawString in -lX11" >&5 ac_lib_var=`echo X11'_'XmbDrawString | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10125,15 +10143,15 @@ test "$with_wnn6" = "yes" && with_wnn=yes # wnn6 implies wnn support test -z "$with_wnn" && { ac_safe=`echo "wnn/jllib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for wnn/jllib.h""... $ac_c" 1>&6 -echo "configure:10129: checking for wnn/jllib.h" >&5 +echo "configure:10147: checking for wnn/jllib.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10156,15 +10174,15 @@ } test -z "$with_wnn" && { ac_safe=`echo "wnn/commonhd.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for wnn/commonhd.h""... $ac_c" 1>&6 -echo "configure:10160: checking for wnn/commonhd.h" >&5 +echo "configure:10178: checking for wnn/commonhd.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10189,10 +10207,10 @@ for ac_func in crypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10193: checking for $ac_func" >&5 +echo "configure:10211: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10244,12 +10262,12 @@ test "$ac_cv_func_crypt" != "yes" && { echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:10248: checking for crypt in -lcrypt" >&5 +echo "configure:10266: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` xe_check_libs=" -lcrypt " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10295,12 +10313,12 @@ if test -z "$with_wnn" -o "$with_wnn" = "yes"; then echo $ac_n "checking for jl_dic_list_e in -lwnn""... $ac_c" 1>&6 -echo "configure:10299: checking for jl_dic_list_e in -lwnn" >&5 +echo "configure:10317: checking for jl_dic_list_e in -lwnn" >&5 ac_lib_var=`echo wnn'_'jl_dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10329,12 +10347,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for jl_dic_list_e in -lwnn4""... $ac_c" 1>&6 -echo "configure:10333: checking for jl_dic_list_e in -lwnn4" >&5 +echo "configure:10351: checking for jl_dic_list_e in -lwnn4" >&5 ac_lib_var=`echo wnn4'_'jl_dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn4 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10363,12 +10381,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for jl_dic_list_e in -lwnn6""... $ac_c" 1>&6 -echo "configure:10367: checking for jl_dic_list_e in -lwnn6" >&5 +echo "configure:10385: checking for jl_dic_list_e in -lwnn6" >&5 ac_lib_var=`echo wnn6'_'jl_dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn6 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10397,12 +10415,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dic_list_e in -lwnn6_fromsrc""... $ac_c" 1>&6 -echo "configure:10401: checking for dic_list_e in -lwnn6_fromsrc" >&5 +echo "configure:10419: checking for dic_list_e in -lwnn6_fromsrc" >&5 ac_lib_var=`echo wnn6_fromsrc'_'dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn6_fromsrc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10458,12 +10476,12 @@ if test "$with_wnn6" != "no"; then echo $ac_n "checking for jl_fi_dic_list in -l$libwnn""... $ac_c" 1>&6 -echo "configure:10462: checking for jl_fi_dic_list in -l$libwnn" >&5 +echo "configure:10480: checking for jl_fi_dic_list in -l$libwnn" >&5 ac_lib_var=`echo $libwnn'_'jl_fi_dic_list | sed 'y%./+-%__p_%'` xe_check_libs=" -l$libwnn " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10509,15 +10527,15 @@ if test "$with_canna" != "no"; then ac_safe=`echo "canna/jrkanji.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6 -echo "configure:10513: checking for canna/jrkanji.h" >&5 +echo "configure:10531: checking for canna/jrkanji.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10521: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10544,15 +10562,15 @@ c_switch_site="$c_switch_site -I/usr/local/canna/include" ac_safe=`echo "canna/jrkanji.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6 -echo "configure:10548: checking for canna/jrkanji.h" >&5 +echo "configure:10566: checking for canna/jrkanji.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10556: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10580,15 +10598,15 @@ test -z "$with_canna" && { ac_safe=`echo "canna/RK.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for canna/RK.h""... $ac_c" 1>&6 -echo "configure:10584: checking for canna/RK.h" >&5 +echo "configure:10602: checking for canna/RK.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10611,12 +10629,12 @@ } test -z "$with_canna" && { echo $ac_n "checking for RkBgnBun in -lRKC""... $ac_c" 1>&6 -echo "configure:10615: checking for RkBgnBun in -lRKC" >&5 +echo "configure:10633: checking for RkBgnBun in -lRKC" >&5 ac_lib_var=`echo RKC'_'RkBgnBun | sed 'y%./+-%__p_%'` xe_check_libs=" -lRKC " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10650,12 +10668,12 @@ } test -z "$with_canna" && { echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6 -echo "configure:10654: checking for jrKanjiControl in -lcanna" >&5 +echo "configure:10672: checking for jrKanjiControl in -lcanna" >&5 ac_lib_var=`echo canna'_'jrKanjiControl | sed 'y%./+-%__p_%'` xe_check_libs=" -lcanna " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10712,12 +10730,12 @@ libs_x="-lXm $libs_x" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-lXm\" to \$libs_x"; fi echo $ac_n "checking for layout_object_getvalue in -li18n""... $ac_c" 1>&6 -echo "configure:10716: checking for layout_object_getvalue in -li18n" >&5 +echo "configure:10734: checking for layout_object_getvalue in -li18n" >&5 ac_lib_var=`echo i18n'_'layout_object_getvalue | sed 'y%./+-%__p_%'` xe_check_libs=" -li18n " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10814,10 +10832,10 @@ for ac_func in cbrt closedir dup2 eaccess fmod fpathconf frexp ftime getaddrinfo gethostname getnameinfo getpagesize gettimeofday getcwd getwd link logb lrand48 matherr mkdir mktime perror poll random readlink rename res_init rint rmdir select setitimer setpgid setlocale setsid sigblock sighold sigprocmask snprintf stpcpy strerror symlink tzset ulimit usleep waitpid vsnprintf fsync ftruncate umask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10818: checking for $ac_func" >&5 +echo "configure:10836: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10872,10 +10890,10 @@ for ac_func in getpt _getpty grantpt unlockpt ptsname killpg tcgetpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10876: checking for $ac_func" >&5 +echo "configure:10894: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10927,10 +10945,10 @@ echo $ac_n "checking for openpty""... $ac_c" 1>&6 -echo "configure:10931: checking for openpty" >&5 +echo "configure:10949: checking for openpty" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_openpty=yes" else @@ -10972,12 +10990,12 @@ echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6 -echo "configure:10976: checking for openpty in -lutil" >&5 +echo "configure:10994: checking for openpty in -lutil" >&5 ac_lib_var=`echo util'_'openpty | sed 'y%./+-%__p_%'` xe_check_libs=" -lutil " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11023,15 +11041,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11027: checking for $ac_hdr" >&5 +echo "configure:11045: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11053: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11068,15 +11086,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11072: checking for $ac_hdr" >&5 +echo "configure:11090: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11080: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11098: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11109,15 +11127,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11113: checking for $ac_hdr" >&5 +echo "configure:11131: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11139: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11150,15 +11168,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11154: checking for $ac_hdr" >&5 +echo "configure:11172: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11194,15 +11212,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11198: checking for $ac_hdr" >&5 +echo "configure:11216: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11206: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11235,10 +11253,10 @@ for ac_func in isastream do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11239: checking for $ac_func" >&5 +echo "configure:11257: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11292,15 +11310,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11296: checking for $ac_hdr" >&5 +echo "configure:11314: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11322: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11333,10 +11351,10 @@ for ac_func in getloadavg do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11337: checking for $ac_func" >&5 +echo "configure:11355: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11392,15 +11410,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11396: checking for $ac_hdr" >&5 +echo "configure:11414: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11436,12 +11454,12 @@ echo $ac_n "checking for kstat_open in -lkstat""... $ac_c" 1>&6 -echo "configure:11440: checking for kstat_open in -lkstat" >&5 +echo "configure:11458: checking for kstat_open in -lkstat" >&5 ac_lib_var=`echo kstat'_'kstat_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lkstat " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11487,15 +11505,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11491: checking for $ac_hdr" >&5 +echo "configure:11509: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11527,12 +11545,12 @@ echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6 -echo "configure:11531: checking for kvm_read in -lkvm" >&5 +echo "configure:11549: checking for kvm_read in -lkvm" >&5 ac_lib_var=`echo kvm'_'kvm_read | sed 'y%./+-%__p_%'` xe_check_libs=" -lkvm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11577,16 +11595,16 @@ fi echo $ac_n "checking whether netdb declares h_errno""... $ac_c" 1>&6 -echo "configure:11581: checking whether netdb declares h_errno" >&5 +echo "configure:11599: checking whether netdb declares h_errno" >&5 cat > conftest.$ac_ext < int main() { return h_errno; ; return 0; } EOF -if { (eval echo configure:11590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 { test "$extra_verbose" = "yes" && cat << \EOF @@ -11606,16 +11624,16 @@ rm -f conftest* echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6 -echo "configure:11610: checking for sigsetjmp" >&5 +echo "configure:11628: checking for sigsetjmp" >&5 cat > conftest.$ac_ext < int main() { sigjmp_buf bar; sigsetjmp (bar, 0); ; return 0; } EOF -if { (eval echo configure:11619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11637: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 { test "$extra_verbose" = "yes" && cat << \EOF @@ -11635,11 +11653,11 @@ rm -f conftest* echo $ac_n "checking whether localtime caches TZ""... $ac_c" 1>&6 -echo "configure:11639: checking whether localtime caches TZ" >&5 +echo "configure:11657: checking whether localtime caches TZ" >&5 if test "$ac_cv_func_tzset" = "yes"; then cat > conftest.$ac_ext < #if STDC_HEADERS @@ -11674,7 +11692,7 @@ exit (0); } EOF -if { (eval echo configure:11678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:11696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then emacs_cv_localtime_cache=no else @@ -11704,9 +11722,9 @@ if test "$HAVE_TIMEVAL" = "yes"; then echo $ac_n "checking whether gettimeofday accepts one or two arguments""... $ac_c" 1>&6 -echo "configure:11708: checking whether gettimeofday accepts one or two arguments" >&5 +echo "configure:11726: checking whether gettimeofday accepts one or two arguments" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""two" 1>&6 else @@ -11749,19 +11767,19 @@ echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:11753: checking for inline" >&5 +echo "configure:11771: checking for inline" >&5 ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -11802,17 +11820,17 @@ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:11806: checking for working alloca.h" >&5 +echo "configure:11824: checking for working alloca.h" >&5 cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:11816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -11836,10 +11854,10 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:11840: checking for alloca" >&5 +echo "configure:11858: checking for alloca" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -11906,10 +11924,10 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:11910: checking whether alloca needs Cray hooks" >&5 +echo "configure:11928: checking whether alloca needs Cray hooks" >&5 cat > conftest.$ac_ext <&6 -echo "configure:11937: checking for $ac_func" >&5 +echo "configure:11955: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11989,10 +12007,10 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:11993: checking stack direction for C alloca" >&5 +echo "configure:12011: checking stack direction for C alloca" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_c_stack_direction=1 else @@ -12040,10 +12058,10 @@ fi echo $ac_n "checking for working strcoll""... $ac_c" 1>&6 -echo "configure:12044: checking for working strcoll" >&5 +echo "configure:12062: checking for working strcoll" >&5 cat > conftest.$ac_ext < main () @@ -12053,7 +12071,7 @@ strcoll ("123", "456") >= 0); } EOF -if { (eval echo configure:12057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_func_strcoll_works=yes else @@ -12081,10 +12099,10 @@ for ac_func in getpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:12085: checking for $ac_func" >&5 +echo "configure:12103: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -12135,10 +12153,10 @@ done echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:12139: checking whether getpgrp takes no argument" >&5 +echo "configure:12157: checking whether getpgrp takes no argument" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_func_getpgrp_void=yes else @@ -12220,10 +12238,10 @@ echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:12224: checking for working mmap" >&5 +echo "configure:12242: checking for working mmap" >&5 case "$opsys" in ultrix* ) have_mmap=no ;; *) cat > conftest.$ac_ext < #include @@ -12256,7 +12274,7 @@ return 1; } EOF -if { (eval echo configure:12260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then have_mmap=yes else @@ -12285,9 +12303,9 @@ if test "$rel_alloc $have_mmap" = "default yes"; then if test "$doug_lea_malloc" = "yes"; then echo $ac_n "checking for M_MMAP_THRESHOLD""... $ac_c" 1>&6 -echo "configure:12289: checking for M_MMAP_THRESHOLD" >&5 +echo "configure:12307: checking for M_MMAP_THRESHOLD" >&5 cat > conftest.$ac_ext < int main() { @@ -12299,7 +12317,7 @@ ; return 0; } EOF -if { (eval echo configure:12303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12321: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rel_alloc=no; echo "$ac_t""yes" 1>&6; else @@ -12324,15 +12342,15 @@ ac_safe=`echo "termios.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for termios.h""... $ac_c" 1>&6 -echo "configure:12328: checking for termios.h" >&5 +echo "configure:12346: checking for termios.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12375,15 +12393,15 @@ echo "$ac_t""no" 1>&6 ac_safe=`echo "termio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for termio.h""... $ac_c" 1>&6 -echo "configure:12379: checking for termio.h" >&5 +echo "configure:12397: checking for termio.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12415,10 +12433,10 @@ echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:12419: checking for socket" >&5 +echo "configure:12437: checking for socket" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -12456,15 +12474,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "netinet/in.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for netinet/in.h""... $ac_c" 1>&6 -echo "configure:12460: checking for netinet/in.h" >&5 +echo "configure:12478: checking for netinet/in.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12486: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12481,15 +12499,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "arpa/inet.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for arpa/inet.h""... $ac_c" 1>&6 -echo "configure:12485: checking for arpa/inet.h" >&5 +echo "configure:12503: checking for arpa/inet.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12493: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12514,9 +12532,9 @@ } echo $ac_n "checking "for sun_len member in struct sockaddr_un"""... $ac_c" 1>&6 -echo "configure:12518: checking "for sun_len member in struct sockaddr_un"" >&5 +echo "configure:12536: checking "for sun_len member in struct sockaddr_un"" >&5 cat > conftest.$ac_ext < @@ -12527,7 +12545,7 @@ static struct sockaddr_un x; x.sun_len = 1; ; return 0; } EOF -if { (eval echo configure:12531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_SOCKADDR_SUN_LEN @@ -12545,9 +12563,9 @@ fi rm -f conftest* echo $ac_n "checking "for ip_mreq struct in netinet/in.h"""... $ac_c" 1>&6 -echo "configure:12549: checking "for ip_mreq struct in netinet/in.h"" >&5 +echo "configure:12567: checking "for ip_mreq struct in netinet/in.h"" >&5 cat > conftest.$ac_ext < @@ -12557,7 +12575,7 @@ static struct ip_mreq x; ; return 0; } EOF -if { (eval echo configure:12561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_MULTICAST @@ -12588,10 +12606,10 @@ echo $ac_n "checking for msgget""... $ac_c" 1>&6 -echo "configure:12592: checking for msgget" >&5 +echo "configure:12610: checking for msgget" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_msgget=yes" else @@ -12629,15 +12647,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6 -echo "configure:12633: checking for sys/ipc.h" >&5 +echo "configure:12651: checking for sys/ipc.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12641: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12654,15 +12672,15 @@ echo "$ac_t""yes" 1>&6 ac_safe=`echo "sys/msg.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/msg.h""... $ac_c" 1>&6 -echo "configure:12658: checking for sys/msg.h" >&5 +echo "configure:12676: checking for sys/msg.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12666: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12684: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12700,15 +12718,15 @@ ac_safe=`echo "dirent.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dirent.h""... $ac_c" 1>&6 -echo "configure:12704: checking for dirent.h" >&5 +echo "configure:12722: checking for dirent.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12735,15 +12753,15 @@ echo "$ac_t""no" 1>&6 ac_safe=`echo "sys/dir.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/dir.h""... $ac_c" 1>&6 -echo "configure:12739: checking for sys/dir.h" >&5 +echo "configure:12757: checking for sys/dir.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12765: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12776,15 +12794,15 @@ ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for nlist.h""... $ac_c" 1>&6 -echo "configure:12780: checking for nlist.h" >&5 +echo "configure:12798: checking for nlist.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12814,22 +12832,22 @@ echo "checking "for sound support"" 1>&6 -echo "configure:12818: checking "for sound support"" >&5 +echo "configure:12836: checking "for sound support"" >&5 test -z "$with_native_sound" -a -n "$native_sound_lib" && with_native_sound=yes if test "$with_native_sound" != "no"; then if test -n "$native_sound_lib"; then ac_safe=`echo "multimedia/audio_device.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for multimedia/audio_device.h""... $ac_c" 1>&6 -echo "configure:12825: checking for multimedia/audio_device.h" >&5 +echo "configure:12843: checking for multimedia/audio_device.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12877,12 +12895,12 @@ if test -z "$native_sound_lib"; then echo $ac_n "checking for ALopenport in -laudio""... $ac_c" 1>&6 -echo "configure:12881: checking for ALopenport in -laudio" >&5 +echo "configure:12899: checking for ALopenport in -laudio" >&5 ac_lib_var=`echo audio'_'ALopenport | sed 'y%./+-%__p_%'` xe_check_libs=" -laudio " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12924,12 +12942,12 @@ if test -z "$native_sound_lib"; then echo $ac_n "checking for AOpenAudio in -lAlib""... $ac_c" 1>&6 -echo "configure:12928: checking for AOpenAudio in -lAlib" >&5 +echo "configure:12946: checking for AOpenAudio in -lAlib" >&5 ac_lib_var=`echo Alib'_'AOpenAudio | sed 'y%./+-%__p_%'` xe_check_libs=" -lAlib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12988,15 +13006,15 @@ for dir in "machine" "sys" "linux"; do ac_safe=`echo "${dir}/soundcard.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ${dir}/soundcard.h""... $ac_c" 1>&6 -echo "configure:12992: checking for ${dir}/soundcard.h" >&5 +echo "configure:13010: checking for ${dir}/soundcard.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13050,15 +13068,15 @@ if test "$with_nas_sound" != "no"; then ac_safe=`echo "audio/audiolib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for audio/audiolib.h""... $ac_c" 1>&6 -echo "configure:13054: checking for audio/audiolib.h" >&5 +echo "configure:13072: checking for audio/audiolib.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13080: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13076,12 +13094,12 @@ echo $ac_n "checking for AuOpenServer in -laudio""... $ac_c" 1>&6 -echo "configure:13080: checking for AuOpenServer in -laudio" >&5 +echo "configure:13098: checking for AuOpenServer in -laudio" >&5 ac_lib_var=`echo audio'_'AuOpenServer | sed 'y%./+-%__p_%'` xe_check_libs=" -laudio " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13131,7 +13149,7 @@ fi libs_x="-laudio $libs_x" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-laudio\" to \$libs_x"; fi cat > conftest.$ac_ext < EOF @@ -13162,7 +13180,7 @@ # Extract the first word of "esd-config", so it can be a program name with args. set dummy esd-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:13166: checking for $ac_word" >&5 +echo "configure:13184: checking for $ac_word" >&5 if test -n "$have_esd_config"; then ac_cv_prog_have_esd_config="$have_esd_config" # Let the user override the test. @@ -13191,10 +13209,10 @@ c_switch_site="$c_switch_site `esd-config --cflags`" && if test "$extra_verbose" = "yes"; then echo " Appending \"`esd-config --cflags`\" to \$c_switch_site"; fi LIBS="`esd-config --libs` $LIBS" && if test "$extra_verbose" = "yes"; then echo " Prepending \"`esd-config --libs`\" to \$LIBS"; fi echo $ac_n "checking for esd_play_stream""... $ac_c" 1>&6 -echo "configure:13195: checking for esd_play_stream" >&5 +echo "configure:13213: checking for esd_play_stream" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_esd_play_stream=yes" else @@ -13268,7 +13286,7 @@ if test "$with_tty" = "yes" ; then echo "checking for TTY-related features" 1>&6 -echo "configure:13272: checking for TTY-related features" >&5 +echo "configure:13290: checking for TTY-related features" >&5 { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_TTY EOF @@ -13281,12 +13299,12 @@ if test -z "$with_ncurses"; then echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:13285: checking for tgetent in -lncurses" >&5 +echo "configure:13303: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -lncurses " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13330,15 +13348,15 @@ ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6 -echo "configure:13334: checking for ncurses/curses.h" >&5 +echo "configure:13352: checking for ncurses/curses.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13360: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13360,15 +13378,15 @@ ac_safe=`echo "ncurses/term.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/term.h""... $ac_c" 1>&6 -echo "configure:13364: checking for ncurses/term.h" >&5 +echo "configure:13382: checking for ncurses/term.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13390: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13398,15 +13416,15 @@ c_switch_site="$c_switch_site -I/usr/include/ncurses" ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6 -echo "configure:13402: checking for ncurses/curses.h" >&5 +echo "configure:13420: checking for ncurses/curses.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13441,12 +13459,12 @@ for lib in curses termlib termcap; do echo $ac_n "checking for tgetent in -l$lib""... $ac_c" 1>&6 -echo "configure:13445: checking for tgetent in -l$lib" >&5 +echo "configure:13463: checking for tgetent in -l$lib" >&5 ac_lib_var=`echo $lib'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -l$lib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13488,12 +13506,12 @@ else echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:13492: checking for tgetent in -lcurses" >&5 +echo "configure:13510: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -lcurses " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13522,12 +13540,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:13526: checking for tgetent in -ltermcap" >&5 +echo "configure:13544: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -ltermcap " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13586,15 +13604,15 @@ test -z "$with_gpm" && { ac_safe=`echo "gpm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for gpm.h""... $ac_c" 1>&6 -echo "configure:13590: checking for gpm.h" >&5 +echo "configure:13608: checking for gpm.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13598: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13616: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13617,12 +13635,12 @@ } test -z "$with_gpm" && { echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:13621: checking for Gpm_Open in -lgpm" >&5 +echo "configure:13639: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` xe_check_libs=" -lgpm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13676,20 +13694,20 @@ test "$with_database_gdbm $with_database_dbm $with_database_berkdb" \ != "no no no" && echo "checking for database support" 1>&6 -echo "configure:13680: checking for database support" >&5 +echo "configure:13698: checking for database support" >&5 if test "$with_database_gdbm $with_database_dbm" != "no no"; then ac_safe=`echo "ndbm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ndbm.h""... $ac_c" 1>&6 -echo "configure:13685: checking for ndbm.h" >&5 +echo "configure:13703: checking for ndbm.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13693: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13719,12 +13737,12 @@ if test "$with_database_gdbm" != "no"; then echo $ac_n "checking for dbm_open in -lgdbm""... $ac_c" 1>&6 -echo "configure:13723: checking for dbm_open in -lgdbm" >&5 +echo "configure:13741: checking for dbm_open in -lgdbm" >&5 ac_lib_var=`echo gdbm'_'dbm_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lgdbm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13763,10 +13781,10 @@ if test "$with_database_dbm" != "no"; then echo $ac_n "checking for dbm_open""... $ac_c" 1>&6 -echo "configure:13767: checking for dbm_open" >&5 +echo "configure:13785: checking for dbm_open" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dbm_open=yes" else @@ -13808,12 +13826,12 @@ echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6 -echo "configure:13812: checking for dbm_open in -ldbm" >&5 +echo "configure:13830: checking for dbm_open in -ldbm" >&5 ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'` xe_check_libs=" -ldbm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13865,10 +13883,10 @@ if test "$with_database_berkdb" != "no"; then echo $ac_n "checking for Berkeley db.h""... $ac_c" 1>&6 -echo "configure:13869: checking for Berkeley db.h" >&5 +echo "configure:13887: checking for Berkeley db.h" >&5 for header in "db/db.h" "db.h"; do cat > conftest.$ac_ext < @@ -13890,7 +13908,7 @@ ; return 0; } EOF -if { (eval echo configure:13894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13912: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* db_h_file="$header"; break else @@ -13906,9 +13924,9 @@ if test "$with_database_berkdb" != "no"; then echo $ac_n "checking for Berkeley DB version""... $ac_c" 1>&6 -echo "configure:13910: checking for Berkeley DB version" >&5 +echo "configure:13928: checking for Berkeley DB version" >&5 cat > conftest.$ac_ext < #if DB_VERSION_MAJOR > 1 @@ -13920,7 +13938,7 @@ egrep "yes" >/dev/null 2>&1; then rm -rf conftest* cat > conftest.$ac_ext < #if DB_VERSION_MAJOR > 2 @@ -13947,10 +13965,10 @@ rm -f conftest* echo $ac_n "checking for $dbfunc""... $ac_c" 1>&6 -echo "configure:13951: checking for $dbfunc" >&5 +echo "configure:13969: checking for $dbfunc" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$dbfunc=yes" else @@ -13992,12 +14010,12 @@ echo $ac_n "checking for $dbfunc in -ldb""... $ac_c" 1>&6 -echo "configure:13996: checking for $dbfunc in -ldb" >&5 +echo "configure:14014: checking for $dbfunc in -ldb" >&5 ac_lib_var=`echo db'_'$dbfunc | sed 'y%./+-%__p_%'` xe_check_libs=" -ldb " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14069,12 +14087,12 @@ if test "$with_socks" = "yes"; then echo $ac_n "checking for SOCKSinit in -lsocks""... $ac_c" 1>&6 -echo "configure:14073: checking for SOCKSinit in -lsocks" >&5 +echo "configure:14091: checking for SOCKSinit in -lsocks" >&5 ac_lib_var=`echo socks'_'SOCKSinit | sed 'y%./+-%__p_%'` xe_check_libs=" -lsocks " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14140,22 +14158,22 @@ if test "$with_modules" != "no"; then echo "checking for module support" 1>&6 -echo "configure:14144: checking for module support" >&5 +echo "configure:14162: checking for module support" >&5 if test "$with_msw" = "yes"; then have_dl=yes; else ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:14151: checking for dlfcn.h" >&5 +echo "configure:14169: checking for dlfcn.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:14159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:14177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -14172,16 +14190,16 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking for dlopen in -lc""... $ac_c" 1>&6 -echo "configure:14176: checking for dlopen in -lc" >&5 +echo "configure:14194: checking for dlopen in -lc" >&5 cat > conftest.$ac_ext < int main() { dlopen ("", 0); ; return 0; } EOF -if { (eval echo configure:14185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* have_dl=yes else @@ -14190,18 +14208,18 @@ rm -rf conftest* echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:14194: checking for dlopen in -ldl" >&5 +echo "configure:14212: checking for dlopen in -ldl" >&5 ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext < int main() { dlopen ("", 0); ; return 0; } EOF -if { (eval echo configure:14205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* have_dl=yes else @@ -14230,12 +14248,12 @@ else echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "configure:14234: checking for shl_load in -ldld" >&5 +echo "configure:14252: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` xe_check_libs=" -ldld " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14273,12 +14291,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld_init in -ldld""... $ac_c" 1>&6 -echo "configure:14277: checking for dld_init in -ldld" >&5 +echo "configure:14295: checking for dld_init in -ldld" >&5 ac_lib_var=`echo dld'_'dld_init | sed 'y%./+-%__p_%'` xe_check_libs=" -ldld " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14334,7 +14352,7 @@ xealias=$internal_configuration echo "checking how to build dynamic libraries for ${xehost}" 1>&6 -echo "configure:14338: checking how to build dynamic libraries for ${xehost}" >&5 +echo "configure:14356: checking how to build dynamic libraries for ${xehost}" >&5 # Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts. case "$xehost" in *-*-linux-gnu*) ;; @@ -14362,9 +14380,9 @@ XEGCC=yes else echo $ac_n "checking checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:14366: checking checking whether we are using GNU C" >&5 +echo "configure:14384: checking checking whether we are using GNU C" >&5 cat > conftest.$ac_ext <&6 -echo "configure:14390: checking how to produce PIC code" >&5 +echo "configure:14408: checking how to produce PIC code" >&5 wl= can_build_shared=yes @@ -14487,18 +14505,18 @@ # Check to make sure the dll_cflags actually works. echo $ac_n "checking if PIC flag ${dll_cflags} really works""... $ac_c" 1>&6 -echo "configure:14491: checking if PIC flag ${dll_cflags} really works" >&5 +echo "configure:14509: checking if PIC flag ${dll_cflags} really works" >&5 save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $dll_cflags -DPIC" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also @@ -14529,7 +14547,7 @@ xldf= xcldf= echo $ac_n "checking if C compiler can produce shared libraries""... $ac_c" 1>&6 -echo "configure:14533: checking if C compiler can produce shared libraries" >&5 +echo "configure:14551: checking if C compiler can produce shared libraries" >&5 if test "$XEGCC" = yes; then xcldf="-shared" xldf="-shared" @@ -14580,14 +14598,14 @@ xe_libs= ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5' cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cc_produces_so=yes else @@ -14612,7 +14630,7 @@ if test "$XEGCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:14616: checking for ld used by GCC" >&5 +echo "configure:14634: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. @@ -14638,7 +14656,7 @@ esac else echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:14642: checking for GNU ld" >&5 +echo "configure:14660: checking for GNU ld" >&5 fi if test -z "$LTLD"; then @@ -14676,7 +14694,7 @@ # Check to see if it really is or isn't GNU ld. echo $ac_n "checking if the linker is GNU ld""... $ac_c" 1>&6 -echo "configure:14680: checking if the linker is GNU ld" >&5 +echo "configure:14698: checking if the linker is GNU ld" >&5 # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LTLD -v 2>&1 &5; then xe_gnu_ld=yes @@ -14704,7 +14722,7 @@ # OK - only NOW do we futz about with ld. # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker supports shared libraries""... $ac_c" 1>&6 -echo "configure:14708: checking whether the linker supports shared libraries" >&5 +echo "configure:14726: checking whether the linker supports shared libraries" >&5 dll_ld=$CC dll_ldflags=$LDFLAGS ld_shlibs=yes @@ -14912,10 +14930,10 @@ for ac_func in dlerror _dlerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:14916: checking for $ac_func" >&5 +echo "configure:14934: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -14977,11 +14995,11 @@ fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:15003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then : else @@ -15754,7 +15772,7 @@ test "$debug" = yes && echo " Compiling in support for extra debugging code." test "$usage_tracking" = yes && echo " Compiling in support for active usage tracking (Sun internal)." if test "$error_check_extents $error_check_types $error_check_text $error_check_gc $error_check_malloc $error_check_glyphs $error_check_byte_code $error_check_display $error_check_structures" \ - != "no no no no no no"; then + != "no no no no no no no no no"; then echo " WARNING: ---------------------------------------------------------" echo " WARNING: Compiling in support for runtime error checking." echo " WARNING: XEmacs will run noticeably more slowly as a result." diff --text -u 'xemacs-21.5.6/configure.in' 'xemacs-21.5.7/configure.in' Index: ././configure.in --- ././configure.in Sun Mar 31 17:29:49 2002 +++ ././configure.in Tue Jun 4 15:12:20 2002 @@ -750,7 +750,7 @@ dnl Has the user specified one of the path options? prefix | exec_prefix | bindir | datadir | statedir | libdir | \ mandir | infodir | infopath | lispdir | etcdir | pkgdir | \ - archlibdir | docdir | package_path ) + archlibdir | docdir | package_path | moduledir ) dnl If the value was omitted, get it from the next argument. if test "$valomitted" = "yes"; then if test "$#" = 0; then @@ -1222,6 +1222,13 @@ dnl Cubix QBx/386 i[[3-9]]86-cubix-sysv* ) machine=intel386 opsys=usg5-3 ;; + dnl Darwin, a.k.a. MacOS X (based on Mach and Freebsd) + *-*-darwin*) + opsys=darwin + RANLIB="ranlib -c" dnl Avoids a link error with lwlib-config.c + pdump=yes dnl No "native" working dumper available + ;; + dnl Data General AViiON Machines i586-dg-dgux*R4* | i586-dg-dgux5.4.4* ) machine=aviion opsys=dgux5-4r4 ;; m88k-dg-dgux5.4R3* | m88k-dg-dgux5.4.3* ) opsys=dgux5-4r3 ;; @@ -2015,6 +2022,21 @@ AC_MSG_RESULT(no) fi +dnl GNU ld now defaults to combreloc, which screws up unexec, but not pdump. +dnl Note that it's OK if the GNU style long option causes non-GNU ld to barf +dnl a usage message, that's often good enough. Please report it, though. +dnl #### Should make this Solaris-friendly. +dnl Link with -z nocombreloc for now. +if test "$pdump" != "yes"; then + AC_MSG_CHECKING(for \"-z nocombreloc\" linker flag) + case "`ld --help 2>&1`" in + *-z\ nocombreloc* ) AC_MSG_RESULT(yes) + XE_PREPEND(-z nocombreloc, ld_switch_site) ;; + *) AC_MSG_RESULT(no) ;; + esac +fi + + dnl Inform compiler that certain flags are meant for the linker dnl XE_PROTECT_LINKER_FLAGS(shell_var) define([XE_PROTECT_LINKER_FLAGS], [ @@ -2032,6 +2054,7 @@ fi])dnl XE_PROTECT_LINKER_FLAGS(ld_switch_system) XE_PROTECT_LINKER_FLAGS(ld_switch_machine) +XE_PROTECT_LINKER_FLAGS(ld_switch_site) XE_PROTECT_LINKER_FLAGS(LDFLAGS) XE_PROTECT_LINKER_FLAGS(ld_call_shared) @@ -2546,20 +2569,6 @@ fi fi -dnl GNU ld now defaults to combreloc, which screws up unexec, but not pdump. -dnl Note that it's OK if the GNU style long option causes non-GNU ld to barf -dnl a usage message, that's often good enough. Please report it, though. -dnl #### Should make this Solaris-friendly. -dnl Link with -z nocombreloc for now. -if test "$pdump" != "yes"; then - AC_MSG_CHECKING(for \"-z nocombreloc\" linker flag) - case "`ld --help 2>&1`" in - *-z\ nocombreloc* ) AC_MSG_RESULT(yes) - XE_PREPEND(-z nocombreloc, ld_switch_site) ;; - *) AC_MSG_RESULT(no) ;; - esac -fi - dnl ---------------------- dnl Choose a window system dnl ---------------------- @@ -5019,7 +5028,7 @@ test "$debug" = yes && echo " Compiling in support for extra debugging code." test "$usage_tracking" = yes && echo " Compiling in support for active usage tracking (Sun internal)." if test "$error_check_extents $error_check_types $error_check_text $error_check_gc $error_check_malloc $error_check_glyphs $error_check_byte_code $error_check_display $error_check_structures" \ - != "no no no no no no"; then + != "no no no no no no no no no"; then echo " WARNING: ---------------------------------------------------------" echo " WARNING: Compiling in support for runtime error checking." echo " WARNING: XEmacs will run noticeably more slowly as a result." diff --text -u 'xemacs-21.5.6/etc/ChangeLog' 'xemacs-21.5.7/etc/ChangeLog' Index: ././etc/ChangeLog --- ././etc/ChangeLog Fri Apr 5 16:43:06 2002 +++ ././etc/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,36 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2001-03-30 Ben Wing + + * sample.init.el: + * sample.init.el (Init-kill-entire-line): + * sample.init.el (describe-foo-at-point): + * sample.init.el (kill-current-buffer): + * sample.init.el (kill-current-buffer-and-window): + * sample.init.el (grep-c-files): Removed. + * sample.init.el (grep-all-files-history): New. + * sample.init.el (grep-all-files-omitted-expressions): New. + * sample.init.el (grep-all-files-omitted-directories): New. + * sample.init.el (construct-grep-all-files-command): New. + * sample.init.el (grep-all-files-in-current-directory): New. + * sample.init.el (grep-lisp-files): Removed. + * sample.init.el (grep-all-files-in-current-directory-and-below): New. + * sample.init.el (clear-select): + * sample.init.el ((control kp-add)): + * sample.init.el (pause): + * sample.init.el ((eq system-type 'windows-nt)): + + Add documentation for defined functions. Change grep functions to + be more generally useful. Document more specifically what the + `menu-force' setting actually does -- what commands are overridden + and how to access them. + +2002-04-22 Hrvoje Niksic + + * photos/hniksic.png, photos/hniksic.png: Update. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. diff --text -u 'xemacs-21.5.6/etc/sample.init.el' 'xemacs-21.5.7/etc/sample.init.el' Index: ././etc/sample.init.el --- ././etc/sample.init.el Wed Mar 13 17:51:26 2002 +++ ././etc/sample.init.el Tue Jun 4 15:03:59 2002 @@ -24,16 +24,20 @@ ;; Boston, MA 02111-1307, USA. ;; #### to do: -;; -- #### figure out how init.el and custom.el interact and put -;; documentation about it here. (perhaps it already exists -;; elsewhere?) - -;;; This is a sample init.el file. It can be used without -;;; modification as your init.el or .emacs. In older versions of -;;; XEmacs, this file was called .emacs and placed in your home -;;; directory. (Under MS Windows, that directory is controlled by the -;;; HOME environment variable and defaults to C:\. You can find out -;;; where XEmacs thinks your home directory is using +;; -- scan for #### markers and fix the problems noted there. +;; -- #### maybe the setqs in this file should be changed to defvars +;; to avoid tromping on customizations when custom.el is loaded +;; early (dv and sjt at least favor making this the default) +;; -- #### update documentation in (lispref)Starting Up XEmacs, in +;; (xemacs)Entering Emacs, and in (custom), then point to them +;; instead of going into detail here. + +;;; This is a sample init file. It can be used without modification +;;; as your init.el or .emacs. In older versions of XEmacs, this file +;;; was called .emacs and placed in your home directory. (Under MS +;;; Windows, that directory is controlled by the HOME environment +;;; variable and defaults to C:\. You can find out where XEmacs +;;; thinks your home directory is using ;;; ;;; ESC : (expand-file-name "~") ;;; @@ -52,7 +56,9 @@ ;;; The language that this file (and most other XEmacs init files) is ;;; written in is called "XEmacs Lisp" or more commonly "Elisp". -;;; There are many sources of further information: +;;; Brief descriptions of how the init process works and how to +;;; accomplish many useful customizations are given below in this +;;; file. There are many sources of further information: ;;; -- the XEmacs User's Manual (Access using the online Info browser: ;;; Use `Help->Info (Online Docs)->XEmacs User's Manual' (if @@ -121,6 +127,130 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Theory of Operation ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; XEmacs allows you to make persistent changes to editor behavior by +;;; saving code in files which are by default loaded at startup. + +;; These files are just Lisp libraries with names built in to XEmacs. +;; There are files for the use of the user (the init file and the +;; custom file), for the site administrator (default.el and +;; site-start.el), and for the XEmacs maintainers (auto-autoloads +;; files). See the Lispref for user and site files (node Starting Up +;; XEmacs, currently inaccurate (it doesn't describe the custom +;; file)). Interactions among the files are complex; see +;; lisp/startup.el for details. + +;; Briefly, after very basic initializations including processing a +;; special command line options (including GUI toolkit options), +;; setting up the terminal, and setting up `load-path', it executes +;; customization code as follows: + +;; 1. It runs the normal hook `before-init-hook'. +;; 2. It loads the library `site-start' (by default `site-start.el'). +;; 3. It loads the init file (by default `~/.xemacs/init.el'). +;; 4. It loads the custom file (by default `~/.xemacs/custom.el'). +;; 5. It loads the library `default' (by default `default.el'). +;; 6. It runs the normal hook `after-init-hook'. + +;; After this the *scratch* buffer is set up and the remaining command +;; line arguments (actions and file names) are processed. + +;; N.B. Switching the order of steps 3 and 4 is under discussion and +;; favored by several core developers. + +;; Step 2 is inhibited by the -no-site-file command line switch. +;; Steps 3 and 4 are inhibited (as a unit) by the -no-init-file +;; command line switch (-q is a convenient synonym). Step 5 is +;; inhibited by -no-init-file or a non-nil value of +;; `inhibit-default-init' (set it in the init file). From now on the +;; hooks and the site initialization files will be ignored. + +;; The custom file and the init file contain customizations managed by +;; XEmacs itself via the Custom subsystem and manual customizations, +;; respectively. Originally both were placed in the same file, +;; usually ~/.emacs, but occasionally XEmacs would trash user settings +;; when automatically changing options, and more frequently users +;; would trash the automatically generated code. So these functions +;; have been reallocated to separate files, usually named custom.el +;; and init.el, respectively. + +;; The Custom system is accessed most conveniently from the +;; Options->Advanced (Customize) menu (also, the Options->Fonts and +;; Options->Sizes menus are implicitly managed by Custom, and +;; Options->Edit Faces explicitly invokes Custom). You can also use +;; the suite of customize commands directly (cf C-h a customize RET). +;; Currently, Custom possesses specialized facilities for setting +;; ordinary variables of many types, and for customizing faces. As a +;; general rule, variable and face initialization should be done using +;; Custom, and other initializations should be done in the init file. + +;; A possible exception is a subsystem with its own complex init file, +;; eg, Gnus and .gnus. In these cases it is often preferable to keep +;; even simple variable initializations together, and you may wish to +;; maintain these configurations by hand. + +;; You should avoid editing the custom file by hand. The syntax used +;; is complex but concise, and it is easy to silently break the whole +;; file with a single error that happens to result in a valid Lisp +;; form. On the other hand, the init file is just a Lisp library that +;; is loaded before starting the read-eval-redisplay loop. + +;; The interactions between the custom file and other init files are +;; governed by a simple idea: + +;; Custom to User: ALL VARIABLES YOURS OURS NOW ARE. + +;; To be precise, Custom is pretty good about noticing and respecting +;; existing settings in interactive use. However, it is weak in +;; understanding advanced use of specifier variables (these are used +;; for customizations which depend on display characteristics and +;; configuration in complex ways), and can be quite brutal at +;; initialization. + +;; Normal practice for Custom at initialization is to (1) reset all +;; customized faces before applying customizations and (2) force all +;; variables to the values specified in custom.el. For this reason, +;; and because it is generally the case that the init file can +;; usefully depend on customized variables, but Custom pays no +;; attention to behavior of the init file, it is probably a good idea +;; to force custom.el to be loaded before the init file. (As +;; mentioned, this will probably become the default in future versions +;; of XEmacs.) + +;; To enable early loading of custom.el, uncomment the following line: +;(setq Init-inhibit-custom-file-p (not (assoc custom-file load-history))) + +;; Code to implement early loading where late loading is the default. +;; A crucial snippet of code must be the last thing in this file. + +;; defvars only initialize uninitialized variables; if the setq above +;; is active, the variable below is defined but the value will not be +;; altered. +(defvar Init-inhibit-custom-file-p nil + "Internal user init flag. Don't use this yourself. + +Non-nil if we need to inhibit XEmacs from loading custom.el after init.el.") + +(when Init-inhibit-custom-file-p + ;; This is the default custom-file. + (let ((file (expand-file-name "~/.xemacs/custom.el"))) + (add-one-shot-hook 'after-init-hook + `(lambda () (setq custom-file ,file))) + (cond ((file-readable-p file) + (load file)) + ((file-exists-p file) + (warn "Existing custom file \"%s\" is not readable!" file))) + (cond ((not (file-exists-p file)) + (display-warning ' resource + (format "Custom file \"%s\" not found." file) + 'info)) + ((not (file-writable-p file)) + (warn "Existing custom file \"%s\" is not writable!" file))))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Basic Customization ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1272,7 +1402,7 @@ ;;; ******************** ;;; resize-minibuffer-mode makes the minibuffer automatically -;;; resize as necessary when it's too big to hold its contents. +;;; resize as necessary when it's too small to hold its contents. (when (fboundp 'resize-minibuffer-mode) (resize-minibuffer-mode) @@ -1302,3 +1432,11 @@ ; ;; of the session, specify the number of lines here. ; w3-telnet-header-length 4 ; ) + +;;; Inhibit loading of custom-file + +;; make-temp-name returns a name which does not refer to an existing file, +;; and thus the named file is unreadable. +(when Init-inhibit-custom-file-p + (setq custom-file (make-temp-name "/tmp/non-existent-"))) + diff --text -u 'xemacs-21.5.6/lib-src/ChangeLog' 'xemacs-21.5.7/lib-src/ChangeLog' Index: ././lib-src/ChangeLog --- ././lib-src/ChangeLog Fri Apr 5 16:43:06 2002 +++ ././lib-src/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,47 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-05-29 Greg Steuck + + * gnuclient.c: Makes it possible again to #undef + INTERNET_DOMAIN_SOCKETS in lib-src/gnuserv.h and get a functional + gnuserv which is only accessible through UNIX_DOMAIN_SOCKETS. + +2002-05-28 Ben Wing + + * make-docfile.c (scan_c_file): + * make-docfile.c (scan_lisp_file): + Fix places where we forget to check for EOF. + +2002-05-05 Ben Wing + + * i.c: + * i.c (skip_executable_name): + * i.c (main): + Create an inheritable event and pass it on to XEmacs, so that ^C + can be handled properly. Intercept ^C and signal the event. + "Stop Build" in VC++ now works. + +2002-04-14 Ben Wing + + * make-docfile.c: + * make-docfile.c (next_extra_elc): + * make-docfile.c (again): Removed. + * make-docfile.c (main): + * make-docfile.c (getc_iso2022): + * make-docfile.c (MDGET): + * make-docfile.c (read_c_string): + * make-docfile.c (write_c_args): + * make-docfile.c (scan_c_file): + * make-docfile.c (read_lisp_symbol): + * make-docfile.c (scan_lisp_file): + Add basic support for handling ISO 2022 doc strings -- we parse + the basic charset designation sequences so we know whether we're + in ASCII and have to pay attention to end quotes and such. + + Reformat code according to coding standards. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. @@ -151,6 +195,7 @@ * XEmacs 21.5.0 "alfalfa" is released. +>>>>>>> 1.136 2000-08-01 Jon Schewe * gnuclient.c (filename_expand): Let Cygwin convert Windows path diff --text -u 'xemacs-21.5.6/lib-src/Makefile.in.in' 'xemacs-21.5.7/lib-src/Makefile.in.in' Index: ././lib-src/Makefile.in.in --- ././lib-src/Makefile.in.in Fri Mar 15 16:43:14 2002 +++ ././lib-src/Makefile.in.in Fri Apr 26 03:03:23 2002 @@ -88,6 +88,9 @@ #ifdef HAVE_SHLIB ellcc\ #endif +#ifdef HAVE_MS_WINDOWS + winclient\ +#endif etags ctags b2m ootags PUBLIC_INSTALLABLE_SCRIPTS=\ @@ -356,6 +359,9 @@ minitar: ${srcdir}/../nt/minitar.c $(CC) $(cflags) ${srcdir}/../nt/minitar.c $(ldflags) -lz -o $@ + +winclient: ${srcdir}/winclient.c + $(CC) $(cflags) ${srcdir}/winclient.c $(ldflags) -o $@ hexl: ${srcdir}/hexl.c $(CC) $(cflags) ${srcdir}/hexl.c $(ldflags) -o $@ diff --text -u 'xemacs-21.5.6/lib-src/gnuclient.c' 'xemacs-21.5.7/lib-src/gnuclient.c' Index: ././lib-src/gnuclient.c --- ././lib-src/gnuclient.c Wed Mar 13 17:51:58 2002 +++ ././lib-src/gnuclient.c Tue Jun 25 17:09:02 2002 @@ -465,13 +465,14 @@ progname); exit (1); } +#if defined(INTERNET_DOMAIN_SOCKETS) if (suppress_windows_system && hostarg) { fprintf (stderr, "%s: Remote editing is available only on X\n", progname); exit (1); } - +#endif *result = '\0'; if (eval_function || eval_form || load_library) { @@ -563,7 +564,7 @@ } /* Don't do disconnect_from_server because we have already read data, and disconnect doesn't do anything else. */ -#ifndef INTERNET_DOMAIN_SOCKETS +#ifdef SYSV_IPC if (connect_type == (int) CONN_IPC) disconnect_from_ipc_server (s, msgp, FALSE); #endif /* !SYSV_IPC */ diff --text -u 'xemacs-21.5.6/lib-src/i.c' 'xemacs-21.5.7/lib-src/i.c' Index: ././lib-src/i.c --- ././lib-src/i.c Fri Apr 13 03:21:02 2001 +++ ././lib-src/i.c Sun May 5 20:30:16 2002 @@ -1,5 +1,6 @@ /* I-connector utility Copyright (C) 2000 Kirill M. Katsnelson + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -84,13 +85,23 @@ CloseHandle (h_thread); } -/* - * Get command line, skip over the executable name, return the rest. - */ +static HANDLE external_event; + +static BOOL +ctrl_c_handler (unsigned long type) +{ + SetEvent (external_event); + return FALSE; +} + +/* Skip over the executable name in the given command line. Correctly + handles quotes in the name. Return NULL upon error. If + REQUIRE_FOLLOWING is non-zero, it's an error if no argument follows the + executable name. */ + static LPTSTR -get_command (void) +skip_executable_name (LPTSTR cl, int require_following) { - LPTSTR cl = GetCommandLine (); int ix; while (1) @@ -107,6 +118,8 @@ { cl += ix; cl += _tcsspn (cl, _T(" \t")); + if (!require_following) + return cl; return *cl ? cl : NULL; } } @@ -133,8 +146,8 @@ PROCESS_INFORMATION pi; I_connector I_in, I_out, I_err; DWORD exit_code; - - LPTSTR command = get_command (); + LPTSTR command = skip_executable_name (GetCommandLine (), 1); + if (command == NULL) { usage (); @@ -156,15 +169,68 @@ CreatePipe (&I_err.source, &si.hStdError, NULL, 0); make_inheritable (&si.hStdError); - if (CreateProcess (NULL, command, NULL, NULL, TRUE, 0, - NULL, NULL, &si, &pi) == 0) - { - _ftprintf (stderr, _T("Error %d launching `%s'\n"), - GetLastError (), command); - return 2; - } + { + SECURITY_ATTRIBUTES sa; + LPTSTR new_command = + (LPTSTR) malloc (666 + sizeof (TCHAR) * _tcslen (command)); + LPTSTR past_exe; + + if (!new_command) + { + _ftprintf (stderr, _T ("Out of memory when launching `%s'\n"), + command); + return 2; + } + + past_exe = skip_executable_name (command, 0); + if (!past_exe) + { + usage (); + return 1; + } + + /* Since XEmacs isn't a console application, it can't easily be + terminated using ^C. Therefore, we set up a communication path with + it so that when a ^C is sent to us (using GenerateConsoleCtrlEvent), + we in turn signals it to commit suicide. (This is cleaner than using + TerminateProcess()). This makes (e.g.) the "Stop Build" command + from VC++ correctly terminate XEmacs. + + #### This will cause problems if i.exe is used for commands other + than XEmacs. We need to make behavior this a command-line + option. */ + + /* Create the event as inheritable so that we can use it to communicate + with the child process */ + sa.nLength = sizeof (sa); + sa.bInheritHandle = TRUE; + sa.lpSecurityDescriptor = NULL; + external_event = CreateEvent (&sa, FALSE, FALSE, NULL); + if (!external_event) + { + _ftprintf (stderr, _T ("Error %d creating signal event for `%s'\n"), + GetLastError (), command); + return 2; + } + + SetConsoleCtrlHandler ((PHANDLER_ROUTINE) ctrl_c_handler, TRUE); + _tcsncpy (new_command, command, past_exe - command); + _stprintf (new_command + (past_exe - command), + /* start with space in case no args past command name */ + " -mswindows-termination-handle %d ", (long) external_event); + _tcscat (new_command, past_exe); + + if (CreateProcess (NULL, new_command, NULL, NULL, TRUE, 0, + NULL, NULL, &si, &pi) == 0) + { + _ftprintf (stderr, _T("Error %d launching `%s'\n"), + GetLastError (), command); + return 2; + } + + CloseHandle (pi.hThread); + } - CloseHandle (pi.hThread); /* Start pump in each I-connector */ start_pump (&I_in); diff --text -u 'xemacs-21.5.6/lib-src/make-docfile.c' 'xemacs-21.5.7/lib-src/make-docfile.c' Index: ././lib-src/make-docfile.c --- ././lib-src/make-docfile.c Wed Mar 13 17:51:59 2002 +++ ././lib-src/make-docfile.c Tue May 28 17:44:26 2002 @@ -2,42 +2,42 @@ Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1998, 1999 J. Kean Johnston. - Copyright (C) 2001 Ben Wing. - -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 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. */ + Copyright (C) 2001, 2002 Ben Wing. + + 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 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. */ /* Synched up with: FSF 19.30. */ /* The arguments given to this program are all the C and Lisp source files - of XEmacs. .elc and .el and .c files are allowed. - A .o or .obj file can also be specified; the .c file it was made from is used. - This helps the makefile pass the correct list of files. - - The results, which go to standard output or to a file - specified with -a or -o (-a to append, -o to start from nothing), - are entries containing function or variable names and their documentation. - Each entry starts with a ^_ character. - Then comes F for a function or V for a variable. - Then comes the function or variable name, terminated with a newline. - Then comes the documentation for that function or variable. - - Added 19.15/20.1: `-i site-packages' allow installer to dump extra packages - without modifying Makefiles, etc. + of XEmacs. .elc and .el and .c files are allowed. + A .o or .obj file can also be specified; the .c file it was made from is + used. This helps the makefile pass the correct list of files. + + The results, which go to standard output or to a file + specified with -a or -o (-a to append, -o to start from nothing), + are entries containing function or variable names and their documentation. + Each entry starts with a ^_ character. + Then comes F for a function or V for a variable. + Then comes the function or variable name, terminated with a newline. + Then comes the documentation for that function or variable. + + Added 19.15/20.1: `-i site-packages' allow installer to dump extra packages + without modifying Makefiles, etc. */ #include @@ -124,36 +124,40 @@ } static char * -next_extra_elc(char *extra_elcs) +next_extra_elc (char *extra_elcs) { static FILE *fp = NULL; static char line_buf[BUFSIZ]; char *p = line_buf+1; - if (!fp) { - if (!extra_elcs) { - return NULL; - } else if (!(fp = fopen(extra_elcs, READ_BINARY))) { - /* It is not an error if this file doesn't exist. */ - /*fatal("error opening site package file list", 0);*/ - return NULL; + if (!fp) + { + if (!extra_elcs) + return NULL; + else if (!(fp = fopen (extra_elcs, READ_BINARY))) + { + /* It is not an error if this file doesn't exist. */ + /*fatal ("error opening site package file list", 0);*/ + return NULL; + } + fgets (line_buf, BUFSIZ, fp); } - fgets(line_buf, BUFSIZ, fp); - } -again: - if (!fgets(line_buf, BUFSIZ, fp)) { - fclose(fp); - fp = NULL; - return NULL; - } + again: + if (!fgets (line_buf, BUFSIZ, fp)) + { + fclose (fp); + fp = NULL; + return NULL; + } line_buf[0] = '\0'; - if (strlen(p) <= 2 || strlen(p) >= (BUFSIZ - 5)) { - /* reject too short or too long lines */ - goto again; - } - p[strlen(p) - 2] = '\0'; - strcat(p, ".elc"); + if (strlen (p) <= 2 || strlen (p) >= (BUFSIZ - 5)) + { + /* reject too short or too long lines */ + goto again; + } + p[strlen (p) - 2] = '\0'; + strcat (p, ".elc"); return p; } @@ -201,10 +205,11 @@ i += 2; } - if (argc > (i + 1) && !strcmp(argv[i], "-i")) { - extra_elcs = argv[i + 1]; - i += 2; - } + if (argc > (i + 1) && !strcmp (argv[i], "-i")) + { + extra_elcs = argv[i + 1]; + i += 2; + } if (outfile == 0) fatal ("No output file specified", ""); @@ -246,13 +251,13 @@ } } - if (extra_elcs) { - char *p; + if (extra_elcs) + { + char *p; - while ((p = next_extra_elc(extra_elcs)) != NULL) { - err_count += scan_file(p); + while ((p = next_extra_elc (extra_elcs)) != NULL) + err_count += scan_file (p); } - } putc ('\n', outfile); if (ellcc) @@ -286,17 +291,102 @@ return scan_c_file (filename, READ_TEXT); } } + +static int +getc_skipping_iso2022 (FILE *file) +{ + register int c; + /* #### Kludge -- Ignore any ISO2022 sequences */ + c = getc (file); + while (c == 27) + { + c = getc (file); + if (c == '$') + c = getc (file); + if (c >= '(' && c <= '/') + c = getc (file); + c = getc (file); + } + return c; +} + +enum iso2022_state +{ + ISO_NOTHING, + ISO_ESC, + ISO_DOLLAR, + ISO_FINAL_IS_NEXT, + ISO_DOLLAR_AND_FINAL_IS_NEXT +}; + +static int non_ascii_p; + +static int +getc_iso2022 (FILE *file) +{ + /* #### Kludge -- Parse ISO2022 sequences (more or less) */ + static enum iso2022_state state; + static int prevc; + register int c; + c = getc (file); + switch (state) + { + case ISO_NOTHING: + if (c == 27) + state = ISO_ESC; + break; + + case ISO_ESC: + if (c == '$') + state = ISO_DOLLAR; + else if (c >= '(' && c <= '/') + state = ISO_FINAL_IS_NEXT; + else + state = ISO_NOTHING; + break; + + case ISO_DOLLAR: + if (c >= '(' && c <= '/') + state = ISO_DOLLAR_AND_FINAL_IS_NEXT; + else if (c >= '@' && c <= 'B') /* ESC $ @ etc */ + { + non_ascii_p = 1; + state = ISO_NOTHING; + } + else + state = ISO_NOTHING; + break; + + case ISO_FINAL_IS_NEXT: + if (prevc == '(' && c == 'B') /* ESC ( B, invoke ASCII */ + non_ascii_p = 0; + else if (prevc == '(' || prevc == ',') /* ESC ( x or ESC , x */ + non_ascii_p = 1; + state = ISO_NOTHING; + break; + + case ISO_DOLLAR_AND_FINAL_IS_NEXT: + if (prevc == '(' || prevc == ',') /* ESC $ ( x or ESC $ , x */ + non_ascii_p = 1; + state = ISO_NOTHING; + break; + } + + prevc = c; + return c; +} + char buf[128]; /* Skip a C string from INFILE, - and return the character that follows the closing ". + and return the character that follows the closing ". If printflag is positive, output string contents to outfile. If it is negative, store contents in buf. Convert escape sequences \n and \t to newline and tab; discard \ followed by newline. */ -#define MDGET do { prevc = c; c = getc (infile); } while (0) +#define MDGET do { prevc = c; c = getc_iso2022 (infile); } while (0) static int read_c_string (FILE *infile, int printflag, int c_docstring) { @@ -307,9 +397,9 @@ MDGET; while (c != EOF) { - while ((c_docstring || c != '"') && c != EOF) + while ((c_docstring || c != '"' || non_ascii_p) && c != EOF) { - if (c == '*') + if (c == '*' && !non_ascii_p) { int cc = getc (infile); if (cc == '/') @@ -343,7 +433,7 @@ *p++ = '\n'; } - if (c == '\\') + if (c == '\\' && !non_ascii_p) { MDGET; if (c == '\n') @@ -364,7 +454,7 @@ start = 0; if (printflag > 0) { - if (ellcc && c == '"') + if (ellcc && c == '"' && !non_ascii_p) putc ('\\', outfile); putc (c, outfile); } @@ -381,22 +471,22 @@ MDGET; } while (isspace (c)); - if (c != '"') + if (c != '"' || non_ascii_p) break; } else { MDGET; - if (c != '"') + if (c != '"' || non_ascii_p) break; /* If we had a "", concatenate the two strings. */ } MDGET; } - + if (printflag < 0) *p = 0; - + return c; } @@ -437,7 +527,7 @@ static char lo[] = "Lisp_Object"; if ((C_IDENTIFIER_CHAR_P (c) != in_ident) && !in_ident && (strncmp (p, lo, sizeof (lo) - 1) == 0) && - isspace((unsigned char) (* (p + sizeof (lo) - 1)))) + isspace ((unsigned char) (* (p + sizeof (lo) - 1)))) { p += (sizeof (lo) - 1); while (isspace ((unsigned char) (*p))) @@ -495,7 +585,7 @@ #endif } if (!ellcc) - putc ('\n', out); /* XEmacs addition */ + putc ('\n', out); /* XEmacs addition */ } /* Read through a c file. If a .o or .obj file is named, @@ -617,7 +707,7 @@ commas = 2; else if (defvarflag) commas = 1; - else /* For DEFSIMPLE and DEFPRED */ + else /* For DEFSIMPLE and DEFPRED */ commas = 2; while (commas) @@ -636,7 +726,7 @@ ungetc (c, infile); if (commas == 2) /* pick up minargs */ fscanf (infile, "%d", &minargs); - else /* pick up maxargs */ + else /* pick up maxargs */ if (c == 'M' || c == 'U') /* MANY || UNEVALLED */ maxargs = -1; else @@ -654,7 +744,11 @@ if (defunflag | defvarflag) { while (c != '/') - c = getc (infile); + { + if (c < 0) + goto eof; + c = getc (infile); + } c = getc (infile); while (c == '*') c = getc (infile); @@ -662,7 +756,11 @@ else { while (c != ',') - c = getc (infile); + { + if (c < 0) + goto eof; + c = getc (infile); + } c = getc (infile); } while (c == ' ' || c == '\n' || c == '\t') @@ -672,15 +770,15 @@ if (defunflag || defvarflag || c == '"') { - if (ellcc) - fprintf (outfile, " CDOC%s(\"%s\", \"\\\n", - defvarflag ? "SYM" : "SUBR", buf); - else - { - putc (037, outfile); - putc (defvarflag ? 'V' : 'F', outfile); - fprintf (outfile, "%s\n", buf); - } + if (ellcc) + fprintf (outfile, " CDOC%s(\"%s\", \"\\\n", + defvarflag ? "SYM" : "SUBR", buf); + else + { + putc (037, outfile); + putc (defvarflag ? 'V' : 'F', outfile); + fprintf (outfile, "%s\n", buf); + } c = read_c_string (infile, 1, (defunflag || defvarflag)); /* If this is a defun, find the arguments and print them. If @@ -690,7 +788,7 @@ if (defunflag && maxargs != -1) { char argbuf[1024], *p = argbuf; -#if 0 /* For old DEFUN's only */ +#if 0 /* For old DEFUN's only */ while (c != ')') { if (c < 0) @@ -708,18 +806,22 @@ /* Copy arguments into ARGBUF. */ *p++ = c; do - *p++ = c = getc (infile); + { + *p++ = c = getc (infile); + if (c < 0) + goto eof; + } while (c != ')'); *p = '\0'; /* Output them. */ - if (ellcc) - fprintf (outfile, "\\n\\\n\\n\\\n"); - else - fprintf (outfile, "\n\n"); + if (ellcc) + fprintf (outfile, "\\n\\\n\\n\\\n"); + else + fprintf (outfile, "\n\n"); write_c_args (outfile, buf, argbuf, minargs, maxargs); } - if (ellcc) - fprintf (outfile, "\\n\");\n\n"); + if (ellcc) + fprintf (outfile, "\\n\");\n\n"); } } eof: @@ -728,17 +830,17 @@ } /* Read a file of Lisp code, compiled or interpreted. - Looks for - (defun NAME ARGS DOCSTRING ...) - (defmacro NAME ARGS DOCSTRING ...) - (autoload (quote NAME) FILE DOCSTRING ...) - (defvar NAME VALUE DOCSTRING) - (defconst NAME VALUE DOCSTRING) - (fset (quote NAME) (make-byte-code ... DOCSTRING ...)) - (fset (quote NAME) #[... DOCSTRING ...]) - (defalias (quote NAME) #[... DOCSTRING ...]) - starting in column zero. - (quote NAME) may appear as 'NAME as well. + Looks for + (defun NAME ARGS DOCSTRING ...) + (defmacro NAME ARGS DOCSTRING ...) + (autoload (quote NAME) FILE DOCSTRING ...) + (defvar NAME VALUE DOCSTRING) + (defconst NAME VALUE DOCSTRING) + (fset (quote NAME) (make-byte-code ... DOCSTRING ...)) + (fset (quote NAME) #[... DOCSTRING ...]) + (defalias (quote NAME) #[... DOCSTRING ...]) + starting in column zero. + (quote NAME) may appear as 'NAME as well. We also look for #@LENGTH CONTENTS^_ at the beginning of the line. When we find that, we save it for the following defining-form, @@ -792,7 +894,7 @@ if (! buffer[0]) fprintf (stderr, "## expected a symbol, got '%c'\n", c); - + skip_white (infile); } @@ -807,7 +909,7 @@ if (infile == NULL) { perror (filename); - return 0; /* No error */ + return 0; /* No error */ } c = '\n'; @@ -818,21 +920,21 @@ if (c != '\n') { - c = getc (infile); + c = getc_skipping_iso2022 (infile); continue; } - c = getc (infile); + c = getc_skipping_iso2022 (infile); /* Detect a dynamic doc string and save it for the next expression. */ if (c == '#') { - c = getc (infile); + c = getc_skipping_iso2022 (infile); if (c == '@') { int length = 0; int i; /* Read the length. */ - while ((c = getc (infile), + while ((c = getc_skipping_iso2022 (infile), c >= '0' && c <= '9')) { length *= 10; @@ -855,9 +957,13 @@ but it is redundant in DOC. So get rid of it here. */ saved_string[length - 1] = 0; /* Skip the newline. */ - c = getc (infile); + c = getc_skipping_iso2022 (infile); while (c != '\n') - c = getc (infile); + { + c = getc_skipping_iso2022 (infile); + if (c < 0) + continue; + } } continue; } @@ -875,11 +981,11 @@ /* Skip the arguments: either "nil" or a list in parens */ - c = getc (infile); - if (c == 'n') /* nil */ + c = getc_skipping_iso2022 (infile); + if (c == 'n') /* nil */ { - if ((c = getc (infile)) != 'i' || - (c = getc (infile)) != 'l') + if ((c = getc_skipping_iso2022 (infile)) != 'i' || + (c = getc_skipping_iso2022 (infile)) != 'l') { fprintf (stderr, "## unparsable arglist in %s (%s)\n", buffer, filename); @@ -894,15 +1000,19 @@ } else while (c != ')') - c = getc (infile); + { + c = getc_skipping_iso2022 (infile); + if (c < 0) + continue; + } skip_white (infile); /* If the next three characters aren't `dquote bslash newline' then we're not reading a docstring. - */ - if ((c = getc (infile)) != '"' || - (c = getc (infile)) != '\\' || - (c = getc (infile)) != '\n') + */ + if ((c = getc_skipping_iso2022 (infile)) != '"' || + (c = getc_skipping_iso2022 (infile)) != '\\' || + (c = getc_skipping_iso2022 (infile)) != '\n') { #ifdef DEBUG fprintf (stderr, "## non-docstring in %s (%s)\n", @@ -922,21 +1032,13 @@ if (saved_string == 0) { - /* Skip until the first newline; remember the two previous chars. */ + /* Skip until the first newline; remember the two previous + chars. */ while (c != '\n' && c >= 0) { - /* #### Kludge -- Ignore any ESC x x ISO2022 sequences */ - if (c == 27) - { - getc (infile); - getc (infile); - goto nextchar; - } - c2 = c1; c1 = c; - nextchar: - c = getc (infile); + c = getc_skipping_iso2022 (infile); } /* If two previous characters were " and \, @@ -957,7 +1059,7 @@ char c1 = 0, c2 = 0; type = 'F'; - c = getc (infile); + c = getc_skipping_iso2022 (infile); if (c == '\'') read_lisp_symbol (infile, buffer); else @@ -976,7 +1078,7 @@ continue; } read_lisp_symbol (infile, buffer); - c = getc (infile); + c = getc_skipping_iso2022 (infile); if (c != ')') { fprintf (stderr, @@ -988,12 +1090,13 @@ if (saved_string == 0) { - /* Skip until the first newline; remember the two previous chars. */ + /* Skip until the first newline; remember the two previous + chars. */ while (c != '\n' && c >= 0) { c2 = c1; c1 = c; - c = getc (infile); + c = getc_skipping_iso2022 (infile); } /* If two previous characters were " and \, @@ -1012,7 +1115,7 @@ else if (! strcmp (buffer, "autoload")) { type = 'F'; - c = getc (infile); + c = getc_skipping_iso2022 (infile); if (c == '\'') read_lisp_symbol (infile, buffer); else @@ -1031,7 +1134,7 @@ continue; } read_lisp_symbol (infile, buffer); - c = getc (infile); + c = getc_skipping_iso2022 (infile); if (c != ')') { fprintf (stderr, @@ -1041,7 +1144,7 @@ } } skip_white (infile); - if ((c = getc (infile)) != '\"') + if ((c = getc_skipping_iso2022 (infile)) != '\"') { fprintf (stderr, "## autoload of %s unparsable (%s)\n", buffer, filename); @@ -1054,9 +1157,9 @@ { /* If the next three characters aren't `dquote bslash newline' then we're not reading a docstring. */ - if ((c = getc (infile)) != '"' || - (c = getc (infile)) != '\\' || - (c = getc (infile)) != '\n') + if ((c = getc_skipping_iso2022 (infile)) != '"' || + (c = getc_skipping_iso2022 (infile)) != '\\' || + (c = getc_skipping_iso2022 (infile)) != '\n') { #ifdef DEBUG fprintf (stderr, "## non-docstring in %s (%s)\n", @@ -1067,7 +1170,7 @@ } } -#if 0 /* causes crash */ +#if 0 /* causes crash */ else if (! strcmp (buffer, "if") || ! strcmp (buffer, "byte-code")) ; @@ -1085,10 +1188,10 @@ /* At this point, we should either use the previous dynamic doc string in saved_string or gobble a doc string from the input file. - + In the latter case, the opening quote (and leading backslash-newline) have already been read. */ - putc ('\n', outfile); /* XEmacs addition */ + putc ('\n', outfile); /* XEmacs addition */ putc (037, outfile); putc (type, outfile); fprintf (outfile, "%s\n", buffer); diff --text -u /dev/null 'xemacs-21.5.7/lib-src/winclient.c' Index: ././lib-src/winclient.c --- ././lib-src/winclient.c Thu Jan 1 09:00:00 1970 +++ ././lib-src/winclient.c Tue May 28 17:44:26 2002 @@ -0,0 +1,486 @@ +/* DDE client for XEmacs. + Copyright (C) 2002 Alastair J. Houghton + + 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 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. */ + +/* Synched up with: Not in FSF. */ + +/* -- Includes -------------------------------------------------------------- */ + +#include +#ifdef HAVE_CONFIG_H +# include +#endif +#include +#include +#include +#include + +static void error (const char* s1, const char* s2); +static void fatal (const char *s1, const char *s2); +static void * xmalloc (size_t size); +static char * getNextArg (const char **ptr, unsigned *len); + +/* -- Post-Include Defines -------------------------------------------------- */ + +/* Timeouts & delays */ +#define CONNECT_DELAY 500 /* ms */ +#define TRANSACTION_TIMEOUT 5000 /* ms */ +#define MAX_INPUT_IDLE_WAIT INFINITE /* ms */ + +/* DDE Strings */ +#define SERVICE_NAME "XEmacs" +#define TOPIC_NAME "System" +#define COMMAND_FORMAT "[open(\"%s%s\")]" + +/* XEmacs program name */ +#define PROGRAM_TO_RUN "xemacs.exe" + +/* -- Constants ------------------------------------------------------------- */ + +/* -- Global Variables ------------------------------------------------------ */ + +HINSTANCE hInstance; +DWORD idInst = 0; + +/* -- Function Declarations ------------------------------------------------- */ + +HDDEDATA CALLBACK ddeCallback (UINT uType, UINT uFmt, HCONV hconv, + HSZ hsz1, HSZ hsz2, HDDEDATA hdata, + DWORD dwData1, DWORD dwData2); + +int WINAPI WinMain (HINSTANCE hInst, + HINSTANCE hPrev, + LPSTR lpCmdLine, + int nCmdShow); + +static HCONV openConversation (void); +static void closeConversation (HCONV hConv); +static int doFile (HCONV hConv, LPSTR lpszFileName1, LPSTR lpszFileName2); +static int parseCommandLine (HCONV hConv, LPSTR lpszCommandLine); + +/* -- Function Definitions -------------------------------------------------- */ + +/* + * Name : ddeCallback + * Function: Gets called by DDEML. + * + */ + +HDDEDATA CALLBACK +ddeCallback (UINT uType, UINT uFmt, HCONV hconv, + HSZ hsz1, HSZ hsz2, HDDEDATA hdata, + DWORD dwData1, DWORD dwData2) +{ + return (HDDEDATA) NULL; +} + +/* + * Name : WinMain + * Function: The program's entry point function. + * + */ + +int WINAPI +WinMain (HINSTANCE hInst, + HINSTANCE hPrev, + LPSTR lpCmdLine, + int nCmdShow) +{ + HCONV hConv; + int ret = 0; + UINT uiRet; + + /* Initialise the DDEML library */ + uiRet = DdeInitialize (&idInst, + (PFNCALLBACK) ddeCallback, + APPCMD_CLIENTONLY + |CBF_FAIL_ALLSVRXACTIONS, + 0); + + if (uiRet != DMLERR_NO_ERROR) + { + MessageBox (NULL, "Could not initialise DDE management library.", + "winclient", MB_ICONEXCLAMATION | MB_OK); + + return 1; + } + + /* Open a conversation */ + hConv = openConversation (); + + if (hConv) + { + /* OK. Next, we need to parse the command line. */ + ret = parseCommandLine (hConv, lpCmdLine); + + /* Close the conversation */ + closeConversation (hConv); + } + + DdeUninitialize (idInst); + + return ret; +} + +/* + * Name : openConversation + * Function: Start a conversation. + * + */ + +static HCONV +openConversation (void) +{ + HSZ hszService = NULL, hszTopic = NULL; + HCONV hConv = NULL; + + /* Get the application (service) name */ + hszService = DdeCreateStringHandle (idInst, + SERVICE_NAME, + CP_WINANSI); + + if (!hszService) + { + MessageBox (NULL, "Could not create string handle for service.", + "winclient", MB_ICONEXCLAMATION | MB_OK); + + goto error; + } + + /* Get the topic name */ + hszTopic = DdeCreateStringHandle (idInst, + TOPIC_NAME, + CP_WINANSI); + + if (!hszTopic) + { + MessageBox (NULL, "Could not create string handle for topic.", + "winclient", MB_ICONEXCLAMATION | MB_OK); + + goto error; + } + + /* Try to connect */ + hConv = DdeConnect (idInst, hszService, hszTopic, NULL); + + if (!hConv) + { + STARTUPINFO sti; + PROCESS_INFORMATION pi; + int n; + + /* Try to start the program */ + ZeroMemory (&sti, sizeof (sti)); + sti.cb = sizeof (sti); + if (!CreateProcess (NULL, PROGRAM_TO_RUN, NULL, NULL, FALSE, 0, + NULL, NULL, &sti, &pi)) + { + MessageBox (NULL, "Could not start process.", + "winclient", MB_ICONEXCLAMATION | MB_OK); + + goto error; + } + + /* Wait for the process to enter an idle state */ + WaitForInputIdle (pi.hProcess, MAX_INPUT_IDLE_WAIT); + + /* Close the handles */ + CloseHandle (pi.hThread); + CloseHandle (pi.hProcess); + + /* Try to connect */ + for (n = 0; n < 5; n++) + { + Sleep (CONNECT_DELAY); + + hConv = DdeConnect (idInst, hszService, hszTopic, NULL); + + if (hConv) + break; + } + + if (!hConv) + { + /* Still couldn't connect. */ + MessageBox (NULL, "Could not connect to DDE server.", + "winclient", MB_ICONEXCLAMATION | MB_OK); + + goto error; + } + } + + /* Release the string handles */ + DdeFreeStringHandle (idInst, hszService); + DdeFreeStringHandle (idInst, hszTopic); + + return hConv; + + error: + if (hConv) + DdeDisconnect (hConv); + if (hszService) + DdeFreeStringHandle (idInst, hszService); + if (hszTopic) + DdeFreeStringHandle (idInst, hszTopic); + + return NULL; +} + +/* + * Name : closeConversation + * Function: Close a conversation. + * + */ + +static void +closeConversation (HCONV hConv) +{ + /* Shut down */ + DdeDisconnect (hConv); +} + +/* + * Name : doFile + * Function: Process a file. + * + */ + +int +doFile (HCONV hConv, LPSTR lpszFileName1, LPSTR lpszFileName2) +{ + char *buf = NULL; + unsigned len; + + /* Calculate the buffer length */ + len = strlen (lpszFileName1) + strlen (lpszFileName2) + + strlen (COMMAND_FORMAT); + + /* Allocate a buffer */ + buf = (char *) xmalloc (len); + + if (!buf) + { + MessageBox (NULL, "Not enough memory.", + "winclient", MB_ICONEXCLAMATION | MB_OK); + + return 1; + } + + /* Build the command */ + len = wsprintf (buf, COMMAND_FORMAT, lpszFileName1, lpszFileName2); + + len++; + + /* OK. We're connected. Send the message. */ + DdeClientTransaction (buf, len, hConv, NULL, + 0, XTYP_EXECUTE, TRANSACTION_TIMEOUT, NULL); + + free (buf); + + return 0; +} + +/* + * Name : getNextArg + * Function: Retrieve the next command line argument. + * + */ + +static char * +getNextArg (const char **ptr, unsigned *len) +{ + int in_quotes = 0, quit = 0, all_in_quotes = 0; + const char *p = *ptr, *start; + char *buf = NULL; + unsigned length = 0; + + /* Skip whitespace */ + while (*p && isspace (*p)) + p++; + + /* If this is the end, return NULL */ + if (!*p) + return NULL; + + /* Remember where we are */ + start = p; + + /* Find the next whitespace character outside quotes */ + if (*p == '"') + all_in_quotes = 1; + + while (*p && !quit) + { + switch (*p) + { + case '"': + in_quotes = 1 - in_quotes; + p++; + break; + + case '\\': + if (!in_quotes) + all_in_quotes = 0; + + p++; + + if (!*p) + break; + + p++; + break; + + default: + if (isspace (*p) && !in_quotes) + quit = 1; + else if (!in_quotes) + all_in_quotes = 0; + + if (!quit) + p++; + } + } + + /* Work out the length */ + length = p - start; + + /* Strip quotes if the argument is completely quoted */ + if (all_in_quotes) + { + start++; + length -= 2; + } + + /* Copy */ + buf = (char *) xmalloc (length + 1); + + if (!buf) + return NULL; + + strncpy (buf, start, length); + buf[length] = '\0'; + + /* Return the pointer and length */ + *ptr = p; + *len = length; + + return buf; +} + +/* + * Name : parseCommandLine + * Function: Process the command line. This program accepts a list of strings + * : (which may contain wildcards) representing filenames. + * + */ + +int +parseCommandLine (HCONV hConv, LPSTR lpszCommandLine) +{ + char *fullpath, *filepart; + char *arg; + unsigned len, pathlen; + int ret = 0; + HANDLE hFindFile = NULL; + WIN32_FIND_DATA wfd; + + /* Retrieve arguments */ + while ((arg = getNextArg ((const char**)&lpszCommandLine, &len)) != NULL) + { + /* First find the canonical path name */ + fullpath = filepart = NULL; + pathlen = GetFullPathName (arg, 0, fullpath, &filepart); + + fullpath = (char *) xmalloc (pathlen); + + if (!fullpath) + { + MessageBox (NULL, "Not enough memory.", "winclient", + MB_ICONEXCLAMATION | MB_OK); + + ret = 1; + free (arg); + + break; + } + + GetFullPathName (arg, pathlen, fullpath, &filepart); + + /* Find the first matching file */ + hFindFile = FindFirstFile (arg, &wfd); + + if (hFindFile == INVALID_HANDLE_VALUE) + ret = doFile (hConv, fullpath, ""); + else + { + /* Chop off the file part from the full path name */ + if (filepart) + *filepart = '\0'; + + /* For each matching file */ + do + { + /* Process it */ + ret = doFile (hConv, fullpath, wfd.cFileName); + + if (ret) + break; + } + while (FindNextFile (hFindFile, &wfd)); + + FindClose (hFindFile); + } + + /* Release the path name buffers */ + free (fullpath); + free (arg); + + if (ret) + break; + } + + return ret; +} + +static void +fatal (const char *s1, const char *s2) +{ + error (s1, s2); + exit (1); +} + +/* Print error message. `s1' is printf control string, `s2' is arg for it. */ +static void +error (const char* s1, const char* s2) +{ + fprintf (stderr, "winclient: "); + fprintf (stderr, s1, s2); + fprintf (stderr, "\n"); +} + +/* Like malloc but get fatal error if memory is exhausted. */ + +static void * +xmalloc (size_t size) +{ + void *result = malloc (size); + if (result == NULL) + fatal ("virtual memory exhausted", (char *) 0); + return result; +} diff --text -u 'xemacs-21.5.6/lisp/ChangeLog' 'xemacs-21.5.7/lisp/ChangeLog' Index: ././lisp/ChangeLog --- ././lisp/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././lisp/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,4 +1,683 @@ -2002-04-05 Stephen J. Turnbull +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-06-27 Mike Sperber + + * dumped-lisp.el (preloaded-file-list): Added post-gc.el. + + * post-gc.el: Create. + +2002-06-24 John Paul Wallington + + * obsolete.el (frame-parameter): New compatibility function. + (makehash): Ditto. + (buffer-local-value): Ditto. + (line-beginning-position): New compatibility alias for `point-at-bol'. + (line-end-position): New compatibility alias for `point-at-eol'. + + * subr.el (with-temp-message): New function; sync with GNU Emacs 21. + (bound-and-true-p): Ditto. + (propertize): New function. + (delete-and-extract-region): Ditto. + +2002-06-24 Jerry James + + * code-files.el (load): Look for a binary module if no Lisp file + with the correct name is found. + +2002-06-22 Ville Skyttä + + * subr.el (add-to-list): Sync with GNU Emacs 21.2, adding the + "&optional append" argument. + +2002-06-23 Stephen J. Turnbull + + * unicode.el (load-unicode-tables): Comment loading 8859-1.TXT. + +2002-06-20 Ben Wing + + * mule/mule-msw-init-late.el: + Specify charset->windows-registry conversion. + + * mule/mule-x-init.el: + * mule/mule-x-init.el (x-use-halfwidth-roman-font): + * mule/mule-x-init.el (init-mule-x-win): + Delete extra mule font additions here. Put them in faces.c. + +2002-06-20 Ben Wing + + * cl-macs.el (defun*): + * cl-macs.el (defmacro*): + * cl-macs.el (destructuring-bind): + Document better. + + * font-lock.el (lisp-font-lock-keywords-1): + Move Lisp function regexp to lisp-mode.el. + + * lisp-mode.el: + * lisp-mode.el (lisp-function-and-type-regexp): New. + * lisp-mode.el (lisp-flet-regexp): New. + * lisp-mode.el (lisp-indent-function): + * lisp-mode.el (lisp-indent-quoteform): New. + Various indentation fixes: + + Handle flet functions better. + Handle argument lists in defuns and flets. + Handle quoted lists, e.g. property lists -- don't indent like + function calls. Distinguish between lambdas and other lists. + + * lisp-mode.el (save-selected-device): Handle this form. + + * faces.el: + * faces.el (face-property-instance): + * faces.el (face-property-matching-instance): + * faces.el (set-face-property): + * faces.el (set-face-display-table): + * faces.el (set-face-underline-p): + * faces.el (set-face-strikethru-p): + * faces.el (set-face-highlight-p): + * faces.el (set-face-blinking-p): + * faces.el (face-equal): + * faces.el (try-font-name): + * faces.el (face-frob-from-locale-first): New. + * faces.el (frob-face-property): Removed. + * faces.el (included): Removed. + * faces.el (frob-face-property-1): Removed. + * faces.el (frob-face-font-2): Removed. + * faces.el (Face-frob-property-device-considered-current): New. + * faces.el (Face-frob-property): New. + * faces.el (make-face-family): + * faces.el (make-face-bold): + * faces.el (make-face-italic): + * faces.el (NOTE): New. + * faces.el (functions): New. + * faces.el (make-face-bold-italic): + * faces.el (make-face-unbold): + * faces.el (make-face-unitalic): + * faces.el (make-face-size): + * faces.el (make-face-smaller): + * faces.el (make-face-larger): + * faces.el (get-frame-background-mode): + * faces.el (init-global-faces): + * font-menu.el: + * font-menu.el (font-menu-set-font): + * font-menu.el (font-menu-change-face): + * font.el: + * font.el (mswindows-font-weight-mappings): + * font.el (font-mswindows-font-regexp): Removed. + * font.el (mswindows-font-create-object): + * font.el (mswindows-font-create-name): + * gtk-faces.el (gtk-init-global-faces): + * msw-faces.el: + * msw-faces.el (mswindows-init-device-faces): + * msw-faces.el (mswindows-font-regexp): Removed. + * msw-faces.el (mswindows-font-canonicalize-name): Removed. + * msw-faces.el (mswindows-canonicalize-font-name): New. + * msw-faces.el (mswindows-parse-font-style): New. + * msw-faces.el (mswindows-construct-font-style): New. + * msw-faces.el (mswindows-frob-font-style): New. + * msw-faces.el (mswindows-frob-font-style-and-sizify): New. + * msw-faces.el (mswindows-nonbold-weight-regexp): New. + * msw-faces.el (mswindows-make-font-unbold): + * msw-faces.el (mswindows-bold-weight-regexp): New. + * msw-faces.el (mswindows-make-font-italic): + * msw-faces.el (mswindows-make-font-bold-mapper): New. + * msw-faces.el (mswindows-make-font-unitalic): + * msw-faces.el (mswindows-make-font-nonbold-mapper): New. + * msw-faces.el (mswindows-make-font-italic-mapper): New. + * msw-faces.el (mswindows-make-font-bold-italic): + * msw-faces.el (mswindows-make-font-unitalic-mapper): New. + * msw-faces.el (mswindows-make-font-bold-italic-mapper): New. + * msw-faces.el (mswindows-find-smaller-font): + * msw-faces.el (mswindows-find-larger-font): + * msw-faces.el (mswindows-available-font-sizes): New. + * msw-faces.el (mswindows-frob-font-size): New. + * msw-font-menu.el: + * msw-font-menu.el (mswindows-font-menu-junk-families): + * msw-font-menu.el (mswindows-font-menu-registry-encoding): Removed. + * msw-font-menu.el (mswindows-reset-device-font-menus): + * msw-font-menu.el (mswindows-font-menu-font-data): + * msw-font-menu.el (mswindows-font-menu-load-font): + * x-faces.el: + * x-faces.el (x-init-global-faces): + * x-faces.el (x-init-device-faces): + * x-init.el (init-x-win): + * x-init.el (init-post-x-win): + + Major overhaul of face-handling code: + + -- Fix lots of bogus code in msw-faces.el, msw-font-menu.el, + font-menu.el that was "truenaming" font specs -- i.e. in the + process of frobbing a particular field in a general user-specified + font spec with wildcarded fields, sticking in particular values + for all the remaining wildcarded fields. This bug was rampant + everywhere except in x-faces.el (the oldest and only correctly + written code). This also means that we need to work with font + names at all times and not font instances, because a font instance + is essentially a truenamed font. + + -- Total rewrite of extremely junky code in msw-faces.el. Work + with names as well as font instances, and return names; stop + truenaming when canonicalizing and frobbing; fix handling of the + combined style field, i.e. weight/slant (also fixed in font.el). + + -- Totally rewrite the frobbing functions in faces.el. This time, + we frob all the instantiators rather than just computing a single + instance value and working backwards. That way, e.g., `bold' will + work for all charsets that have bold available, rather than only + for whatever charset was part of the computed font instance + (another example of the truename virus). Also fix up code to look + at the fallbacks (all of them) when no global value present, so we + don't need to put something in the global value. Intelligently + handle a request to frob a buffer locale, rather than signalling + an error. When frobbing instantiators, try hard to figure out + what device type is associated with them, and frob each according + to its own proper device type. Correctly handle inheritance + vectors given as instantiators. Preserve existing tags when + putting back frobbed instantiators. Extract out general + specifier-frobbing code into specifier.el. Document everything + cleanly. Do lots of other things better, etc. + + -- Don't duplicatively set a global specification for the default + font -- it's already in the fallback and we no longer need a + default global specification present. Delete various code in + x-faces.el and msw-faces.el that duplicated the lists of fonts in + faces.c. + + -- init-global-faces was not being called at all under MS Windows! + Major bogosity. That caused device-specific values to get stuck + into all the fonts, making it very hard to change them -- setting + global specs caused nothing to happen. + + -- Correct weight names in font.el. + + -- Lots more font fixups in objects*.c. + + * Printer.el (generic-print-region): + Warning fix. + + * specifier.el: + * specifier.el (map-specifier): + * specifier.el (modify-specifier-instances): + * specifier.el (instance-to-instantiator): New. + * specifier.el (device-type-matches-spec): New. + * specifier.el (add-tag-to-inst-list): New. + * specifier.el (derive-domain-from-locale): New. + * specifier.el (derive-device-type-from-tag-set): New. + * specifier.el (Specifically): New. + * specifier.el (derive-device-type-from-locale-and-tag-set): New. + * specifier.el (derive-specifier-specs-from-locale): New. + Add more args to map-specifier. + + Add various "heuristic" specifier functions to aid in creation of + specifier-munging code such as in faces.el. + + * subr.el: + * subr.el (args-out-of-range): New. + * subr.el (argument-in-range-p): New. + * subr.el (check-argument-range): New. + New functions. + + +2002-06-04 Andy Piper + + * startup.el (normal-top-level): Fix bad merge. + +2002-06-04 Jerry James + + * find-paths.el (paths-find-architecture-directory): Search in + `system-configuration'/`base', not `base'`system-configuration'. + +2002-06-03 Andy Piper + + * dialog-items.el (make-search-dialog): align various subcontrols + in visually pleasing ways, allow frame to autosize to the dialog + size. + * dialog.el (make-dialog-box): add a border inside the frame. Add + :autosize property, if t then reset the frame size appropriately + before the frame is mapped. + * gutter-items.el (set-progress-feedback-instantiator): align + various subcontrols. + * gutter-items.el (set-progress-abort-instantiator): ditto. + +2002-05-30 Andy Piper + + * files.el (revert-buffer-internal): don't visit + revert-buffer. Kill buffer when not used. Suggested by Mike + Alexander + +2002-05-08 Andy Piper + + * files.el (revert-buffer): observe noconfirm behavior. + +2002-04-09 Andy Piper + + * files.el (revert-buffer): use revert-buffer-internal if it looks + like doing so will not result in any user-visible changes. + (revert-buffer-internal): new function. Do the actual process of + reversion and then see whether the result is any different to what + we have already. If it is not then do nothing. + +2002-02-04 Andy Piper + + * files.el (convert-standard-filename): Fix for short filename + Peter Arius + +2001-12-16 Andy Piper + + * package-get.el (package-get-update-all): Make sure installed.db + gets updated after updating packages. + +2001-12-11 Andy Piper + + * menubar.el (get-popup-menu-response): re-order so that it works + on more sane/facist window systems. + +2001-12-03 Andy Piper + + * faces.el (frob-face-property): don't infloop in face frobbing + from Jan Vroonhof . + +2001-11-30 Andy Piper + + * printer.el (generic-print-region): fix for non-MS systems from + Mike Fabian. + +2001-11-30 Jan Vroonhof + + * font.el (font-window-system-mappings): Add mapping for Gtk + (assume identical to X) + +2001-11-30 Jan Vroonhof + + * faces.el (frob-face-property): Follow face fall-back hierarchy + properly for face properties without an instance. Only do manual + copy form 'default in last resort. This handles in particular + the case where 'default itself has only a fall-back (which is + the case by default on windows). + +2001-11-24 Andy Piper + + * printer.el (generic-print-region): set default-frame-plist to + nil while creating the printer frame so that sizes reflect the + printed page. + + * faces.el (face-complain-about-font): Don't complain on printers. + +2002-04-25 Steve Youngs + + * mule/mule-charset.el (string-to-char-list): New. This used to + be in 'mule-misc.el' but that file has been removed. + +2002-04-14 Steve Youngs + + * obsolete.el (find-non-ascii-charset-region): A couple of + packages use this. + (find-non-ascii-charset-string): Ditto. + +2002-04-14 Ben Wing + + * abbrev.el: + * abbrev.el (abbrev-mode): + * abbrev.el (only-global-abbrevs): + * abbrev.el (defining-abbrev-turns-on-abbrev-mode): New. + * abbrev.el (define-abbrev-table): + * abbrev.el (global-abbrev-mode): New. + * abbrev.el (add-mode-abbrev): + * abbrev.el (add-global-abbrev): + * abbrev.el (inverse-add-mode-abbrev): + * abbrev.el (inverse-add-global-abbrev): + Add `global-abbrev-mode', which turns on or off abbrev-mode in all + buffers. Added `defining-abbrev-turns-on-abbrev-mode' -- if + non-nil, defining an abbrev through an interactive function will + automatically turn on abbrev-mode, either globally or locally + depending on the command. This is the "what you'd expect" + behavior. + * indent.el: + * indent.el (indent-balanced-expression-function): New. + * indent.el (indent-balanced-expression): New. + * indent.el (indent-region-or-balanced-expression): New. + general function for indenting a balanced expression in a + mode-correct way. Works similar to indent-region in that a mode + can specify a specific command to do the whole operation; if not, + figure out the region using forward-sexp and indent each line + using indent-according-to-mode. + * keydefs.el: + * keydefs.el (global-map): Removed. + Modify M-C-backslash to do indent-region-or-balanced-expression. + Make S-Tab just insert a TAB char, like it's meant to do. + * make-docfile.el: + * make-docfile.el (docfile-out-of-date): + Now that we're using the call-process-in-lisp, we need to load + an extra file win32-native.el because we're running a bare temacs. + * menubar-items.el: + * menubar-items.el (default-menubar): + Totally redo the Cmds menu so that most used commands appear + directly on the menu and less used commands appear in submenus. + The old way may have been very pretty, but rather impractical. + * process.el (call-process-internal): + Under Windows, don't ever use old-call-process-internal, even + in batch mode. We can do processes in batch mode. + * subr.el: + * subr.el (truncate-string-to-width): + * subr.el (truncate-string-with-continuation-dots): New. + * subr.el (plist-to-alist): + Someone recoded truncate-string-to-width, saying "the FSF version + is too complicated and does lots of hard-to-understand stuff" but + the resulting recoded version was *totally* wrong! it + misunderstood the basic point of this function, which is work in + *columns* not chars. i dumped ours and copied the version from + FSF 21.1. Also added truncate-string-with-continuation-dots, + since this idiom is used often. + +2002-04-07 William M. Perry + + * startup.el (command-line): Don't call init-menubar-at-startup + unless we were built with menubar support. + +2002-03-19 Daiki Ueno + + * mule/japanese.el: Don't quote function expressions listed as + `native-coding-system'. + * mule/chinese.el: Likewise. + +2002-06-03 Ben Wing and + Michael Sperber [Mr. Preprocessor] + + * process.el: + * process.el (process-synchronize-point): New. + * process.el (call-process-internal): + Create new process-synchronize-point to avoid dynamic binding + problems. Fix editing bogosity in setting process sentinels. + +2002-05-28 Katsumi Yamaoka + + * obsolete.el (find-non-ascii-charset-region): Revert the function + definition. + (find-non-ascii-charset-string): Ditto. + +2002-06-01 Ben Wing + + * process.el (call-process-internal): + Insert before, not after, point. + +2002-05-30 Michael Sperber [Mr. Preprocessor] + + * code-process.el (call-process): Ensure that the argument to + `symbol-value-in-buffer' is a buffer even if `buffer' is a string. + +2002-05-28 Ben Wing + + * code-init.el: + * code-init.el (coding-system-variable-default-value-table): + * code-init.el (coding-system-variable-default-value): + Don't use CRLF conversion by default on process output. CMD.EXE and + friends work both ways but Cygwin programs don't like the CRs. + + * code-process.el: + * code-process.el (process-coding-system-alist): + * code-process.el (call-process): + * code-process.el (call-process-region): + * code-process.el (start-process): + * code-process.el (open-network-stream): + * code-process.el (set-buffer-process-coding-system): + * multicast.el: + * multicast.el (open-multicast-group): + * process.el: + * process.el (start-process-shell-command): + * process.el (call-process-internal): + * process.el (call-process): Removed. + * process.el (call-process-region): Removed. + * process.el (start-process): Removed. + * process.el (open-network-stream): Removed. + + Improvements to call-process-internal: + + -- allows a buffer to be specified for input and stderr output + -- use it on all systems + -- implement C-g as documented + -- clean up and comment + + call-process-region uses new call-process facilities; no temp file. + + remove duplicate funs in process.el. + + comment exactly how coding systems work and fix various problems. + + open-multicast-group now does similar coding-system frobbing to + open-network-stream. + + * dumped-lisp.el (preloaded-file-list): + * faces.el (init-global-faces): + * msw-faces.el (mswindows-init-global-faces): New. + Fix some hidden errors due to code not being defined at the right time. + +2002-05-25 Steve Youngs + + * package-ui.el (pui-help-echo): Display both installed and author + version. Use a balloon-help window to display extra info like + package requires. + +2002-05-23 Ben Wing + + * files.el: + * files.el (recover-session): + * files.el (recover-session-finish): Removed. + * files.el (Recover-session-files-from-auto-save-list-file): New. + Recover-session improvements: Only show session files where some + files can actually be recovered, and show in chronological order. + + * subr.el: + * subr.el (truncate-string-to-width): + * subr.el (BUG): New. + * subr.el (truncate-string-with-continuation-dots): Removed. + * subr.el (plist-to-alist): + * menubar-items.el (default-menubar): + As promised to rms, the functionality in + truncate-string-with-continuation-dots has been merged into + truncate-string-to-width. Change callers in menubar-items.el. + + * select.el: + * select.el (copy-primary-selection): + * select.el (kill-primary-selection): + * select.el (own-selection): + * select.el (cut-copy-clear-internal): + Document some of these funs better. Fix problem where we were + doing own-clipboard twice. + +2002-05-20 Stephen J. Turnbull + + * files.el (revert-buffer): + (revert-buffer-internal): + Update docstrings from 21.4. + +2002-04-17 Nickolay Pakoulin + + * cus-edit.el (custom-save-delete-any): New function + (make-custom-save-resets-mapper): New macro + (custom-save-resets-mapper-alist): New constant + (custom-save-resets): Modified + Save customized values MUCH faster by keeping often used lambdas + in cache `custom-save-resets-mapper-alist' instead of building them + on the fly in `custom-save-resets'. + + * cus-edit.el (custom-save-pretty-print): New variable + (custom-save-variable-p): New function + (custom-save-variable-internal): New function + (custom-save-variables): Modified + (custom-save-face-p): New function + (custom-save-face-internal): Modified + (custom-save-faces): Modified + Save customized variables and faces in the alphabetic order. + `custom-save-pretty-print' turns on/off pretty-printing values. + +2002-05-16 Ben Wing + + * dialog.el: + * dialog.el (get-user-response): New. Function to ask a + multiple-choice question, automatically choosing a dialog box or + minibuffer representation as necessary. Generalized version of + yes-or-no-p, y-or-n-p. + + * files.el: + * files.el (recover-file-diff-program): New. + * files.el (recover-file-diff-arguments): New. + * files.el (recover-file): + Use get-user-response to ask "yes/no/diff" question when recovering. + "diff" means that a diff is displayed between the current file and the + autosave. (Converts/deconverts escape-quoted as necessary. No more + complaints from you, Mr. Turnbull!) One known problem: when a dialog + is used, it's modal, so you can't scroll the diff. Will fix soon. + + * lisp-mode.el (lisp-fill-paragraph): + If we're filling a string, don't treat semicolon as a comment, + which would give very unfriendly results. + Uses `buffer-syntactic-context'. + + * simple.el: + * simple.el (undo-all-changes): New. + all changes back to the beginning. (Useful if you've saved the file + in the middle of the changes.) + + * simple.el (kill-word-into-kill-ring): New. + * simple.el (backward-kill-word): + Add option kill-word-into-kill-ring, which controls whether words + deleted with kill-word, backward-kill-word, etc. are "cut" into the + kill ring, or "cleared" into nothingness. (My preference is the + latter, by far. I'd almost go so far as suggesting we make it the + default, as you can always select a word and then cut it if you want + it cut.) + + * menubar-items.el (default-menubar): + Add option corresponding to kill-word-into-kill-ring. + +2002-05-09 Stephen J. Turnbull + + This patch is based on Jerry James's patch and analysis. + + * select.el (get-clipboard): + (get-selection): + Update docstrings. + (get-clipboard-foreign): + (get-selection-foreign): + New function for use as `interprogram-paste-function's. + + * simple.el (interprogram-paste-function): Change default to + `get-clipboard-foreign'; improve docstring. + (interprogram-cut-function): Improve dosctring. + +2002-05-13 Ben Wing + + * files.el (revert-buffer): + Andy's patch from 21.4. Fix evil nasty problems with revert-buffer. + + * menubar-items.el (default-menubar): + Add Append to Register to Rectangles/Register menu. + +2002-05-13 Adrian Aichner + + * code-process.el (call-process): Process-related docstring + improvements spurred by Norbert Koch. + * code-process.el (call-process-region): Ditto. + * code-process.el (start-process): Ditto. + +2002-05-09 Ben Wing + + * keydefs.el (global-map): New. + * msw-init.el (init-post-mswindows-win): + ctrl-delete is like M-d, in keeping with PC standards. it still + will function at its original (delete-selection), when there's a + selection, with the new associated pending-del patch. + +2002-04-14 Golubev I. N. + + * info.el (Info-find-index-alternatives): fix missing \ in \t. + Port of `Info-index' change from 21.4. + +2002-04-23 Jerry James + + * select.el (get-clipboard): Document connection with + interprogram-paste-function. + * select.el (get-selection): Document that nil should be + returned if XEmacs owns the selection. + Remove unnecessary variable. + * simple.el (kill-ring-max): Synch with FSF Emacs 21.2. + * simple.el (kill-new): Synch with FSF Emacs 21.2 + +2002-05-05 Ben Wing + + * bytecomp-runtime.el (with-obsolete-variable): + * bytecomp-runtime.el (with-obsolete-function): + Doc string changes. + + * compat.el: + * compat.el (compat-current-package): + * compat.el (compat-current-package)): New. + * compat.el (compat-define-compat-functions): New. + * compat.el (compat-define-group): + * compat.el (compat-define-functions): Removed. + * compat.el (compat-defun): New. + * compat.el (compat-define-function): New. + * compat.el (compat-wrap-runtime): New. + * compat.el (compat-wrap): New. + * compat.el (compat): Removed. + * compat.el (overlays): + * compat.el (overlayp): New. + * compat.el (make-overlay): New. + * compat.el (move-overlay): New. + * compat.el (delete-overlay): New. + * compat.el (overlay-start): New. + * compat.el (overlay-end): New. + * compat.el (overlay-buffer): New. + * compat.el (overlay-properties): New. + * compat.el (overlays-at): New. + * compat.el (overlays-in): New. + * compat.el (next-overlay-change): New. + * compat.el (previous-overlay-change): New. + * compat.el (overlay-lists): New. + * compat.el (overlay-recenter): New. + * compat.el (overlay-get): New. + * compat.el (overlay-put): New. + * compat.el ('delete-extent): New. + * compat.el ('extent-end-position): New. + * compat.el ('extent-start-position): New. + * compat.el ('set-extent-endpoints): New. + * compat.el ('set-extent-property): New. + * compat.el ('make-extent): New. + * compat.el (extent-property): New. + * compat.el (extent-at): New. + * compat.el (map-extents): New. Some attempts to redo this to + make it truly useful and fix the "multiple versions interacting + with each other" problem. Not yet done. Currently doesn't work. + + * files.el (revert-buffer-internal): + Use with-obsolete-variable to avoid warnings in new revert-buffer code. + +2002-05-02 Steve Youngs + + * package-get.el (package-get): Use 'warn' instead of 'lwarn'. + +2002-05-01 Steve Youngs + + * package-get.el (package-get-update-base-entry): Remove code to + add package entries into custom. + (package-get-custom-groups): Remove. + (package-get-custom): Ditto. + (package-get-custom-add-entry): Ditto. + +2002-04-29 Steve Youngs + + * menubar-items.el (default-menubar): Remove entry for managing + packages via custom. + +2002-04-24 Mats Lidell + + * mule/european.el (language-info-alist): Add TUTORIAL & greeting for Swedish. + +2002-04-28 Steve Youngs + + * mule/mule-charset.el: Revert my last patch. 'string-to-char-list'. * XEmacs 21.5.6 "bok choi" is released. @@ -726,6 +1405,101 @@ * printer.el (generic-print-region): set default-frame-plist to nil while creating the printer frame so that sizes reflect the printed page. + +2002-05-09 Stephen J. Turnbull + + This patch is based on Jerry James's patch and analysis. + + * select.el (get-clipboard): + (get-selection): + Update docstrings. + (get-clipboard-foreign): + (get-selection-foreign): + New function for use as `interprogram-paste-function's. + + * simple.el (interprogram-paste-function): Change default to + `get-clipboard-foreign'; improve docstring. + (interprogram-cut-function): Improve dosctring. + +2002-03-18 Adrian Aichner + + * cus-edit.el (customize-save-variable): Fix typo in prompt. + +2002-03-26 John Paul Wallington + + * obsolete.el (assq-delete-all): New compatibility alias for + remassq. + +2002-01-09 Simon Josefsson + + * files.el (auto-mode-alist): Support Sieve (*.siv, *.sieve). + +2002-01-04 Adrian Aichner + + * info.el (Info-auto-generate-directory): Default + Info-auto-generate-directory to 'if-outdated. + +2002-03-28 Stephen J. Turnbull + + * startup.el (normal-top-level): Prevent migration code from + trashing .emacs on an error in loading the init files. + +2002-03-14 Ville Skyttä + + * files.el (auto-mode-alist): GNUmakefile is a Makefile, + "system default" Xdefaults and friends get xrdb-mode. + +2002-03-05 Mats Lidell + + * help-nomule.el (tutorial-supported-languages): Added Swedish + tutorial. Sorted languages. + +2002-02-11 Mike Sperber + + * info.el (Info-maybe-update-dir): Regenerate dir if we're + regenerating outdated dir files and dir is non-existent. + +2002-01-27 Stephen J. Turnbull + + * code-files.el (convert-mbox-coding-system): Improve comment. + (write-region): Improve docstring. Reformat to 80 columns. Add + coding-system argument to `write-region-pre-hook' call. + (write-region-pre-hook): Fix docstring to mention lockname argument. + +2002-01-18 Stephen J. Turnbull + + * minibuf.el (completing-read): Remove redundant wrong arg list. + + * help.el (with-displaying-help-buffer): Put usage advice in docstring. + +2001-12-27 John Paul Wallington + + * obsolete.el (interactive-form): new compatibility alias for + function-interactive. + +2001-11-29 Adrian Aichner + + * menubar-items.el (Menubar-items-truncate-list): Removed. + * menubar-items.el (Menubar-items-truncate-history): New. + * menubar-items.el (default-menubar): Use + Menubar-items-truncate-history. + +2002-02-03 Adrian Aichner + + * printer.el (generic-print-region): Pass correct arguments to + lpr-region. Thanks to Nevin Kapur and Björn + Torkelsson . + +2002-01-09 John Paul Wallington + + * help.el (describe-mode): synched with FSF 19.34; handle nil + minor mode indicators. + +2001-12-03 Christoph Wedler + + * minibuf.el (completing-read): Update docstring. + +2001-12-17 Stephen J. Turnbull * faces.el (face-complain-about-font): Don't complain on printers. diff --text -u 'xemacs-21.5.6/lisp/abbrev.el' 'xemacs-21.5.7/lisp/abbrev.el' Index: ././lisp/abbrev.el --- ././lisp/abbrev.el Fri Apr 13 03:21:09 2001 +++ ././lisp/abbrev.el Sun Apr 14 21:42:04 2002 @@ -1,6 +1,7 @@ ;;; abbrev.el --- abbrev mode commands for Emacs ;; Copyright (C) 1985, 1986, 1987, 1992, 1997 Free Software Foundation, Inc. +;; Copyright (C) 2002 Ben Wing. ;; Maintainer: XEmacs Development Team ;; Keywords: abbrev, dumped @@ -37,17 +38,28 @@ :tag "Abbreviations" :group 'editing) -(defgroup abbrev-mode nil +(defcustom abbrev-mode nil "Word abbreviations mode." + :initialize #'set-default + :set #'(lambda (sym val) + (global-abbrev-mode (if val 1 0))) :group 'abbrev) -;jwz: this is preloaded so don't ;;;###autoload -(defcustom only-global-abbrevs nil "\ -*Non-nil means user plans to use global abbrevs only. +(defcustom only-global-abbrevs nil + "*Non-nil means user plans to use global abbrevs only. Makes the commands to define mode-specific abbrevs define global ones instead." :type 'boolean :group 'abbrev) +(defcustom defining-abbrev-turns-on-abbrev-mode t + "*NOn-nil turns on abbrev-mode whenever an abbrev is defined. +This occurs only when the user-level commands (e.g. `add-global-abbrev') +are used. abbrev-mode is turned on in all buffers or the current-buffer +only, depending on whether a global or mode-specific abbrev is defined." + ;;#### should turn on in all buffers of current mode in mode-specific abbrev! + :type 'boolean + :group 'abbrev) + ;;; XEmacs: the following block of code is not in FSF (defvar abbrev-table-name-list '() "List of symbols whose values are abbrev tables.") @@ -66,7 +78,6 @@ (setq abbrevs-changed t) nil) - (defun define-abbrev-table (table-name definitions) "Define TABLE-NAME (a symbol) as an abbrev table name. Define abbrevs in it according to DEFINITIONS, which is a list of elements @@ -270,6 +281,22 @@ ;; XEmacs change (redraw-modeline)) +;; XEmacs change +(defun global-abbrev-mode (arg) + "Toggle abbrev mode in all buffers. +With argument ARG, enable abbrev mode globally if ARG is positive, else +disable. In abbrev mode, inserting an abbreviation causes it to expand +and be replaced by its expansion." + (interactive "P") + (let ((newval (if (null arg) (not abbrev-mode) + (> (prefix-numeric-value arg) 0)))) + (setq-default abbrev-mode newval) + (loop for buf being the buffers do + (if (not (eq (symbol-value-in-buffer 'abbrev-mode buf) newval)) + (with-current-buffer buf + (setq abbrev-mode newval))))) + (redraw-modeline)) + (defvar edit-abbrevs-map nil "Keymap used in edit-abbrevs.") @@ -423,11 +450,12 @@ (save-excursion (backward-word arg) (point)))))) (defun add-mode-abbrev (arg) - "Define mode-specific abbrev for last word(s) before point. -Argument is how many words before point form the expansion; -or zero means the region is the expansion. -A negative argument means to undefine the specified abbrev. -Reads the abbreviation in the minibuffer. + "Define mode-specific abbrev for region or last word(s) before point. +If region active, use it as the expansion\; otherwise, choose the word +before point. A prefix argument specifies the number of words before point +that form the expansion; or zero means the text between point and mark is +the expansion. A negative argument means to undefine the specified abbrev. +This command uses the minibuffer to read the abbreviation. Don't use this function in a Lisp program; use `define-abbrev' instead." ;; XEmacs change: @@ -437,19 +465,22 @@ global-abbrev-table (or local-abbrev-table (error "No per-mode abbrev table"))) - "Mode" arg)) + "Mode" arg) + (if defining-abbrev-turns-on-abbrev-mode (abbrev-mode 1))) (defun add-global-abbrev (arg) - "Define global (all modes) abbrev for last word(s) before point. -The prefix argument specifies the number of words before point that form the -expansion; or zero means the region is the expansion. -A negative argument means to undefine the specified abbrev. + "Define global (all modes) abbrev for region or last word(s) before point. +If region active, use it as the expansion\; otherwise, choose the word +before point. A prefix argument specifies the number of words before point +that form the expansion; or zero means the text between point and mark is +the expansion. A negative argument means to undefine the specified abbrev. This command uses the minibuffer to read the abbreviation. Don't use this function in a Lisp program; use `define-abbrev' instead." ;; XEmacs change: (interactive "P") - (add-abbrev global-abbrev-table "Global" arg)) + (add-abbrev global-abbrev-table "Global" arg) + (if defining-abbrev-turns-on-abbrev-mode (global-abbrev-mode 1))) (defun add-abbrev (table type arg) "Add an abbreviation to abbrev table TABLE. @@ -492,7 +523,8 @@ global-abbrev-table (or local-abbrev-table (error "No per-mode abbrev table"))) - "Mode" arg)) + "Mode" arg) + (if defining-abbrev-turns-on-abbrev-mode (abbrev-mode 1))) (defun inverse-add-global-abbrev (arg) "Define last word before point as a global (mode-independent) abbrev. @@ -500,7 +532,8 @@ This command uses the minibuffer to read the expansion. Expands the abbreviation after defining it." (interactive "p") - (inverse-add-abbrev global-abbrev-table "Global" arg)) + (inverse-add-abbrev global-abbrev-table "Global" arg) + (if defining-abbrev-turns-on-abbrev-mode (global-abbrev-mode 1))) (defun inverse-add-abbrev (table type arg) (let (name nameloc exp) diff --text -u 'xemacs-21.5.6/lisp/bytecomp-runtime.el' 'xemacs-21.5.7/lisp/bytecomp-runtime.el' Index: ././lisp/bytecomp-runtime.el --- ././lisp/bytecomp-runtime.el Fri Mar 15 16:43:18 2002 +++ ././lisp/bytecomp-runtime.el Sun May 5 20:30:23 2002 @@ -477,13 +477,15 @@ (put 'with-obsolete-variable 'lisp-indent-function 1) (defmacro with-obsolete-variable (symbol &rest body) "Evaluate BODY but do not warn about usage of obsolete variable SYMBOL. -SYMBOL must be quoted. See also `with-obsolete-function'." +SYMBOL must be quoted and can be a list of SYMBOLS. See also +`with-obsolete-function'." `(with-byte-compiler-warnings-suppressed 'obsolete ,@body)) (put 'with-obsolete-function 'lisp-indent-function 1) (defmacro with-obsolete-function (symbol &rest body) "Evaluate BODY but do not warn about usage of obsolete function SYMBOL. -SYMBOL must be quoted. See also `with-obsolete-variable'." +SYMBOL must be quoted and can be a list of SYMBOLS. See also +`with-obsolete-variable'." `(with-byte-compiler-warnings-suppressed 'obsolete ,@body)) diff --text -u 'xemacs-21.5.6/lisp/cl-macs.el' 'xemacs-21.5.7/lisp/cl-macs.el' Index: ././lisp/cl-macs.el --- ././lisp/cl-macs.el Sun Mar 31 17:27:23 2002 +++ ././lisp/cl-macs.el Fri Jun 21 06:18:02 2002 @@ -113,7 +113,31 @@ (defmacro defun* (name args &rest body) "(defun* NAME ARGLIST [DOCSTRING] BODY...): define NAME as a function. Like normal `defun', except ARGLIST allows full Common Lisp conventions, -and BODY is implicitly surrounded by (block NAME ...)." +and BODY is implicitly surrounded by (block NAME ...). + +\"Full Common Lisp conventions\" means that: + +-- In addition to &optional and &rest, the lambda-list keywords &key, + &allow-other-keys, and &aux are allowed. + +-- The format of the arguments to &optional is expanded: As well as simple + variables, they can be lists of the form (VAR [INITFORM [SVAR]]); when + no argument is available for VAR, INITFORM is evaluated (or nil, if + INITFORM is omitted) and stored as VAR's value, and SVAR is bound to t. + If an arguent is available for VAR, and INITFORM is unused, SVAR is + bound to nil. + +-- &key specifies keyword arguments. The format of each argument is + VAR || ( { VAR || (KEYWORD VAR) } [INITFORM [SVAR]]) -- #### document me. + +-- &allow-other-keys means that if other keyword arguments are given that are + not specifically list in the arg list, they are allowed, rather than an + error being signalled. They can be retrieved with an &rest form. + +-- &aux specifies extra bindings, exactly like a `let*' enclosing the body. + The format of each binding is VAR || (VAR [INITFORM]) -- exactly like the + format of `let'/`let*' bindings. +" (let* ((res (cl-transform-lambda (cons args body) name)) (form (list* 'defun name (cdr res)))) (if (car res) (list 'progn (car res) form) form))) @@ -122,7 +146,43 @@ (defmacro defmacro* (name args &rest body) "(defmacro* NAME ARGLIST [DOCSTRING] BODY...): define NAME as a macro. Like normal `defmacro', except ARGLIST allows full Common Lisp conventions, -and BODY is implicitly surrounded by (block NAME ...)." +and BODY is implicitly surrounded by (block NAME ...). + +\"Full Common Lisp conventions\" means that: + +-- The lambda-list keywords &optional, &rest, &key, &allow-other-keys, and + &aux are allowed, as in `defun*'. + +-- Three additional lambda-list keywords are allowed: &body, &whole, and + &environment. #### Document me. + +-- The macro arg list syntax allows for \"destructuring\" -- see also + `destructuring-bind', which destructures exactly like `defmacro*', and + `loop', which does a rather different way of destructuring. Anywhere + that a simple argument may appear, and (if following a lambda-list + keyword) a list may not normally appear, an embedded lambda list can be + substituted. (The format of the embedded lambda list is exactly the + same as for a top-level list except that &environment is not allowed.) + When matching this lambda list against a caller-specified argument, that + argument is treated as a list and normal lambda-list processing occurs, + just as if the entire operation were happening at top level. + Furthermore, any lambda list, embedded or top-level, can be dotted at its + end, and this will cause matching with an appropriate dotted list given + as an argument. + + See `loop' for practical examples of destructuring, but + keep in mind that `loop' destructuring is somewhat different from macro + destructuring in that + + (a) Macro destructuring has extra features in the various lambda-list + keywords, allowing for special processing of a list other than just + simple matching. + (b) Macro destructuring is strict, in that an error is signalled if the + actual structure does not match the expected structure. On the + other hand, loop destructuring is lax -- extra arguments in a list + are ignored, not enough arguments cause the remaining parameters to + receive a value of nil, etc. +" (let* ((res (cl-transform-lambda (cons args body) name)) (form (list* 'defmacro name (cdr res)))) (if (car res) (list 'progn (car res) form) form))) @@ -370,6 +430,26 @@ ;;;###autoload (defmacro destructuring-bind (args expr &rest body) + "Bind the arguments in ARGS to EXPR then eval BODY. +This is similar to `let' but it does \"destructuring\", in that it matches +the structure of ARGS to the structure of EXPR and binds corresponding +arguments in ARGS to their values in EXPR. The format of ARGS, and the +way the destructuring works, is exactly like the destructuring that occurs +in `defmacro*'; see that for more information. + +An alternative means of destructuring is using the `loop' macro. `loop' +gives practical examples of destructuring. `defmacro*' describes the +differences between loop and macro-style destructuring. + +You can rewrite a call to (destructuring-bind ARGS EXPR &rest BODY) using +`loop', approximately like this: + + (loop for ARGS = EXPR + return (progn BODY)) + +I say \"approximately\" because the destructuring works in a somewhat +different fashion, although for most reasonably simple constructs the +results will be the same." (let* ((bind-lets nil) (bind-forms nil) (bind-inits nil) (bind-defs nil) (bind-block 'cl-none)) (cl-do-arglist (or args '(&aux)) expr) diff --text -u 'xemacs-21.5.6/lisp/code-files.el' 'xemacs-21.5.7/lisp/code-files.el' Index: ././lisp/code-files.el --- ././lisp/code-files.el Mon Apr 1 12:58:07 2002 +++ ././lisp/code-files.el Wed Jun 26 09:11:16 2002 @@ -220,56 +220,69 @@ ;(defun convert-mbox-coding-system (filename visit start end) ...) (defun load (file &optional noerror nomessage nosuffix) - "Execute a file of Lisp code named FILE. -First tries FILE with .elc appended, then tries with .el, - then tries FILE unmodified. Searches directories in load-path. + "Execute a file of Lisp code named FILE, or load a binary module. +First tries to find a Lisp FILE with .elc appended, then with .el, then with + FILE unmodified. If unsuccessful, tries to find a binary module FILE with + .ell appended, then with .dll, then with .so, and finally unmodified. +Searches directories in load-path for Lisp files, and in module-load-path + for binary modules. If optional second arg NOERROR is non-nil, report no error if FILE doesn't exist. Print messages at start and end of loading unless optional third arg NOMESSAGE is non-nil. If optional fourth arg NOSUFFIX is non-nil, don't try adding - suffixes .elc or .el to the specified name FILE. + suffixes .elc, .el, or .ell to the specified name FILE. Return t if file exists." (let* ((filename (substitute-in-file-name file)) (handler (find-file-name-handler filename 'load)) (path nil)) (if handler (funcall handler 'load filename noerror nomessage nosuffix) - (if (or (<= (length filename) 0) - (null (setq path - (locate-file filename load-path + ;; First try to load a Lisp file + (if (and (> (length filename) 0) + (setq path (locate-file filename load-path (and (not nosuffix) - '(".elc" ".el" "")))))) - (and (null noerror) - (signal 'file-error (list "Cannot open load file" filename))) - ;; now use the internal load to actually load the file. - (load-internal - file noerror nomessage nosuffix - (let ((elc ; use string= instead of string-match to keep match-data. + '(".elc" ".el" ""))))) + ;; now use the internal load to actually load the file. + (load-internal + file noerror nomessage nosuffix + (let ((elc ; use string= instead of string-match to keep match-data. (equalp ".elc" (substring path -4)))) - (or (and (not elc) coding-system-for-read) ; prefer for source file - ;; find magic-cookie - (let ((codesys (find-coding-system-magic-cookie-in-file path))) - (when codesys - (setq codesys (intern codesys)) - (if (find-coding-system codesys) codesys))) - (if elc - ;; if reading a byte-compiled file and we didn't find - ;; a coding-system magic cookie, then use `binary'. - ;; We need to guarantee that we never do autodetection - ;; on byte-compiled files because confusion here would - ;; be a very bad thing. Pre-existing byte-compiled - ;; files are always in the `binary' coding system. - ;; Also, byte-compiled files always use `lf' to terminate - ;; a line; don't risk confusion here either. - 'binary - (or (find-file-coding-system-for-read-from-filename path) - ;; looking up in `file-coding-system-alist'. - ;; otherwise use `buffer-file-coding-system-for-read', - ;; as normal - buffer-file-coding-system-for-read) - ))) - ))))) + (or (and (not elc) coding-system-for-read) ;prefer for source file + ;; find magic-cookie + (let ((codesys + (find-coding-system-magic-cookie-in-file path))) + (when codesys + (setq codesys (intern codesys)) + (if (find-coding-system codesys) codesys))) + (if elc + ;; if reading a byte-compiled file and we didn't find + ;; a coding-system magic cookie, then use `binary'. + ;; We need to guarantee that we never do autodetection + ;; on byte-compiled files because confusion here would + ;; be a very bad thing. Pre-existing byte-compiled + ;; files are always in the `binary' coding system. + ;; Also, byte-compiled files always use `lf' to terminate + ;; a line; don't risk confusion here either. + 'binary + (or (find-file-coding-system-for-read-from-filename path) + ;; looking up in `file-coding-system-alist'. + ;; otherwise use `buffer-file-coding-system-for-read', + ;; as normal + buffer-file-coding-system-for-read) + )))) + ;; The file name is invalid, or we want to load a binary module + (if (and (> (length filename) 0) + (setq path (locate-file filename module-load-path + (and (not nosuffix) + '(".ell" ".dll" ".so" ""))))) + (if (featurep 'modules) + (let ((load-modules-quietly nomessage)) + (load-module path)) + (signal 'file-error '("This XEmacs does not support modules"))) + (and (null noerror) + (signal 'file-error (list "Cannot open load file" filename)))) + )))) (defvar insert-file-contents-access-hook nil "A hook to make a file accessible before reading it. @@ -454,18 +467,18 @@ "A special hook to decide the coding system used for writing out a file. Before writing a file, `write-region' calls the functions on this hook with -arguments START, END, FILENAME, APPEND, VISIT, LOCKNAME, and CODING-SYSTEM, +arguments START, END, FILENAME, APPEND, VISIT, LOCKNAME and CODING-SYSTEM, the same as the corresponding arguments in the call to `write-region'. The return value of each function should be one of -- nil -- A coding system or a symbol denoting it, indicating the coding system - to be used for reading the file + to be used for writing the file -- A list of two elements (absolute pathname and length of data written), - which is used as the return value to `write-region'. In this - case, `write-region' assumes that the function has written - the file, and returns. + which is used as the return value to `write-region'. In this case, + `write-region' assumes that the function has written the file and + returns. If any function returns non-nil, the remaining functions are not called.") @@ -476,11 +489,12 @@ FILENAME, APPEND, VISIT, LOCKNAME, and CODING-SYSTEM, the same as the corresponding arguments in the call to `write-region'.") -(defun write-region (start end filename &optional append visit lockname coding-system) +(defun write-region (start end filename + &optional append visit lockname coding-system) "Write current region into specified file. By default the file's existing contents are replaced by the specified region. -Call interactively, prompts for the filename. With a prefix arg, also prompts -for a coding system. +Called interactively, prompts for a file name. With a prefix arg, prompts +for a coding system as well. When called from a program, takes three required arguments: START, END and FILENAME. START and END are buffer positions. diff --text -u 'xemacs-21.5.6/lisp/code-init.el' 'xemacs-21.5.7/lisp/code-init.el' Index: ././lisp/code-init.el --- ././lisp/code-init.el Wed Mar 13 17:52:04 2002 +++ ././lisp/code-init.el Tue May 28 17:44:30 2002 @@ -1,6 +1,6 @@ ;;; code-init.el --- Handle coding system default values -;; Copyright (C) 2001 Ben Wing. +;; Copyright (C) 2001, 2002 Ben Wing. ;; This file is part of XEmacs. @@ -80,7 +80,7 @@ ;; to not do the same translations ourselves. (terminal binary binary binary binary mswindows-multibyte-unix) (default-process-coding-system-read binary raw-text undecided raw-text undecided) - (default-process-coding-system-write binary binary binary raw-text-dos mswindows-multibyte-system-default-dos) + (default-process-coding-system-write binary binary binary raw-text mswindows-multibyte-system-default) (no-conversion-coding-system-mapping binary raw-text raw-text raw-text mswindows-multibyte) )) @@ -152,17 +152,17 @@ The table of default values looks like this: (see below for abbreviations) - Unix Unix+EOL Unix+Mule MSW MSW+Mule + Unix Unix+EOL Unix+Mule MSW MSW+Mule ------------------------------------------------------------------------------ -bfcs-for-read binary raw-text undecided raw-text undecided -default bfcs binary binary iso-2022-8 raw-text-dos MSW-MB-dos -file-name binary binary binary raw-text-dos MSW-MB-SD-dos -native binary binary binary raw-text-dos MSW-MB-SD-dos -keyboard binary raw-text undecided raw-text undecided -terminal binary binary binary binary MSW-MB-unix -process-read binary raw-text undecided raw-text undecided -process-write binary binary binary raw-text-dos MSW-MB-dos -no-conv-cs binary raw-text raw-text raw-text MSW-MB +bfcs-for-read binary raw-text undecided raw-text undecided +default bfcs binary binary iso-2022-8 raw-text-dos MSW-MB-dos +file-name binary binary binary raw-text-dos MSW-MB-SD-dos +native binary binary binary raw-text-dos MSW-MB-SD-dos +keyboard binary raw-text undecided raw-text undecided +terminal binary binary binary binary MSW-MB-unix +process-read binary raw-text undecided raw-text undecided +process-write binary binary binary raw-text MSW-MB-SD +no-conv-cs binary raw-text raw-text raw-text MSW-MB VAR can be one of: (abbreviations in parens) diff --text -u 'xemacs-21.5.6/lisp/code-process.el' 'xemacs-21.5.7/lisp/code-process.el' Index: ././lisp/code-process.el --- ././lisp/code-process.el Wed Mar 13 17:52:04 2002 +++ ././lisp/code-process.el Fri May 31 16:14:52 2002 @@ -1,7 +1,7 @@ ;;; code-process.el --- Process coding functions for XEmacs. ;; Copyright (C) 1985-1987, 1993, 1994, 1997 Free Software Foundation, Inc. -;; Copyright (C) 1995, 2000 Ben Wing +;; Copyright (C) 1995, 2000, 2002 Ben Wing ;; Copyright (C) 1997 MORIOKA Tomohiko ;; Author: Ben Wing @@ -39,50 +39,102 @@ from the program and encoding what sent to the program. If VAL is a cons of coding systems, the car part is used for decoding, and the cdr part is used for encoding. -If VAL is a function symbol, the function must return a coding system -or a cons of coding systems which are used as above.") +If VAL is a function symbol, it is called with two arguments, a symbol +indicating the operation being performed (one of `start-process', +`call-process', `open-network-stream', or `open-multicast-group') and the +program name. The function must return a coding system or a cons of +coding systems which are used as above.") (defun call-process (program &optional infile buffer displayp &rest args) "Call PROGRAM synchronously in separate process. + The program's input comes from file INFILE (nil means `/dev/null'). +XEmacs feature: INFILE can also be a list of (BUFFER [START [END]]), i.e. +a list of one to three elements, consisting of a buffer and optionally +a start position or start and end position. In this case, input comes +from the buffer, starting from START (defaults to the beginning of the +buffer) and ending at END (defaults to the end of the buffer). + Insert output in BUFFER before point; t means current buffer; nil for BUFFER means discard it; 0 means discard and don't wait. +If BUFFER is a string, then find or create a buffer with that name, +then insert the output in that buffer, before point. BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, REAL-BUFFER says what to do with standard output, as above, while STDERR-FILE says what to do with standard error in the child. STDERR-FILE may be nil (discard standard error output), -t (mix it with ordinary output), or a file name string. +t (mix it with ordinary output), a file name string, or (XEmacs feature) +a buffer object. If STDERR-FILE is a buffer object (but not the name of +a buffer, since that would be interpreted as a file), the standard error +output will be inserted into the buffer before point. -Fourth arg DISPLAYP non-nil means redisplay buffer as output is inserted. +Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted. Remaining arguments are strings passed as command arguments to PROGRAM. -If BUFFER is 0, `call-process' returns immediately with value nil. -Otherwise it waits for PROGRAM to terminate and returns a numeric exit status - or a signal description string. -If you quit, the process is killed with SIGINT, or SIGKILL if you - quit again." - (let* ((coding-system-for-read - (or coding-system-for-read - (let (ret) - (catch 'found - (let ((alist process-coding-system-alist) - (case-fold-search nil)) - (while alist - (if (string-match (car (car alist)) program) - (throw 'found (setq ret (cdr (car alist)))) - ) - (setq alist (cdr alist)) - ))) - (if (functionp ret) - (setq ret (funcall ret 'call-process program)) - ) - (cond ((consp ret) (car ret)) - ((not ret) 'undecided) - ((find-coding-system ret) ret) - ) - )))) - (apply 'call-process-internal program infile buffer displayp args) - )) +If BUFFER is 0, returns immediately with value nil. +Otherwise waits for PROGRAM to terminate and returns a numeric exit status +or a signal description string. If you quit, the process is first killed +with SIGINT, then with SIGKILL if you quit again before the process exits. + +If INFILE is a file, we transfer its exact contents to the process without +any encoding/decoding. (#### This policy might change.) + +Otherwise, the read/write coding systems used for process I/O on the +process are determined as follows: + +1. `coding-system-for-read', `coding-system-for-write', if non-nil. + (Intended as a temporary overriding mechanism for use by Lisp + code.) +2. The matching value for the process name from `process-coding-system-alist', + if any, and if non-nil. The value may be either a single coding + system, used for both read and write; or a cons of read/write; or a + function, called to get one of the other two values. +3. For writing: If a buffer was given in INFILE, the value of + `buffer-file-coding-system' in that buffer. + For reading: if a buffer was given in BUFFER, the value of + `buffer-file-coding-system-for-read' in that buffer. +4. The value of `default-process-coding-system', which should be a cons + of read/write coding systems, if the values are non-nil. +5. The coding system `undecided' for read, and `raw-text' for write. + +Note that the processes of determining the read and write coding systems +proceed essentially independently one from the other, as in `start-process'." + (let (cs-r cs-w) + (let (ret) + (catch 'found + (let ((alist process-coding-system-alist) + (case-fold-search nil)) + (while alist + (if (string-match (car (car alist)) program) + (throw 'found (setq ret (cdr (car alist))))) + (setq alist (cdr alist)) + ))) + (if (functionp ret) + (setq ret (funcall ret 'call-process program))) + (cond ((consp ret) + (setq cs-r (car ret) + cs-w (cdr ret))) + ((and ret (find-coding-system ret)) + (setq cs-r ret + cs-w ret)))) + (let ((coding-system-for-read + (or coding-system-for-read cs-r + (let ((thebuf (if (consp buffer) (car buffer) buffer))) + (and (or (bufferp thebuf) (stringp thebuf)) + (get-buffer thebuf) + (symbol-value-in-buffer + 'buffer-file-coding-system-for-read (get-buffer thebuf)))) + (car default-process-coding-system) + 'undecided)) + (coding-system-for-write + (or coding-system-for-write cs-w + (and (consp infile) + (symbol-value-in-buffer + 'buffer-file-coding-system + (get-buffer (car infile)))) + (cdr default-process-coding-system) + 'raw-text))) + (apply 'call-process-internal program infile buffer displayp args)))) (defun call-process-region (start end program &optional deletep buffer displayp @@ -92,67 +144,83 @@ Insert output in BUFFER before point; t means current buffer; nil for BUFFER means discard it; 0 means discard and don't wait. +If BUFFER is a string, then find or create a buffer with that name, +then insert the output in that buffer, before point. BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, REAL-BUFFER says what to do with standard output, as above, while STDERR-FILE says what to do with standard error in the child. STDERR-FILE may be nil (discard standard error output), -t (mix it with ordinary output), or a file name string. +t (mix it with ordinary output), a file name string, or (XEmacs feature) +a buffer object. If STDERR-FILE is a buffer object (but not the name of +a buffer, since that would be interpreted as a file), the standard error +output will be inserted into the buffer before point. Sixth arg DISPLAYP non-nil means redisplay buffer as output is inserted. Remaining args are passed to PROGRAM at startup as command args. If BUFFER is 0, returns immediately with value nil. -Otherwise waits for PROGRAM to terminate -and returns a numeric exit status or a signal description string. -If you quit, the process is first killed with SIGINT, then with SIGKILL if -you quit again before the process exits." - (let ((temp - (make-temp-name - (concat (file-name-as-directory (temp-directory)) "emacs")))) - (unwind-protect - (let (cs-r cs-w) - (let (ret) - (catch 'found - (let ((alist process-coding-system-alist) - (case-fold-search nil)) - (while alist - (if (string-match (car (car alist)) program) - (throw 'found (setq ret (cdr (car alist))))) - (setq alist (cdr alist)) - ))) - (if (functionp ret) - (setq ret (funcall ret 'call-process-region program))) - (cond ((consp ret) - (setq cs-r (car ret) - cs-w (cdr ret))) - ((null ret) - (setq cs-r buffer-file-coding-system - cs-w buffer-file-coding-system)) - ((find-coding-system ret) - (setq cs-r ret - cs-w ret)))) - (let ((coding-system-for-read - (or coding-system-for-read cs-r)) - (coding-system-for-write - (or coding-system-for-write cs-w))) - (write-region start end temp nil 'silent) - (if deletep (delete-region start end)) - (apply #'call-process program temp buffer displayp args))) - (ignore-file-errors (delete-file temp))))) +Otherwise waits for PROGRAM to terminate and returns a numeric exit status +or a signal description string. If you quit, the process is first killed +with SIGINT, then with SIGKILL if you quit again before the process exits. + +The read/write coding systems used for process I/O on the process are +the same as for `call-process'." + ;; We used to delete the text before calling call-process; that was when + ;; a temporary file was used to pass the text to call-process. Now that + ;; we don't do that, we delete the text afterward; if it's being inserted + ;; in the same buffer, make sure we track the insertion, and don't get + ;; any of it in the deleted region if insertion happens at either end + ;; of the region. + (let ((s (and deletep (copy-marker start t))) + (e (and deletep (copy-marker end)))) + (apply #'call-process program (list (current-buffer) start end) + buffer displayp args) + (if deletep (delete-region s e)))) (defun start-process (name buffer program &rest program-args) "Start a program in a subprocess. Return the process object for it. -Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS NAME is name for process. It is modified if necessary to make it unique. BUFFER is the buffer or (buffer-name) to associate with the process. Process output goes at end of that buffer, unless you specify an output stream or filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated - with any buffer + with any buffer. +BUFFER can also have the form (REAL-BUFFER STDERR-BUFFER); in that case, + REAL-BUFFER says what to do with standard output, as above, + while STDERR-BUFFER says what to do with standard error in the child. + STDERR-BUFFER may be nil (discard standard error output, unless a stderr + filter is set). Note that if you do not use this form at process creation, + stdout and stderr will be mixed in the output buffer, and this cannot be + changed, even by setting a stderr filter. Third arg is program file name. It is searched for as in the shell. Remaining arguments are strings to give program as arguments. -INCODE and OUTCODE specify the coding-system objects used in input/output - from/to the process." + +The read/write coding systems used for process I/O on the process are +determined as follows: + +1. `coding-system-for-read', `coding-system-for-write', if non-nil. + (Intended as a temporary overriding mechanism for use by Lisp + code.) +2. The matching value for the process name from `process-coding-system-alist', + if any, and if non-nil. The value may be either a single coding + system, used for both read and write; or a cons of read/write; or a + function, called to get one of the other two values. +3. The value of `default-process-coding-system', which should be a cons + of read/write coding systems, if the values are non-nil. +4. The coding system `undecided' for read, and `raw-text' for write. + +Note that the processes of determining the read and write coding systems +proceed essentially independently one from the other. For example, a value +determined from `process-coding-system-alist' might specify a read coding +system but not a write coding system, in which the read coding system is as +specified and the write coding system comes from proceeding to step 3 (and +looking in `default-process-coding-system'). + +You can change the coding systems later on using +`set-process-coding-system', `set-process-input-coding-system', or +`set-process-output-coding-system'. + +See also `set-process-filter' and `set-process-stderr-filter'." (let (cs-r cs-w) (let (ret) (catch 'found @@ -168,15 +236,15 @@ (cond ((consp ret) (setq cs-r (car ret) cs-w (cdr ret))) - ((find-coding-system ret) + ((and ret (find-coding-system ret)) (setq cs-r ret cs-w ret)))) (let ((coding-system-for-read (or coding-system-for-read cs-r - (car default-process-coding-system))) + (car default-process-coding-system) 'undecided)) (coding-system-for-write (or coding-system-for-write cs-w - (cdr default-process-coding-system)))) + (cdr default-process-coding-system) 'raw-text))) (apply 'start-process-internal name buffer program program-args) ))) @@ -199,13 +267,12 @@ "Open a TCP connection for a service to a host. Return a process object to represent the connection. Input and output work as for subprocesses; `delete-process' closes it. -Args are NAME BUFFER HOST SERVICE. NAME is name for process. It is modified if necessary to make it unique. BUFFER is the buffer (or buffer-name) to associate with the process. Process output goes at end of that buffer, unless you specify an output stream or filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated - with any buffer + with any buffer. Third arg is name of the host to connect to, or its IP address. Fourth arg SERVICE is name of the service desired, or an integer specifying a port number to connect to. @@ -218,7 +285,28 @@ not guaranteed to be sent and received in discrete packets. (But small datagrams around 500 bytes that are not truncated by `process-send-string' are usually fine.) Note further that UDP protocol does not guard against -lost packets." +lost packets. + +The read/write coding systems used for process I/O on the process are +determined as follows: + +1. `coding-system-for-read', `coding-system-for-write', if non-nil. + (Intended as a temporary overriding mechanism for use by Lisp + code.) +2. The matching value for the service from `network-coding-system-alist', + if any, and if non-nil. The value may be either a single coding + system, used for both read and write; or a cons of read/write; or a + function, called to get one of the other two values. +3. The value of `default-network-coding-system', which should be a cons + of read/write coding systems, if the values are non-nil. +4. The coding system `undecided' for read, and `raw-text' for write. + +Note that the processes of determining the read and write coding systems +proceed essentially independently one from the other, as in `start-process'. + +You can change the coding systems later on using +`set-process-coding-system', `set-process-input-coding-system', or +`set-process-output-coding-system'." (let (cs-r cs-w) (let (ret) (catch 'found @@ -245,13 +333,17 @@ (cond ((consp ret) (setq cs-r (car ret) cs-w (cdr ret))) - ((find-coding-system ret) + ((and ret (find-coding-system ret)) (setq cs-r ret cs-w ret)))) (let ((coding-system-for-read - (or coding-system-for-read cs-r)) + (or coding-system-for-read cs-r + (car default-network-coding-system) + 'undecided)) (coding-system-for-write - (or coding-system-for-write cs-w))) + (or coding-system-for-write cs-w + (cdr default-network-coding-system) + 'raw-text))) (open-network-stream-internal name buffer host service protocol)))) (defun set-buffer-process-coding-system (decoding encoding) @@ -259,7 +351,7 @@ DECODING is the coding system to be used to decode input from the process, ENCODING is the coding system to be used to encode output to the process. -For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]." +For a list of possible values of CODING-SYSTEM, use \\[coding-system-list]." (interactive "zCoding-system for process input: \nzCoding-system for process output: ") (let ((proc (get-buffer-process (current-buffer)))) diff --text -u 'xemacs-21.5.6/lisp/compat.el' 'xemacs-21.5.7/lisp/compat.el' Index: ././lisp/compat.el --- ././lisp/compat.el Fri Apr 13 03:21:14 2001 +++ ././lisp/compat.el Sun May 5 20:30:23 2002 @@ -1,6 +1,6 @@ ;;; compat.el --- Mechanism for non-intrusively providing compatibility funs. -;; Copyright (C) 2000 Ben Wing. +;; Copyright (C) 2000, 2002 Ben Wing. ;; Author: Ben Wing ;; Maintainer: Ben Wing @@ -31,6 +31,63 @@ ;;; Commentary: +;; The idea is to provide emulation of API's in a namespace-clean way. Lots of packages are filled with declarations such as + +;; (defalias 'gnus-overlay-get 'extent-property) + +; There should be a single package to provide such compatibility code. The +; tricky part is how to do it in a clean way, without packages interfering +; with each other. + +; The basic usage of compat is: + +; (1) Each package copies compat.el and renames it, e.g. gnus-compat.el. + +; (2) `compat' defines various API's that can be activated. To use them in a +; file, first place code like this at the top of the file: + +;(let ((compat-current-package 'Gnus)) +; (require 'gnus-compat)) + +; then wrap the rest of the code like this: + +; (Gnus-compat-wrap '(overlays events) + +;;; Commentary + +;; blah + +;;; Code + +;(defun random-module-my-fun (bar baz) +; ... +; (overlay-put overlay 'face 'bold) +; ... +;) +; +;(defun ... +;) +; +; +; +; +;) ;; end of (Gnus-compat) + +;;;; random-module.el ends here + +; (3) What this does is implement the requested API's (in this case, the +; overlay API from GNU Emacs and event API from XEmacs) in whichever +; version of Emacs is running, with names such as +; `Gnus-compat-overlay-put', and then it uses `macrolet' to map the +; generic names in the wrapped code into namespace-clean names. The +; result of loading `gnus-compat' leaves around only functions beginning +; with `Gnus-compat' (or whatever prefix was specified in +; `compat-current-package'). This way, various packages, with various +; versions of `compat' as part of them, can coexist, with each package +; running the version of `compat' that it's been tested with. The use of +; `macrolet' ensures that only code that's lexically wrapped -- not code +; that's called from that code -- is affected by the API mapping. + ;; Typical usage: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -41,10 +98,9 @@ ;(compat-define-functions 'fsf-compat -;(defun overlayp (object) -; "Return t if OBJECT is an overlay." -; (and (extentp object) -; (extent-property object 'overlay))) +;(defun overlay-put (overlay prop value) +; "Set property PROP to VALUE in overlay OVERLAY." +; (set-extent-property overlay prop value)) ;(defun make-overlay (beg end &optional buffer front-advance rear-advance) ; ...) @@ -60,17 +116,129 @@ ;; 2. Wrap modules that use the compatibility functions like this: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;(compat 'fsf-compat - +;(let ((compat-current-package 'gnus)) +; (require 'gnus-compat)) +; +;(gnus-compat 'fsf-compat +; +;; Code: +;; +;; ;(defun random-module-my-fun (bar baz) -; (if (fboundp 'overlays-in) (overlays-in bar baz))) - -;... - +; ... +; (overlay-put overlay 'face 'bold) +; ... +;) +; +;(defun ... +;) +; +; +; +; ;) ;; end of (compat 'fsf-compat) ;;;; random-module.el ends here +(defvar compat-current-package) + +(eval-when-compile + (setq compat-current-package 'compat)) + +;; #### not yet working +'( + +(defmacro compat-define-compat-functions (&rest body) + "Define the functions of the `compat' package in a namespace-clean way. +This relies on `compat-current-package' being set. If `compat-current-package' +is equal to the symbol `foo', and within BODY is something like + +\(defmacro compat-define-group (group) + ... +) + +then this turns into + +\(defmacro foo-compat-define-group (group) + ... +) + +and all calls are replaced accordingly. + + + + +Functions such as +compatibility functions in GROUP. +You should simply wrap this around the code that defines the functions. +Any functions and macros defined at top level using `defun' or `defmacro' +will be noticed and added to GROUP. Other top-level code will be executed +normally. All code and definitions in this group can safely reference any +other functions in this group -- the code is effectively wrapped in a +`compat' call. You can call `compat-define-functions' more than once, if +necessary, for a single group. + +What actually happens is that the functions and macros defined here are in +fact defined using names prefixed with GROUP. To use these functions, +wrap any calling code with the `compat' macro, which lexically renames +the function and macro calls appropriately." + (let ((prefix (if (boundp 'compat-current-package) + compat-current-package + (error + "`compat-current-package' must be defined when loading this module"))) + (defs-to-munge '(defun defmacro)) + mappings) + (if (symbolp prefix) (setq prefix (symbol-name prefix))) + ;; first, note all defuns and defmacros + (let (fundef + (body-tail body)) + (while body-tail + (setq fundef (car body-tail)) + (when (and (consp fundef) (memq (car fundef) defs-to-munge)) + (push (cons (second fundef) (third fundef)) mappings)) + (setq body-tail (cdr body-tail)))) + ;; now, munge the definitions with the new names + (let (fundef + (body-tail body) + result + defs) + (while body-tail + (setq fundef (car body-tail)) + (push + (cond ((and (consp fundef) (memq (car fundef) defs-to-munge)) + (nconc (list (car fundef) + (intern (concat prefix "-" + (symbol-name (second fundef)))) + (third fundef)) + (nthcdr 3 fundef))) + (t fundef)) + result) + (setq body-tail (cdr body-tail))) + (setq result (nreverse result)) + ;; now, generate the munged code, with the references to the functions + ;; macroletted + (mapc + #'(lambda (acons) + (let ((fun (car acons)) + (args (cdr acons))) + (push + (list fun args + (nconc + (list 'list + (list 'quote + (intern (concat prefix "-" + (symbol-name fun))))) + args)) + defs))) + mappings) + ;; it would be cleaner to use `lexical-let' instead of `let', but that + ;; causes function definitions to have obnoxious, unreadable junk in + ;; them. #### Move `lexical-let' into C!!! + `(macrolet ((compat-current-package () ,compat-current-package) + ,@defs) + ,@result)))) + +(compat-define-compat-functions (defun compat-hash-table (group) (get group 'compat-table)) @@ -78,9 +246,9 @@ (defun compat-make-hash-table (group) (put group 'compat-table (make-hash-table))) -(defmacro compat-define-group (group) +(defmacro compat-define-group (group &rest body) "Define GROUP as a group of compatibility functions. -Individual functions are defined using `compat-define-functions'. +This macro should wrap individual Individual functions are defined using `compat-define-functions'. Once defined, the functions can be used by wrapping your code in the `compat' macro. @@ -94,9 +262,12 @@ (let ((group (eval group))) (clrhash (compat-hash-table group)))) -(defmacro compat-define-functions (group &rest body) - "Define compatibility functions in GROUP. -You should simply wrap this around the code that defines the functions. +(defmacro compat-defun (args &rest body) + +(defmacro compat-define-function (props name arglist &rest body) + "Define a compatibility function. +PROPS are properties controlling how the function should be defined. +control how the should simply wrap this around the code that defines the functions. Any functions and macros defined at top level using `defun' or `defmacro' will be noticed and added to GROUP. Other top-level code will be executed normally. All code and definitions in this group can safely reference any @@ -108,14 +279,14 @@ fact defined using names prefixed with GROUP. To use these functions, wrap any calling code with the `compat' macro, which lexically renames the function and macro calls appropriately." - (let ((group (eval group))) + (let ((group (eval group)) + (defs-to-munge '(defun defmacro)) + ) (let (fundef (body-tail body)) (while body-tail (setq fundef (car body-tail)) - (when (and (consp fundef) (eq (car fundef) 'defun)) - (puthash (second fundef) (third fundef) (compat-hash-table group))) - (when (and (consp fundef) (eq (car fundef) 'defmacro)) + (when (and (consp fundef) (memq (car fundef) defs-to-munge)) (puthash (second fundef) (third fundef) (compat-hash-table group))) (setq body-tail (cdr body-tail)))) (let (fundef @@ -124,14 +295,8 @@ (while body-tail (setq fundef (car body-tail)) (push - (cond ((and (consp fundef) (eq (car fundef) 'defun)) - (nconc (list 'defun - (intern (concat (symbol-name group) "-" - (symbol-name (second fundef)))) - (third fundef)) - (nthcdr 3 fundef))) - ((and (consp fundef) (eq (car fundef) 'defmacro)) - (nconc (list 'defmacro + (cond ((and (consp fundef) (memq (car fundef) defs-to-munge)) + (nconc (list (car fundef) (intern (concat (symbol-name group) "-" (symbol-name (second fundef)))) (third fundef)) @@ -139,7 +304,7 @@ (t fundef)) result) (setq body-tail (cdr body-tail))) - (nconc (list 'compat (list 'quote group)) (nreverse result))))) + (nconc (list 'compat-wrap (list 'quote group)) (nreverse result))))) (defvar compat-active-groups nil) @@ -154,10 +319,121 @@ (return t))) groups)))) -(defmacro compat (group &rest body) - "Make use of compatibility functions and macros in GROUP. +(defmacro compat-wrap-runtime (groups &rest body)) + +(defmacro compat-wrap (groups &rest body) + "Make use of compatibility functions and macros in GROUPS. +GROUPS is a symbol, an API group, or list of API groups. Each API group +defines a set of functions, macros, variables, etc. and that will (or +should ideally) work on all recent versions of both GNU Emacs and XEmacs, +and (to some extent, depending on how the functions were designed) on older +version. When this function is used, it will generally not be named +`compat-wrap', but have some name such as `Gnus-compat-wrap', if this is +wrapping something in `gnus'. (The renaming happened when the `compat' +package was loaded -- see discussion at top). + +To use `compat' in your package (assume your package is `gnus'), you first +have to do a bit if setup. + +-- Copy and rename compat.el, e.g. to `gnus-compat.el'. The name must be + globally unique across everything on the load path (that means all + packages). +-- Incude this file in your package. It will not interfere with any other + versions of compat (earlier, later, etc.) provided in other packages + and similarly renamed. + +To make use of the API's provided: + +-- First place code like this at the top of the file, after the copyright + notices and comments: + +\(let ((compat-current-package 'Gnus)) + (require 'gnus-compat)) + +-- then wrap the rest of the code like this, assuming you want access to + the GNU Emacs overlays API, and the XEmacs events API: + +\(Gnus-compat-wrap '(overlays xem-events) + +... +... +... + +\(defun gnus-random-fun (overlay baz) + ... + (overlay-put overlay 'face 'bold) + ... +) + +... +... + +\(defun gnus-random-fun-2 (event) + (interactive "e") + (let ((x (event-x event)) + (y (event-y event))) + ... + ) + ) + +) ;; end of (Gnus-compat) + +;;;; random-module.el ends here + +Both the requested API's will be implemented whichever version of Emacs +\(GNU Emacs, XEmacs, etc.) is running, and (with limitations) on older +versions as well. Furthermore, the API's are provided *ONLY* to code +that's actually, lexically wrapped by `compat-wrap' (or its renamed +version). All other code, including code that's called by the wrapped +code, is not affected -- e.g. if we're on XEmacs, and `overlay-put' isn't +normally defined, then it won't be defined in code other than the wrapped +code, even if the wrapped code calls that code. Clever, huh? + +What happens is that the `compat-wrap' actually uses `macrolet' to +inline-substitute calls to `overlay-put' to (in this case) +`Gnus-compat-overlay-put', which was defined when `gnus-compat' was loaded. + +What happens is that is implement the requested API's (in this case, the +overlay API from GNU Emacs and event API from XEmacs) in whichever +version of Emacs is running, with names such as +`Gnus-compat-overlay-put', and then it uses `macrolet' to map the +generic names in the wrapped code into namespace-clean names. The +result of loading `gnus-compat' leaves around only functions beginning +with `Gnus-compat' (or whatever prefix was specified in +`compat-current-package'). This way, various packages, with various +versions of `compat' as part of them, can coexist, with each package +running the version of `compat' that it's been tested with. The use of +`macrolet' ensures that only code that's lexically wrapped -- not code +that's called from that code -- is affected by the API mapping. + +Before using `compat' + +For any file where you want to make use of one or more API's provided by +`compat', first do this: + +Wrap a call to `compat-wrap' around your entire file, like this: + +;; First, you copied compat.el into your package -- we're assuming \"gnus\" -- +;; and renamed it, e.g. gnus-compat.el. Now we load it and tell it to +;; use `Gnus' as the prefix for all stuff it defines. (Use a capital letter +;; or some similar convention so that these names are not so easy to see.) + +\(let ((current-compat-package 'Gnus)) + (require 'gnus-compat)) + +;; The function `compat-wrap' was mapped to `Gnus-compat-wrap'. The idea +;; is that the raw functions beginning with `compat-' are never actually +;; defined. They may appear as function calls inside of functions, but +;; they will always be mapped to something beginning with the given prefix. + +\(Gnus-compat-wrap '(overlays xem-events) + + ... + +) + You should simply wrap this around the code that uses the functions -and macros in GROUP. Typically, a call to `compat' should be placed +and macros in GROUPS. Typically, a call to `compat' should be placed at the top of an ELisp module, with the closing parenthesis at the bottom; use this in place of a `require' statement. Wrapped code can be either function or macro definitions or other ELisp code, and @@ -196,3 +472,264 @@ (macrolet ((fboundp (fun) `(compat-fboundp ',compat-active-groups ,fun)) ,@defs) ,@body)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Define the compat groups ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; overlays ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(compat-define-group 'overlays + +(defun-compat overlayp (object) + "Return t if OBJECT is an overlay." + (and (extentp object) + (extent-property object 'overlay))) + +(defun-compat make-overlay (beg end &optional buffer front-advance rear-advance) + "Create a new overlay with range BEG to END in BUFFER. +If omitted, BUFFER defaults to the current buffer. +BEG and END may be integers or markers. +The fourth arg FRONT-ADVANCE, if non-nil, makes the +front delimiter advance when text is inserted there. +The fifth arg REAR-ADVANCE, if non-nil, makes the +rear delimiter advance when text is inserted there." + (if (null buffer) + (setq buffer (current-buffer)) + (check-argument-type 'bufferp buffer)) + (when (> beg end) + (setq beg (prog1 end (setq end beg)))) + + (let ((overlay (make-extent beg end buffer))) + (set-extent-property overlay 'overlay t) + (if front-advance + (set-extent-property overlay 'start-open t) + (set-extent-property overlay 'start-closed t)) + (if rear-advance + (set-extent-property overlay 'end-closed t) + (set-extent-property overlay 'end-open t)) + + overlay)) + +(defun-compat move-overlay (overlay beg end &optional buffer) + "Set the endpoints of OVERLAY to BEG and END in BUFFER. +If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now. +If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current +buffer." + (check-argument-type 'overlayp overlay) + (if (null buffer) + (setq buffer (extent-object overlay))) + (if (null buffer) + (setq buffer (current-buffer))) + (check-argument-type 'bufferp buffer) + (and (= beg end) + (extent-property overlay 'evaporate) + (delete-overlay overlay)) + (when (> beg end) + (setq beg (prog1 end (setq end beg)))) + (set-extent-endpoints overlay beg end buffer) + overlay) + +(defun-compat delete-overlay (overlay) + "Delete the overlay OVERLAY from its buffer." + (check-argument-type 'overlayp overlay) + (detach-extent overlay) + nil) + +(defun-compat overlay-start (overlay) + "Return the position at which OVERLAY starts." + (check-argument-type 'overlayp overlay) + (extent-start-position overlay)) + +(defun-compat overlay-end (overlay) + "Return the position at which OVERLAY ends." + (check-argument-type 'overlayp overlay) + (extent-end-position overlay)) + +(defun-compat overlay-buffer (overlay) + "Return the buffer OVERLAY belongs to." + (check-argument-type 'overlayp overlay) + (extent-object overlay)) + +(defun-compat overlay-properties (overlay) + "Return a list of the properties on OVERLAY. +This is a copy of OVERLAY's plist; modifying its conses has no effect on +OVERLAY." + (check-argument-type 'overlayp overlay) + (extent-properties overlay)) + +(defun-compat overlays-at (pos) + "Return a list of the overlays that contain position POS." + (overlays-in pos pos)) + +(defun-compat overlays-in (beg end) + "Return a list of the overlays that overlap the region BEG ... END. +Overlap means that at least one character is contained within the overlay +and also contained within the specified region. +Empty overlays are included in the result if they are located at BEG +or between BEG and END." + (if (featurep 'xemacs) + (mapcar-extents #'identity nil nil beg end + 'all-extents-closed-open 'overlay) + (let ((ovls (overlay-lists)) + tmp retval) + (if (< end beg) + (setq tmp end + end beg + beg tmp)) + (setq ovls (nconc (car ovls) (cdr ovls))) + (while ovls + (setq tmp (car ovls) + ovls (cdr ovls)) + (if (or (and (<= (overlay-start tmp) end) + (>= (overlay-start tmp) beg)) + (and (<= (overlay-end tmp) end) + (>= (overlay-end tmp) beg))) + (setq retval (cons tmp retval)))) + retval))) + +(defun-compat next-overlay-change (pos) + "Return the next position after POS where an overlay starts or ends. +If there are no more overlay boundaries after POS, return (point-max)." + (let ((next (point-max)) + tmp) + (map-extents + (lambda (overlay ignore) + (when (or (and (< (setq tmp (extent-start-position overlay)) next) + (> tmp pos)) + (and (< (setq tmp (extent-end-position overlay)) next) + (> tmp pos))) + (setq next tmp)) + nil) + nil pos nil nil 'all-extents-closed-open 'overlay) + next)) + +(defun-compat previous-overlay-change (pos) + "Return the previous position before POS where an overlay starts or ends. +If there are no more overlay boundaries before POS, return (point-min)." + (let ((prev (point-min)) + tmp) + (map-extents + (lambda (overlay ignore) + (when (or (and (> (setq tmp (extent-end-position overlay)) prev) + (< tmp pos)) + (and (> (setq tmp (extent-start-position overlay)) prev) + (< tmp pos))) + (setq prev tmp)) + nil) + nil nil pos nil 'all-extents-closed-open 'overlay) + prev)) + +(defun-compat overlay-lists () + "Return a pair of lists giving all the overlays of the current buffer. +The car has all the overlays before the overlay center; +the cdr has all the overlays after the overlay center. +Recentering overlays moves overlays between these lists. +The lists you get are copies, so that changing them has no effect. +However, the overlays you get are the real objects that the buffer uses." + (or (boundp 'xemacs-internal-overlay-center-pos) + (overlay-recenter (1+ (/ (- (point-max) (point-min)) 2)))) + (let ((pos xemacs-internal-overlay-center-pos) + before after) + (map-extents (lambda (overlay ignore) + (if (> pos (extent-end-position overlay)) + (push overlay before) + (push overlay after)) + nil) + nil nil nil nil 'all-extents-closed-open 'overlay) + (cons (nreverse before) (nreverse after)))) + +(defun-compat overlay-recenter (pos) + "Recenter the overlays of the current buffer around position POS." + (set (make-local-variable 'xemacs-internal-overlay-center-pos) pos)) + +(defun-compat overlay-get (overlay prop) + "Get the property of overlay OVERLAY with property name PROP." + (check-argument-type 'overlayp overlay) + (let ((value (extent-property overlay prop)) + category) + (if (and (null value) + (setq category (extent-property overlay 'category))) + (get category prop) + value))) + +(defun-compat overlay-put (overlay prop value) + "Set one property of overlay OVERLAY: give property PROP value VALUE." + (check-argument-type 'overlayp overlay) + (cond ((eq prop 'evaporate) + (set-extent-property overlay 'detachable value)) + ((eq prop 'before-string) + (set-extent-property overlay 'begin-glyph + (make-glyph (vector 'string :data value)))) + ((eq prop 'after-string) + (set-extent-property overlay 'end-glyph + (make-glyph (vector 'string :data value)))) + ((eq prop 'local-map) + (set-extent-property overlay 'keymap value)) + ((memq prop '(window insert-in-front-hooks insert-behind-hooks + modification-hooks)) + (error "cannot support overlay '%s property under XEmacs" + prop))) + (set-extent-property overlay prop value)) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; extents ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defalias-compat 'delete-extent 'delete-overlay) +(defalias-compat 'extent-end-position 'overlay-end) +(defalias-compat 'extent-start-position 'overlay-start) +(defalias-compat 'set-extent-endpoints 'move-overlay) +(defalias-compat 'set-extent-property 'overlay-put) +(defalias-compat 'make-extent 'make-overlay) + +(defun-compat extent-property (extent property &optional default) + (or (overlay-get extent property) default)) + +(defun-compat extent-at (pos &optional object property before at-flag) + (let ((tmp (overlays-at (point))) + ovls) + (if property + (while tmp + (if (extent-property (car tmp) property) + (setq ovls (cons (car tmp) ovls))) + (setq tmp (cdr tmp))) + (setq ovls tmp + tmp nil)) + (car-safe + (sort ovls + (function + (lambda (a b) + (< (- (extent-end-position a) (extent-start-position a)) + (- (extent-end-position b) (extent-start-position b))))))))) + +(defun-compat map-extents (function &optional object from to + maparg flags property value) + (let ((tmp (overlays-in (or from (point-min)) + (or to (point-max)))) + ovls) + (if property + (while tmp + (if (extent-property (car tmp) property) + (setq ovls (cons (car tmp) ovls))) + (setq tmp (cdr tmp))) + (setq ovls tmp + tmp nil)) + (catch 'done + (while ovls + (setq tmp (funcall function (car ovls) maparg) + ovls (cdr ovls)) + (if tmp + (throw 'done tmp)))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; extents ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; events ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +) ;; group overlays + +) ;; compat-define-compat-functions + +(fmakunbound 'compat-define-compat-functions) + +) \ No newline at end of file diff --text -u 'xemacs-21.5.6/lisp/cus-edit.el' 'xemacs-21.5.7/lisp/cus-edit.el' Index: ././lisp/cus-edit.el --- ././lisp/cus-edit.el Tue Mar 19 07:22:15 2002 +++ ././lisp/cus-edit.el Sat May 18 03:28:45 2002 @@ -344,6 +344,12 @@ (defvar custom-prefix-list nil "List of prefixes that should be ignored by `custom-unlispify'") +(defcustom custom-save-pretty-print t + "Non-nil means pretty-print values of customized variables if available." +:group 'customize +:type 'boolean) + + (defcustom custom-unlispify-menu-entries t "Display menu entries as words instead of symbols if non nil." :group 'custom-menu @@ -3379,78 +3385,148 @@ (point)) (throw 'found nil)))))) +(defun custom-save-delete-any (&rest symbols) + "Delete the call to any symbol among SYMBOLS in `custom-file'. +Leave the point at the end of the file." + (let ((find-file-hooks nil) + (auto-mode-alist nil)) + (set-buffer (find-file-noselect custom-file))) + (goto-char (point-min)) + (condition-case nil + (while (not (eobp)) + (let ((sexp (read (current-buffer)))) + (when (and (listp sexp) + (memq (car sexp) symbols)) + (delete-region (save-excursion + (backward-sexp) + (point)) + (point)) + (while (and (eolp) (not (eobp))) + (delete-region (point) (prog2 (forward-line 1) (point)))) + ))) + (end-of-file nil))) + +(defsubst custom-save-variable-p (symbol) + "Return non-nil if symbol SYMBOL is a customized variable." + (and (symbolp symbol) + (let ((spec (car-safe (get symbol 'theme-value)))) + (or (and spec (eq (car spec) 'user) + (eq (second spec) 'set)) + (get symbol 'saved-variable-comment) + ;; support non-themed vars + (and (null spec) (get symbol 'saved-value)))))) + +(defun custom-save-variable-internal (symbol) + "Print variable SYMBOL to the standard output. +SYMBOL must be a customized variable." + (let ((requests (get symbol 'custom-requests)) + (now (not (or (get symbol 'standard-value) + (and (not (boundp symbol)) + (not (eq (get symbol 'force-value) + 'rogue)))))) + (comment (get symbol 'saved-variable-comment)) + ;; Print everything, no placeholders `...' + (print-level nil) + (print-length nil)) + (unless (custom-save-variable-p symbol) + (error 'wrong-type-argument "Not a customized variable" symbol)) + (princ "\n '(") + (prin1 symbol) + (princ " ") + ;; This comment stuff is in the way #### + ;; Is (eq (third spec) (car saved-value)) ???? + ;; (prin1 (third spec)) + ;; XEmacs -- pretty-print value if available + (if (and custom-save-pretty-print + (fboundp 'pp)) + ;; To suppress bytecompiler warning + (with-fboundp 'pp + (pp (car (get symbol 'saved-value)))) + (prin1 (car (get symbol 'saved-value)))) + (when (or now requests comment) + (princ (if now " t" " nil"))) + (when (or comment requests) + (princ " ") + (prin1 requests)) + (when comment + (princ " ") + (prin1 comment)) + (princ ")"))) + (defun custom-save-variables () "Save all customized variables in `custom-file'." (save-excursion (custom-save-delete 'custom-load-themes) (custom-save-delete 'custom-reset-variables) (custom-save-delete 'custom-set-variables) + ;; This leaves point at the end of file. + ;; Adrian Aichner stated it is + ;; a bad behavior + ;;(custom-save-delete-any 'custom-load-themes + ;; 'custom-reset-variables + ;; 'custom-set-variables) (custom-save-loaded-themes) (custom-save-resets 'theme-value 'custom-reset-variables nil) - (let ((standard-output (current-buffer))) + (let ((standard-output (current-buffer)) + ;; To make nconc work + (sorted-list (make-list 1 t))) + ;; First create a sorted list of saved variables. + (mapatoms + (lambda (symbol) + (when (custom-save-variable-p symbol) + (nconc sorted-list (list symbol))))) + (setq sorted-list (sort (cdr sorted-list) 'string<)) + (unless (bolp) - (princ "\n")) + (princ "\n")) (princ "(custom-set-variables") - (mapatoms (lambda (symbol) - (let ((spec (car-safe (get symbol 'theme-value))) - (requests (get symbol 'custom-requests)) - (now (not (or (get symbol 'standard-value) - (and (not (boundp symbol)) - (not (eq (get symbol 'force-value) - 'rogue)))))) - (comment (get symbol 'saved-variable-comment))) - (when (or (and spec (eq (car spec) 'user) - (eq (second spec) 'set)) comment - ;; support non-themed vars - (and (null spec) (get symbol 'saved-value))) - (princ "\n '(") - (prin1 symbol) - (princ " ") - ;; This comment stuff is in the way #### - ;; Is (eq (third spec) (car saved-value)) ???? - ;; (prin1 (third spec)) - ;; XEmacs -- pretty-print value if available - (if-fboundp 'pp - (pp (car (get symbol 'saved-value))) - (prin1 (car (get symbol 'saved-value)))) - (when (or now requests comment) - (princ (if now " t" " nil"))) - (when (or comment requests) - (princ " ") - (prin1 requests)) - (when comment - (princ " ") - (prin1 comment)) - (princ ")"))))) - (princ ")") - (unless (looking-at "\n") - (princ "\n"))))) + (mapc 'custom-save-variable-internal + sorted-list) + (princ ")") + (unless (looking-at "\n") + (princ "\n"))))) (defvar custom-save-face-ignoring nil) -(defun custom-save-face-internal (symbol) +(defsubst custom-save-face-p (symbol) + "Return non-nil if SYMBOL is a customized face." (let ((theme-spec (car-safe (get symbol 'theme-face))) - (comment (get symbol 'saved-face-comment)) + (comment (get symbol 'saved-face-comment))) + (or (and (not (memq symbol custom-save-face-ignoring)) + ;; Don't print default face here. + (or (and theme-spec + (eq (car theme-spec) 'user) + (eq (second theme-spec) 'set)) + ;; cope with non-themed faces + (and (null theme-spec) + (get symbol 'saved-face)))) + comment))) + +(defun custom-save-face-internal (symbol) + "Print face SYMBOL to the standard output. +SYMBOL must be a customized face." + (let ((comment (get symbol 'saved-face-comment)) (now (not (or (get symbol 'face-defface-spec) (and (not (find-face symbol)) - (not (eq (get symbol 'force-face) 'rogue))))))) - (when (or (and (not (memq symbol custom-save-face-ignoring)) - ;; Don't print default face here. - (or (and theme-spec - (eq (car theme-spec) 'user) - (eq (second theme-spec) 'set)) - ;; cope with non-themed faces - (and (null theme-spec) - (get symbol 'saved-face)))) comment) + (not (eq (get symbol 'force-face) 'rogue)))))) + ;; Print everything, no placeholders `...' + (print-level nil) + (print-length nil)) + (if (memq symbol custom-save-face-ignoring) + ;; Do nothing + nil + ;; Print face + (unless (custom-save-face-p symbol) + (error 'wrong-type-argument "Not a customized face" symbol)) (princ "\n '(") (prin1 symbol) (princ " ") (prin1 (get symbol 'saved-face)) (if (or comment now) - (princ (if now " t" " nil"))) + (princ (if now " t" " nil"))) (when comment - (princ " ") - (prin1 comment)) + (princ " ") + (prin1 comment)) (princ ")")))) (defun custom-save-faces () @@ -3458,52 +3534,92 @@ (save-excursion (custom-save-delete 'custom-reset-faces) (custom-save-delete 'custom-set-faces) + ;; This leaves point at the end of file. + ;; Adrian Aichner stated it is + ;; a bad behavior + ;;(custom-save-delete-any 'custom-reset-faces + ;; 'custom-set-faces) (custom-save-resets 'theme-face 'custom-reset-faces '(default)) - (let ((standard-output (current-buffer))) + (let ((standard-output (current-buffer)) + ;; To make nconc work + (sorted-list (make-list 1 t))) + ;; Create a sorted list of faces + (mapatoms + (lambda (symbol) + (when (custom-save-face-p symbol) + (nconc sorted-list (list symbol))))) + (setq sorted-list (sort (cdr sorted-list) 'string<)) + (unless (bolp) (princ "\n")) (princ "(custom-set-faces") ;; The default face must be first, since it affects the others. - (custom-save-face-internal 'default) + (when (custom-save-face-p 'default) + (custom-save-face-internal 'default)) (let ((custom-save-face-ignoring '(default))) - (mapatoms #'custom-save-face-internal)) + (mapc 'custom-save-face-internal + sorted-list)) (princ ")") (unless (looking-at "\n") (princ "\n"))))) +(defmacro make-custom-save-resets-mapper (property setter) + "Create a mapper for `custom-save-resets'." + `(lambda (object) + (let ((spec (car-safe (get object (quote ,property)))) + (print-level nil) + (print-length nil)) + (with-boundp '(ignored-special started-writing) + (when (and (not (memq object ignored-special)) + (eq (car spec) 'user) + (eq (second spec) 'reset)) + ;; Do not write reset statements unless necessary. + (unless started-writing + (setq started-writing t) + (unless (bolp) + (princ "\n")) + (princ "(") + (princ (quote ,setter)) + (princ "\n '(") + (prin1 object) + (princ " ") + (prin1 (third spec)) + (princ ")"))))))) + +(defconst custom-save-resets-mapper-alist + (eval-when-compile + (list (list 'theme-value 'custom-reset-variables + (byte-compile + (make-custom-save-resets-mapper + 'theme-value 'custom-reset-variables))) + (list 'theme-face 'custom-reset-faces + (byte-compile + (make-custom-save-resets-mapper + 'theme-face 'custom-reset-faces))))) + "Never use it. +Hashes several heavily used functions for `custom-save-resets'") + (defun custom-save-resets (property setter special) + (declare (special ignored-special)) (let (started-writing ignored-special) - (setq ignored-special ignored-special) ;; suppress byte-compiler warning ;; (custom-save-delete setter) Done by caller (let ((standard-output (current-buffer)) - (mapper `(lambda (object) - (let ((spec (car-safe (get object (quote ,property))))) - (when (and (not (memq object ignored-special)) - (eq (car spec) 'user) - (eq (second spec) 'reset)) - ;; Do not write reset statements unless necessary. - (unless started-writing - (setq started-writing t) - (unless (bolp) - (princ "\n")) - (princ "(") - (princ (quote ,setter)) - (princ "\n '(") - (prin1 object) - (princ " ") - (prin1 (third spec)) - (princ ")"))))))) + (mapper (let ((triple (assq property custom-save-resets-mapper-alist))) + (if (and triple (eq (second triple) setter)) + (third triple) + (make-custom-save-resets-mapper property setter))))) (mapc mapper special) (setq ignored-special special) (mapatoms mapper) (when started-writing - (princ ")\n")))) - ) + (princ ")\n"))))) (defun custom-save-loaded-themes () (let ((themes (reverse (get 'user 'theme-loads-themes))) - (standard-output (current-buffer))) + (standard-output (current-buffer)) + (print-level nil) + (print-length nil)) (when themes (unless (bolp) (princ "\n")) (princ "(custom-load-themes") diff --text -u 'xemacs-21.5.6/lisp/dialog-items.el' 'xemacs-21.5.7/lisp/dialog-items.el' Index: ././lisp/dialog-items.el --- ././lisp/dialog-items.el Fri Apr 13 03:21:16 2001 +++ ././lisp/dialog-items.el Tue Jun 4 15:04:15 2002 @@ -60,17 +60,18 @@ 'general :parent parent :title "Search" + :autosize t :spec (setq search-dialog (make-glyph `[layout - :orientation horizontal :justify left - ;; neither the following height/width nor the identical one - ;; below should be necessary! (see below) - :height 11 :width 40 + :orientation horizontal + :vertically-justify top + :horizontally-justify center :border [string :data "Search"] :items - ([layout :orientation vertical :justify left + ([layout :orientation vertical + :justify top ; implies left also :items ([string :data "Search for:"] [button :descriptor "Match Case" @@ -92,10 +93,12 @@ :selected (not search-dialog-direction) :callback (setq search-dialog-direction nil)] )] - [layout :orientation vertical :justify left - :items + [layout :orientation vertical + :vertically-justify top + :horizontally-justify right + :items ([edit-field :width 15 :descriptor "" :active t - :face default :initial-focus t] + :initial-focus t] [button :width 10 :descriptor "Find Next" :callback-ex (lambda (image-instance event) @@ -108,8 +111,9 @@ (isearch-dehighlight) (delete-frame (event-channel event)))])])])) - ;; neither this height/width nor the identical one above should - ;; be necessary! (in fact, if you omit the one above, the layout - ;; sizes itself correctly; but the frame as a whole doesn't use - ;; the layout's size, as it should.) - :properties '(height 11 width 40)))) + ;; These are no longer strictly necessary, but not setting a size + ;; at all yields a much more noticeable resize since the initial + ;; frame is so big. + :properties `(height ,(widget-logical-to-character-height 6) + width ,(widget-logical-to-character-width 39)) + ))) diff --text -u 'xemacs-21.5.6/lisp/dialog.el' 'xemacs-21.5.7/lisp/dialog.el' Index: ././lisp/dialog.el --- ././lisp/dialog.el Tue Oct 30 14:13:27 2001 +++ ././lisp/dialog.el Tue Jun 4 15:04:16 2002 @@ -1,7 +1,7 @@ ;;; dialog.el --- Dialog-box support for XEmacs ;; Copyright (C) 1991-4, 1997 Free Software Foundation, Inc. -;; Copyright (C) 2000 Ben Wing. +;; Copyright (C) 2000, 2002 Ben Wing. ;; Maintainer: XEmacs Development Team ;; Keywords: extensions, internal, dumped @@ -25,6 +25,9 @@ ;;; Synched up with: Not in FSF. +;;; Authorship: Mostly written or rewritten by Ben Wing; some old old stuff +;;; that underlies some current code was written by JWZ. + ;;; Commentary: ;; This file is dumped with XEmacs (when dialog boxes are compiled in). @@ -89,6 +92,116 @@ `[,(car x) (dialog-box-finish ',(cdr x)) t]))) (cdr contents)))) +(defun get-user-response (position question answers) + "Ask a question and get a response from the user, in minibuffer or dialog box. +POSITION specifies which frame to use. +This is normally an event or a window or frame. +If POSITION is t or nil, it means to use the frame the mouse is on. +The dialog box appears in the middle of the specified frame. + +QUESTION is the question to ask (it should end with a question mark followed +by a space). + +ANSWERS are the possible answers. It is a list; each item looks like + + (KEY BUTTON-TEXT RESPONSE) + +where KEY is the key to be pressed in the minibuffer, BUTTON-TEXT is the +text to be displayed in a dialog box button (you should put %_ in it to +indicate the accelerator), and RESPONSE is a value (typically a symbol) +to be returned if the user selects this response. KEY should be either a +single character or a string; which one you use needs to be consistent for +all responses and determines whether the user responds by hitting a single +key or typing in a string and hitting ENTER. + +An item may also be just a string--that makes a nonselectable item in the +dialog box and is ignored in the minibuffer. + +An item may also be nil -- that means to put all preceding items +on the left of the dialog box and all following items on the right; ignored +in the minibuffer." + (if (should-use-dialog-box-p) + (get-dialog-box-response + position + (cons question + (mapcar #'(lambda (x) + (cond + ((null x) nil) + ((stringp x) x) + (t (cons (second x) (third x))))) + answers))) + (save-excursion + (let* ((answers (remove-if-not #'consp answers)) + (possible + (gettext + (flet ((car-to-string-if (x) + (setq x (car x)) + (if (stringp x) x (char-to-string x)))) + (concat (mapconcat #'car-to-string-if + (butlast answers) ", ") " or " + (car-to-string-if (car (last answers))))))) + (question (gettext question)) + (p (format "%s(%s) " question possible))) + (block nil + (if (stringp (caar answers)) + ;; based on yes-or-no-p. + (while t + (let* ((ans (downcase (read-string p nil t))) ;no history + (res (member* ans answers :test #'equal :key #'car))) + (if res (return (third (car res))) + (ding nil 'yes-or-no-p) + (discard-input) + (message "Please answer %s." possible) + (sleep-for 2)))) + ;; based on y-or-n-p. + (save-excursion + (let* ((pre "") event) + (while t + (if (let ((cursor-in-echo-area t) + (inhibit-quit t)) + (message "%s%s(%s) " pre question possible) + (setq event (next-command-event event)) + (condition-case nil + (prog1 + (or quit-flag (eq 'keyboard-quit + (key-binding event))) + (setq quit-flag nil)) + (wrong-type-argument t))) + (progn + (message "%s%s(%s) %s" pre question possible + (single-key-description event)) + (setq quit-flag nil) + (signal 'quit '()))) + (let* ((keys (events-to-keys (vector event))) + (def (lookup-key query-replace-map keys))) + (cond +; ((eq def 'skip) +; (message "%s%sNo" question possible) +; (return nil)) +; ((eq def 'act) +; (message "%s%sYes" question possible) +; (return t)) + ((eq def 'recenter) + (recenter)) + ((or (eq def 'quit) (eq def 'exit-prefix)) + (signal 'quit '())) + ((button-release-event-p event) ; ignore them + nil) + (t + (let ((res (member* (event-to-character event) answers + :key #'car))) + (if res (return (third (car res))) + (message "%s%s(%s) %s" pre question possible + (single-key-description event)) + (ding nil 'y-or-n-p) + (discard-input) + (if (= (length pre) 0) + (setq pre (format "Please answer %s. " + ;; 17 parens! a record in + ;; our lisp code. + possible))))))))))))))))) + + (defun message-box (fmt &rest args) "Display a message, in a dialog box if possible. If the selected device has no dialog-box support, use the echo area. @@ -195,6 +308,8 @@ The frame is made a child of this frame (defaults to the selected frame). :properties Additional properties of the frame, as well as `dialog-frame-plist'. +:autosize + If t the frame is sized to exactly fit the widgets given by :spec. --------------------------------------------------------------------------- @@ -568,6 +683,7 @@ (:parent (selected-frame)) :modal :properties + :autosize :spec) () (flet ((create-dialog-box-frame () @@ -615,6 +731,7 @@ vertical-scrollbar-visible-p nil horizontal-scrollbar-visible-p nil unsplittable t + internal-border-width 8 left ,(+ fleft (- (/ fwidth 2) (/ (* dfwidth fontw) @@ -625,6 +742,19 @@ 2))))))) (set-face-foreground 'modeline [default foreground] frame) (set-face-background 'modeline [default background] frame) + ;; resize before mapping + (when cl-autosize + (set-frame-pixel-size + frame + (image-instance-width + (glyph-image-instance cl-spec + (frame-selected-window frame))) + (image-instance-height + (glyph-image-instance cl-spec + (frame-selected-window frame))))) + ;; somehow, even though the resizing is supposed + ;; to be while the frame is not visible, a + ;; visible resize is perceptible (unless unmapped (make-frame-visible frame)) (let ((newbuf (generate-new-buffer " *dialog box*"))) (set-buffer-dedicated-frame newbuf frame) diff --text -u 'xemacs-21.5.6/lisp/dumped-lisp.el' 'xemacs-21.5.7/lisp/dumped-lisp.el' Index: ././lisp/dumped-lisp.el --- ././lisp/dumped-lisp.el Sun Mar 31 17:27:24 2002 +++ ././lisp/dumped-lisp.el Fri Jun 28 23:20:42 2002 @@ -7,6 +7,7 @@ "setup-paths" "dump-paths" "subr" ; load the most basic Lisp functions + "post-gc" "replace" ; match-string used in version.el. ; Ignore compiled-by-mistake version.elc "version.el" @@ -24,6 +25,10 @@ "console" "obsolete" "specifier" + "frame" ; needed by faces + (when-feature x "x-faces") ; needed by faces + (when-feature gtk "gtk-faces") + (when-feature mswindows "msw-faces") "faces" ; must be loaded before any make-face call ;;(pureload "facemenu") #### not yet ported "glyphs" @@ -34,7 +39,6 @@ "text-props" "process" ;; This is bad. network-streams may not be defined. (when-feature multicast "multicast") ; #+network-streams implicitly true - "frame" ; move up here cause some stuff needs it here "map-ynp" "simple" "keydefs" ; Before loaddefs so that keymap vars exist. @@ -203,7 +207,6 @@ ;; others to control this programmatically. (when-feature (and infodock (or x mswindows gtk) menubar) "id-menus") ;; preload the X code. - (when-feature x "x-faces") (when-feature x "x-iso8859-1") (when-feature x "x-mouse") (when-feature x "x-select") @@ -217,7 +220,6 @@ (when-feature gtk "gtk-widgets") (when-feature gtk "gdk") (when-feature gtk "gtk-init") - (when-feature gtk "gtk-faces") (when-feature gtk "gtk-iso8859-1") (when-feature (and gtk dialog) "dialog-gtk") (when-feature gtk "gtk-select") @@ -228,7 +230,6 @@ ;; preload the mswindows code. (when-feature mswindows "msw-glyphs") - (when-feature mswindows "msw-faces") (when-feature mswindows "msw-mouse") (when-feature mswindows "msw-init") (when-feature mswindows "msw-select") diff --text -u 'xemacs-21.5.6/lisp/faces.el' 'xemacs-21.5.7/lisp/faces.el' Index: ././lisp/faces.el --- ././lisp/faces.el Fri Mar 15 16:43:19 2002 +++ ././lisp/faces.el Fri Jun 21 06:18:02 2002 @@ -2,7 +2,7 @@ ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1995 Board of Trustees, University of Illinois -;; Copyright (C) 1995, 1996 Ben Wing +;; Copyright (C) 1995, 1996, 2002 Ben Wing ;; Author: Ben Wing ;; Keywords: faces, internal, dumped @@ -166,7 +166,7 @@ (put face property specifier))))) (defun face-property-instance (face property - &optional domain default no-fallback) + &optional domain default no-fallback) "Return the instance of FACE's PROPERTY in the specified DOMAIN. Under most circumstances, DOMAIN will be a particular window, @@ -216,8 +216,8 @@ value)) (defun face-property-matching-instance (face property matchspec - &optional domain default - no-fallback) + &optional domain default + no-fallback) "Return the instance of FACE's PROPERTY matching MATCHSPEC in DOMAIN. Currently the only useful value for MATCHSPEC is a charset, when used in conjunction with the face's font; this allows you to retrieve a @@ -231,12 +231,22 @@ (setq face (get-face face)) (let ((value (get face property))) (if (specifierp value) - (setq value (specifier-matching-instance value matchspec domain - default no-fallback))) + (setq value (if (or (charsetp matchspec) + (and (symbolp matchspec) + (find-charset matchspec))) + (or + (specifier-matching-instance + value (cons matchspec nil) domain default + no-fallback) + (specifier-matching-instance + value (cons matchspec t) domain default + no-fallback)) + (specifier-matching-instance value matchspec domain + default no-fallback)))) value)) (defun set-face-property (face property value &optional locale tag-set - how-to-add) + how-to-add) "Change a property of FACE. NOTE: If you want to remove a property from a face, use `remove-face-property' @@ -636,7 +646,7 @@ (face-property-instance face 'display-table domain default no-fallback)) (defun set-face-display-table (face display-table &optional locale tag-set - how-to-add) + how-to-add) "Change the display table of FACE to DISPLAY-TABLE in LOCALE. DISPLAY-TABLE should be a vector as returned by `make-display-table'. @@ -655,7 +665,7 @@ (face-property-instance face 'underline domain default no-fallback)) (defun set-face-underline-p (face underline-p &optional locale tag-set - how-to-add) + how-to-add) "Change the underline property of FACE to UNDERLINE-P. UNDERLINE-P is normally a face-boolean instantiator; see `make-face-boolean-specifier'. @@ -670,7 +680,7 @@ (face-property-instance face 'strikethru domain default no-fallback)) (defun set-face-strikethru-p (face strikethru-p &optional locale tag-set - how-to-add) + how-to-add) "Change whether FACE is strikethru-d (i.e. struck through) in LOCALE. STRIKETHRU-P is normally a face-boolean instantiator; see `make-face-boolean-specifier'. @@ -685,7 +695,7 @@ (face-property-instance face 'highlight domain default no-fallback)) (defun set-face-highlight-p (face highlight-p &optional locale tag-set - how-to-add) + how-to-add) "Change whether FACE is highlighted in LOCALE (TTY locales only). HIGHLIGHT-P is normally a face-boolean instantiator; see `make-face-boolean-specifier'. @@ -714,7 +724,7 @@ (face-property-instance face 'blinking domain default no-fallback)) (defun set-face-blinking-p (face blinking-p &optional locale tag-set - how-to-add) + how-to-add) "Change whether FACE is blinking in LOCALE (TTY locales only). BLINKING-P is normally a face-boolean instantiator; see `make-face-boolean-specifier'. @@ -766,11 +776,7 @@ (and (face-equal-loop common-props face1 face2 domain) (cond ((eq 'tty (device-type device)) (face-equal-loop tty-props face1 face2 domain)) - ;; #### Why isn't this (console-on-window-system-p (device-console device))? - ;; #### FIXME! - ((or (eq 'x (device-type device)) - (eq 'gtk (device-type device)) - (eq 'mswindows (device-type device))) + ((console-on-window-system-p (device-console device)) (face-equal-loop win-props face1 face2 domain)) (t t))))) @@ -779,12 +785,19 @@ See `face-property-instance' for the semantics of the DOMAIN argument." (not (face-equal face 'default domain))) -; moved from x-faces.el (defun try-font-name (name &optional device) + "Return NAME if it's a valid font name on DEVICE, else nil." ;; yes, name really should be here twice. (and name (make-font-instance name device t) name)) + +(defcustom face-frob-from-locale-first nil + "*If non nil, use kludgy way of frobbing fonts suitable for non-mule +multi-charset environments." + :group 'faces + :type 'boolean) + ;; This function is a terrible, disgusting hack!!!! Need to ;; separate out the font elements as separate face properties! @@ -803,204 +816,263 @@ ;; WE DEMAND LEXICAL SCOPING!!! ;; WE DEMAND LEXICAL SCOPING!!! ;; WE DEMAND LEXICAL SCOPING!!! -(defun frob-face-property (face property func device-tags &optional -locale tags) - "Change the specifier for FACE's PROPERTY according to FUNC, in LOCALE. -This function is ugly and messy and is primarily used as an internal -helper function for `make-face-bold' et al., so you probably don't -want to use it or read the rest of the documentation. But if you do ... - -FUNC should be a function of two arguments (an instance and a device) -that returns a modified name that is valid for the given device. -If LOCALE specifies a valid domain (i.e. a window, frame, or device), -this function instantiates the specifier over that domain, applies FUNC -to the resulting instance, and adds the result back as an instantiator -for that locale. Otherwise, LOCALE should be a locale, locale type, or -'all (defaults to 'all if omitted). For each specification thusly -included: if the locale given is a valid domain, FUNC will be -iterated over all valid instantiators for the device of the domain -until a non-nil result is found (if there is no such result, the -first valid instantiator is used), and that result substituted for -the specification; otherwise, the process just outlined is -iterated over each existing device and the concatenated results -substituted for the specification. - -DEVICE-TAGS is a list of tags that each device must match in order for -the function to be called on it." - (let ((sp (face-property face property)) - temp-sp) - (if (valid-specifier-domain-p locale) - ;; this is easy. - (let* ((inst (face-property-instance face property locale)) - (name (and inst - (device-matches-specifier-tag-set-p - (dfw-device locale) device-tags) - (funcall func inst (dfw-device locale))))) - (when name - (add-spec-to-specifier sp name locale tags))) - ;; otherwise, map over all specifications ... - ;; but first, some further kludging: - ;; (1) if we're frobbing the global property, make sure - ;; that something is there (copy from the default face, - ;; if necessary). Otherwise, something like - ;; (make-face-larger 'modeline) - ;; won't do anything at all if the modeline simply - ;; inherits its font from 'default. - ;; (2) if we're frobbing a particular locale, nothing would - ;; happen if that locale has no instantiators. So signal - ;; an error to indicate this. - - - (setq temp-sp (copy-specifier sp)) - (if (or (eq locale 'global) (eq locale 'all) (not locale)) - (when (not (specifier-specs temp-sp 'global)) - ;; Try fallback via the official ways and then do it "by hand" - (let* ((fallback (specifier-fallback sp)) - (fallback-sp - (cond ((specifierp fallback) fallback) - ;; just an inst list - (fallback - (make-specifier-and-init (specifier-type sp) - fallback)) - ((eq (get-face face) (get-face 'default)) - (error "Unable to find global specification")) - ;; If no fallback we snoop from default - (t (face-property 'default property))))) - (copy-specifier fallback-sp temp-sp 'global)))) - (if (and (valid-specifier-locale-p locale) - (not (specifier-specs temp-sp locale))) - (error "Property must have a specification in locale %S" locale)) - (map-specifier - temp-sp - (lambda (sp-arg locale inst-list func) - (let* ((device (dfw-device locale)) - ;; if a device can be derived from the locale, - ;; call frob-face-property-1 for that device. - ;; Otherwise map frob-face-property-1 over each device. - (result - (if device - (list (and (device-matches-specifier-tag-set-p - device device-tags) - (frob-face-property-1 sp-arg device inst-list - func))) - (mapcar (lambda (device) - (and (device-matches-specifier-tag-set-p - device device-tags) - (frob-face-property-1 sp-arg device - inst-list func))) - (device-list)))) - new-result) - ;; remove duplicates and nils from the obtained list of - ;; instantiators. Also add tags amd remove 'defaults'. - (mapcar (lambda (arg) - (when arg - (if (not (consp arg)) - (setq arg (cons tags arg)) - (setcar arg (append tags (delete 'default - (car arg)))))) - (when (and arg (not (member arg new-result))) - (setq new-result (cons arg new-result)))) - result) - ;; add back in. - (add-spec-list-to-specifier sp (list (cons locale new-result))) - ;; tell map-specifier to keep going. - nil)) - locale - func)))) - -(defun frob-face-property-1 (sp device inst-list func) - (let - (first-valid result) - (while (and inst-list (not result)) - (let* ((inst-pair (car inst-list)) - (tag-set (car inst-pair)) - (sp-inst (specifier-instance-from-inst-list - sp device (list inst-pair)))) - (if sp-inst - (progn - (if (not first-valid) - (setq first-valid inst-pair)) - (setq result (funcall func sp-inst device)) - (if result - (setq result (cons tag-set result)))))) - (setq inst-list (cdr inst-list))) - (or result first-valid))) - -(defcustom face-frob-from-locale-first nil - "*If non nil, use kludgy way of frobbing fonts suitable for non-mule -multi-charset environments." - :group 'faces - :type 'boolean) -(defun frob-face-font-2 (face locale tags unfrobbed-face frobbed-face - tty-thunk ws-thunk standard-face-mapping) - ;; another kludge to make things more intuitive. If we're - ;; inheriting from a standard face in this locale, frob the - ;; inheritance as appropriate. Else, if, after the first - ;; window-system frobbing pass, the face hasn't changed and still - ;; looks like the standard unfrobbed face (e.g. 'default), make it - ;; inherit from the standard frobbed face (e.g. 'bold). Regardless - ;; of things, do the TTY frobbing. - - ;; yuck -- The LOCALE argument to make-face-bold is not actually a locale, - ;; but is a "locale, locale-type, or nil for all". So ... do our extra - ;; frobbing only if it's actually a locale; or for nil, do the frobbing - ;; on 'global. This specifier stuff needs some rethinking. - (let* ((the-locale (cond ((null locale) 'global) - ((valid-specifier-locale-p locale) locale) - (t nil))) - (spec-list - (and - the-locale - (specifier-spec-list (get (get-face face) 'font) the-locale tags t))) - (change-it - (and - spec-list - (cdr (assoc (cdadar spec-list) standard-face-mapping))))) - (if (and change-it - (not (memq (face-name (find-face face)) - '(default bold italic bold-italic)))) - (progn - (or (equal change-it t) - (set-face-property face 'font change-it the-locale tags)) - (funcall tty-thunk)) - (let* ((domain (cond ((null the-locale) nil) - ((valid-specifier-domain-p the-locale) the-locale) - ;; OK, this next one is truly a kludge, but - ;; it results in more intuitive behavior most - ;; of the time. (really!) - ((or (eq the-locale 'global) (eq the-locale 'all)) - (selected-device)) - (t nil))) - (inst (and domain (face-property-instance face 'font domain)))) - ;; If it's reasonable to do the inherit-from-standard-face trick, - ;; and it's called for, then do it now. - (if (and - face-frob-from-locale-first - (eq the-locale 'global) - domain - (equal inst (face-property-instance face 'font domain)) - ;; don't do it for standard faces, or you'll get inheritance loops. - ;; #### This makes XEmacs seg fault! fix this bug. - (not (memq (face-name (find-face face)) - '(default bold italic bold-italic))) - (equal (face-property-instance face 'font domain) - (face-property-instance unfrobbed-face 'font domain))) - (set-face-property face 'font (vector frobbed-face) - the-locale tags) - ;; and only otherwise try to build new property value artificially - (funcall tty-thunk) - (funcall ws-thunk) - (and - domain - (equal inst (face-property-instance face 'font domain)) - ;; don't do it for standard faces, or you'll get inheritance loops. - ;; #### This makes XEmacs seg fault! fix this bug. - (not (memq (face-name (find-face face)) - '(default bold italic bold-italic))) - (equal (face-property-instance face 'font domain) - (face-property-instance unfrobbed-face 'font domain)) - (set-face-property face 'font (vector frobbed-face) the-locale tags))))))) +;; When we are initializing a device, it won't be selected; we communicate +;; the device to consider as selected using this variable. +(defvar Face-frob-property-device-considered-current nil) + +(defun Face-frob-property (face locale tag-set exact-p + unfrobbed-face frobbed-face + win-prop tty-props + frob-mapping standard-face-mapping) + ;; implement the semantics of `make-face-bold' et al. FACE, LOCALE, TAG-SET + ;; and EXACT-P are as in that call. UNFROBBED-FACE and FROBBED-FACE are + ;; what we expect the original face and the result to look like, + ;; respectively. TTY-PROPS is a list of face properties to frob in place + ;; of `font' for TTY's. FROB-MAPPING is either a plist mapping device + ;; types to functions of two args (NAME DEVICE) that will frob the + ;; instantiator as appropriate for the device type (this includes TTY's), + ;; or a function to handle the mapping for all device types. + ;; STANDARD-FACE-MAPPING is an alist of mappings of inheritance + ;; instantiators to be replaced with other inheritance instantiators, meant + ;; for e.g. converting [bold] into [bold-italic]. + + ;; #### it would be nice if this function could be generalized to be + ;; a general specifier frobber. but so much of what it does is specific + ;; to faces -- e.g. handling of inheritance, standard faces, + ;; special-casing in various ways for tty's, etc. i've already extracted + ;; as much of the functionality as i can into subfunctions in the + ;; heuristic section of specifier.el. + + ;; #### Note: The old code was totally different (and there was much less + ;; of it). It didn't bother with trying to frob all the instantiators, + ;; or handle inheritance vectors as instantiators, or do something + ;; sensible with buffer locales, or many other things. (It always, or + ;; usually, did a specifier-instance and frobbed the result.) But it did + ;; do three things we don't: + ;; + ;; (1) Map over all devices when processing global or buffer locales. + ;; Should we be doing this in stages 2 and/or 3? The fact that we + ;; now process all fallback instantiators seems to make this less + ;; necessary, at least for global locales. + ;; + ;; (2) Remove all instantiators tagged with `default' when putting the + ;; instantiators back. I don't see why this is necessary, but maybe + ;; it is. + ;; + ;; (3) Pay attention to the face-frob-from-locale-first variable. #### + ;; I don't understand its purpose. Undocumented hacks like this, + ;; clearly added after-the-fact, don't deserve to live. DOCUMENT + ;; THIS SHIT! + + (flet + ( + + ;; non-nil if either instantiator non-nil, or nil instantiators allowed. + (nil-instantiator-ok (inst devtype-spec) + (or inst (eq devtype-spec 'tty))) + + ;; if LOCALE is a global locale (all, nil, global), return 'global, + ;; else nil. + (global-locale (locale) + (and (memq locale '(all nil global)) 'global)) + + ;; Given a locale and the inst-list from that locale, frob the + ;; instantiators according to FROB-MAPPING, a plist mapping device + ;; types to functions that frob instantiators of that device type. + ;; NOTE: TAG-SET and FROB-MAPPING from environment. + (frob-face-inst-list (locale inst-list prop devtype-spec) + (let* ((ffpdev Face-frob-property-device-considered-current) + (results + ;; for each inst-pair, frob it (the result will be 0 or + ;; more inst-pairs; we may get more than one if, e.g. the + ;; instantiator specifies inheritance and we expand the + ;; inheritance); then nconc the results together + (loop for (tag-set . x) in inst-list + for devtype = (derive-device-type-from-locale-and-tag-set + locale tag-set devtype-spec ffpdev) + ;; devtype may be nil if it fails to match DEVTYPE-SPEC + if devtype + if (let* ((mapper (if (functionp frob-mapping) frob-mapping + (plist-get frob-mapping devtype))) + (result + (cond + ;; if a vector ... + ((vectorp x) + (let ((change-to + (cdr (assoc x standard-face-mapping)))) + (cond + ;; (1) handle standard mappings/null vectors + ((or change-to (null (length x))) + (list (cons tag-set + (cond ((eq change-to t) x) + (change-to) + (t x))))) + ;; (2) inheritance vectors. retrieve the + ;; inherited value and recursively frob. + ;; stick the tag-set into the result. + (t (let* + ((subprop + (if (> (length x) 1) (elt x 1) + prop)) + (subinsts + (frob-face-inst-list + locale + (cdar + (specifier-spec-list + (face-property (elt x 0) + subprop))) + subprop devtype-spec))) + ;; #### we don't currently handle + ;; the "reverse the sense" flag on + ;; tty inheritance vectors. + (add-tag-to-inst-list subinsts + tag-set)))))) + ;; (3) not a vector. just process it. + (t + (let ((value + (if (eq devtype-spec 'tty) + (funcall mapper x) + (funcall mapper x + (derive-domain-from-locale + locale devtype-spec + ffpdev))))) + (and (nil-instantiator-ok value devtype-spec) + (list (cons tag-set value)))))))) + ;; if we're adding to a tty, we need to tag our + ;; additions with `tty'; see [note 1] below. we leave + ;; the old spec in place, however -- if e.g. we're + ;; italicizing a font that was always set to be + ;; underlined, even on window systems, then we still + ;; want the underline there. unless we put the old + ;; spec back, the underline will disappear, since + ;; the new specs are all tagged with `tty'. this + ;; doesn't apply to the [note 1] situations below + ;; because there we're just adding, not substituting. + (if (and (eq 'tty devtype-spec) + (not (or (eq 'tty tag-set) + (memq 'tty tag-set)))) + (nconc (add-tag-to-inst-list result 'tty) + (list (cons tag-set x))) + result)) + nconc it))) + (delete-duplicates results :test #'equal))) + + ;; Frob INST-LIST, which came from LOCALE, and put the new value back + ;; into SP at LOCALE. THUNK is a cons of (PROP . DEVTYPE-SPEC), the + ;; property being processed and whether this is a TTY property or a + ;; win property. + (frob-locale (sp locale inst-list thunk) + (let ((newinst (frob-face-inst-list locale inst-list + (car thunk) (cdr thunk)))) + (remove-specifier sp locale tag-set exact-p) + (add-spec-list-to-specifier sp (list (cons locale newinst)))) + ;; map-specifier should keep going + nil) + + ;; map over all specified locales in LOCALE; for each locale, + ;; frob the instantiators in that locale in the specifier in both + ;; WIN-PROP and TTY-PROPS in FACE. Takes values from environment. + (map-over-locales (locale) + (map-specifier (get face win-prop) #'frob-locale locale + (cons win-prop 'window-system) + tag-set exact-p) + (loop for prop in tty-props do + (map-specifier (get face prop) #'frob-locale locale + (cons prop 'tty) + tag-set exact-p))) + + ;; end of flets + ) + + ;; the function itself + + (let* ((ffpdev Face-frob-property-device-considered-current) + (do-later-stages + (or (global-locale locale) + (valid-specifier-domain-p locale) + (bufferp locale))) + (domain (and do-later-stages + (derive-domain-from-locale locale 'window-system + ffpdev))) + (check-differences + (and unfrobbed-face frobbed-face domain + (not (memq (face-name face) + '(default bold italic bold-italic))))) + (orig-instance + (and check-differences + (face-property-instance face win-prop domain)))) + + ;; first do the frobbing + (setq face (get-face face)) + (map-over-locales locale) + + (when do-later-stages + + (if (global-locale locale) (setq locale 'global)) + + ;; now do the second stage -- if there's nothing there, try + ;; harder to find an instantiator, and frob it. + (let (do-something) + (loop for prop in (cons win-prop tty-props) + for propspec = (get face prop) + for devtype-spec = (if (eq prop win-prop) 'window-system 'tty) + if propspec + do + (or (specifier-spec-list propspec locale) + (let ((doit (derive-specifier-specs-from-locale + propspec locale devtype-spec ffpdev + ;; #### does this make sense? When no tags + ;; given, frob the whole list of fallbacks when + ;; global, else just retrieve a current-device + ;; value. this tries to mirror normal practices, + ;; where with no tags you want everything frobbed, + ;; but with a tag you want only the tag frobbed + ;; and hence you probably don't want lots and lots + ;; of items there. (#### Perhaps the best way -- + ;; or at least a way with some theoretical + ;; justifiability -- is to fetch the fallbacks + ;; that match the TAG-SET/EXACT-P, and if none, + ;; fall back onto doing the selected-device + ;; trick.) + (and (not tag-set) (not exact-p))))) + (if (and (not doit) (eq locale 'global)) + (error + "No fallback for specifier property %s in face %s???" + prop face)) + ;; [note 1] whenever we add to a tty property, + ;; make sure we tag our additions with `tty' to + ;; avoid accidentally messing things up on window + ;; systems (e.g. when making things italic we + ;; don't want to set the underline property on + ;; window systems) + (when doit + (add-spec-list-to-specifier + propspec + (list (cons locale + (add-tag-to-inst-list + doit + (append (if (listp tag-set) tag-set + (list tag-set)) + (if (eq devtype-spec 'tty) '(tty))) + )))) + (setq do-something t))))) + (when do-something + (map-over-locales (or (global-locale locale) locale)))) + + ;; then do the third stage -- check for whether we have to do + ;; the inheritance trick. + + (when (and check-differences + (let ((new-instance + (face-property-instance face win-prop domain))) + (and + (equal orig-instance new-instance) + (equal orig-instance + (face-property-instance unfrobbed-face win-prop + domain))))) + (set-face-property face win-prop (vector frobbed-face) + (or (global-locale locale) locale) tag-set)))))) ;; WE DEMAND FOUNDRY FROBBING! @@ -1008,253 +1080,263 @@ ;; Thx Jan Vroonhof, Ref xemacs-beta <87oflypbum.fsf@petteflet.ntlworld.com> ;; Brainlessly derived from make-face-size by Stephen; don't blame Jan. ;; I'm long since flown to Rio, it does you little good to blame me, either. -(defun make-face-family (face family &optional locale tags) - "Set FACE's family to FAMILY in LOCALE, if possible. - -Add/replace settings specified by TAGS only." - (frob-face-property face 'font - ;; uses dynamic scope of family - #'(lambda (f d) +(defun make-face-family (face family &optional locale tags exact-p) + "Set FACE's family to FAMILY in LOCALE, if possible." + (interactive (list (read-face-name "Set family of which face: ") + (read-string "Family to set: "))) + + (Face-frob-property face locale tags exact-p + nil nil 'font nil + `(lambda (f d) ;; keep the dependency on font.el for now - (let ((fo (font-create-object (font-instance-name f) - d))) - (set-font-family fo family) + (let ((fo (font-create-object f d))) + (set-font-family fo ,family) (font-create-name fo d))) - nil locale tags)) + nil)) ;; Style (ie, typographical face) frobbing -(defun make-face-bold (face &optional locale tags) +(defun make-face-bold (face &optional locale tags exact-p) "Make FACE bold in LOCALE, if possible. -This will attempt to make the font bold for X/MSW locales and will set the -highlight flag for TTY locales. +This will attempt to make the font bold for window-system locales and will +set the highlight flag for TTY locales. -If LOCALE is nil, omitted, or `all', this will attempt to frob all -font specifications for FACE to make them appear bold. Similarly, if -LOCALE is a locale type, this frobs all font specifications for locales -of that type. If LOCALE is a particular locale, what happens depends on -what sort of locale is given. If you gave a device, frame, or window, -then it's always possible to determine what the font actually will be, -so this is determined and the resulting font is frobbed and added back as a -specification for this locale. If LOCALE is a buffer, however, you can't -determine what the font will actually be unless there's actually a -specification given for that particular buffer (otherwise, it depends -on what window and frame the buffer appears in, and might not even be -well-defined if the buffer appears multiple times in different places); -therefore you will get an error unless there's a specification for the -buffer. - -Finally, in some cases (specifically, when LOCALE is not a locale type), -if the frobbing didn't actually make the font look any different -\(this happens, for example, if your font specification is already bold -or has no bold equivalent), and currently looks like the font of the -'default face, it is set to inherit from the 'bold face. This is kludgy -but it makes `make-face-bold' have more intuitive behavior in many -circumstances." +The actual behavior of this function is somewhat messy, in an attempt to +get more intuitive behavior in quite a lot of different circumstances. (You +might view this as indicative of design failures with specifiers, but in +fact almost all code that attempts to interface to humans and produce +\"intuitive\" results gets messy, particularly with a system as complicated +as specifiers, whose complexity results from an attempt to work well in +many different circumstances.) + +The meaning of LOCALE is the same as for `specifier-spec-list', i.e.: + +-- If LOCALE is nil, omitted, or `all', this will attempt to \"frob\" all + font specifications for FACE to make them appear bold (i.e. the + specifications are replaced with equivalent specifications, where the + font names have been changed to the closest bold font). + +-- If LOCALE is a locale type \(`buffer', `window', etc.), this frobs all + font specifications for locales of that type. + +-- If LOCALE is a particular locale, this frobs all font specifications for + that locale. + +If TAGS is given, this only processes instantiators whose tag set includes +all tags mentioned in TAGS. In addition, if EXACT-P is non-nil, only +instantiators whose tag set exactly matches TAGS are processed; otherwise, +additional tags may be present in the instantiator's tag set. + +This function proceeeds in three stages. + +STAGE 1: Frob the settings that are already present. +STAGE 2: (if called for) Ensure that *some* setting exists in the locale + that was given, finding it in various ways and frobbing it as in + stage 1. This ensures that there is an actual setting for + the locale, so you will get the expected buffer-local/frame-local + behavior -- changes to the global value, to other locales, won't + affect this locale, (b) the face will actually look bold in + the locale. +STAGE 3: (if called for) + +The way the frobbing works depends on the device type -- first on whether +or not it's TTY, and second, if it's a window-system device type, on which +particular window-system device type. For locales with a specific device +type, we do the frobbing in the context of that device type -- this means +that for TTY device types we set the highlight flag, and for window-system +device types we modify the font spec according to the rules for font specs +of that device type. For global locales, we may process both the highlight +flag and the font specs (depending on the device types compiled into this +XEmacs). When processing font specs, we check the tag set associated with +each font spec to see if it's specific to a particular device type; if so, +we frob it in the context of that type, else we use the type of the current +device. (A hack, but works well in practice -- and if a new device is +created, we will automatically frob all the standard fonts to make sure +they display OK on that device.) + +If LOCALE is not a locale type, and both TAGS and EXACT-P are omitted, we +do further frobbing in an attempt to give more intuitive behavior. + +First, if there are no specifications in LOCALE (if LOCALE is `all', we act +as if it were `global' for this step), we do our utmost to put a +specification there; otherwise, this function will have no effect. For +device, frame, or window locales, the face's font is instantiated using the +locale as a domain, and the resulting font is frobbed and added back as a +specification for this locale. If LOCALE is `global', we retrieve the +fallback specs and frob them. If LOCALE is a buffer, things get tricky +since you can't instantiate a specifier in a buffer domain \(the buffer can +appear in multiple places, or in different places over time, so this +operation is not well-defined). We used to signal an error in this case, +but now we instead try to do something logical so that we work somewhat +similarly to buffer-local variables. Specifically, we use +`get-buffer-window' to find a window viewing the buffer, and if there is +one, use this as a domain to instantiate the font, and frob the resulting +value. Otherwise, we use the selected window for the same purpose. + +Finally, if the frobbing didn't actually make the font look any different +in whatever domain we instantiated the font in (this happens, for example, +if your font specification is already bold or has no bold equivalent; note +that in this step, we use the selected device in place of `global' or `all' +-- another hack, but works well in practice since there's usually only one +device), and the font currently looks like the font of the `default' face, +it is set to inherit from the `bold' face. + +NOTE: For the other functions defined below, the identity of these two +standard faces mentioned in the previous paragraph, and the TTY properties +that are modified, may be different, and whether the TTY property or +properties are set or unset may be different. For example, for +`make-face-unitalic', the last sentence in the previous paragraph would +read \"... and the font currently looks like the font of the `italic' face, +it is set to inherit from the `default' face.\", and the second sentence in +the first paragraph would read \"This will attempt to make the font +non-italic for window-system locales and will unset the underline flag for +TTY locales.\" + +Here's a table indicating the behavior differences with the different +functions: + +function face1 face2 tty-props tty-val +---------------------------------------------------------------------------- +make-face-bold default bold highlight t +make-face-italic default italic underline t +make-face-bold-italic default bold-italic highlight,underline t +make-face-unbold bold default highlight nil +make-face-unitalic italic default underline nil +" (interactive (list (read-face-name "Make which face bold: "))) - (frob-face-font-2 - face locale tags 'default 'bold - (lambda () - ;; handle TTY specific entries - (when (featurep 'tty) - (set-face-highlight-p face t locale (cons 'tty tags)))) - (lambda () - ;; handle window-system specific entries - (when (featurep 'gtk) - (frob-face-property face 'font 'gtk-make-font-bold - '(gtk) locale tags)) - (when (featurep 'x) - (frob-face-property face 'font 'x-make-font-bold - '(x) locale tags)) - (when (featurep 'mswindows) - (frob-face-property face 'font 'mswindows-make-font-bold - '(mswindows) locale tags) - (frob-face-property face 'font 'mswindows-make-font-bold - '(msprinter) locale tags)) - ) - '(([default] . [bold]) - ([bold] . t) - ([italic] . [bold-italic]) - ([bold-italic] . t)))) + (Face-frob-property face locale tags exact-p + 'default 'bold 'font '(highlight) + '(tty (lambda (x) t) + x x-make-font-bold + gtk gtk-make-font-bold + mswindows mswindows-make-font-bold + msprinter mswindows-make-font-bold) + '(([default] . [bold]) + ([bold] . t) + ([italic] . [bold-italic]) + ([bold-italic] . t)))) -(defun make-face-italic (face &optional locale tags) +(defun make-face-italic (face &optional locale tags exact-p) "Make FACE italic in LOCALE, if possible. This will attempt to make the font italic for X/MS Windows locales and will set the underline flag for TTY locales. See `make-face-bold' for the semantics of the LOCALE argument and for more specifics on exactly how this function works." (interactive (list (read-face-name "Make which face italic: "))) - (frob-face-font-2 - face locale tags 'default 'italic - (lambda () - ;; handle TTY specific entries - (when (featurep 'tty) - (set-face-underline-p face t locale (cons 'tty tags)))) - (lambda () - ;; handle window-system specific entries - (when (featurep 'gtk) - (frob-face-property face 'font 'gtk-make-font-italic - '(gtk) locale tags)) - (when (featurep 'x) - (frob-face-property face 'font 'x-make-font-italic - '(x) locale tags)) - (when (featurep 'mswindows) - (frob-face-property face 'font 'mswindows-make-font-italic - '(mswindows) locale tags) - (frob-face-property face 'font 'mswindows-make-font-italic - '(msprinter) locale tags)) - ) - '(([default] . [italic]) - ([bold] . [bold-italic]) - ([italic] . t) - ([bold-italic] . t)))) + (Face-frob-property face locale tags exact-p + 'default 'italic 'font '(underline) + '(tty (lambda (x) t) + x x-make-font-italic + gtk gtk-make-font-italic + mswindows mswindows-make-font-italic + msprinter mswindows-make-font-italic) + '(([default] . [italic]) + ([bold] . [bold-italic]) + ([italic] . t) + ([bold-italic] . t)))) -(defun make-face-bold-italic (face &optional locale tags) +(defun make-face-bold-italic (face &optional locale tags exact-p) "Make FACE bold and italic in LOCALE, if possible. This will attempt to make the font bold-italic for X/MS Windows locales and will set the highlight and underline flags for TTY locales. See `make-face-bold' for the semantics of the LOCALE argument and for more specifics on exactly how this function works." (interactive (list (read-face-name "Make which face bold-italic: "))) - (frob-face-font-2 - face locale tags 'default 'bold-italic - (lambda () - ;; handle TTY specific entries - (when (featurep 'tty) - (set-face-highlight-p face t locale (cons 'tty tags)) - (set-face-underline-p face t locale (cons 'tty tags)))) - (lambda () - ;; handle window-system specific entries - (when (featurep 'gtk) - (frob-face-property face 'font 'gtk-make-font-bold-italic - '(gtk) locale tags)) - (when (featurep 'x) - (frob-face-property face 'font 'x-make-font-bold-italic - '(x) locale tags)) - (when (featurep 'mswindows) - (frob-face-property face 'font 'mswindows-make-font-bold-italic - '(mswindows) locale tags) - (frob-face-property face 'font 'mswindows-make-font-bold-italic - '(msprinter) locale tags)) - ) - '(([default] . [italic]) - ([bold] . [bold-italic]) - ([italic] . [bold-italic]) - ([bold-italic] . t)))) + (Face-frob-property face locale tags exact-p + 'default 'bold-italic 'font '(underline highlight) + '(tty (lambda (x) t) + x x-make-font-bold-italic + gtk gtk-make-font-bold-italic + mswindows mswindows-make-font-bold-italic + msprinter mswindows-make-font-bold-italic) + '(([default] . [italic]) + ([bold] . [bold-italic]) + ([italic] . [bold-italic]) + ([bold-italic] . t)))) + -(defun make-face-unbold (face &optional locale tags) +(defun make-face-unbold (face &optional locale tags exact-p) "Make FACE non-bold in LOCALE, if possible. This will attempt to make the font non-bold for X/MS Windows locales and will unset the highlight flag for TTY locales. See `make-face-bold' for the semantics of the LOCALE argument and for more specifics on exactly how this function works." (interactive (list (read-face-name "Make which face non-bold: "))) - (frob-face-font-2 - face locale tags 'bold 'default - (lambda () - ;; handle TTY specific entries - (when (featurep 'tty) - (set-face-highlight-p face nil locale (cons 'tty tags)))) - (lambda () - ;; handle window-system specific entries - (when (featurep 'gtk) - (frob-face-property face 'font 'gtk-make-font-unbold - '(gtk) locale tags)) - (when (featurep 'x) - (frob-face-property face 'font 'x-make-font-unbold - '(x) locale tags)) - (when (featurep 'mswindows) - (frob-face-property face 'font 'mswindows-make-font-unbold - '(mswindows) locale tags) - (frob-face-property face 'font 'mswindows-make-font-unbold - '(msprinter) locale tags)) - ) - '(([default] . t) - ([bold] . [default]) - ([italic] . t) - ([bold-italic] . [italic])))) + (Face-frob-property face locale tags exact-p + 'bold 'default 'font '(highlight) + '(tty (lambda (x) nil) + x x-make-font-unbold + gtk gtk-make-font-unbold + mswindows mswindows-make-font-unbold + msprinter mswindows-make-font-unbold) + '(([default] . t) + ([bold] . [default]) + ([italic] . t) + ([bold-italic] . [italic])))) -(defun make-face-unitalic (face &optional locale tags) +(defun make-face-unitalic (face &optional locale tags exact-p) "Make FACE non-italic in LOCALE, if possible. This will attempt to make the font non-italic for X/MS Windows locales and will unset the underline flag for TTY locales. See `make-face-bold' for the semantics of the LOCALE argument and for more specifics on exactly how this function works." (interactive (list (read-face-name "Make which face non-italic: "))) - (frob-face-font-2 - face locale tags 'italic 'default - (lambda () - ;; handle TTY specific entries - (when (featurep 'tty) - (set-face-underline-p face nil locale (cons 'tty tags)))) - (lambda () - ;; handle window-system specific entries - (when (featurep 'gtk) - (frob-face-property face 'font 'gtk-make-font-unitalic - '(gtk) locale tags)) - (when (featurep 'x) - (frob-face-property face 'font 'x-make-font-unitalic - '(x) locale tags)) - (when (featurep 'mswindows) - (frob-face-property face 'font 'mswindows-make-font-unitalic - '(mswindows) locale tags) - (frob-face-property face 'font 'mswindows-make-font-unitalic - '(msprinter) locale tags)) - ) - '(([default] . t) - ([bold] . t) - ([italic] . [default]) - ([bold-italic] . [bold])))) + (Face-frob-property face locale tags exact-p + 'italic 'default 'font '(underline) + '(tty (lambda (x) nil) + x x-make-font-unitalic + gtk gtk-make-font-unitalic + mswindows mswindows-make-font-unitalic + msprinter mswindows-make-font-unitalic) + '(([default] . t) + ([bold] . t) + ([italic] . [default]) + ([bold-italic] . [bold])))) ;; Size frobbing ;; Thx Jan Vroonhof, Ref xemacs-beta <87oflypbum.fsf@petteflet.ntlworld.com> ;; Jan had a separate helper function -(defun make-face-size (face size &optional locale tags) - "Adjust FACE to SIZE in LOCALE, if possible. - -Add/replace settings specified by TAGS only." - (frob-face-property face 'font - ;; uses dynamic scope of size - #'(lambda (f d) - ;; keep the dependency on font.el for now - (let ((fo (font-create-object (font-instance-name f) - d))) - (set-font-size fo size) - (font-create-name fo d))) - nil locale tags)) +(defun make-face-size (face size &optional locale tags exact-p) + "Adjust FACE to SIZE in LOCALE, if possible." + (interactive (list (read-face-name "Set size of which face: ") + (read-number "Size to set: " t 10))) + (Face-frob-property face locale tags exact-p + nil nil 'font nil + `(lambda (f d) + ;; keep the dependency on font.el for now + (let ((fo (font-create-object f d))) + (set-font-size fo ,size) + (font-create-name fo d))) + nil)) ;; Why do the following two functions lose so badly in so many ;; circumstances? -(defun make-face-smaller (face &optional locale) +(defun make-face-smaller (face &optional locale tags exact-p) "Make the font of FACE be smaller, if possible. LOCALE works as in `make-face-bold' et al., but the ``inheriting- from-the-bold-face'' operations described there are not done because they don't make sense in this context." (interactive (list (read-face-name "Shrink which face: "))) - ;; handle X specific entries - (when (featurep 'x) - (frob-face-property face 'font 'x-find-smaller-font - '(x) locale)) - (when (featurep 'mswindows) - (frob-face-property face 'font 'mswindows-find-smaller-font - '(mswindows) locale) - (frob-face-property face 'font 'mswindows-find-smaller-font - '(msprinter) locale))) + (Face-frob-property face locale tags exact-p + nil nil 'font nil + '(x x-find-smaller-font + gtk gtk-find-smaller-font + mswindows mswindows-find-smaller-font + msprinter mswindows-find-smaller-font) + nil)) -(defun make-face-larger (face &optional locale) +(defun make-face-larger (face &optional locale tags exact-p) "Make the font of FACE be larger, if possible. See `make-face-smaller' for the semantics of the LOCALE argument." (interactive (list (read-face-name "Enlarge which face: "))) - ;; handle X specific entries - (when (featurep 'x) - (frob-face-property face 'font 'x-find-larger-font - '(x) locale)) - (when (featurep 'mswindows) - (frob-face-property face 'font 'mswindows-find-larger-font - '(mswindows) locale) - (frob-face-property face 'font 'mswindows-find-larger-font - '(msprinter) locale))) + (Face-frob-property face locale tags exact-p + nil nil 'font nil + '(x x-find-larger-font + gtk gtk-find-larger-font + mswindows mswindows-find-larger-font + msprinter mswindows-find-larger-font) + nil)) (defun invert-face (face &optional locale) "Swap the foreground and background colors of the face." @@ -1320,9 +1402,12 @@ (if (< (apply '+ (color-instance-rgb-components color-instance)) 65536) 'dark 'light) - ;; Here, we get an error on a TTY. As we don't have - ;; a good way of detecting whether a TTY is light or - ;; dark, we'll guess it's dark. + ;; Here, we get an error on a TTY (Return value from + ;; color-instance-rgb-components is nil), and on the + ;; initial stream device (Return value from + ;; face-background-instance is nil). As we don't have a + ;; good way of detecting whether a TTY is light or dark, + ;; we'll guess it's dark. (error 'dark)))) (set-frame-property frame 'background-mode mode) mode)) @@ -1587,41 +1672,36 @@ ;; Is there anything which should be done for TTY's? ))) -;; #### This is somewhat X-specific, and is called when the first -;; X device is created (even if there were TTY devices created -;; beforehand). The concept of resources has not been generalized -;; outside of X-specificness, so we have to live with this -;; breach of device-independence. - -(defun init-global-faces () - ;; Look for global face resources. - (loop for face in (face-list) do - (init-face-from-resources face 'global)) - ;; Further X frobbing. - (and (featurep 'x) (declare-fboundp (x-init-global-faces))) - (and (featurep 'gtk) (declare-fboundp (gtk-init-global-faces))) - - ;; for bold and the like, make the global specification be bold etc. - ;; if the user didn't already specify a value. These will also be - ;; frobbed further in init-other-random-faces. - (unless (face-font 'bold 'global) - (make-face-bold 'bold 'global)) - ;; - (unless (face-font 'italic 'global) - (make-face-italic 'italic 'global)) - ;; - (unless (face-font 'bold-italic 'global) - (make-face-bold-italic 'bold-italic 'global) - (unless (face-font 'bold-italic 'global) - (copy-face 'bold 'bold-italic) - (make-face-italic 'bold-italic))) +;; Called when the first device created. - (when (face-equal 'bold 'bold-italic) - (copy-face 'italic 'bold-italic) - (make-face-bold 'bold-italic)) - ;; - ;; Nothing more to be done for X or TTY's? - ) +(defun init-global-faces (device) + (let ((Face-frob-property-device-considered-current device)) + ;; Look for global face resources. + (loop for face in (face-list) do + (init-face-from-resources face 'global)) + ;; Further frobbing. + (and (featurep 'x) (declare-fboundp (x-init-global-faces))) + (and (featurep 'gtk) (declare-fboundp (gtk-init-global-faces))) + (and (featurep 'mswindows) (declare-fboundp (mswindows-init-global-faces))) + + ;; for bold and the like, make the global specification be bold etc. + ;; if the user didn't already specify a value. These will also be + ;; frobbed further in init-other-random-faces. + (unless (face-font 'bold 'global) + (make-face-bold 'bold 'global)) + ;; + (unless (face-font 'italic 'global) + (make-face-italic 'italic 'global)) + ;; + (unless (face-font 'bold-italic 'global) + (make-face-bold-italic 'bold-italic 'global) + (unless (face-font 'bold-italic 'global) + (copy-face 'bold 'bold-italic) + (make-face-italic 'bold-italic))) + + (when (face-equal 'bold 'bold-italic device) + (copy-face 'italic 'bold-italic) + (make-face-bold 'bold-italic)))) ;; These warnings are there for a reason. Just specify your fonts diff --text -u 'xemacs-21.5.6/lisp/files.el' 'xemacs-21.5.7/lisp/files.el' Index: ././lisp/files.el --- ././lisp/files.el Mon Apr 1 12:58:07 2002 +++ ././lisp/files.el Tue Jun 4 15:04:17 2002 @@ -377,7 +377,8 @@ (let ((name (copy-sequence filename)) (start 0)) ;; leave ':' if part of drive specifier - (if (eq (aref name 1) ?:) + (if (and (> (length name) 1) + (eq (aref name 1) ?:)) (setq start 2)) ;; destructively replace invalid filename characters with ! (while (string-match "[?*:<>|\"\000-\037]" name start) @@ -2763,7 +2764,9 @@ (defvar revert-buffer-insert-file-contents-function nil "Function to use to insert contents when reverting this buffer. Gets two args, first the nominal file name to use, -and second, t if reading the auto-save file.") +and second, t if reading the auto-save file. +If the current buffer contents are to be discarded, the function must do +so itself.") (defvar before-revert-hook nil "Normal hook for `revert-buffer' to run before reverting. @@ -2788,10 +2791,10 @@ With a prefix argument, offer to revert from latest auto-save file, if that is more recent than the visited file. -This command also works for special buffers that contain text which -doesn't come from a file, but reflects some other data base instead: -for example, Dired buffers and buffer-list buffers. In these cases, -it reconstructs the buffer contents from the appropriate data base. +This command also refreshes certain special buffers that contain text +which doesn't come from a file, but reflects some other data base +instead: for example, Dired buffers and buffer-list buffers. This is +implemented by having the modes set `revert-buffer-function'. When called from Lisp, the first argument is IGNORE-AUTO; only offer to revert from the auto-save file when this is nil. Note that the @@ -2803,13 +2806,17 @@ all. Optional third argument PRESERVE-MODES non-nil means don't alter -the files modes. Normally we reinitialize them using `normal-mode'. +the buffer's modes. Otherwise, reinitialize them using `normal-mode'. If the value of `revert-buffer-function' is non-nil, it is called to do all the work for this command. Otherwise, the hooks `before-revert-hook' and `after-revert-hook' are run at the beginning and the end, and if `revert-buffer-insert-file-contents-function' is -non-nil, it is called instead of rereading visited file contents." +non-nil, it is called instead of rereading visited file contents. + +If the buffer-modified flag is nil, and we are not reverting from an +auto-save file, then compare the contents of the buffer and the file. +Revert only if they differ." ;; I admit it's odd to reverse the sense of the prefix argument, but ;; there is a lot of code out there which assumes that the first @@ -2821,6 +2828,8 @@ (if revert-buffer-function (funcall revert-buffer-function ignore-auto noconfirm) (let* ((opoint (point)) + (newbuf nil) + (delay-prompt nil) (auto-save-p (and (not ignore-auto) (recent-auto-save-p) buffer-auto-save-file-name @@ -2838,104 +2847,163 @@ (dolist (rx revert-without-query found) (when (string-match rx file-name) (setq found t))))) + ;; If we might perform an optimized revert then we + ;; want to delay prompting in case we don't need to + ;; do it at all + (and (not auto-save-p) + (not (buffer-modified-p)) + (setq delay-prompt t)) (yes-or-no-p (format "Revert buffer from file %s? " file-name))) (run-hooks 'before-revert-hook) - ;; If file was backed up but has changed since, - ;; we should make another backup. - (and (not auto-save-p) - (not (verify-visited-file-modtime (current-buffer))) - (setq buffer-backed-up nil)) - ;; Get rid of all undo records for this buffer. - (or (eq buffer-undo-list t) - (setq buffer-undo-list nil)) - ;; Effectively copy the after-revert-hook status, - ;; since after-find-file will clobber it. - (let ((global-hook (default-value 'after-revert-hook)) - (local-hook-p (local-variable-p 'after-revert-hook - (current-buffer))) - (local-hook (and (local-variable-p 'after-revert-hook - (current-buffer)) - after-revert-hook))) - (let (buffer-read-only - ;; Don't make undo records for the reversion. - (buffer-undo-list t)) - (if revert-buffer-insert-file-contents-function - (funcall revert-buffer-insert-file-contents-function - file-name auto-save-p) - (if (not (file-exists-p file-name)) - (error "File %s no longer exists!" file-name)) - ;; Bind buffer-file-name to nil - ;; so that we don't try to lock the file. - (let ((buffer-file-name nil)) - (or auto-save-p - (unlock-buffer))) - (widen) - ;; When reading in an autosave, it's encoded using - ;; `escape-quoted', so we need to use it. (It is always - ;; safe to specify `escape-quoted': - ;; - ;; 1. If file-coding but no Mule, `escape-quoted' is - ;; aliased to `binary'. - ;; 2. If no file-coding, all coding systems devolve into - ;; `binary'. - ;; 3. ASCII and ISO8859-1 are encoded the same in both - ;; `binary' and `escape-quoted', so they will be - ;; compatible for the most part.) - ;; - ;; Otherwise, use coding-system-for-read if explicitly - ;; given (e.g. the "Revert Buffer with Specified - ;; Encoding" menu entries), or use the coding system - ;; that the file was loaded as. - (let* ((coding-system-for-read - (if auto-save-p 'escape-quoted - (or coding-system-for-read - buffer-file-coding-system-when-loaded))) - ;; If the bfcs wasn't changed from its original - ;; value (other than possible EOL change), then we - ;; should update it for the new coding system. - (should-update-bfcs - (eq (coding-system-base + ;; Only perform our optimized revert if nothing obvious + ;; has changed. + (cond ((or auto-save-p + (buffer-modified-p) + (and (setq newbuf (revert-buffer-internal + file-name)) + (or noconfirm + (and delay-prompt + (yes-or-no-p + (format "Revert buffer from file %s? " + file-name)))))) + ;; If file was backed up but has changed since, + ;; we should make another backup. + (and (not auto-save-p) + (not (verify-visited-file-modtime (current-buffer))) + (setq buffer-backed-up nil)) + ;; Get rid of all undo records for this buffer. + (or (eq buffer-undo-list t) + (setq buffer-undo-list nil)) + ;; Effectively copy the after-revert-hook status, + ;; since after-find-file will clobber it. + (let ((global-hook (default-value 'after-revert-hook)) + (local-hook-p (local-variable-p 'after-revert-hook + (current-buffer))) + (local-hook (and (local-variable-p 'after-revert-hook + (current-buffer)) + after-revert-hook))) + (let (buffer-read-only + ;; Don't make undo records for the reversion. + (buffer-undo-list t)) + (if revert-buffer-insert-file-contents-function + (funcall revert-buffer-insert-file-contents-function + file-name auto-save-p) + (if (not (file-exists-p file-name)) + (error "File %s no longer exists!" file-name)) + ;; Bind buffer-file-name to nil + ;; so that we don't try to lock the file. + (let ((buffer-file-name nil)) + (or auto-save-p + (unlock-buffer))) + (widen) + ;; When reading in an autosave, it's encoded using + ;; `escape-quoted', so we need to use it. (It is always + ;; safe to specify `escape-quoted': + ;; + ;; 1. If file-coding but no Mule, `escape-quoted' is + ;; aliased to `binary'. + ;; 2. If no file-coding, all coding systems devolve into + ;; `binary'. + ;; 3. ASCII and ISO8859-1 are encoded the same in both + ;; `binary' and `escape-quoted', so they will be + ;; compatible for the most part.) + ;; + ;; Otherwise, use coding-system-for-read if explicitly + ;; given (e.g. the "Revert Buffer with Specified + ;; Encoding" menu entries), or use the coding system + ;; that the file was loaded as. + (let* ((coding-system-for-read + (if auto-save-p 'escape-quoted + (or coding-system-for-read + buffer-file-coding-system-when-loaded))) + ;; If the bfcs wasn't changed from its original + ;; value (other than possible EOL change), then we + ;; should update it for the new coding system. + (should-update-bfcs + (eq (coding-system-base + buffer-file-coding-system-when-loaded) + (coding-system-base + buffer-file-coding-system))) + (old-bfcs buffer-file-coding-system) + ;; But if the EOL was changed, match it in the new + ;; value of bfcs. + (adjust-eol + (and should-update-bfcs + (not + (eq (get-coding-system + buffer-file-coding-system-when-loaded) + (get-coding-system + buffer-file-coding-system)))))) + (insert-file-contents file-name (not auto-save-p) + nil nil t) + (when should-update-bfcs + (setq buffer-file-coding-system old-bfcs) + (set-buffer-file-coding-system + (if adjust-eol + (coding-system-base + buffer-file-coding-system-when-loaded) buffer-file-coding-system-when-loaded) - (coding-system-base - buffer-file-coding-system))) - (old-bfcs buffer-file-coding-system) - ;; But if the EOL was changed, match it in the new - ;; value of bfcs. - (adjust-eol - (and should-update-bfcs - (not - (eq (get-coding-system - buffer-file-coding-system-when-loaded) - (get-coding-system - buffer-file-coding-system)))))) - (insert-file-contents file-name (not auto-save-p) - nil nil t) - (when should-update-bfcs - (setq buffer-file-coding-system old-bfcs) - (set-buffer-file-coding-system - (if adjust-eol - (coding-system-base - buffer-file-coding-system-when-loaded) - buffer-file-coding-system-when-loaded) - (not adjust-eol)))))) - (goto-char (min opoint (point-max))) - ;; Recompute the truename in case changes in symlinks - ;; have changed the truename. - ;XEmacs: already done by insert-file-contents - ;;(setq buffer-file-truename - ;;(abbreviate-file-name (file-truename buffer-file-name))) - (after-find-file nil nil t t preserve-modes) - ;; Run after-revert-hook as it was before we reverted. - (setq-default revert-buffer-internal-hook global-hook) - (if local-hook-p - (progn - (make-local-variable 'revert-buffer-internal-hook) - (setq revert-buffer-internal-hook local-hook)) - (kill-local-variable 'revert-buffer-internal-hook)) - (run-hooks 'revert-buffer-internal-hook)) + (not adjust-eol)))))) + (goto-char (min opoint (point-max))) + ;; Recompute the truename in case changes in symlinks + ;; have changed the truename. + ;;XEmacs: already done by insert-file-contents + ;;(setq buffer-file-truename + ;;(abbreviate-file-name (file-truename buffer-file-name))) + (after-find-file nil nil t t preserve-modes) + ;; Run after-revert-hook as it was before we reverted. + (setq-default revert-buffer-internal-hook global-hook) + (if local-hook-p + (progn + (make-local-variable 'revert-buffer-internal-hook) + (setq revert-buffer-internal-hook local-hook)) + (kill-local-variable 'revert-buffer-internal-hook)) + (run-hooks 'revert-buffer-internal-hook))) + ((null newbuf) + ;; The resultant buffer is identical, alter + ;; modtime, update mods and exit + (set-visited-file-modtime) + (after-find-file nil nil t t t)) + (t t)) t))))) +(defun revert-buffer-internal (&optional file-name) + "Read contents of FILE-NAME into a buffer, and compare to current buffer. +Return nil if identical, and the new buffer if different." + + (let* ((newbuf (get-buffer-create " *revert*")) + bmin bmax) + (save-excursion + (set-buffer newbuf) + (with-obsolete-variable '(before-change-function after-change-function) + (let (buffer-read-only + (buffer-undo-list t) + after-change-function + after-change-functions + before-change-function + before-change-functions) + (if revert-buffer-insert-file-contents-function + (funcall revert-buffer-insert-file-contents-function + file-name nil) + (if (not (file-exists-p file-name)) + (error "File %s no longer exists!" file-name)) + (widen) + (insert-file-contents file-name nil nil nil t) + (setq bmin (point-min) + bmax (point-max)))))) + (if (not (and (eq bmin (point-min)) + (eq bmax (point-max)) + (eq (compare-buffer-substrings + newbuf bmin bmax (current-buffer) bmin bmax) 0))) + newbuf + (and (kill-buffer newbuf) nil)))) + +(defvar recover-file-diff-program "diff" + "Absolute or relative name of the `diff' program used by `recover-file'.") +(defvar recover-file-diff-arguments '("-c") + "List of arguments (switches) to pass to `diff' by `recover-file'.") + (defun recover-file (file) "Visit file FILE, but get contents from its last auto-save file." ;; Actually putting the file name in the minibuffer should be used @@ -2958,9 +3026,10 @@ (not (file-newer-than-file-p file-name file)) (not (file-exists-p file-name))) (error "Auto-save file %s not current" file-name)) - ((save-window-excursion + (t + (save-window-excursion ;; XEmacs change: use insert-directory instead of - ;; calling ls directly. + ;; calling ls directly. Add option for diff. (with-output-to-temp-buffer "*Directory*" (buffer-disable-undo standard-output) (save-excursion @@ -2970,14 +3039,85 @@ (if (file-symlink-p file) "-lL" "-l")) (setq default-directory (file-name-directory file-name)) (insert-directory file-name "-l"))) - (yes-or-no-p (format "Recover auto save file %s? " file-name))) - (switch-to-buffer (find-file-noselect file t)) - (let ((buffer-read-only nil)) - (erase-buffer) - (let ((coding-system-for-read 'escape-quoted)) - (insert-file-contents file-name nil))) - (after-find-file nil nil t)) - (t (error "Recover-file cancelled."))))))) + (block nil + (while t + (case (get-user-response + nil + ;; Formerly included file name. Useless now that + ;; we display an ls of the files, and potentially + ;; fills up the minibuffer, esp. with autosaves + ;; all in one directory. + "Recover auto save file? " + '(("yes" "%_Yes" yes) + ("no" "%_No" no) + ("diff" "%_Diff" diff))) + (no (error "Recover-file cancelled.")) + (yes + (switch-to-buffer (find-file-noselect file t)) + (let ((buffer-read-only nil)) + (erase-buffer) + (let ((coding-system-for-read 'escape-quoted)) + (insert-file-contents file-name nil))) + (after-find-file nil nil t) + (return nil)) + (diff + ;; rather than just diff the two files (which would + ;; be easy), we have to deal with the fact that + ;; they may be in different formats, since + ;; auto-saves are always in escape-quoted. so, we + ;; read the file into a buffer (#### should we look + ;; at or use a file if it's already in a buffer? + ;; maybe we would find hints as to the encoding of + ;; the file?), then we save the resulting buffer in + ;; escape-quoted, do the diff (between two files + ;; both in escape-quoted) and read in the results + ;; using coding system escape-quoted. That way, we + ;; should get what's correct most of the time. + (let ((buffer (generate-new-buffer "*recover*")) + (temp + (make-temp-name + (concat (file-name-as-directory + (temp-directory)) + (file-name-nondirectory file) "-")))) + (unwind-protect + (progn + (save-current-buffer + (set-buffer buffer) + (insert-file-contents file) + (let ((coding-system-for-write + 'escape-quoted)) + (write-region (point-min) (point-max) + temp nil 'silent))) + (with-output-to-temp-buffer "*Autosave Diff*" + (buffer-disable-undo standard-output) + (let ((coding-system-for-read + 'escape-quoted)) + (condition-case ferr + (apply #'call-process + recover-file-diff-program + nil standard-output nil + (append + recover-file-diff-arguments + (list temp file-name))) + (io-error + (save-excursion + (set-buffer standard-output) + (setq default-directory + (file-name-directory file)) + (insert-directory + file + (if (file-symlink-p file) "-lL" + "-l")) + (setq default-directory + (file-name-directory file-name)) + (insert-directory file-name "-l") + (terpri) + (princ "Error during diff: ") + (display-error ferr + standard-output))))))) + (ignore-errors (kill-buffer buffer)) + (ignore-file-errors + (delete-file temp))))))))))))))) (defun recover-session () "Recover auto save files from a previous Emacs session. @@ -2991,33 +3131,35 @@ (if (null auto-save-list-file-prefix) (error "You set `auto-save-list-file-prefix' to disable making session files")) - (declare-fboundp (dired (concat auto-save-list-file-prefix "*"))) - (goto-char (point-min)) - (or (looking-at "Move to the session you want to recover,") - (let ((inhibit-read-only t)) - (insert "Move to the session you want to recover,\n" - "then type C-c C-c to select it.\n\n" - "You can also delete some of these files;\n" - "type d on a line to mark that file for deletion.\n\n"))) - (use-local-map (let ((map (make-sparse-keymap))) - (set-keymap-parents map (list (current-local-map))) - map)) - (define-key (current-local-map) "\C-c\C-c" 'recover-session-finish)) - -(defun recover-session-finish () - "Choose one saved session to recover auto-save files from. -This command is used in the special Dired buffer created by -\\[recover-session]." - (interactive) - ;; Get the name of the session file to recover from. - (let ((file (declare-fboundp (dired-get-filename))) - files + (let* ((auto-save-list-dir + (file-name-directory auto-save-list-file-prefix)) + (files (directory-files + auto-save-list-dir + t + (concat "^" (regexp-quote (file-name-nondirectory + auto-save-list-file-prefix))))) + (files (sort (delete-if-not #'Recover-session-files-from-auto-save-list-file + files) #'file-newer-than-file-p))) + (unless files + (error "No sessions can be recovered now")) + (declare-fboundp (dired (cons auto-save-list-dir files))) + (goto-char (point-min)) + (or (looking-at "Move to the session you want to recover,") + (let ((inhibit-read-only t)) + (delete-matching-lines "^[ \t]*total.*$") + (insert "Move to the session you want to recover,\n" + "then type C-c C-c to select it.\n\n" + "You can also delete some of these files;\n" + "type d on a line to mark that file for deletion.\n\n"))) + (use-local-map (let ((map (make-sparse-keymap))) + (set-keymap-parents map (list (current-local-map))) + map)) + (define-key (current-local-map) "\C-c\C-c" 'recover-session-finish))) + +(defun Recover-session-files-from-auto-save-list-file (file) + "Return the auto save files in list file FILE that are current." + (let (files (buffer (get-buffer-create " *recover*"))) - ;; #### dired-do-flagged-delete in FSF. - ;; This version is for ange-ftp - ;;(dired-do-deletions t) - ;; This version is for efs - (declare-fboundp (dired-expunge-deletions)) (unwind-protect (save-excursion ;; Read in the auto-save-list file. @@ -3062,22 +3204,37 @@ ;; Ignore a file if its auto-save file does not exist now. (if (file-exists-p autofile) (setq files (cons thisfile files))))) - (setq files (nreverse files)) - ;; The file contains a pair of line for each auto-saved buffer. - ;; The first line of the pair contains the visited file name - ;; or is empty if the buffer was not visiting a file. - ;; The second line is the auto-save file name. - (if files - (map-y-or-n-p "Recover %s? " - (lambda (file) - (condition-case nil - (save-excursion (recover-file file)) - (error - (lwarn 'recover 'alert "Failed to recover `%s'" file)))) - files - '("file" "files" "recover")) - (message "No files can be recovered from this session now"))) + (setq files (nreverse files))) (kill-buffer buffer)))) + +(defun recover-session-finish () + "Choose one saved session to recover auto-save files from. +This command is used in the special Dired buffer created by +\\[recover-session]." + (interactive) + ;; Get the name of the session file to recover from. + (let ((file (declare-fboundp (dired-get-filename)))) + ;; #### dired-do-flagged-delete in FSF. + ;; This version is for ange-ftp + ;;(dired-do-deletions t) + ;; This version is for efs + (declare-fboundp (dired-expunge-deletions)) + (let ((files (Recover-session-files-from-auto-save-list-file file))) + ;; The file contains a pair of line for each auto-saved buffer. + ;; The first line of the pair contains the visited file name + ;; or is empty if the buffer was not visiting a file. + ;; The second line is the auto-save file name. + (if files + (map-y-or-n-p "Recover %s? " + (lambda (file) + (condition-case nil + (save-excursion (recover-file file)) + (error + (lwarn 'recover 'alert + "Failed to recover `%s'" file)))) + files + '("file" "files" "recover")) + (message "No files can be recovered from this session now"))))) (defun kill-some-buffers (&optional list) "For each buffer in LIST, ask whether to kill it. diff --text -u 'xemacs-21.5.6/lisp/find-paths.el' 'xemacs-21.5.7/lisp/find-paths.el' Index: ././lisp/find-paths.el --- ././lisp/find-paths.el Fri Mar 15 16:43:19 2002 +++ ././lisp/find-paths.el Wed Jun 5 01:45:54 2002 @@ -237,7 +237,8 @@ (or ;; from more to less specific (paths-find-version-directory roots - (concat base system-configuration) + (paths-construct-path + (list system-configuration base)) envvar default) (paths-find-version-directory roots base diff --text -u 'xemacs-21.5.6/lisp/font-lock.el' 'xemacs-21.5.7/lisp/font-lock.el' Index: ././lisp/font-lock.el --- ././lisp/font-lock.el Fri Mar 29 13:46:29 2002 +++ ././lisp/font-lock.el Fri Jun 21 06:18:03 2002 @@ -1944,30 +1944,28 @@ ;; generally more like variables (no parameters), and the function and ;; keyword colors are currently the same, while the variable color is ;; different, which looks better. - (list (concat "^(\\(def\\(" - ;; Function declarations. - "\\(un\\|advice\\|alias\\|macro\\|macro\\*\\|setf\\|subst\\|" - "subst\\*\\|-edebug-spec\\|" - "ine-\\(ccl-program\\|compatible-function-alias\\|" - "compiler-macro\\|device-method\\|device-method\\*\\|" - "function\\|function-when-void\\|modify-macro\\|" - "obsolete-function-alias\\|prefix-command\\|setf-method\\|" - "skeleton\\)\\)\\|" - ;; Structure declarations. - "\\(class\\|struct\\|type\\)\\|" - ;; Former variable declarations, but woefully inadequate. - ;"\\(const\\(\\|ant\\)\\|ine-key\\(\\|-after\\)\\|var\\|custom\\)\\|" - ;; Everything else is a function declaration. - "\\([^ \t\n\(\)]+\\)" - "\\)\\)\\>" - ;; Any whitespace and declared object. - "[ \t'\(]*" - "\\([^ \t\n\)]+\\)?") - '(1 font-lock-keyword-face) - '(7 (cond ((match-beginning 3) 'font-lock-function-name-face) - ((match-beginning 5) 'font-lock-type-face) - (t 'font-lock-variable-name-face)) - nil t)) + (list (concat + "^(\\(" lisp-function-and-type-regexp + ;; Former variable declarations, but woefully inadequate. + ;; "\\|def\\(const\\(\\|ant\\)\\|ine-key\\(\\|-after\\)\\|" + ;; "var\\|custom\\)" + ;; Everything else is a variable declaration. + ;; anything else is a variable + "\\|def\\([^ \t\n\(\)]+\\)" + ;; make sure we are at end of word. + "\\)\\>" + ;; Any whitespace following and declared object. + "[ \t'\(]*" + "\\([^ \t\n\)]+\\)?") + ;; Note about numbering: #1 is the grouping around the whole + ;; keyword. #2 - #4 are in lisp-function-and-type-regexp. + ;; #5 is for variables. (Must be set if neither #3 nor #4 are.) + ;; #6 for the following object. + '(1 font-lock-keyword-face) + '(6 (cond ((match-beginning 3) 'font-lock-function-name-face) + ((match-beginning 4) 'font-lock-type-face) + (t 'font-lock-variable-name-face)) + nil t)) ) "Subdued level highlighting Lisp modes.") diff --text -u 'xemacs-21.5.6/lisp/font-menu.el' 'xemacs-21.5.7/lisp/font-menu.el' Index: ././lisp/font-menu.el --- ././lisp/font-menu.el Wed Mar 13 17:52:05 2002 +++ ././lisp/font-menu.el Fri Jun 21 06:18:03 2002 @@ -64,10 +64,6 @@ ;;; `reset-device-font-menus' to rebuild the menus from all currently ;;; available fonts. ;;; -;;; There is knowledge here about the regexp match numbers in -;;; `mswindows-font-regexp' and `mswindows-font-regexp-foundry-and-family' defined in -;;; mswindows-faces.el. -;;; ;;; There are at least three kinds of fonts under X11r5: ;;; ;;; - bitmap fonts, which can be assumed to look as good as possible; @@ -297,14 +293,15 @@ (when weight (signal 'error '("Setting weight currently not supported"))) (setq new-default-face-font - (font-menu-load-font - (or family from-family) - (or weight from-weight) - (or size from-size) - from-slant - (specifier-instance - font-menu-preferred-resolution (selected-device)))) - ;; This is such a gross hack. The border-glyph face under + (font-instance-name + (font-menu-load-font + (or family from-family) + (or weight from-weight) + (or size from-size) + from-slant + (specifier-instance + font-menu-preferred-resolution (selected-device))))) + ;; #### This is such a gross hack. The border-glyph face under ;; mswindows is in a symbol font. Thus it will not appear in the ;; cache - being a junk family. What we should do is change the ;; size but not the family, but this is more work than I care to @@ -368,13 +365,14 @@ (to-weight (string-equal face-weight from-weight)) (to-size (= face-size from-size)))) (set-face-font face - (font-menu-load-font (or to-family face-family) - (or to-weight face-weight) - (or to-size face-size) - face-slant - (specifier-instance - font-menu-preferred-resolution - (selected-device))) + (font-instance-name + (font-menu-load-font (or to-family face-family) + (or to-weight face-weight) + (or to-size face-size) + face-slant + (specifier-instance + font-menu-preferred-resolution + (selected-device)))) (and font-menu-this-frame-only-p (selected-frame)))))) diff --text -u 'xemacs-21.5.6/lisp/font.el' 'xemacs-21.5.7/lisp/font.el' Index: ././lisp/font.el --- ././lisp/font.el Sat Mar 16 19:39:02 2002 +++ ././lisp/font.el Fri Jun 21 06:18:03 2002 @@ -2,6 +2,7 @@ ;; Copyright (c) 1995, 1996 by William M. Perry (wmperry@cs.indiana.edu) ;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. +;; Copyright (C) 2002 Ben Wing. ;; Author: wmperry ;; Maintainer: XEmacs Development Team @@ -11,7 +12,7 @@ ;; 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 1, or (at your option) +;; 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 @@ -34,6 +35,8 @@ '(x-list-fonts mswindows-list-fonts ns-list-fonts internal-facep fontsetp get-font-info get-fontset-info mswindows-define-rgb-color cancel-function-timers + mswindows-font-regexp mswindows-canonicalize-font-name + mswindows-parse-font-style mswindows-construct-font-style ;; #### perhaps we should rewrite font-warn to avoid the warning font-warn)) @@ -780,40 +783,20 @@ ;;; The window-system dependent code (mswindows-style) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; mswindows fonts look like: -;;; fontname[:[weight][ style][:pointsize[:effects]]][:charset] -;;; A minimal mswindows font spec looks like: -;;; Courier New -;;; A maximal mswindows font spec looks like: -;;; Courier New:Bold Italic:10:underline strikeout:western -;;; Missing parts of the font spec should be filled in with these values: -;;; Courier New:Regular:10::western -;; "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+:[a-zA-Z ]*:[a-zA-Z 0-9]*$" -(defvar font-mswindows-font-regexp - (let - ((- ":") - (fontname "\\([a-zA-Z ]+\\)") - (weight "\\([a-zA-Z]*\\)") - (style "\\( [a-zA-Z]*\\)?") - (pointsize "\\([0-9]+\\)") - (effects "\\([a-zA-Z ]*\\)") - (charset "\\([a-zA-Z 0-9]*\\)") - ) - (concat "^" - fontname - weight style - pointsize - effects - charset "$"))) - (defconst mswindows-font-weight-mappings - '((:extra-light . "Extralight") + '((:thin . "Thin") + (:extra-light . "Extra Light") (:light . "Light") - (:demi-light . "Demilight") - (:demi . "Demi") - (:book . "Book") + (:demi-light . "Light") + (:demi . "Light") + (:book . "Medium") (:medium . "Medium") (:normal . "Normal") - (:demi-bold . "Demibold") + (:demi-bold . "Demi Bold") (:bold . "Bold") (:regular . "Regular") - (:extra-bold . "Extrabold")) + (:extra-bold . "Extra Bold") + (:heavy . "Heavy")) "An assoc list mapping keywords to actual mswindows specific strings for use in the 'weight' field of an mswindows font string.") @@ -838,41 +821,46 @@ (defun mswindows-font-create-object (fontname &optional device) "Return a font descriptor object for FONTNAME, appropriate for MS Windows devices." (let ((case-fold-search t) - (font (declare-fboundp (mswindows-font-canonicalize-name fontname)))) + (font (declare-fboundp (mswindows-canonicalize-font-name fontname)))) (if (or (not (stringp font)) - (not (string-match font-mswindows-font-regexp font))) + (not (string-match mswindows-font-regexp font))) (make-font) (let ((family (match-string 1 font)) - (weight (match-string 2 font)) - (style (match-string 3 font)) - (pointsize (match-string 4 font)) - (effects (match-string 5 font)) - (charset (match-string 6 font)) + (style (match-string 2 font)) + (pointsize (match-string 3 font)) + (effects (match-string 4 font)) + (charset (match-string 5 font)) (retval nil) (size nil) (case-fold-search t) ) - (if pointsize (setq size (concat pointsize "pt"))) - (if weight (setq weight (intern-soft (concat ":" (downcase weight))))) - (setq retval (make-font :family family - :weight weight - :size size - :encoding charset)) - (set-font-bold-p retval (eq :bold weight)) - (cond - ((null style) nil) - ((string-match "^ *[iI]talic" style) - (set-font-italic-p retval t))) - (cond - ((null effects) nil) - ((string-match "^[uU]nderline [sS]trikeout" effects) - (set-font-underline-p retval t) - (set-font-strikethru-p retval t)) - ((string-match "[uU]nderline" effects) - (set-font-underline-p retval t)) - ((string-match "[sS]trikeout" effects) - (set-font-strikethru-p retval t))) - retval)))) + (destructuring-bind (weight . slant) + (mswindows-parse-font-style style) + (if (equal pointsize "") (setq pointsize nil)) + (if pointsize (setq size (concat pointsize "pt"))) + (if weight (setq weight + (intern-soft + (concat ":" (downcase (replace-in-string + weight " " "-")))))) + (setq retval (make-font :family family + :weight weight + :size size + :encoding charset)) + (set-font-bold-p retval (eq :bold weight)) + (cond + ((null slant) nil) + ((string-match "[iI]talic" slant) + (set-font-italic-p retval t))) + (cond + ((null effects) nil) + ((string-match "^[uU]nderline [sS]trikeout" effects) + (set-font-underline-p retval t) + (set-font-strikethru-p retval t)) + ((string-match "[uU]nderline" effects) + (set-font-underline-p retval t)) + ((string-match "[sS]trikeout" effects) + (set-font-strikethru-p retval t))) + retval))))) (defun mswindows-font-create-name (fontobj &optional device) "Return a font name constructed from FONTOBJ, appropriate for MS Windows devices." @@ -893,8 +881,7 @@ (font-size default))) (underline-p (font-underline-p fontobj)) (strikeout-p (font-strikethru-p fontobj)) - (encoding (or (font-encoding fontobj) - (font-encoding default)))) + (encoding (font-encoding fontobj))) (if (stringp family) (setq family (list family))) (setq weight (font-higher-weight weight @@ -920,10 +907,12 @@ family)) ;; We treat oblique and italic as equivalent. Don't ask. ;; Courier New:Bold Italic:10:underline strikeout:western - (setq font-name (format "%s:%s%s:%s:%s:%s" - cur-family weight - (if (font-italic-p fontobj) - " Italic" "") + (setq font-name (format "%s:%s:%s:%s:%s" + cur-family + (mswindows-construct-font-style + weight + (if (font-italic-p fontobj) + "Italic" "")) (if size (int-to-string size) "10") (if underline-p diff --text -u 'xemacs-21.5.6/lisp/gtk-faces.el' 'xemacs-21.5.7/lisp/gtk-faces.el' Index: ././lisp/gtk-faces.el --- ././lisp/gtk-faces.el Fri Mar 15 16:43:19 2002 +++ ././lisp/gtk-faces.el Fri Jun 21 06:18:03 2002 @@ -86,30 +86,8 @@ (defun gtk-init-frame-faces (frame) ) -;;; gtk-init-global-faces is responsible for ensuring that the -;;; default face has some reasonable fallbacks if nothing else is -;;; specified. -;;; (defun gtk-init-global-faces () - (let* ((dev nil) - (default-font (or (face-font 'default 'global) - ;;(plist-get (gtk-style-info dev) 'font) - "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*")) - (italic-font (or (gtk-make-font-italic default-font dev) default-font)) - (bold-font (or (gtk-make-font-bold default-font dev) default-font)) - (bi-font (or (gtk-make-font-bold-italic default-font dev) default-font))) - - (or (face-font 'default 'global) - (set-face-font 'default default-font 'global '(gtk default))) - - (or (face-font 'bold 'global) - (set-face-font 'bold bold-font 'global '(gtk default))) - - (or (face-font 'bold-italic 'global) - (set-face-font 'bold-italic bi-font 'global '(gtk default))) - - (or (face-font 'italic 'global) - (set-face-font 'italic italic-font 'global '(gtk default))))) + ) ;;; Lots of this stolen from x-faces.el - I'm not sure if this will diff --text -u 'xemacs-21.5.6/lisp/gtk-marshal.el' 'xemacs-21.5.7/lisp/gtk-marshal.el' Index: ././lisp/gtk-marshal.el --- ././lisp/gtk-marshal.el Tue Jun 5 01:59:53 2001 +++ ././lisp/gtk-marshal.el Thu May 9 22:49:39 2002 @@ -186,8 +186,8 @@ ("NONE" "OBJECT" "STRING" "STRING") ("NONE" "OBJECT" "STRING") ("NONE" "OBJECT") - ("NONE" "POINTER" "INT") ("NONE" "POINTER" "INT" "INT") + ("NONE" "POINTER" "INT") ("NONE" "POINTER" "POINTER" "BOOL" "INT" "INT" "INT" "INT" "INT" "INT") ("NONE" "POINTER" "POINTER" "BOOL" "INT" "INT" "INT" "INT") ("NONE" "POINTER" "POINTER" "INT" "INT" "INT" "INT") @@ -239,6 +239,7 @@ ("POINTER" "OBJECT" "POINTER") ("POINTER" "OBJECT") ("POINTER" "POINTER") + ("POINTER" "STRING" "INT") ("POINTER") ("STRING" "INT" "INT" "INT") ("STRING" "INT") @@ -268,7 +269,7 @@ return !strcmp ( (const char *) st1, (const char *) st2); } -unsigned long +static unsigned long our_string_hash (const void *xv) { unsigned int h = 0; diff --text -u 'xemacs-21.5.6/lisp/gutter-items.el' 'xemacs-21.5.7/lisp/gutter-items.el' Index: ././lisp/gutter-items.el --- ././lisp/gutter-items.el Wed Mar 13 17:52:05 2002 +++ ././lisp/gutter-items.el Tue Jun 4 15:04:19 2002 @@ -193,8 +193,8 @@ (setq progress-glyph-height 24) (setq progress-layout-instantiator `[layout - :orientation vertical :justify left - :margin-width 4 + :orientation vertical :margin-width 4 + :horizontally-justify left :vertically-justify center :items (,progress-text-instantiator [layout :orientation horizontal @@ -211,7 +211,8 @@ (defun set-progress-abort-instantiator (&optional locale) (set-glyph-image progress-abort-glyph - `[layout :orientation vertical :justify left + `[layout :orientation vertical + :horizontally-justify left :vertically-justify center :items (,progress-text-instantiator [layout :margin-width 4 diff --text -u 'xemacs-21.5.6/lisp/help.el' 'xemacs-21.5.7/lisp/help.el' Index: ././lisp/help.el --- ././lisp/help.el Fri Mar 29 13:46:30 2002 +++ ././lisp/help.el Tue Jun 4 15:04:21 2002 @@ -487,11 +487,7 @@ (format "*%s*" name)) (format "*%s*" help-buffer-prefix-string))) -;; Use this function for displaying help when C-h something is pressed -;; or in similar situations. Do *not* use it when you are displaying -;; a help message and then prompting for input in the minibuffer -- -;; this macro usually selects the help buffer, which is not what you -;; want in those situations. +;; with-displaying-help-buffer ;; #### Should really be a macro to eliminate the requirement of ;; caller to code a lambda form in THUNK -- mrb @@ -518,7 +514,13 @@ (defun with-displaying-help-buffer (thunk &optional name) "Form which makes a help buffer with given NAME and evaluates BODY there. -The actual name of the buffer is generated by the function `help-buffer-name'." +The actual name of the buffer is generated by the function `help-buffer-name'. + +Use this function for displaying help when C-h something is pressed or +in similar situations. Do *not* use it when you are displaying a help +message and then prompting for input in the minibuffer -- this macro +usually selects the help buffer, which is not what you want in those +situations." (let* ((winconfig (current-window-configuration)) (was-one-window (one-window-p)) (buffer-name (help-buffer-name name)) diff --text -u 'xemacs-21.5.6/lisp/indent.el' 'xemacs-21.5.7/lisp/indent.el' Index: ././lisp/indent.el --- ././lisp/indent.el Fri Apr 13 03:21:27 2001 +++ ././lisp/indent.el Sun Apr 14 21:42:04 2002 @@ -1,6 +1,7 @@ ;;; indent.el --- indentation commands for XEmacs ;; Copyright (C) 1985, 1992, 1993, 1995, 1997 Free Software Foundation, Inc. +;; Copyright (C) 2002 Ben Wing. ;; Maintainer: FSF ;; Keywords: lisp, languages, tools, dumped @@ -332,6 +333,39 @@ (indent-to column 0)) (forward-line 1)) (move-marker end nil)))) + +(defvar indent-balanced-expression-function nil + "Short cut function to indent balanced expression. +A value of nil means really run `indent-according-to-mode' on each line of +balanced expression as computed with `forward-sexp'.") + +(defun indent-balanced-expression () + "Indent each nonblank line in the balanced expression at point. +Use `indent-balanced-expression-function' if that's non-nil, or find +expression with `forward-sexp' and use `indent-region' on result." + (interactive "") + (let ((fun (or indent-balanced-expression-function + (cond ((memq major-mode '(c-mode c++-mode java-mode objc-mode + idl-mode pike-mode + c++-c-mode elec-c-mode)) + 'c-indent-exp) + ((memq major-mode + '(lisp-mode + emacs-lisp-mode lisp-interaction-mode + scheme-mode inferior-scheme-mode + scheme-interaction-mode)) + 'indent-sexp))))) + (if fun (funcall fun) + (let ((end (save-excursion (forward-sexp) (point)))) + (indent-region (point) end nil))))) + +(defun indent-region-or-balanced-expression () + "Indent region if active, or balanced expression at point. +See `indent-region' and `indent-balanced-expression'." + (interactive "") + (if (region-active-p) + (indent-region (region-beginning) (region-end) nil) + (indent-balanced-expression))) (defun indent-relative-maybe () "Indent a new line like previous nonblank line." diff --text -u 'xemacs-21.5.6/lisp/info.el' 'xemacs-21.5.7/lisp/info.el' Index: ././lisp/info.el --- ././lisp/info.el Fri Mar 29 13:46:31 2002 +++ ././lisp/info.el Wed May 8 01:14:04 2002 @@ -2277,7 +2277,7 @@ (defun Info-find-index-alternatives (topic) (let ((pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*%s" (regexp-quote topic) - "\\(.*\\)\\.[ t]*\\([0-9]*\\)$")) + "\\(.*\\)\\.[ \t]*\\([0-9]*\\)$")) node) (message "Searching index for `%s'..." topic) (Info-goto-node "Top") diff --text -u 'xemacs-21.5.6/lisp/keydefs.el' 'xemacs-21.5.7/lisp/keydefs.el' Index: ././lisp/keydefs.el --- ././lisp/keydefs.el Wed Mar 13 17:52:06 2002 +++ ././lisp/keydefs.el Thu May 9 17:33:46 2002 @@ -1,7 +1,7 @@ ;;; keydefs.el --- Define standard keybindings. ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc. -;; Copyright (C) 2000, 2001 Ben Wing. +;; Copyright (C) 2000, 2001, 2002 Ben Wing. ;; Maintainer: XEmacs Development Team ;; Keywords: internal, dumped @@ -167,11 +167,11 @@ ;;(define-key global-map "\t" 'self-insert-command) (define-key global-map "\t" 'indent-for-tab-command) -(define-key global-map "\M-\C-\\" 'indent-region) +(define-key global-map "\M-\C-\\" 'indent-region-or-balanced-expression) (define-key global-map "\C-x\t" 'indent-rigidly) (define-key global-map "\M-i" 'tab-to-tab-stop) ;; XEmacs addition: -(define-key global-map [(shift tab)] 'tab-to-tab-stop) +(define-key global-map [(shift tab)] 'self-insert-command) ;; FSFmacs isearch.el @@ -614,10 +614,12 @@ ;; the infamous delete key (define-key global-map 'delete 'backward-or-forward-delete-char) +(define-key global-map '(control delete) 'backward-or-forward-kill-word) (define-key global-map '(meta delete) 'backward-or-forward-kill-word) (define-key global-map [(control x) (delete)] 'backward-or-forward-kill-sentence) (define-key global-map 'kp-delete 'backward-or-forward-delete-char) +(define-key global-map '(control kp-delete) 'backward-or-forward-kill-word) (define-key global-map '(meta kp-delete) 'backward-or-forward-kill-word) (define-key global-map [(control x) (kp-delete)] 'backward-or-forward-kill-sentence) diff --text -u 'xemacs-21.5.6/lisp/lisp-mode.el' 'xemacs-21.5.7/lisp/lisp-mode.el' Index: ././lisp/lisp-mode.el --- ././lisp/lisp-mode.el Sun Mar 31 17:27:24 2002 +++ ././lisp/lisp-mode.el Fri Jun 21 06:18:03 2002 @@ -675,6 +675,40 @@ (t normal-indent)))))) +(defvar lisp-function-and-type-regexp + (concat "def\\(" + ;; def but not define-. + "\\(un\\|advice\\|alias\\|macro\\*?\\|setf\\|subst\\*?\\|" + "-edebug-spec\\|" + ;; CLOS + "method\\|generic\\|" + ;; define-* + "ine-\\(?:" + ;; basic Lisp stuff + "compiler-macro\\|function\\|function-when-void\\|modify-macro\\|" + "setf-method\\|" + ;; obsolete/compatible support, XEmacs-specific + "compatible-function-alias\\|obsolete-function-alias\\|" + ;; XEmacs-specific, supporting stuff inside of XEmacs + "ccl-program\\|device-method\\*?\\|prefix-command\\|skeleton" + "\\)\\)\\|" + ;; Structure declarations. + "\\(class\\|struct\\|type\\)\\)\\>") + "Regular expression to match the function and type keywords used in Lisp. +This matches, for example, the string \"defun\", as well as defsetf, +defsubst*, define-prefix-command, etc. Match string 1 matches everything +but the three-letter \"def\" string at the beginning. Match string 2 +matches everything after that, when it's *NOT* a \"type\" declaration -- +which includes defclass, defstruct, and deftype. Match string 3 is similar +to match string 2 in that it matches everything after the \"def\", when +\(and only when) the keyword matched *IS* a type declaration. You can use +match strings 2 and 3 to easily determine whether a function or type was +matched. The regex is terminated with a \\\> so that there must be a +word-end; i.e. defunbbb won't match.") + +(defvar lisp-flet-regexp + "(\\(flet\\|macrolet\\|labels\\)\\(\\s-\\|\n\\)") + (defun lisp-indent-function (indent-point state) ;; free reference to `calculate-lisp-indent-last-sexp' ;; in #'calculate-lisp-indent @@ -697,19 +731,91 @@ ;; inside the innermost containing sexp. (backward-prefix-chars) (current-column)) - (let ((function (buffer-substring (point) + + ;; Now come a bunch of ad-hoc checks to see if we're in particular + ;; places (defining an flet function, in the argument list of a + ;; regular or flet function, in a quoted list, etc.) where the + ;; regular indenting doesn't work well. + + ;; #### All this stuff here should be generalized so that + ;; you can specify, for various functions, how you want + ;; particular arguments handled -- in some way that works + ;; recursively, so it can handle flet and such. + + (let* ((function (buffer-substring (point) (progn (forward-sexp 1) (point)))) - method) - (if (condition-case nil + (quote (condition-case nil + (save-excursion + (backward-up-list 1) + (memq (char-before (point)) '(?' ?`))))) + method) + (cond + ;; if we're indenting a quoted list, and the first word is not + ;; lambda, line up second line below first with no indentation, + ;; so that property lists indent correctly. + ((and quote (not (equal function "lambda"))) + (setq method 'lisp-indent-quoteform)) + ;; do the same if we're indenting the arg list of a def* form. + ((let ((p (point))) + (condition-case nil (save-excursion - (backward-up-list 1) - (backward-up-list 1) - (backward-up-list 1) - (looking-at "(\\(flet\\|macrolet\\|labels\\)\\s-")) - (error nil)) - (setq method 'defun) - (setq method (or (get (intern-soft function) 'lisp-indent-function) - (get (intern-soft function) 'lisp-indent-hook)))) + (backward-up-list 2) + ;; make sure we're indeed the second argument of the + ;; def* form. + (and (eq (point) (save-excursion + (goto-char p) + (backward-up-list 1) + (backward-sexp 2) + (1- (point)))) + ;; check to see that the function is a def* type + (eq (char-after) ?\() + (progn (forward-char 1) t) + (looking-at lisp-function-and-type-regexp) + ;; defstruct may have slot option specs, which + ;; should probably be reverse-indented like + ;; normal, because the slot name is the first + ;; in the list. #### Review this. + (not (equal (match-string 0) "defstruct")))) + (error nil))) + (setq method 'lisp-indent-quoteform)) + + ;; handle functions in flet forms + ((let ((p (point))) + (condition-case nil + (save-excursion + (backward-up-list 3) + ;; make sure we're indeed a function, i.e. inside the + ;; first form after the flet. + (and (eq (point) (save-excursion + (goto-char p) + (backward-up-list 2) + (backward-sexp 1) + (1- (point)))) + (looking-at lisp-flet-regexp))) + (error nil))) + (setq method 'defun)) + + ;; handle the arg lists in functions in flet forms + ((let ((p (point))) + (condition-case nil + (save-excursion + (backward-up-list 2) + ;; make sure we're indeed the arg list -- i.e. the first + ;; element after the function name. + (and (eq (point) (save-excursion + (goto-char p) + (backward-up-list 1) + (backward-sexp 1) + (1- (point)))) + (progn + (backward-up-list 2) + (looking-at lisp-flet-regexp)))) + (error nil))) + (setq method 'lisp-indent-quoteform)) + (t + (setq method + (or (get (intern-soft function) 'lisp-indent-function) + (get (intern-soft function) 'lisp-indent-hook))))) (cond ((or (eq method 'defun) (and (null method) (> (length function) 3) @@ -721,6 +827,14 @@ (method (funcall method state indent-point))))))) +(defun lisp-indent-quoteform (state indent-point) + (goto-char (car (cdr state))) + (forward-line 1) + (if (> (point) (car (cdr (cdr state)))) + (progn + (goto-char (car (cdr state))) + (+ 1 (current-column))))) + (defvar lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form.") @@ -796,6 +910,8 @@ (put 'with-selected-window 'lisp-indent-function 1) (put 'save-selected-frame 'lisp-indent-function 0) (put 'with-selected-frame 'lisp-indent-function 1) +(put 'save-selected-device 'lisp-indent-function 0) +(put 'with-selected-device 'lisp-indent-function 1) (put 'save-restriction 'lisp-indent-function 0) (put 'save-match-data 'lisp-indent-function 0) (put 'let 'lisp-indent-function 1) @@ -983,7 +1099,10 @@ (cond ((eq (char-after (point)) ?\\) (forward-char 2)) ((memq (char-after (point)) '(?\" ??)) (forward-sexp 1)))) - (looking-at ";+[\t ]*")) + ;; don't do comment filling in a string, or we will mess up + ;; doc strings and other places where semicolons are used. + (and (not (eq 'string (buffer-syntactic-context))) + (looking-at ";+[\t ]*"))) (error nil)) (setq has-comment t has-code-and-comment t) (setq comment-fill-prefix diff --text -u 'xemacs-21.5.6/lisp/make-docfile.el' 'xemacs-21.5.7/lisp/make-docfile.el' Index: ././lisp/make-docfile.el --- ././lisp/make-docfile.el Fri Apr 13 03:21:30 2001 +++ ././lisp/make-docfile.el Sun Apr 14 21:42:04 2002 @@ -1,6 +1,7 @@ ;;; make-docfile.el --- Cache docstrings in external file ;; Copyright (C) 1985, 1986, 1992-1995, 1997 Free Software Foundation, Inc. +;; Copyright (C) 2002 Ben Wing. ;; Author: Unknown ;; Maintainer: Steven L Baur @@ -88,6 +89,8 @@ (load "dump-paths.el") (require 'custom) (load "process") +;; need for stuff called from C by process code +(if (featurep 'windows-nt) (load "win32-native")) (let (preloaded-file-list) (load (expand-file-name "../lisp/dumped-lisp.el")) @@ -162,7 +165,8 @@ ;; (locate-file-clear-hashing nil) (if (memq system-type '(berkeley-unix next-mach)) ;; Suboptimal, but we have a unresolved bug somewhere in the - ;; low-level process code + ;; low-level process code. #### Now that we've switched to using + ;; the regular asynch process code, we should try removing this. (call-process-internal "/bin/csh" nil diff --text -u 'xemacs-21.5.6/lisp/menubar-items.el' 'xemacs-21.5.7/lisp/menubar-items.el' Index: ././lisp/menubar-items.el --- ././lisp/menubar-items.el Sun Mar 31 17:27:25 2002 +++ ././lisp/menubar-items.el Thu May 23 20:46:10 2002 @@ -424,17 +424,17 @@ ("C%_mds" - ["Repeat %_Last Complex Command..." repeat-complex-command] + ["Repeat Last Comple%_x Command..." repeat-complex-command] ["E%_valuate Lisp Expression..." eval-expression] ["Execute %_Named Command..." execute-extended-command] "----" - ["Start %_Macro Recording" start-kbd-macro + ["Start %_Defining Macro" start-kbd-macro :included (not defining-kbd-macro)] - ["End %_Macro Recording" end-kbd-macro + ["Stop %_Defining Macro" end-kbd-macro :included defining-kbd-macro] - ["E%_xecute Last Macro" call-last-kbd-macro + ["%_Execute Last Macro" call-last-kbd-macro :active last-kbd-macro] - ("%_Other Macro" + ("Other %_Macro" ["Edit %_Last Macro" edit-last-kbd-macro :active last-kbd-macro] ["%_Edit Macro..." edit-kbd-macro] @@ -460,24 +460,29 @@ :active (region-exists-p)] ) "----" - ("%_Abbrev" ["D%_ynamic Abbrev Expand" dabbrev-expand] + ["Define %_Global Abbrev for " add-global-abbrev + :suffix (truncate-string-to-width (abbrev-string-to-be-defined nil) + 40 nil nil t)] + ("Other %_Abbrev" ["Dynamic Abbrev %_Complete" dabbrev-completion] ["Dynamic Abbrev Complete in %_All Buffers" (dabbrev-completion 16)] "----" "----" ["%_Define Global Abbrev for " add-global-abbrev - :suffix (abbrev-string-to-be-defined nil) - :active abbrev-mode] + :suffix (truncate-string-to-width (abbrev-string-to-be-defined nil) + 40 nil nil t)] ["Define %_Mode-Specific Abbrev for " add-mode-abbrev - :suffix (abbrev-string-to-be-defined nil) - :active abbrev-mode] + :suffix (truncate-string-to-width (abbrev-string-to-be-defined nil) + 40 nil nil t)] ["Define Global Ex%_pansion for " inverse-add-global-abbrev - :suffix (inverse-abbrev-string-to-be-defined 1) - :active abbrev-mode] + :suffix (truncate-string-to-width + (inverse-abbrev-string-to-be-defined 1) + 40 nil nil t)] ["Define Mode-Specific Expa%_nsion for " inverse-add-mode-abbrev - :suffix (inverse-abbrev-string-to-be-defined 1) - :active abbrev-mode] + :suffix (truncate-string-to-width + (inverse-abbrev-string-to-be-defined 1) + 40 nil nil t)] "---" ["E%_xpand Abbrev" expand-abbrev] ["Expand Abbrevs in Re%_gion" expand-region-abbrevs @@ -497,73 +502,69 @@ ["%_Save Abbrevs As..." write-abbrev-file] ["L%_oad Abbrevs..." read-abbrev-file] ) - ("%_Rectangles" - ["%_Kill Rectangle" kill-rectangle] + "---" + ["%_Cut Rectangle" kill-rectangle] + ("Other %_Rectangles/Register" ["%_Yank Rectangle" yank-rectangle] ["Rectangle %_to Register" copy-rectangle-to-register] ["Rectangle %_from Register" insert-register] - ["%_Clear Rectangle" clear-rectangle] + ["%_Delete Rectangle" clear-rectangle] ["%_Open Rectangle" open-rectangle] ["%_Prefix Rectangle..." string-rectangle] ["Rectangle %_Mousing" (customize-set-variable 'mouse-track-rectangle-p (not mouse-track-rectangle-p)) :style toggle :selected mouse-track-rectangle-p] - ) - ("Re%_gister" + "---" ["%_Copy to Register..." copy-to-register :active (region-exists-p)] - ["%_Paste Register..." insert-register] + ["%_Append to Register..." append-register :active (region-exists-p)] + ["%_Insert Register..." insert-register] "---" ["%_Save Point to Register" point-to-register] ["%_Jump to Register" register-to-point] ) - ("%_Sort" - ["%_Lines in Region" sort-lines :active (region-exists-p)] - ["%_Paragraphs in Region" sort-paragraphs :active (region-exists-p)] - ["P%_ages in Region" sort-pages :active (region-exists-p)] - ["%_Columns in Region" sort-columns :active (region-exists-p)] - ["%_Regexp..." sort-regexp-fields :active (region-exists-p)] - ) - ("%_Change Case" - ["%_Upcase Region" upcase-region :active (region-exists-p)] - ["%_Downcase Region" downcase-region :active (region-exists-p)] - ["%_Capitalize Region" capitalize-region :active (region-exists-p)] - ["%_Title-Case Region" capitalize-region-as-title - :active (region-exists-p)] - ) - ("Ce%_nter" - ["%_Line" center-line] - ["%_Paragraph" center-paragraph] - ["%_Region" center-region :active (region-exists-p)] - ) - ("%_Indent" - ["%_As Previous Line" indent-relative] - ["%_To Column..." indent-to-column] - "---" - ["%_Region" indent-region :active (region-exists-p)] - ["%_Balanced Expression" indent-sexp] - ["%_C Expression" indent-c-exp] - ) - ("%_Tabs" - ["%_Convert Tabs to Spaces" untabify :active (and (region-exists-p) - (fboundp 'untabify))] - ["Convert %_Spaces to Tabs" tabify :active (and (region-exists-p) - (fboundp 'tabify))] - "---" - ["%_Tab to Tab Stop" tab-to-tab-stop] - ["%_Move to Tab Stop" move-to-tab-stop] - ["%_Edit Tab Stops" edit-tab-stops] - ) - ("S%_pell-Check" - ["%_Buffer" ispell-buffer - :active (fboundp 'ispell-buffer)] - "---" - ["%_Word" ispell-word] - ["%_Complete Word" ispell-complete-word] - ["%_Region" ispell-region] + "---" + ["%_Sort Lines in Region" sort-lines :active (region-exists-p)] + ["%_Uppercase Region or Word" upcase-region-or-word] + ["%_Lowercase Region or Word" downcase-region-or-word] + ["%_Indent Region or Balanced Expression" + indent-region-or-balanced-expression] + ["%_Fill Paragraph or Region" fill-paragraph-or-region] + ("Other %_Text Commands" + ["Sort %_Paragraphs in Region" sort-paragraphs :active (region-exists-p)] + ["Sort Pa%_ges in Region" sort-pages :active (region-exists-p)] + ["Sort C%_olumns in Region" sort-columns :active (region-exists-p)] + ["Sort %_Regexp..." sort-regexp-fields :active (region-exists-p)] + "---" + ["%_Capitalize Region" capitalize-region :active (region-exists-p)] + ["Title-C%_ase Region" capitalize-region-as-title + :active (region-exists-p)] + "----" + ["C%_enter Region or Paragraph" + (if (region-active-p) (center-region) (center-line))] + ["Center %_Line" center-line] + "---" + ["%_Indent Region Rigidly" indent-rigidly :active (region-exists-p)] + ["In%_dent To Column..." indent-to-column] + "---" + ["%_Untabify (Tabs to Spaces)" untabify :active (and (region-exists-p) + (fboundp 'untabify))] + ["%_Tabify (Spaces to Tabs)" tabify :active (and (region-exists-p) + (fboundp 'tabify))] + ["Tab to Tab %_Stop" tab-to-tab-stop] + ["Edit Ta%_b Stops" edit-tab-stops] + ) + "---" + ("S%_pell-Check" + ["%_Buffer" ispell-buffer + :active (fboundp 'ispell-buffer)] + "---" + ["%_Word" ispell-word] + ["%_Complete Word" ispell-complete-word] + ["%_Region" ispell-region] + ) ) - ) - + ("%_Tools" ("%_Packages" ("%_Add Download Site" @@ -573,16 +574,6 @@ ["%_Update Package Index" package-get-update-base] ["%_List and Install" pui-list-packages] ["U%_pdate Installed Packages" package-get-update-all] - ;; hack-o-matic, we can't force a load of package-base here - ;; since it triggers dialog box interactions which we can't - ;; deal with while using a menu - ("Using %_Custom" - :filter (lambda (&rest junk) - (if package-get-base - (submenu-generate-accelerator-spec - (cdr (custom-menu-create 'packages))) - '("Please load Package Index")))) - ["%_Help" (Info-goto-node "(xemacs)Packages")]) ("%_Internet" ["Read Mail %_1 (VM)..." vm @@ -896,7 +887,12 @@ :style toggle :selected (and (boundp 'pending-delete-mode) pending-delete-mode) :active (boundp 'pending-delete-mode)] - ["`%_kill-line' Kills Whole Line at %_Beg" + ["`kill-%_word' Stores in Clipboard" + (customize-set-variable 'kill-word-into-kill-ring + (not kill-word-into-kill-ring)) + :style toggle + :selected kill-word-into-kill-ring] + ["`kill-%_line' Kills Whole Line at Beg" (customize-set-variable 'kill-whole-line (not kill-whole-line)) :style toggle :selected kill-whole-line] @@ -2100,6 +2096,14 @@ tutorial-supported-languages))))) (set-menubar default-menubar) + +(when (featurep 'menubar-items) + (loop for buf being the buffers do + (or (eq default-menubar (symbol-value-in-buffer 'current-menubar buf)) + (with-current-buffer buf + (condition-case nil + (funcall major-mode) + (error (setq current-menubar default-menubar))))))) ;;; Popup menus. diff --text -u 'xemacs-21.5.6/lisp/minibuf.el' 'xemacs-21.5.7/lisp/minibuf.el' Index: ././lisp/minibuf.el --- ././lisp/minibuf.el Wed Mar 13 17:52:07 2002 +++ ././lisp/minibuf.el Tue Jun 4 15:04:22 2002 @@ -761,10 +761,10 @@ &optional predicate require-match initial-contents history default) "Read a string in the minibuffer, with completion. -Args: PROMPT, TABLE, PREDICATE, REQUIRE-MATCH, INITIAL-CONTENTS, HISTORY. + PROMPT is a string to prompt with; normally it ends in a colon and a space. TABLE is an alist whose elements' cars are strings, or an obarray. -TABLE can also be a function to do the completion itself. +TABLE can also be a function which does the completion itself. PREDICATE limits completion to a subset of TABLE. See `try-completion' and `all-completions' for more details on completion, TABLE, and PREDICATE. diff --text -u 'xemacs-21.5.6/lisp/msw-faces.el' 'xemacs-21.5.7/lisp/msw-faces.el' Index: ././lisp/msw-faces.el --- ././lisp/msw-faces.el Fri Mar 29 13:46:34 2002 +++ ././lisp/msw-faces.el Fri Jun 21 06:18:04 2002 @@ -29,7 +29,8 @@ ;; This file does the magic to parse mswindows font names, and make sure that ;; the default and modeline attributes of new frames are specified enough. -(set-face-font 'gui-element "MS Sans Serif:Regular:8" nil 'mswindows) +(defun mswindows-init-global-faces () + (set-face-font 'gui-element "MS Sans Serif:Regular:8" nil 'mswindows)) (defun mswindows-init-device-faces (device) (let ((color-default (device-system-metric device 'color-default)) @@ -38,167 +39,275 @@ ; an error now instead of a crash at frame creation. (unless (face-font-instance 'default device) (error "Can't find a suitable default font")) - + + ;; Don't set them on the device because then the global setting won't + ;; override them. + ;; #### Use device tags if we have multiple msprinter devices. (can we?) (if (car color-default) - (set-face-foreground 'default (car color-default)) device) + (set-face-foreground 'default (car color-default) nil + (device-type device))) (if (cdr color-default) - (set-face-background 'default (cdr color-default)) device) + (set-face-background 'default (cdr color-default) nil + (device-type device))) (if (car color-3d-face) - (set-face-foreground 'gui-element (car color-3d-face)) device) + (set-face-foreground 'gui-element (car color-3d-face) nil + (device-type device))) (if (cdr color-3d-face) - (set-face-background 'gui-element (cdr color-3d-face)) device) + (set-face-background 'gui-element (cdr color-3d-face) nil + (device-type device))) )) (defun mswindows-init-frame-faces (frame) ) ;; Other functions expect these regexps -(defconst mswindows-font-regexp - (let - ((- ":") - (fontname "\\([a-zA-Z ]+\\)") - (weight "\\([a-zA-Z]*\\)?") - (style "\\( [a-zA-Z]*\\)?") - (pointsize "\\([0-9]+\\)?") - (effects "\\([a-zA-Z ]*\\)?") - (charset "\\([a-zA-Z 0-9]*\\)") - ) - (concat "^" - fontname - weight style - pointsize - effects - charset "$"))) +(let + ((- ":") + (fontname "\\([a-zA-Z ]*\\)") ; 1 + (style "\\(\\(?:[a-zA-Z]+\\(?: +[a-zA-Z]+\\)*\\)?\\)") ; 2 + (pointsize "\\([0-9]*\\)") ; 3 + (effects "\\(\\(?:[a-zA-Z]+\\(?: +[a-zA-Z]+\\)*\\)?\\)") ; 4 + ;; must match "OEM/DOS" + (charset "\\([a-zA-Z/ ]*\\)") ; 5 + ) + (defconst mswindows-font-regexp + (concat "^" fontname - style - pointsize - effects - charset "$")) + (defconst mswindows-font-regexp-missing-1 + (concat "^" fontname - style - pointsize - effects "$")) + (defconst mswindows-font-regexp-missing-2 + (concat "^" fontname - style - pointsize "$")) + (defconst mswindows-font-regexp-missing-3 + (concat "^" fontname - style "$")) + (defconst mswindows-font-regexp-missing-4 + (concat "^" fontname "$")) +) ;;; Fill in missing parts of a font spec. This is primarily intended as a ;;; helper function for the functions below. ;;; mswindows fonts look like: -;;; fontname[:[weight][ style][:pointsize[:effects]]][:charset] +;;; fontname[:[weight][ slant][:pointsize[:effects]]][:charset] ;;; A minimal mswindows font spec looks like: ;;; Courier New ;;; A maximal mswindows font spec looks like: ;;; Courier New:Bold Italic:10:underline strikeout:Western -;;; Missing parts of the font spec should be filled in with these values: -;;; Courier New:Regular:10::Western -(defun mswindows-font-canonicalize-name (font) - "Given a mswindows font or font name, this returns its name in -canonical form." - (if (or (font-instance-p font) - (stringp font)) - (let ((name (if (font-instance-p font) - (font-instance-name font) - font))) - (cond ((string-match - "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+:[a-zA-Z ]*:[a-zA-Z 0-9]*$" - name) name) - ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+:[a-zA-Z ]*$" - name) (concat name ":Western")) - ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*:[0-9]+$" name) - (concat name "::Western")) - ((string-match "^[a-zA-Z ]+:[a-zA-Z ]*$" name) - (concat name ":10::Western")) - ((string-match "^[a-zA-Z ]+$" name) - (concat name ":Regular:10::Western")) - (t "Courier New:Regular:10::Western"))))) +(defun mswindows-canonicalize-font-name (font) + "Given a mswindows font or font name, return its name in canonical form. +This adds missing colons and fills in the style field with \"Regular\". +This does *NOT* fill in the point size or charset fields, because in those +cases an empty field is not equivalent to any particular field value, but a +wildcard allowing for any possible value (charset Western and point size 10 +are chosen first, if they exist)." + (if (font-instance-p font) (setq font (font-instance-name font))) + ;; fill in missing colons + (setq font + (cond ((string-match mswindows-font-regexp font) font) + ((string-match mswindows-font-regexp-missing-1 font) + (concat font ":")) + ((string-match mswindows-font-regexp-missing-2 font) + (concat font "::")) + ((string-match mswindows-font-regexp-missing-3 font) + (concat font ":::")) + ((string-match mswindows-font-regexp-missing-4 font) + (concat font "::::")) + (t "::::"))) + (or (string-match mswindows-font-regexp font) (error "can't parse %S" font)) + (if (equal "" (match-string 2 font)) + (concat (substring font 0 (match-beginning 2)) "Regular" + (substring font (match-beginning 2))) + font)) + +(defun mswindows-parse-font-style (style) + ;; Parse a style into a cons (WEIGHT . SLANT). WEIGHT will never be the + ;; empty string (it may be "Regular"), but SLANT will be empty for + ;; non-italic. + (save-match-data + (let ((case-fold-search t)) + (cond ((equalp style "Italic") '("Regular" . "Italic")) + ((string-match "^\\([a-zA-Z ]+?\\) +Italic$" style) + (cons (match-string 1 style) "Italic")) + (t (cons style "")))))) + +(defun mswindows-construct-font-style (weight slant) + ;; Construct the style from WEIGHT and SLANT. Opposite of + ;; mswindows-parse-font-style. + (cond ((and (equal slant "") (equal weight "")) "Regular") + ((equal slant "") weight) + ((or (equalp weight "Regular") (equal weight "")) slant) + (t (concat weight " " slant)))) + +(defun mswindows-frob-font-style (font which) + ;; Given a font name or font instance, return a name with the style field + ;; (which includes weight and/or slant) changed according to WHICH, a plist. + ;; If no entry found, don't change. + (if (null font) nil + (setq font (mswindows-canonicalize-font-name font)) + (or (string-match mswindows-font-regexp font) + (error "can't parse %S" font)) + (let* ((style (match-string 2 font)) + (style-rep + (save-match-data + (or (loop for (x y) on which by #'cddr + if (string-match (concat "^" x "$") style) + return (replace-match y nil nil style)) + style)))) + (concat (substring font 0 (match-beginning 2)) + style-rep + (substring font (match-end 2)))))) + +(defun mswindows-frob-font-style-and-sizify (font which &optional device) + (if (null font) nil + (let* ((oldwidth (if (font-instance-p font) (font-instance-width font) + (let ((fi (make-font-instance font device t))) + (and fi (font-instance-width fi))))) + (newname (mswindows-frob-font-style font which)) + (newfont (make-font-instance newname device t))) + ;; Hack! On MS Windows, bold fonts (even monospaced) are often wider + ;; than the equivalent non-bold font. Making the bold font one point + ;; smaller usually makes it the same width (maybe at the expense of + ;; making it one pixel shorter). Do the same trick in both directions. + (when (font-instance-p newfont) + (let ((newerfont newfont)) + (block nil + (while (and newerfont oldwidth) + (setq newfont newerfont) + (cond ((< (font-instance-width newfont) oldwidth) + (setq newerfont + (make-font-instance + (mswindows-find-larger-font newfont device) + device t)) + (if (and newerfont + (> (font-instance-width newerfont) oldwidth)) + (return nil))) + ((> (font-instance-width newfont) oldwidth) + (setq newerfont + (make-font-instance + (mswindows-find-smaller-font newfont device) + device t)) + (if (and newerfont + (< (font-instance-width newerfont) oldwidth)) + (return nil))) + (t (return nil)))))) + (if (font-instance-p newfont) (font-instance-name newfont) newfont))))) + +(defconst mswindows-nonbold-weight-regexp + ;; He looked so, so cool with the ultra light dangling from his mouth as + ;; his fingers spun out demisemiquavers from the keyboard ... + "\\(Regular\\|Thin\\|Extra Light\\|Ultra Light\\|Light\\|Normal\\|Medium\\|Semi Bold\\|Demi Bold\\)" + ) +(defconst mswindows-bold-weight-regexp + "\\(Semi Bold\\|Demi Bold\\|Bold\\|Extra Bold\\|Ultra Bold\\|Heavy\\|Black\\)" + ) + +(defconst mswindows-make-font-bold-mapper + `(,mswindows-nonbold-weight-regexp "Bold" + "Italic" "Bold Italic" + ,(concat mswindows-nonbold-weight-regexp " Italic") "Bold Italic")) + +(defconst mswindows-make-font-nonbold-mapper + `(,mswindows-bold-weight-regexp "Regular" + ,(concat mswindows-bold-weight-regexp " Italic") "Italic")) + +(defconst mswindows-make-font-italic-mapper + '("\\(.*\\)Italic" "\\1Italic" + "\\(.*\\)" "\\1 Italic")) + +(defconst mswindows-make-font-unitalic-mapper + '("Italic" "Regular" + "\\(.*\\) Italic" "\\1")) + +(defconst mswindows-make-font-bold-italic-mapper + `(,mswindows-nonbold-weight-regexp "Bold Italic" + ,(concat mswindows-nonbold-weight-regexp " Italic") "Bold Italic" + "Italic" "Bold Italic" + ,mswindows-bold-weight-regexp "\\1 Italic")) (defun mswindows-make-font-bold (font &optional device) "Given a mswindows font specification, this attempts to make a bold font. If it fails, it returns nil." - (if (font-instance-p font) - (let ((name (mswindows-font-canonicalize-name font)) - (oldwidth (font-instance-width font))) - (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name) - (let ((newfont (make-font-instance - (concat (substring name 0 (match-beginning 1)) - "Bold" (substring name (match-end 1))) - device t))) -; Hack! on mswindows, bold fonts (even monospaced) are often wider than the -; equivalent non-bold font. Making the bold font one point smaller usually -; makes it the same width (maybe at the expense of making it one pixel shorter) - (if (font-instance-p newfont) - (if (> (font-instance-width newfont) oldwidth) - (mswindows-find-smaller-font newfont device) - newfont)))))) + (mswindows-frob-font-style-and-sizify font mswindows-make-font-bold-mapper + device)) (defun mswindows-make-font-unbold (font &optional device) "Given a mswindows font specification, this attempts to make a non-bold font. If it fails, it returns nil." - (if (font-instance-p font) - (let ((name (mswindows-font-canonicalize-name font))) - (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name) - (make-font-instance (concat - (substring name 0 (match-beginning 1)) - "Regular" (substring name (match-end 1))) - device t)))) + (mswindows-frob-font-style-and-sizify font mswindows-make-font-nonbold-mapper + device)) (defun mswindows-make-font-italic (font &optional device) "Given a mswindows font specification, this attempts to make an `italic' font. If it fails, it returns nil." - (if (font-instance-p font) - (let ((name (mswindows-font-canonicalize-name font))) - (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name) - (make-font-instance (concat - (substring name 0 (match-beginning 1)) - "Italic" (substring name (match-end 1))) - device t)))) + (try-font-name (mswindows-frob-font-style + font mswindows-make-font-italic-mapper) device)) (defun mswindows-make-font-unitalic (font &optional device) "Given a mswindows font specification, this attempts to make a non-italic font. If it fails, it returns nil." - (if (font-instance-p font) - (let ((name (mswindows-font-canonicalize-name font))) - (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name) - (make-font-instance (concat - (substring name 0 (match-beginning 1)) - "Regular" (substring name (match-end 1))) - device t)))) + (try-font-name (mswindows-frob-font-style + font mswindows-make-font-unitalic-mapper) device)) (defun mswindows-make-font-bold-italic (font &optional device) "Given a mswindows font specification, this attempts to make a `bold-italic' font. If it fails, it returns nil." - (if (font-instance-p font) - (let ((name (mswindows-font-canonicalize-name font)) - (oldwidth (font-instance-width font))) - (string-match "^[a-zA-Z ]+:\\([a-zA-Z ]*\\):" name) - (let ((newfont (make-font-instance - (concat (substring name 0 (match-beginning 1)) - "Bold Italic" (substring name (match-end 1))) - device t))) -; Hack! on mswindows, bold fonts (even monospaced) are often wider than the -; equivalent non-bold font. Making the bold font one point smaller usually -; makes it the same width (maybe at the expense of making it one pixel shorter) - (if (font-instance-p newfont) - (if (> (font-instance-width newfont) oldwidth) - (mswindows-find-smaller-font newfont device) - newfont)))))) + (mswindows-frob-font-style-and-sizify font + mswindows-make-font-bold-italic-mapper + device)) + +(defun mswindows-available-font-sizes (font device) + (if (font-instance-p font) (setq font (font-instance-name font))) + (setq font (mswindows-canonicalize-font-name font)) + (or (string-match mswindows-font-regexp font) (error "Can't parse %S" font)) + ;; turn pointsize into wildcard + (setq font + (concat (substring font 0 (match-beginning 3)) + (substring font (match-end 3) (match-end 0)))) + (sort + (delq nil + (mapcar #'(lambda (name) + (and (string-match mswindows-font-regexp name) + (string-to-int (substring name (match-beginning 3) + (match-end 3))))) + (list-fonts font device))) + #'<)) + +(defun mswindows-frob-font-size (font up-p device) + (if (stringp font) (setq font (make-font-instance font device))) + (let* ((name (font-instance-name font)) + (truename (font-instance-truename font)) + (available (and truename + (mswindows-available-font-sizes truename device)))) + (if (null available) nil + (or (string-match mswindows-font-regexp truename) + (error "can't parse %S" truename)) + (let ((old-size (string-to-int + (substring truename + (match-beginning 3) (match-end 3))))) + (or (> old-size 0) (error "font truename has 0 pointsize?")) + (or (string-match mswindows-font-regexp name) + (error "can't parse %S" name)) + (let ((newsize + ;; scalable fonts: change size by 1 point. + (if (= 0 (car available)) + (if (and (not up-p) (= 1 old-size)) nil + (if up-p (1+ old-size) (1- old-size))) + ;; non-scalable fonts: take the next available size. + (if up-p + (loop for tail on available + if (eql (car tail) old-size) + return (cadr tail)) + (loop for tail on available + if (eql (cadr tail) old-size) + return (car tail)))))) + (and newsize + (concat (substring name 0 (match-beginning 3)) + (int-to-string newsize) + (substring name (match-end 3) (match-end 0))))))))) (defun mswindows-find-smaller-font (font &optional device) "Loads a new version of the given font (or font name) 1 point smaller. Returns the font if it succeeds, nil otherwise." - (if (stringp font) (setq font (make-font-instance font device))) - (if (font-instance-p font) (setq font (font-instance-truename font))) - (if (stringp font) (setq font (make-font-instance font device))) - (if (font-instance-p font) - (let (old-size (name (mswindows-font-canonicalize-name font))) - (string-match "^[a-zA-Z ]+:[a-zA-Z ]*:\\([0-9]+\\):" name) - (setq old-size (string-to-int - (substring name (match-beginning 1) (match-end 1)))) - (if (> old-size 0) - (make-font-instance (concat - (substring name 0 (match-beginning 1)) - (int-to-string (- old-size 1)) - (substring name (match-end 1))) - device t))))) + (mswindows-frob-font-size font nil device)) (defun mswindows-find-larger-font (font &optional device) "Loads a new version of the given font (or font name) 1 point larger. Returns the font if it succeeds, nil otherwise." - (if (stringp font) (setq font (make-font-instance font device))) - (if (font-instance-p font) (setq font (font-instance-truename font))) - (if (stringp font) (setq font (make-font-instance font device))) - (if (font-instance-p font) - (let (old-size (name (mswindows-font-canonicalize-name font))) - (string-match "^[a-zA-Z ]+:[a-zA-Z ]*:\\([0-9]+\\):" name) - (setq old-size (string-to-int - (substring name (match-beginning 1) (match-end 1)))) - (make-font-instance (concat - (substring name 0 (match-beginning 1)) - (int-to-string (+ old-size 1)) - (substring name (match-end 1))) - device t)))) + (mswindows-frob-font-size font t device)) diff --text -u 'xemacs-21.5.6/lisp/msw-font-menu.el' 'xemacs-21.5.7/lisp/msw-font-menu.el' Index: ././lisp/msw-font-menu.el --- ././lisp/msw-font-menu.el Fri Mar 29 13:46:34 2002 +++ ././lisp/msw-font-menu.el Fri Jun 21 06:18:04 2002 @@ -1,6 +1,7 @@ ;; msw-font-menu.el --- Managing menus of mswindows fonts. ;; Copyright (C) 1999 Free Software Foundation, Inc. +;; Copyright (C) 2002 Ben Wing. ;; Adapted from x-font-menu.el by Andy Piper @@ -21,6 +22,13 @@ ;; Free Software Foundation, 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. +;;; Known Problems: +;;; =============== +;;; There is knowledge here about the regexp match numbers in +;;; `mswindows-font-regexp' and `mswindows-font-regexp-foundry-and-family' defined in +;;; mswindows-faces.el. +;;; + ;;; mswindows fonts look like: ;;; fontname[:[weight][ style][:pointsize[:effects]]][:charset] ;;; ie: @@ -40,9 +48,6 @@ (require 'font-menu) (globally-declare-boundp 'mswindows-font-regexp) -(defvar mswindows-font-menu-registry-encoding nil - "Registry and encoding to use with font menu fonts.") - (defvar mswindows-font-menu-junk-families (mapconcat #'identity @@ -65,7 +70,6 @@ or if you change your font path, you can call this to re-initialize the menus." (unless mswindows-font-regexp-ascii (setq mswindows-font-regexp-ascii "Western")) - (setq mswindows-font-menu-registry-encoding "Western") (let ((case-fold-search t) family size weight entry dev-cache cache families sizes weights) @@ -75,8 +79,9 @@ (t debug))) (when (and (string-match mswindows-font-regexp-ascii name) (string-match mswindows-font-regexp name)) - (setq weight (capitalize (match-string 2 name)) - size (string-to-int (or (match-string 4 name) "0")) + (setq weight (capitalize (car (mswindows-parse-font-style + (match-string 2 name)))) + size (string-to-int (match-string 3 name)) family (match-string 1 name)) (unless (string-match mswindows-font-menu-junk-families family) (setq entry (or (vassoc name cache) @@ -174,15 +179,16 @@ (return-from mswindows-font-menu-font-data (make-vector 5 nil))) (when (string-match mswindows-font-regexp name) - (setq weight (match-string 2 name)) - (setq size (string-to-int (or (match-string 4 name) "0")))) + (setq weight (car (mswindows-parse-font-style (match-string 2 name)))) + (setq size (string-to-int (match-string 3 name)))) (when (string-match mswindows-font-regexp truename) - (when (not (member weight (aref entry 1))) - (setq weight (match-string 2 truename))) - (when (not (member size (aref entry 2))) - (setq size (string-to-int (or (match-string 4 truename) "0")))) - (setq slant (match-string 5 truename))) + (destructuring-bind (newweight . slant) + (mswindows-parse-font-style (match-string 2 truename)) + (when (not (member weight (aref entry 1))) + (setq weight newweight)) + (when (not (member size (aref entry 2))) + (setq size (string-to-int (match-string 3 truename)))))) (vector entry family size weight slant))) @@ -195,14 +201,15 @@ (dolist (weight (list weight "")) (dolist (slant ;; oblique is not currently implemented - (cond ((string-equal slant "Oblique") '(" Italic" "")) - ((string-equal slant "Italic") '(" Italic" "")) + (cond ((string-equal slant "Oblique") '("Italic" "")) + ((string-equal slant "Italic") '("Italic" "")) (t (list slant "")))) (when (setq font (make-font-instance - (concat family ":" weight slant ":" - size "::" - mswindows-font-menu-registry-encoding) + (concat + family ":" + (mswindows-construct-font-style weight slant) ":" + size "::") nil t)) (throw 'got-font font))))))) diff --text -u 'xemacs-21.5.6/lisp/msw-init.el' 'xemacs-21.5.7/lisp/msw-init.el' Index: ././lisp/msw-init.el --- ././lisp/msw-init.el Sat Apr 28 16:48:40 2001 +++ ././lisp/msw-init.el Thu May 9 17:33:46 2002 @@ -46,7 +46,6 @@ ;; Old-style mswindows bindings. The new-style mswindows bindings ;; (namely Ctrl-X, Ctrl-C and Ctrl-V) are already spoken for by XEmacs. (global-set-key '(shift delete) 'kill-primary-selection) - (global-set-key '(control delete) 'delete-primary-selection) (global-set-key '(shift insert) 'yank-clipboard-selection) (global-set-key '(control insert) 'copy-primary-selection) diff --text -u 'xemacs-21.5.6/lisp/mule/chinese.el' 'xemacs-21.5.7/lisp/mule/chinese.el' Index: ././lisp/mule/chinese.el --- ././lisp/mule/chinese.el Sat Mar 16 19:39:05 2002 +++ ././lisp/mule/chinese.el Mon Apr 8 02:10:50 2002 @@ -326,7 +326,7 @@ (cygwin-locale "zh") (locale "zh_CN.eucCN" "zh_CN.EUC" "zh_CN" "chinese-s" "zh" - #'(lambda (arg) + (lambda (arg) (and arg (let ((case-fold-search t)) (string-match "^zh_.*.GB.*" arg))))) (mswindows-locale ("CHINESE" . "CHINESE_SIMPLIFIED")) @@ -399,7 +399,7 @@ (cygwin-locale "zh_TW") (locale "zh_TW.Big5" "zh_TW.big5" "zh_CN.big5" "zh_TW" "chinese-t" - #'(lambda (arg) + (lambda (arg) (and arg (let ((case-fold-search t)) (string-match "^zh_.*.BIG5.*" arg))))) (mswindows-locale ("CHINESE" . "CHINESE_TRADITIONAL")) diff --text -u 'xemacs-21.5.6/lisp/mule/european.el' 'xemacs-21.5.7/lisp/mule/european.el' Index: ././lisp/mule/european.el --- ././lisp/mule/european.el Sat Mar 16 19:39:06 2002 +++ ././lisp/mule/european.el Tue Jun 4 15:04:29 2002 @@ -27,7 +27,8 @@ ;;; Commentary: -;; Support six Latin coded character sets ISO8859-1,2,3,4,9,15. +;; For Europeans, six coded character sets ISO8859-1,2,3,4,9 are supported. +;; Note: ISO 8859/15 (Latin-9) is supported via the latin-unity package. ;; #### latin.el would be a better name for this file. @@ -374,7 +375,7 @@ ("Norwegian" "no" "TUTORIAL.no") ("Portuguese" "pt" nil "Bem-vindo! Tudo bem?") ("Spanish" "es" "TUTORIAL.es" ",A!(BHola!") - ("Swedish" "sv"))) + ("Swedish" "sv" "TUTORIAL.se" "Hej!"))) ((latin-iso8859-15 iso-8859-15 "latin-1-prefix" ;; #### FIXME "Latin-9" "ISO-8859-15" ("\ diff --text -u 'xemacs-21.5.6/lisp/mule/japanese.el' 'xemacs-21.5.7/lisp/mule/japanese.el' Index: ././lisp/mule/japanese.el --- ././lisp/mule/japanese.el Sat Mar 16 19:39:06 2002 +++ ././lisp/mule/japanese.el Mon Apr 8 02:10:50 2002 @@ -499,7 +499,7 @@ (native-coding-system ;; first, see if an explicit encoding was given. - #'(lambda (locale) + (lambda (locale) (let ((case-fold-search t)) (cond ;; many unix versions @@ -521,21 +521,21 @@ ))) ;; aix (CJKV p. 465) - #'(lambda (locale) + (lambda (locale) (when (eq system-type 'aix) (cond ((string-match "^Ja_JP" locale) 'shift-jis) ((string-match "^ja_JP" locale) 'euc-jp)))) ;; other X11R6 locale.alias - #'(lambda (locale) + (lambda (locale) (cond ((string-match "^Jp_JP" locale) 'euc-jp) ((and (eq system-type 'hpux) (eq locale "japanese")) 'shift-jis))) ;; fallback - 'euc-jp) + euc-jp) ;; (input-method . "japanese") (features japan-util) diff --text -u 'xemacs-21.5.6/lisp/mule/mule-charset.el' 'xemacs-21.5.7/lisp/mule/mule-charset.el' Index: ././lisp/mule/mule-charset.el --- ././lisp/mule/mule-charset.el Thu Mar 21 16:30:22 2002 +++ ././lisp/mule/mule-charset.el Sun Apr 28 15:40:33 2002 @@ -77,6 +77,7 @@ (defalias 'find-charset-string 'charsets-in-string) (defalias 'find-charset-region 'charsets-in-region) + ;;;; Charset accessors diff --text -u 'xemacs-21.5.6/lisp/mule/mule-msw-init-late.el' 'xemacs-21.5.7/lisp/mule/mule-msw-init-late.el' Index: ././lisp/mule/mule-msw-init-late.el --- ././lisp/mule/mule-msw-init-late.el Mon Mar 18 19:07:37 2002 +++ ././lisp/mule/mule-msw-init-late.el Fri Jun 21 06:18:11 2002 @@ -30,6 +30,33 @@ ;; guess we're supposed to query the font for what ranges it supports, and ;; what its preferred range is.) +(let ((l '((ascii . "Western") + (latin-iso8859-2 . "Central European") + (cyrillic-iso8859-5 . "Cyrillic") + (latin-iso8859-1 . "Western") + (greek-iso8859-7 . "Greek") + (latin-iso8859-9 . "Turkish") + (hebrew-iso8859-8 . "Hebrew") + (arabic-iso8859-6 . "Arabic") + (latin-iso8859-4 . "Baltic") + (vietnamese-viscii-lower . "Viet Nam") + (vietnamese-viscii-upper . "Viet Nam") + (thai-tis620 . "Thai") + (latin-jisx0201 . "Japanese") + (katakana-jisx0201 . "Japanese") + ;; (japanese-jisx0208-1978 . "Japanese") + (japanese-jisx0208 . "Japanese") + (japanese-jisx0212 . "Japanese") + (chinese-gb2312 . "Simplified Chinese") + (korean-ksc5601 . "Korean") + (chinese-big5-1 . "Traditional Chinese") + (chinese-big5-2 . "Traditional Chinese")))) + (while l + (let ((charset (car (car l))) + (registry (cdr (car l)))) + (mswindows-set-charset-registry charset registry) + (setq l (cdr l))))) + (let ((l '((ascii . 1252) (latin-iso8859-2 . 1250) (cyrillic-iso8859-5 . 1251) diff --text -u 'xemacs-21.5.6/lisp/mule/mule-x-init.el' 'xemacs-21.5.7/lisp/mule/mule-x-init.el' Index: ././lisp/mule/mule-x-init.el --- ././lisp/mule/mule-x-init.el Sat May 5 07:42:25 2001 +++ ././lisp/mule/mule-x-init.el Fri Jun 21 06:18:11 2002 @@ -1,6 +1,6 @@ ;;; mule-x-init.el --- initialization code for X Windows under MULE -*- coding: iso-2022-7bit; -*- ;; Copyright (C) 1994 Free Software Foundation, Inc. -;; Copyright (C) 1996 Ben Wing +;; Copyright (C) 1996, 2002 Ben Wing ;; Author: various ;; Keywords: mule X11 @@ -40,22 +40,20 @@ occupy exactly twice the screen space of ASCII (`halfwidth') characters. On many systems, e.g. Sun CDE systems, this can only be achieved by using a national variant roman font to display ASCII." - (let* ((charset-font-width - (lambda (charset) - (font-instance-width - (face-font-instance 'default (selected-device) charset)))) - - (twice-as-wide - (lambda (cs1 cs2) - (let ((width1 (funcall charset-font-width cs1)) - (width2 (funcall charset-font-width cs2))) - (and width1 width2 (eq (+ width1 width1) width2)))))) + (flet ((charset-font-width (charset) + (font-instance-width + (face-font-instance 'default (selected-device) charset))) + + (twice-as-wide (cs1 cs2) + (let ((width1 (charset-font-width cs1)) + (width2 (charset-font-width cs2))) + (and width1 width2 (eq (+ width1 width1) width2))))) (when (eq 'x (device-type)) (condition-case nil - (unless (funcall twice-as-wide 'ascii fullwidth-charset) + (unless (twice-as-wide 'ascii fullwidth-charset) (set-charset-registry 'ascii roman-registry) - (unless (funcall twice-as-wide 'ascii fullwidth-charset) + (unless (twice-as-wide 'ascii fullwidth-charset) ;; Restore if roman-registry didn't help (set-charset-registry 'ascii "iso8859-1"))) (error (set-charset-registry 'ascii "iso8859-1")))))) @@ -66,61 +64,4 @@ (defun init-mule-x-win () "Initialize X Windows for MULE at startup. Don't call this." - (when (not mule-x-win-initted) - (define-specifier-tag 'mule-fonts - (lambda (device) (eq 'x (device-type device)))) - - (set-face-font - 'default - '("-*-fixed-medium-r-*--16-*-iso8859-1" - "-*-fixed-medium-r-*--*-iso8859-1" - "-*-fixed-medium-r-*--*-iso8859-2" - "-*-fixed-medium-r-*--*-iso8859-3" - "-*-fixed-medium-r-*--*-iso8859-4" - "-*-fixed-medium-r-*--*-iso8859-7" - "-*-fixed-medium-r-*--*-iso8859-8" - "-*-fixed-medium-r-*--*-iso8859-5" - "-*-fixed-medium-r-*--*-iso8859-9" - - ;; Following 3 fonts proposed by Teruhiko.Kurosaka@Japan.eng.sun - "-sun-gothic-medium-r-normal--14-120-75-75-c-60-jisx0201.1976-0" - "-sun-gothic-medium-r-normal--14-120-75-75-c-120-jisx0208.1983-0" - "-wadalab-gothic-medium-r-normal--14-120-75-75-c-120-jisx0212.1990-0" - ;; Other Japanese fonts - "-*-fixed-medium-r-*--*-jisx0201.1976-*" - "-*-fixed-medium-r-*--*-jisx0208.1983-*" - "-*-fixed-medium-r-*--*-jisx0212*-*" - - ;; Chinese fonts - "-*-*-medium-r-*--*-gb2312.1980-*" - - ;; Use One font specification for CNS chinese - ;; Too many variations in font naming - "-*-fixed-medium-r-*--*-cns11643*-*" - ;; "-*-fixed-medium-r-*--*-cns11643*2" - ;; "-*-fixed-medium-r-*--*-cns11643*3" - ;; "-*-fixed-medium-r-*--*-cns11643*4" - ;; "-*-fixed-medium-r-*--*-cns11643.5-0" - ;; "-*-fixed-medium-r-*--*-cns11643.6-0" - ;; "-*-fixed-medium-r-*--*-cns11643.7-0" - - "-*-fixed-medium-r-*--*-big5*-*" - "-*-fixed-medium-r-*--*-sisheng_cwnn-0" - - ;; Other fonts - - ;; "-*-fixed-medium-r-*--*-viscii1.1-1" - - ;; "-*-fixed-medium-r-*--*-mulearabic-0" - ;; "-*-fixed-medium-r-*--*-mulearabic-1" - ;; "-*-fixed-medium-r-*--*-mulearabic-2" - - ;; "-*-fixed-medium-r-*--*-muleipa-1" - ;; "-*-fixed-medium-r-*--*-ethio-*" - - "-*-mincho-medium-r-*--*-ksc5601.1987-*" ; Korean - "-*-fixed-medium-r-*--*-tis620.2529-1" ; Thai - ) - 'global '(mule-fonts) 'append) - - (setq mule-x-win-initted t))) + ) diff --text -u 'xemacs-21.5.6/lisp/multicast.el' 'xemacs-21.5.7/lisp/multicast.el' Index: ././lisp/multicast.el --- ././lisp/multicast.el Sat May 5 07:42:12 2001 +++ ././lisp/multicast.el Tue May 28 17:44:30 2002 @@ -1,6 +1,7 @@ ;;; multicast.el --- lisp frontend for multicast connections in XEmacs ;; Copyright (C) 1997-2000 Didier Verna. +;; Copyright (C) 2002 Ben Wing. ;; Author: Didier Verna ;; Maintainer: Didier Verna @@ -47,13 +48,12 @@ "Open a multicast connection on the specified address. Returns a process object to represent the connection. Input and output work as for subprocesses; `delete-process' closes it. -Args are NAME BUFFER ADDRESS. NAME is a name for the process. It is modified if necessary to make it unique. BUFFER is the buffer (or buffer-name) to associate with the process. Process output goes at the end of that buffer, unless you specify an output stream or filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated with any - buffer + buffer. ADDRESS specifies a standard multicast address \"dest/port/ttl\": dest is an internet address between 224.0.0.0 and 239.255.255.255 port is a communication port like in traditional unicast @@ -61,7 +61,28 @@ WARNING: it is *strongly* recommended to avoid using groups beginning with 224 or 239. Such groups are considered 'admin' groups, and may - behave in a surprising way ..." + behave in a surprising way ... + +The read/write coding systems used for process I/O on the process are +determined as follows: + +1. `coding-system-for-read', `coding-system-for-write', if non-nil. + (Intended as a temporary overriding mechanism for use by Lisp + code.) +2. The matching value for the port from `network-coding-system-alist', + if any, and if non-nil. The value may be either a single coding + system, used for both read and write; or a cons of read/write; or a + function, called to get one of the other two values. +3. The value of `default-network-coding-system', which should be a cons + of read/write coding systems, if the values are non-nil. +4. The coding system `undecided' for read, and `raw-text' for write. + +Note that the processes of determining the read and write coding systems +proceed essentially independently one from the other, as in `start-process'. + +You can change the coding systems later on using +`set-process-coding-system', `set-process-input-coding-system', or +`set-process-output-coding-system'." (let (dest port ttl) ;; We check only the general form of the multicast address. ;; The rest will be handled by the internal function. @@ -75,7 +96,44 @@ (error "invalid port specification.")) (and (= 0 (setq ttl (string-to-int (match-string 3 address)))) (error "invalid ttl specification.")) - (declare-fboundp (open-multicast-group-internal name buffer dest port ttl)) - )) + (let (cs-r cs-w) + (let (ret) + (catch 'found + (let ((alist network-coding-system-alist) + (case-fold-search nil) + pattern) + (while alist + (setq pattern (car (car alist))) + (and + (cond ((numberp pattern) + (and (numberp port) + (eq pattern port))) + ((stringp pattern) + (or (and (stringp port) + (string-match pattern port)) + (and (numberp port) + (string-match pattern + (number-to-string port)))))) + (throw 'found (setq ret (cdr (car alist))))) + (setq alist (cdr alist)) + ))) + (if (functionp ret) + (setq ret (funcall ret 'open-multicast-group port))) + (cond ((consp ret) + (setq cs-r (car ret) + cs-w (cdr ret))) + ((and ret (find-coding-system ret)) + (setq cs-r ret + cs-w ret)))) + (let ((coding-system-for-read + (or coding-system-for-read cs-r + (car default-network-coding-system) + 'undecided)) + (coding-system-for-write + (or coding-system-for-write cs-w + (cdr default-network-coding-system) + 'raw-text))) + (declare-fboundp (open-multicast-group-internal name buffer dest port + ttl)))))) ;;; multicast.el ends here diff --text -u 'xemacs-21.5.6/lisp/obsolete.el' 'xemacs-21.5.7/lisp/obsolete.el' Index: ././lisp/obsolete.el --- ././lisp/obsolete.el Fri Mar 15 20:00:28 2002 +++ ././lisp/obsolete.el Wed Jun 26 09:11:16 2002 @@ -148,6 +148,12 @@ ;; future. (destructive-plist-to-alist (frame-properties frame))) +(make-compatible 'frame-parameter 'frame-property) +(defun frame-parameter (frame parameter) + "Return FRAME's value for parameter PARAMETER. +If FRAME is nil, describe the currently selected frame." + (cdr (assq parameter (frame-parameters frame)))) + (make-compatible 'modify-frame-parameters 'set-frame-properties) (defun modify-frame-parameters (frame alist) "Modify the properties of frame FRAME according to ALIST. @@ -259,7 +265,26 @@ (make-obsolete-variable 'executing-macro 'executing-kbd-macro) (define-compatible-function-alias 'interactive-form - 'function-interactive) ;FSFmacs 21.1 + 'function-interactive) ;GNU 21.1 +(define-compatible-function-alias 'assq-delete-all + 'remassq) ;GNU 21.1 + +(defun makehash (&optional test) + "Create a new hash table. +Optional first argument TEST specifies how to compare keys in the table. +Predefined tests are `eq', `eql', and `equal'. Default is `eql'." + (make-hash-table :test test)) +(make-compatible 'makehash 'make-hash-table) + +(defun buffer-local-value (variable buffer) + "Return the value of VARIABLE in BUFFER. +If VARIABLE does not have a buffer-local binding in BUFFER, the value +is the default binding of variable." + (symbol-value-in-buffer variable buffer)) +(make-compatible 'buffer-local-value 'symbol-value-in-buffer) + +(define-compatible-function-alias 'line-beginning-position 'point-at-bol) +(define-compatible-function-alias 'line-end-position 'point-at-eol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;; modeline @@ -308,6 +333,22 @@ It always returns 1 in XEmacs, and in recent FSF Emacs versions." 1) (make-obsolete 'char-bytes "This function always returns 1") + +(defun find-non-ascii-charset-string (string) + "Return a list of charsets in the STRING except ascii. +It might be available for compatibility with Mule 2.3, +because its `find-charset-string' ignores ASCII charset." + (delq 'ascii (charsets-in-string string))) +(make-obsolete 'find-non-ascii-charset-string + "use (delq 'ascii (charsets-in-string STRING)) instead.") + +(defun find-non-ascii-charset-region (start end) + "Return a list of charsets except ascii in the region between START and END. +It might be available for compatibility with Mule 2.3, +because its `find-charset-string' ignores ASCII charset." + (delq 'ascii (charsets-in-region start end))) +(make-obsolete 'find-non-ascii-charset-region + "use (delq 'ascii (charsets-in-region START END)) instead.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;; window-system objects diff --text -u 'xemacs-21.5.6/lisp/package-get.el' 'xemacs-21.5.7/lisp/package-get.el' Index: ././lisp/package-get.el --- ././lisp/package-get.el Fri Mar 29 13:46:35 2002 +++ ././lisp/package-get.el Thu May 2 23:35:32 2002 @@ -337,8 +337,7 @@ (let ((existing (assq (car entry) package-get-base))) (if existing (setcdr existing (cdr entry)) - (setq package-get-base (cons entry package-get-base)) - (package-get-custom-add-entry (car entry) (car (cdr entry)))))) + (setq package-get-base (cons entry package-get-base))))) (defun package-get-locate-file (file &optional nil-if-not-found no-remote) "Locate an existing FILE with respect to `package-get-remote'. @@ -764,11 +763,9 @@ (string-to-number latest) latest)) (if (not (null version)) - (lwarn 'packages - "Installing %s package version %s, you had a newer version %s" + (warn "Installing %s package version %s, you had a newer version %s" package latest installed) - (lwarn 'packages - "Skipping %s package, you have a newer version %s" + (warn "Skipping %s package, you have a newer version %s" package installed) (throw 'skip-update t)))) @@ -1044,26 +1041,6 @@ (message "No appropriate package found"))) found)) -;; -;; customize interfaces. -;; The group is in this file so that custom loads includes this file. -;; -(defgroup packages nil - "Configure XEmacs packages." - :group 'emacs) - -;;;###autoload -(defun package-get-custom () - "Fetch and install the latest versions of all customized packages." - (interactive) - (package-get-require-base t) - (mapcar (lambda (pkg) - (if (eval (intern (concat (symbol-name (car pkg)) "-package"))) - (package-get (car pkg) nil)) - t) - package-get-base) - (package-net-update-installed-db)) - (defun package-get-ever-installed-p (pkg &optional notused) (string-match "-package$" (symbol-name pkg)) (custom-initialize-set @@ -1072,26 +1049,6 @@ packages-package-list (intern (substring (symbol-name pkg) 0 (match-beginning 0)))) t))) - -(defvar package-get-custom-groups nil - "List of package-get-custom groups") - -(defun package-get-custom-add-entry (package props) - (let* ((category (plist-get props 'category)) - (group (intern (concat category "-packages"))) - (custom-var (intern (concat (symbol-name package) "-package"))) - (description (plist-get props 'description))) - (when (not (memq group package-get-custom-groups)) - (setq package-get-custom-groups (cons group - package-get-custom-groups)) - (eval `(defgroup ,group nil - ,(concat category " package group") - :group 'packages))) - (eval `(defcustom ,custom-var nil - ,description - :group ',group - :initialize 'package-get-ever-installed-p - :type 'boolean)))) (provide 'package-get) diff --text -u 'xemacs-21.5.6/lisp/package-ui.el' 'xemacs-21.5.7/lisp/package-ui.el' Index: ././lisp/package-ui.el --- ././lisp/package-ui.el Sun Jul 1 08:07:06 2001 +++ ././lisp/package-ui.el Sat May 25 10:55:30 2002 @@ -488,7 +488,7 @@ "Display additional package info in the modeline. EXTENT determines the package to display (the package information is attached to the extent as properties)." - (let (pkg-sym info inst-ver auth-ver date maintainer) + (let (pkg-sym info inst-ver auth-ver date maintainer balloon req) (if (or force-update (not (current-message)) (string-match ".*: .*: " (current-message)) ) @@ -498,14 +498,29 @@ inst-ver (package-get-key pkg-sym :version) auth-ver (package-get-info-prop info 'author-version) date (package-get-info-prop info 'date) - maintainer (package-get-info-prop info 'maintainer)) + maintainer (package-get-info-prop info 'maintainer) + req (package-get-info-prop info 'requires)) (if (not inst-ver) - (setq inst-ver "")) + (setq inst-ver 0)) + (if (featurep 'balloon-help) + (progn + (setq balloon (format " +Package Information: [For package: \"%s\"] +================ +Installed Version : %.2f +Author Version : %s +Maintainer : %s +Released : %s +Required Packages : %s\n\n" + pkg-sym inst-ver auth-ver maintainer + date req)) + (set-extent-property extent 'balloon-help balloon))) (if pui-list-verbose - (format "Author version: %-8s %11s: %s" - auth-ver date maintainer) - (format "%-6s: %-8s %11s: %s" - inst-ver auth-ver date maintainer)) + (format + "Inst V: %.2f Auth V: %s Maint: %s" + inst-ver auth-ver maintainer) + (format "%.2f : %s : %s" + inst-ver auth-ver maintainer)) )) )) diff --text -u /dev/null 'xemacs-21.5.7/lisp/post-gc.el' Index: ././lisp/post-gc.el --- ././lisp/post-gc.el Thu Jan 1 09:00:00 1970 +++ ././lisp/post-gc.el Fri Jun 28 23:20:42 2002 @@ -0,0 +1,49 @@ +;;; post-gc.el --- post-gc actions + +;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc. +;; Copyright (c) 1993, 1994 Sun Microsystems, Inc. +;; Copyright (C) 1995 Board of Trustees, University of Illinois + +;; Author: Mike Sperber +;; Maintainer: XEmacs Development Team +;; Keywords: internal, dumped + +;; 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 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, 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Synched up with: Not in FSF. + +;;; Commentary: + +;; This file is dumped with XEmacs. + +;; This file defines actions to happen after each GC to perform +;; additional cleanup, call finalizers, etc. + +(defun run-finalizers (alist) + "Run the finalizers for all objects that have just become unreachable." + (let ((info (assq 'finalize-list alist))) + (if info + (let ((finalize-list (cdr info))) + (while finalize-list + (funcall (cdr (car finalize-list)) (car (car finalize-list))) + (setq finalize-list (cdr finalize-list))))))) + +(add-hook 'post-gc-hook 'run-finalizers) + + + diff --text -u 'xemacs-21.5.6/lisp/process.el' 'xemacs-21.5.7/lisp/process.el' Index: ././lisp/process.el --- ././lisp/process.el Fri Mar 15 16:43:21 2002 +++ ././lisp/process.el Mon Jun 3 21:23:56 2002 @@ -1,7 +1,7 @@ ;;; process.el --- commands for subprocesses; split out of simple.el ;; Copyright (C) 1985-7, 1993,4, 1997 Free Software Foundation, Inc. -;; Copyright (C) 1995, 2000, 2001 Ben Wing. +;; Copyright (C) 1995, 2000, 2001, 2002 Ben Wing. ;; Author: Ben Wing ;; Maintainer: XEmacs Development Team @@ -61,7 +61,6 @@ (defun start-process-shell-command (name buffer &rest args) "Start a program in a subprocess. Return the process object for it. -Args are NAME BUFFER COMMAND &rest COMMAND-ARGS. NAME is name for process. It is modified if necessary to make it unique. BUFFER is the buffer or (buffer-name) to associate with the process. Process output goes at end of that buffer, unless you specify @@ -76,162 +75,246 @@ (start-process name buffer shell-file-name shell-command-switch (mapconcat #'identity args " "))) -(defun call-process-internal (program &optional infile buffer display &rest args) - "Call PROGRAM synchronously in separate process, with coding-system specified. -Arguments are - (PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS). -The program's input comes from file INFILE (nil means `/dev/null'). -Insert output in BUFFER before point; t means current buffer; - nil for BUFFER means discard it; 0 means discard and don't wait. -BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, -REAL-BUFFER says what to do with standard output, as above, -while STDERR-FILE says what to do with standard error in the child. -STDERR-FILE may be nil (discard standard error output), -t (mix it with ordinary output), or a file name string. - -Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted. -Remaining arguments are strings passed as command arguments to PROGRAM. +(defun process-synchronize-point (proc) + "Set the point(s) in buffer and stderr-buffer according to the process mark." + ;; We need this because the documentation says to insert *BEFORE* point, + ;; but we end up inserting after because only the process mark moves + ;; forward, not point. We synchronize after every place output might + ;; happen, in sentinels, and in an unwind-protect, to make *SURE* that + ;; point is correct. (We could do this more easily and perhaps more + ;; safely using a process filter, but that would create a LOT of garbage + ;; since all the data would get sent in strings.) We make this a separate + ;; function, not an flet, due to dynamic binding problems -- the flet may + ;; not still be in scope when the sentinel is called. + (let ((pb (process-buffer proc)) + (pm (process-mark proc))) + (if (and pb (buffer-live-p pb) (marker-buffer pm)) + (goto-char pm pb)) + (if (process-has-separate-stderr-p proc) + (let ((pseb (process-stderr-buffer proc)) + (psem (process-stderr-mark proc))) + (if (and pseb (not (eq pb pseb)) + (buffer-live-p pseb) + (marker-buffer psem)) + (goto-char psem pseb)))))) + +(defun call-process-internal (program &optional infile buffer display + &rest args) + "Internal function to call PROGRAM synchronously in separate process. +Lisp callers should use `call-process' or `call-process-region'. -If BUFFER is 0, `call-process' returns immediately with value nil. -Otherwise it waits for PROGRAM to terminate and returns a numeric exit status - or a signal description string. -If you quit, the process is killed with SIGINT, or SIGKILL if you - quit again." - ;; #### remove windows-nt check when this is ready for prime time. - (if (or (noninteractive) (not (eq 'windows-nt system-type))) - (apply 'old-call-process-internal program infile buffer display args) - (let (proc inbuf errbuf discard) - (unwind-protect - (progn - (when infile - (setq infile (expand-file-name infile)) - (setq inbuf (generate-new-buffer "*call-process*")) - (with-current-buffer inbuf - ;; Make sure this works with jka-compr - (let ((file-name-handler-alist nil)) - (insert-file-contents-internal infile nil nil nil nil - 'binary)))) - (let ((stderr (if (consp buffer) (second buffer) t))) - (if (consp buffer) (setq buffer (car buffer))) - (setq buffer - (cond ((null buffer) nil) - ((eq buffer t) (current-buffer)) - ;; use integerp for compatibility with existing - ;; call-process rmsism. - ((integerp buffer) (setq discard t) nil) - (t (get-buffer-create buffer)))) - (when (and stderr (not (eq t stderr))) - (setq stderr (expand-file-name stderr)) - (setq errbuf (generate-new-buffer "*call-process*"))) - (setq proc - (apply 'start-process-internal "*call-process*" - buffer - ;#### not implemented until my new process - ;changes go in. - ;(if (eq t stderr) buffer (list buffer errbuf)) - program args)) - (if buffer - (set-marker (process-mark proc) (point buffer) buffer)) - (unwind-protect - (prog1 - (catch 'call-process-done - (when (not discard) - (set-process-sentinel - proc - #'(lambda (proc status) - (cond ((eq 'exit (process-status proc)) - (set-process-sentinel proc nil) - (throw 'call-process-done - (process-exit-status proc))) - ((eq 'signal (process-status proc)) - (set-process-sentinel proc nil) - (throw 'call-process-done status)))))) - (when inbuf - (process-send-region proc 1 - (1+ (buffer-size inbuf)) inbuf)) - (process-send-eof proc) - (when discard - ;; we're trying really really hard to emulate - ;; the old call-process. - (if errbuf - (set-process-sentinel - proc - `(lambda (proc status) - (write-region-internal - 1 (1+ (buffer-size)) - ,stderr - nil 'major-rms-kludge-city nil - coding-system-for-write)))) - (setq errbuf nil) - (setq proc nil) - (throw 'call-process-done nil)) - (while t - (accept-process-output proc) - (if display (sit-for 0)))) - (when errbuf - (with-current-buffer errbuf - (write-region-internal 1 (1+ (buffer-size)) stderr - nil 'major-rms-kludge-city nil - coding-system-for-write)))) - (if proc (set-process-sentinel proc nil))))) - (if inbuf (kill-buffer inbuf)) - (if errbuf (kill-buffer errbuf)) - (condition-case nil - (if (and proc (process-live-p proc)) (kill-process proc)) - (error nil)))))) - -(defun call-process (program &optional infile buffer displayp &rest args) - "Call PROGRAM synchronously in separate process. The program's input comes from file INFILE (nil means `/dev/null'). -Insert output in BUFFER before point; t means current buffer; - nil for BUFFER means discard it; 0 means discard and don't wait. -BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, -REAL-BUFFER says what to do with standard output, as above, -while STDERR-FILE says what to do with standard error in the child. -STDERR-FILE may be nil (discard standard error output), -t (mix it with ordinary output), or a file name string. - -Fourth arg DISPLAYP non-nil means redisplay buffer as output is inserted. -Remaining arguments are strings passed as command arguments to PROGRAM. - -If BUFFER is 0, `call-process' returns immediately with value nil. -Otherwise it waits for PROGRAM to terminate and returns a numeric exit status - or a signal description string. -If you quit, the process is killed with SIGINT, or SIGKILL if you - quit again." - (apply 'call-process-internal program infile buffer displayp args)) - -(defun call-process-region (start end program - &optional deletep buffer displayp - &rest args) - "Send text from START to END to a synchronous process running PROGRAM. -Delete the text if fourth arg DELETEP is non-nil. +XEmacs feature: INFILE can also be a list of (BUFFER [START [END]]), i.e. +a list of one to three elements, consisting of a buffer and optionally +a start position or start and end position. In this case, input comes +from the buffer, starting from START (defaults to the beginning of the +buffer) and ending at END (defaults to the end of the buffer). Insert output in BUFFER before point; t means current buffer; nil for BUFFER means discard it; 0 means discard and don't wait. +If BUFFER is a string, then find or create a buffer with that name, +then insert the output in that buffer, before point. BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, REAL-BUFFER says what to do with standard output, as above, while STDERR-FILE says what to do with standard error in the child. STDERR-FILE may be nil (discard standard error output), -t (mix it with ordinary output), or a file name string. +t (mix it with ordinary output), a file name string, or (XEmacs feature) +a buffer object. If STDERR-FILE is a buffer object (but not the name of +a buffer, since that would be interpreted as a file), the standard error +output will be inserted into the buffer before point. -Sixth arg DISPLAYP non-nil means redisplay buffer as output is inserted. -Remaining args are passed to PROGRAM at startup as command args. +Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted. +Remaining arguments are strings passed as command arguments to PROGRAM. If BUFFER is 0, returns immediately with value nil. -Otherwise waits for PROGRAM to terminate -and returns a numeric exit status or a signal description string. -If you quit, the process is first killed with SIGINT, then with SIGKILL if -you quit again before the process exits." - (let ((temp - (make-temp-name - (concat (file-name-as-directory (temp-directory)) "emacs")))) +Otherwise waits for PROGRAM to terminate and returns a numeric exit status +or a signal description string. If you quit, the process is first killed +with SIGINT, then with SIGKILL if you quit again before the process exits. + +Coding systems for the process are the same as for `start-process-internal'." + (let (proc inbuf errbuf kill-inbuf kill-errbuf no-wait start end) + ;; first set up an unwind-protect to clean everything up. this will: + ;; + ;; -- kill the process. (when we're not waiting for it to finish, we + ;; set PROC to nil when we're ready to exit so this doesn't happen -- + ;; if we're interrupted before we're ready to exit, we should still + ;; kill the process) + ;; -- kill temporary buffers created to handle I/O to or from a file. + ;; KILL-INBUF/KILL-ERRBUF tell us if we should do so. + ;; + ;; note that we need to be *very* careful in this code to handle C-g + ;; at any point. (unwind-protect (progn - (write-region start end temp nil 'silent) - (if deletep (delete-region start end)) - (apply #'call-process program temp buffer displayp args)) - (ignore-file-errors (delete-file temp))))) + ;; first handle INFILE. + (cond ((stringp infile) + (setq infile (expand-file-name infile)) + (setq kill-inbuf t) + (setq inbuf (generate-new-buffer "*call-process*")) + ;; transfer the exact contents of the file to the process. + ;; we do that by reading in and writing out in + ;; binary. #### is this even correct? should we be doing + ;; the same thing with stderr? if so we'd need a way of + ;; controlling the stderr coding system separate from + ;; everything else. + (with-current-buffer inbuf + ;; Make sure this works with jka-compr + (let ((file-name-handler-alist nil)) + (insert-file-contents-internal infile nil nil nil nil + 'binary)) + (setq start (point-min) end (point-max)))) + ((consp infile) + (setq inbuf (get-buffer (car infile))) + (setq start (or (nth 1 infile) (point-min inbuf))) + (setq end (or (nth 2 infile) (point-max inbuf)))) + ((null infile) nil) + (t + (error 'wrong-type-argument + "Must be filename or (BUFFER [START [END]])" + infile))) + ;; now handle BUFFER + (let ((stderr (if (consp buffer) (second buffer) t))) + (if (consp buffer) (setq buffer (car buffer))) + (setq buffer + (cond ((null buffer) nil) + ((eq buffer t) (current-buffer)) + ;; use integerp for compatibility with existing + ;; call-process rmsism. + ((integerp buffer) (setq no-wait t) nil) + (t (get-buffer-create buffer)))) + (when (and stderr (not (eq t stderr))) + ;; both ERRBUF and STDERR being non-nil indicates to the + ;; code below that STDERR is a file and we should write + ;; ERRBUF to it; so clear out STDERR if we don't want this. + (if (bufferp stderr) (setq errbuf stderr stderr nil) + (setq stderr (expand-file-name stderr)) + (setq kill-errbuf t) + (setq errbuf (generate-new-buffer "*call-process*")))) + ;; now start process. using a pty causes all sorts of + ;; weirdness, at least under cygwin, when there's input. #### i + ;; don't know what's going wrong and whether it's a cygwin-only + ;; problem. suffice to say that there were NO pty connections + ;; in the old version. + (let ((process-connection-type nil)) + (setq proc + (apply 'start-process-internal "*call-process*" + (if (eq t stderr) buffer (list buffer errbuf)) + program args))) + ;; see comment above where the data was read from the file. + (if kill-inbuf + (set-process-output-coding-system proc 'binary)) + ;; point mark/stderr-mark at the right place (by default it's + ;; end of buffer). + (if buffer + (set-marker (process-mark proc) (point buffer) buffer)) + (if errbuf + (set-marker (process-stderr-mark proc) (point errbuf) errbuf)) + ;; now do I/O, very carefully! the unwind-protect makes sure + ;; to clear out the sentinel, since it does a `throw', which + ;; would have no catch (or writes to a file -- we only want + ;; this on normal exit) + (unwind-protect + ;; if not NO-WAIT, set a sentinel to return the exit + ;; status. it will throw to this catch so we can exit + ;; properly. + (catch 'call-process-done + (set-process-sentinel + proc + (cond + ((and no-wait errbuf stderr) + ;; we're trying really really hard to emulate + ;; the old call-process, which would save the + ;; stderr to a file even if discarding output. so + ;; we set a sentinel to save the output when + ;; we finish. + ;; + ;; #### not clear if we should be doing this. + ;; + ;; NOTE NOTE NOTE: Due to the total bogosity of + ;; dynamic scoping, and the lack of closures, we + ;; have to be careful how we write the first + ;; sentinel below since it may be executed after + ;; this function has returned -- thus we fake a + ;; closure. (This doesn't apply to the second one, + ;; which only gets executed within the + ;; unwind-protect.) + `(lambda (proc status) + (set-process-sentinel proc nil) + (process-synchronize-point proc) + (with-current-buffer ,errbuf + (write-region-internal + 1 (1+ (buffer-size)) + ,stderr + nil 'major-rms-kludge-city nil + coding-system-for-write)) + (kill-buffer ,errbuf))) + (no-wait nil) + (t + ;; normal sentinel: maybe write out stderr and return + ;; status. + #'(lambda (proc status) + (process-synchronize-point proc) + (when (and errbuf stderr) + (with-current-buffer errbuf + (write-region-internal + 1 (1+ (buffer-size)) stderr + nil 'major-rms-kludge-city nil + coding-system-for-write))) + (cond ((eq 'exit (process-status proc)) + (set-process-sentinel proc nil) + (throw 'call-process-done + (process-exit-status proc))) + ((eq 'signal (process-status proc)) + (set-process-sentinel proc nil) + (throw 'call-process-done status))))))) + (if (not no-wait) + ;; we're waiting. send the input and loop forever, + ;; handling process output and maybe redisplaying. + ;; exit happens through the sentinel or C-g. if + ;; C-g, send SIGINT the first time, EOF if not + ;; already done so (might make the process exit), + ;; and keep waiting. Another C-g will exit the + ;; whole function, and the unwind-protect will + ;; kill the process. (Hence the documented semantics + ;; of SIGINT/SIGKILL.) + (let (eof-sent) + (condition-case nil + (progn + (when inbuf + (process-send-region proc start end inbuf)) + (process-send-eof proc) + (setq eof-sent t) + (while t + (accept-process-output proc) + (process-synchronize-point proc) + (if display (sit-for 0)))) + (quit + (process-send-signal 'SIGINT proc) + (unless eof-sent + (process-send-eof proc)) + (while t + (accept-process-output proc) + (process-synchronize-point proc) + (if display (sit-for 0)))))) + ;; discard and no wait: send the input, set PROC + ;; and ERRBUF to nil so that the unwind-protect + ;; forms don't erase the sentinel, kill the process, + ;; or kill ERRBUF (the sentinel does that), and exit. + (when inbuf + (process-send-region proc start end inbuf)) + (process-send-eof proc) + (setq errbuf nil) + (setq proc nil))) + ;; inner unwind-protect, once we're ready to do I/O. + (when proc + (set-process-sentinel proc nil) + (process-synchronize-point proc))))) + ;; outer unwind-protect forms, to make sure we always clean up. + (if (and inbuf kill-inbuf) (kill-buffer inbuf)) + (if (and errbuf kill-errbuf) (kill-buffer errbuf)) + (condition-case nil + (if (and proc (process-live-p proc)) (kill-process proc)) + (error nil))))) (defun shell-command (command &optional output-buffer) @@ -396,46 +479,6 @@ (point)))))) (t (set-window-start (display-buffer buffer) 1)))))))) - - -(defun start-process (name buffer program &rest program-args) - "Start a program in a subprocess. Return the process object for it. -Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS -NAME is name for process. It is modified if necessary to make it unique. -BUFFER is the buffer or (buffer-name) to associate with the process. - Process output goes at end of that buffer, unless you specify - an output stream or filter function to handle the output. - BUFFER may be also nil, meaning that this process is not associated - with any buffer -Third arg is program file name. It is searched for as in the shell. -Remaining arguments are strings to give program as arguments." - (apply 'start-process-internal name buffer program program-args)) - -(defun open-network-stream (name buffer host service &optional protocol) - "Open a TCP connection for a service to a host. -Returns a process object to represent the connection. -Input and output work as for subprocesses; `delete-process' closes it. -Args are NAME BUFFER HOST SERVICE. -NAME is name for process. It is modified if necessary to make it unique. -BUFFER is the buffer (or buffer-name) to associate with the process. - Process output goes at end of that buffer, unless you specify - an output stream or filter function to handle the output. - BUFFER may be also nil, meaning that this process is not associated - with any buffer -Third arg is name of the host to connect to, or its IP address. -Fourth arg SERVICE is name of the service desired, or an integer - specifying a port number to connect to. -Fifth argument PROTOCOL is a network protocol. Currently 'tcp - (Transmission Control Protocol) and 'udp (User Datagram Protocol) are - supported. When omitted, 'tcp is assumed. - -Output via `process-send-string' and input via buffer or filter (see -`set-process-filter') are stream-oriented. That means UDP datagrams are -not guaranteed to be sent and received in discrete packets. (But small -datagrams around 500 bytes that are not truncated by `process-send-string' -are usually fine.) Note further that UDP protocol does not guard against -lost packets." - (open-network-stream-internal name buffer host service protocol)) (defun shell-quote-argument (argument) "Quote an argument for passing as argument to an inferior shell." diff --text -u 'xemacs-21.5.6/lisp/select.el' 'xemacs-21.5.7/lisp/select.el' Index: ././lisp/select.el --- ././lisp/select.el Wed Mar 13 17:52:08 2002 +++ ././lisp/select.el Thu May 23 20:46:10 2002 @@ -3,6 +3,7 @@ ;; Copyright (C) 1998 Andy Piper. ;; Copyright (C) 1990, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1995 Sun Microsystems. +;; Copyright (C) 2002 Ben Wing. ;; Maintainer: XEmacs Development Team ;; Keywords: extensions, dumped @@ -46,13 +47,19 @@ set the clipboard.") (defun copy-primary-selection () - "Copy the selection to the Clipboard and the kill ring." + "Copy the selection to the Clipboard and the kill ring. +This is similar to the command \\[kill-ring-save] except that it will +save to the Clipboard even if that command doesn't, and it handles rectangles +properly." (interactive) (and (console-on-window-system-p) (cut-copy-clear-internal 'copy))) (defun kill-primary-selection () - "Copy the selection to the Clipboard and the kill ring, then delete it." + "Copy the selection to the Clipboard and the kill ring, then deleted it. +This is similar to the command \\[kill-region] except that it will +save to the Clipboard even if that command doesn't, and it handles rectangles +properly." (interactive "*") (and (console-on-window-system-p) (cut-copy-clear-internal 'cut))) @@ -75,9 +82,15 @@ (insert clip)))) (defun get-clipboard () - "Return text pasted to the clipboard." + "Return text pasted to the clipboard. +Not suitable for `interprogram-paste-function', use `get-clipboard-foreign'." (get-selection 'CLIPBOARD)) +(defun get-clipboard-foreign () + "Return text pasted to the clipboard by another program. +See `interprogram-paste-function' for more information." + (get-selection-foreign 'CLIPBOARD)) + (define-device-method get-cutbuffer "Return the value of one of the cut buffers. This will do nothing under anything other than X.") @@ -93,19 +106,27 @@ "Return the value of a window-system selection. The argument TYPE (default `PRIMARY') says which selection, and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule) -says how to convert the data. If there is no selection an error is signalled." +says how to convert the data. If there is no selection an error is signalled. +Not suitable in a `interprogram-paste-function', q.v." (or type (setq type 'PRIMARY)) (or data-type (setq data-type selected-text-type)) - (let ((text - (if (consp data-type) - (condition-case err - (get-selection-internal type (car data-type)) - (selection-conversion-error - (if (cdr data-type) - (get-selection type (cdr data-type)) - (signal (car err) (cdr err))))) - (get-selection-internal type data-type)))) - text)) + (if (consp data-type) + (condition-case err + (get-selection-internal type (car data-type)) + (selection-conversion-error + (if (cdr data-type) + (get-selection type (cdr data-type)) + (signal (car err) (cdr err))))) + (get-selection-internal type data-type))) + +(defun get-selection-foreign (&optional type data-type) + "Return the value of a window-system selection, or nil if XEmacs owns it. +The argument TYPE (default `PRIMARY') says which selection, +and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule) +says how to convert the data. If there is no selection an error is signalled. +See `interprogram-paste-function' for more information." + (unless (selection-owner-p type) + (get-selection type data-type))) ;; FSFmacs calls this `x-set-selection', and reverses the ;; first two arguments (duh ...). This order is more logical. @@ -116,7 +137,7 @@ that can be converted using the function corresponding to DATA-TYPE in `select-converter-alist'---strings are the usual choice, but other types may be permissible depending on the DATA-TYPE parameter -(if DATA-TYPE is not supplied, the default behavior is window +\(if DATA-TYPE is not supplied, the default behavior is window system specific, but strings are always accepted). HOW-TO-ADD may be any of the following: @@ -125,7 +146,7 @@ 'append or t -- append data to existing DATA-TYPE data. DATA-TYPE is the window-system specific data type identifier -(see `register-selection-data-type' for more information). +\(see `register-selection-data-type' for more information). The selection may also be a cons of two markers pointing to the same buffer, or an overlay. In these cases, the selection is considered to be the text @@ -341,8 +362,7 @@ (cond ((memq mode '(cut copy)) (if rect-p (progn - ;; why is killed-rectangle free? Is it used somewhere? - ;; should it be defvarred? + ;; killed-rectangle is defvarred in rect.el (setq killed-rectangle (extract-rectangle s e)) (kill-new (mapconcat #'identity killed-rectangle "\n"))) (copy-region-as-kill s e)) @@ -351,6 +371,7 @@ ;; some other way, but owning the clipboard twice in that case ;; wouldn't actually hurt anything. (or (and (consp kill-hooks) (memq 'own-clipboard kill-hooks)) + (eq 'own-clipboard interprogram-cut-function) (own-clipboard (car kill-ring))))) (cond ((memq mode '(cut clear)) (if rect-p diff --text -u 'xemacs-21.5.6/lisp/simple.el' 'xemacs-21.5.7/lisp/simple.el' Index: ././lisp/simple.el --- ././lisp/simple.el Mon Apr 1 12:58:09 2002 +++ ././lisp/simple.el Thu May 16 22:30:58 2002 @@ -959,6 +959,14 @@ (setq pending-undo-list (primitive-undo count pending-undo-list) last-undo-buffer (current-buffer))) ; XEmacs +(defun undo-all-changes () + "Keep undoing till the start of the undo list is reached. +Undoes all changes, even past a file save. Especially useful when you've +saved the file at some point." + (interactive) + (undo-start) + (while pending-undo-list (undo-more 1))) + ;; XEmacs (defun call-with-transparent-undo (fn &rest args) "Apply FN to ARGS, and then undo all changes made by FN to the current @@ -1224,7 +1232,9 @@ The first argument, TEXT, is a string containing the text which should be made available. The second, PUSH, if non-nil means this is a \"new\" kill; -nil means appending to an \"old\" kill." +nil means appending to an \"old\" kill. + +One reasonable choice is `own-clipboard' (the default)." :type '(radio (function-item :tag "Send to Clipboard" :format "%t\n" own-clipboard) @@ -1232,7 +1242,7 @@ (function :tag "Other")) :group 'killing) -(defcustom interprogram-paste-function 'get-clipboard +(defcustom interprogram-paste-function 'get-clipboard-foreign "Function to call to get text cut from other programs. Most window systems provide some sort of facility for cutting and @@ -1250,10 +1260,13 @@ most recent string, the function should return nil. If it is difficult to tell whether Emacs or some other program provided the current string, it is probably good enough to return nil if the string -is equal (according to `string=') to the last text Emacs provided." +is equal (according to `string=') to the last text Emacs provided. + +Reasonable choices include `get-clipboard-foreign' (the default), and +functions calling `get-selection-foreign' (q.v.)." :type '(radio (function-item :tag "Get from Clipboard" :format "%t\n" - get-clipboard) + get-clipboard-foreign) (const :tag "None" nil) (function :tag "Other")) :group 'killing) @@ -1271,7 +1284,7 @@ interaction; you may want to use them instead of manipulating the kill ring directly.") -(defcustom kill-ring-max 30 +(defcustom kill-ring-max 60 "*Maximum length of kill ring before oldest elements are thrown away." :type 'integer :group 'killing) @@ -1282,12 +1295,13 @@ (defun kill-new (string &optional replace) "Make STRING the latest kill in the kill ring. Set `kill-ring-yank-pointer' to point to it. +If `interprogram-cut-function' is non-nil, apply it to STRING. Run `kill-hooks'. Optional second argument REPLACE non-nil means that STRING will replace the front of the kill ring, rather than being added to the list." ; (and (fboundp 'menu-bar-update-yank-menu) ; (menu-bar-update-yank-menu string (and replace (car kill-ring)))) - (if replace + (if (and replace kill-ring) (setcar kill-ring string) (setq kill-ring (cons string kill-ring)) (if (> (length kill-ring) kill-ring-max) @@ -2976,11 +2990,21 @@ (interactive "p") (mark-something 'mark-word 'forward-word count)) +(defcustom kill-word-into-kill-ring t + "*Non-nil means `kill-word' saves word killed into kill ring. +\(Normally, this also affects the clipboard.) +Nil means word is just deleted, without being remembered. +This also applies to `backward-kill-word' and `backward-or-forward-kill-word'." + :type 'boolean + :group 'editing-basics) + (defun kill-word (&optional count) "Kill characters forward until encountering the end of a word. With optional argument COUNT, do this that many times." (interactive "*p") - (kill-region (point) (save-excursion (forward-word count) (point)))) + (if kill-word-into-kill-ring + (kill-region (point) (save-excursion (forward-word count) (point))) + (delete-region (point) (save-excursion (forward-word count) (point))))) (defun backward-kill-word (&optional count) "Kill characters backward until encountering the end of a word. diff --text -u 'xemacs-21.5.6/lisp/specifier.el' 'xemacs-21.5.7/lisp/specifier.el' Index: ././lisp/specifier.el --- ././lisp/specifier.el Wed Mar 13 17:52:08 2002 +++ ././lisp/specifier.el Fri Jun 21 06:18:04 2002 @@ -1,7 +1,7 @@ ;;; specifier.el --- Lisp interface to specifiers ;; Copyright (C) 1997 Free Software Foundation, Inc. -;; Copyright (C) 1995, 1996, 2000 Ben Wing. +;; Copyright (C) 1995, 1996, 2000, 2002 Ben Wing. ;; Author: Ben Wing ;; Keywords: internal, dumped @@ -50,7 +50,8 @@ ;; God damn, do I hate dynamic scoping. -(defun map-specifier (ms-specifier ms-func &optional ms-locale ms-maparg) +(defun map-specifier (ms-specifier ms-func &optional ms-locale ms-maparg + ms-tag-set ms-exact-p) "Apply MS-FUNC to the specification(s) for MS-LOCALE in MS-SPECIFIER. If MS-LOCALE is a locale, MS-FUNC will be called for that locale. @@ -58,13 +59,16 @@ of that type. If MS-LOCALE is 'all or nil, MS-FUNC will be mapped over all locales in MS-SPECIFIER. +MS-TAG-SET and MS-EXACT-P are as in `specifier-spec-list'. + MS-FUNC is called with four arguments: the MS-SPECIFIER, the locale being mapped over, the inst-list for that locale, and the optional MS-MAPARG. If any invocation of MS-FUNC returns non-nil, the mapping will stop and the returned value becomes the value returned from `map-specifier'. Otherwise, `map-specifier' returns nil." - (let ((ms-specs (specifier-spec-list ms-specifier ms-locale)) + (let ((ms-specs (specifier-spec-list ms-specifier ms-locale ms-tag-set + ms-exact-p)) ms-result) (while (and ms-specs (not ms-result)) (let ((ms-this-spec (car ms-specs))) @@ -408,7 +412,7 @@ value) (defun modify-specifier-instances (specifier func &optional args force default - locale tag-set) + locale tag-set) "Modify all specifications that match LOCALE and TAG-SET by FUNC. For each specification that exists for SPECIFIER, in locale LOCALE @@ -612,5 +616,359 @@ ;; about clobbering user settings. (define-specifier-tag 'default) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; "Heuristic" specifier functions ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; "Heuristic" is a euphemism for kludge. This stuff works well in +;;; practice, though. + +;;; You might view all the contortions we do here and in Face-frob-property +;;; as indicative of design failures with specifiers, and perhaps you're +;;; right. But in fact almost all code that attempts to interface to +;;; humans and produce "intuitive" results gets messy, particularly with a +;;; system as complicated as specifiers, whose complexity results from an +;;; attempt to work well in many different circumstances. We could create +;;; a much simpler system, but the tradeoff would be that you'd have to +;;; programmatically control all the stuff that gets handled automatically +;;; by setting the right specifiers -- and then things wouldn't "just work" +;;; if the user simultaneously creates a TTY and X device, or X devices on +;;; different types of machines, or wants some buffers to display +;;; differently from others, etc. without a lot of hook functions and other +;;; glue machinery to set everything up. The result would be just as much +;;; complexity, but worse, and much harder to control, since there wouldn't +;;; be any standard framework for managing all these hook functions and the +;;; user would have to be able to write lots of Lisp code to get things +;;; working. + +;;; The problem is that we have no high-level code, e.g. custom, to make it +;;; easy for the user to control specifiers nicely. The following +;;; lower-level code, though, should make it easier to implement the +;;; high-level code. + +;;; #### Something like Face-frob-property, but more general, should be +;;; created for general specifier frobbing. + +;;; #### Other possible extensions to specifiers would be +;;; +;;; (a) the ability to create specifications for particular types of +;;; buffers, e.g. all C-mode buffers one way, all text-mode buffers +;;; another way, etc. Perhaps this should be implemented through hook +;;; functions; but that wouldn't easily allow you to `make-face-bold' +;;; and have it work on these other kinds of specifications. Probably +;;; a better way is to extend the tag mechanism so that it can specify +;;; things other than device types. One way would be to simply allow +;;; tags to have arbitrary elisp attached to them -- a function that +;;; takes a domain and returns whether the attached instantiator +;;; applies. This should be doable given (a) that we now have code to +;;; allow elisp to be run inside a "sandbox", sufficiently protected +;;; that it can even be called from redisplay, and (b) the large amount +;;; of caching we already have, which would minimize the speed hit. +;;; However, this still runs into problems -- (a) it requires +;;; programming to get anything at all done, and (b) you'll get +;;; horrible namespace clashes very quickly. Another possibility to be +;;; used in conjunction with this would be vector tags, with an +;;; extendable mechanism to control their syntax. For example, +;;; +;;; [tag :mode 'c] (buffer in c-mode) +;;; [tag :buffer-name "\\*Help: function"] (help-on-function buffers) +;;; [tag :buffer-coding-system 'japanese-euc] (buffer's coding system is +;;; EUC-JP) +;;; [tag :buffer-file-name "^#.*#$"] (autosave files) +;;; [tag :language-environment "French"] (whenever the global language +;;; environment is French) +;;; [tag :font-height-minimum '(default 12)] (if the height of the default +;;; font is at least 12 pixels +;;; in this domain) +;;; +;;; The general idea is that the properties allowable in a tag vector +;;; are extendable, just by specifying the property name and a function +;;; of two arguments, the property value and the domain, which should +;;; return whether the tag applies. You could imagine very complex +;;; behavior (e.g. combining two tags in a single tag set makes an +;;; `and', and putting the two tags separately with separate (perhaps +;;; identical) instantiators makes an `or'. You could effectively do a +;;; lot of what you might want to do with hooks, but in a much more +;;; controllable fashion. Obviously, much of this complexity wouldn't +;;; necessarily be directly set by the user -- they wouldn't probably +;;; do more than simple tags based on mode, buffer or file name, etc. +;;; But a higher-level interface could easily have various possible +;;; "behaviors" to choose from, implemented using this mechanism. +;;; +;;; #### WE NEED CUSTOM SUPPORT! +;;; +;;; (b) Another possibility is "partial" inheritance. For example -- +;;; toolbars and menubars are complex specifications. Currently the +;;; only way to make a change is to copy the entire value and make the +;;; necessary modifications. What we would like instead is to be able +;;; to construct a mini-menubar that says something like "add this menu +;;; here" and combine with everything else. That would require a +;;; slightly different approach to instantiation. Currently it just +;;; searches up the tree from specific to general, looking for a match; +;;; from this match, it generates the instance. Instead, it would +;;; potentially have to record all the matches it found and pass a list +;;; of them to the instantiation function. To implement this, we would +;;; create another specifier method "instantiator_inherits_up", which +;;; looks at the instantiator to determine if it calls for combining +;;; itself with the value higher up. this tells the specifier code +;;; whether to stop now or keep going. It would then pass a Dynarr of +;;; the instantiators to the instantiate method, which might be a +;;; special version, e.g. "instantiate_multi". + +(defun instance-to-instantiator (inst) + "Convert an instance to an instantiator. +If we have an instance object, we fetch the instantiator that generated the object. Otherwise, we just return the instance." + (cond ((font-instance-p inst) + (setq inst (font-instance-name inst))) + ((color-instance-p inst) + (setq inst (color-instance-name inst))) + ((image-instance-p inst) + (setq inst (image-instance-instantiator inst))) + (t inst))) + +(defun device-type-matches-spec (devtype devtype-spec) + ;; Return DEVTYPE (a devtype) if it matches DEVTYPE-SPEC, else nil. + ;; DEVTYPE-SPEC can be nil (all types OK), a device type (only that type + ;; OK), or `window-system' -- window system device types OK. + (cond ((not devtype-spec) devtype) + ((eq devtype-spec 'window-system) + (and (not (memq devtype '(tty stream))) devtype)) + (t (and (eq devtype devtype-spec) devtype)))) + +(defun add-tag-to-inst-list (inst-list tag-set) + "Add TAG-SET (tag or tag-set) to all tags in INST-LIST." + ;; Ah, all is sweetness and light with `loop' + (if (null tag-set) inst-list + (loop for (t2 . x2) in inst-list + for newt2 = (delete-duplicates + (append (if (listp tag-set) tag-set (list tag-set)) + (if (listp t2) t2 (list t2)))) + collect (cons newt2 x2)))) + +(defun derive-domain-from-locale (locale &optional devtype-spec current-device) + "Given a locale, try to derive the \"most reasonable\" domain. + +This is a heuristic \(\"works most of the time\") algorithm. + +\[Remember that, in specifiers, locales are what you attach specifications or +\"instantiators\" to, and domains are the contexts in which you can +retrieve the value or \"instance\" of the specifier. Not all locales are +domains. In particular, buffers are locales but not domains because +buffers may be displayed in different windows on different frames, and thus +end up with different values if the frames each have a frame-local +instantiator and the instantiators are different. However, we may well +find ourselves in a situation where we want to figure out the most likely +value of a specifier in a buffer -- for example we might conceptually want +to make a buffer's modeline face be bold, so we need to figure out what the +current face is. If the buffer already has an instantiator, it's easy; but +if it doesn't, we want to do something reasonable rather than just issue an +error, even though technically the value is not well-defined. We want +something that gives the right answer most of the time.] + +LOCALE is a specifier locale -- i.e. a buffer, window, frame, device, the +symbol `global', or nil, meaning the same as `global'. + +DEVTYPE-SPEC, if given, can restrict the possible return values to domains +on devices of that device type; or if it's `window-system', to domains on +window-system devices. + +CURRENT-DEVICE is what should be considered as the \"selected device\" when +this value is needed. It defaults to the currently selected device. + +-- If LOCALE is a domain, it's simply returned. +-- If LOCALE is `all', `global', or nil, we return CURRENT-DEVICE. +-- If LOCALE is a buffer, we use `get-buffer-window' to find a window viewing + the buffer, and return it if there is one; otherwise we return the selected + window on CURRENT-DEVICE. + +The return value may be nil if the only possible values don't agree with +DEVTYPE-SPEC." + ;; DEVICE aims to be the selected device, but picks some other + ;; device if that won't work. may be nil. + (let* ((device (or current-device (selected-device))) + (device (if (device-type-matches-spec (device-type device) + devtype-spec) + device + (first + (delete-if-not + #'(lambda (x) + (device-type-matches-spec (device-type x) + devtype-spec)) + (device-list)))))) + (cond ((memq locale '(all nil global)) device) + ((valid-specifier-domain-p locale) + (and (device-type-matches-spec (device-type (dfw-device locale)) + devtype-spec) + locale)) + ((bufferp locale) + (let ((win (get-buffer-window locale t devtype-spec))) + (or win (and device (selected-window device)))))))) + +(defun derive-device-type-from-tag-set (tag-set &optional try-stages + devtype-spec current-device) + "Given a tag set, try (heuristically) to get a device type from it. + +There are three stages that this function proceeds through, each one trying +harder than the previous to get a value. TRY-STAGES controls how many +stages to try. If nil or 1, only stage 1 is done; if 2; stages 1 and 2 are +done; if 3, stages 1-3 are done; if t, all stages are done (currently 1-3). + +Stage 1 looks at the tags themselves to see if any of them are device-type +tags. If so, it returns the device type. If there is more than one device +type, this tag can never match anything, but we go ahead and return one of +them. If no device types in the tags, we fail. + +Stage 2 runs all devices through the tag set to see if any match, and +accumulate a list of device types of all matching devices. If there is +exactly one device type in the list, we return it, else fail. + +Stage 3 picks up from where stage 2 left off, and tries hard to return +*SOME* device type in all possible situations, modulo the DEVTYPE-SPEC +flag. \(DEVTYPE-SPEC and CURRENT-DEVICE are the same as in +`derive-domain-from-locale'.) + +Specifically: + +\(a) if no matching devices, return the selected device's type. +\(b) if more than device type and the selected device's type is + listed, use it. +\(c) else, pick one of the device types (currently the first). + +This will never return a device type that's incompatible with the +DEVTYPE-SPEC flag; thus, it may return nil." + (or try-stages (setq try-stages 1)) + (if (eq try-stages t) (setq try-stages 3)) + (check-argument-range try-stages 1 3) + (flet ((delete-wrong-type (x) + (delete-if-not + #'(lambda (y) + (device-type-matches-spec y devtype-spec)) + x))) + (let ((both (intersection (device-type-list) + (canonicalize-tag-set tag-set)))) + ;; shouldn't be more than one (will fail), but whatever + (if both (first (delete-wrong-type both)) + (and (>= try-stages 2) + ;; no device types mentioned. try the hard way, + ;; i.e. check each existing device to see if it will + ;; pass muster. + (let ((okdevs + (delete-wrong-type + (delete-duplicates + (mapcan + #'(lambda (dev) + (and (device-matches-specifier-tag-set-p + dev tag-set) + (list (device-type dev)))) + (device-list))))) + (devtype (cond ((or (null devtype-spec) + (eq devtype-spec 'window-system)) + (let ((dev (derive-domain-from-locale + 'global devtype-spec + current-device))) + (and dev (device-type dev)))) + (t devtype-spec)))) + (cond ((= 1 (length okdevs)) (car okdevs)) + ((< try-stages 3) nil) + ((null okdevs) devtype) + ((memq devtype okdevs) devtype) + (t (car okdevs))))))))) + +;; Sheesh, the things you do to get "intuitive" behavior. +(defun derive-device-type-from-locale-and-tag-set (locale tag-set + &optional devtype-spec + current-device) + "Try to derive a device type from a locale and tag set. + +If the locale is a domain, use the domain's device type. Else, if the tag +set uniquely specifies a device type, use it. Else, if a buffer is given, +find a window visiting the buffer, and if any, use its device type. +Finally, go back to the tag set and \"try harder\" -- if the selected +device matches the tag set, use its device type, else use some valid device +type from the tag set. + +DEVTYPE-SPEC and CURRENT-DEVICE as in `derive-domain-from-locale'." + + (cond ((valid-specifier-domain-p locale) + ;; if locale is a domain, then it must match DEVTYPE-SPEC, + ;; or we exit immediately with nil. + (device-type-matches-spec (device-type (dfw-device locale)) + devtype-spec)) + ((derive-device-type-from-tag-set tag-set 2 devtype-spec + current-device)) + ((and (bufferp locale) + (let ((win (get-buffer-window locale t devtype-spec))) + (and win (device-type (dfw-device win)))))) + ((derive-device-type-from-tag-set tag-set t devtype-spec + current-device)))) + +(defun derive-specifier-specs-from-locale (specifier locale + &optional devtype-spec + current-device + global-use-fallback) + "Heuristically find the specs of a specifier in a locale. + +This tries to find some reasonable instantiators that are most likely to +correspond to the specifier's \"value\" (i.e. instance) in a particular +locale, even when the user has not specifically set any such instantiators. +This is useful for functions that want to modify the instance of a +specifier in a particular locale, and only in that locale. + +Keep in mind that this is a heuristic (i.e. kludge) function, and that it +may not always give the right results, since the operation is not +technically well-defined in many cases! (See `derive-domain-from-locale'.) + +DEVTYPE-SPEC and CURRENT-DEVICE are as in `derive-domain-from-locale'. + +The return value is an inst-list, i.e. + + ((TAG-SET . INSTANTIATOR) ...) + +More specifically, if there is already a spec in the locale, it's just +returned. Otherwise, if LOCALE is `global', `all', or nil: If +GLOBAL-USE-FALLBACK is non-nil, the fallback is fetched, and returned, with +`default' added to the tag set; else, we use CURRENT-DEVICE (defaulting to +the selected device) as a domain and proceed as in the following. If +LOCALE is a domain (window, frame, device), the specifier's instance in +that domain is computed, and converted back to an instantiator +\(`instance-to-instantiator'). Else, if LOCALE is a buffer, we use +`derive-domain-from-locale' to heuristically get a likely domain, and +proceed as if LOCALE were a domain." + (if (memq locale '(all nil)) (setq locale 'global)) + (let ((current (specifier-spec-list specifier locale))) + (if current (cdar current) + ;; case 1: a global locale, fallbacks + (cond ((and (eq locale 'global) global-use-fallback) + ;; if nothing there globally, retrieve the fallback. + ;; this is either an inst-list or a specifier. in the + ;; latter case, we need to recursively retrieve its + ;; fallback. + (let (sofar + (fallback (specifier-fallback specifier))) + (while (specifierp fallback) + (setq sofar (nconc sofar + (cdar (specifier-spec-list fallback + 'global)))) + (setq fallback (specifier-fallback fallback))) + (add-tag-to-inst-list (nconc sofar fallback) 'default))) + (t + (let (domain) + ;; case 2: window, frame, device locale + (cond ((eq locale 'global) + (setq domain (or current-device (selected-device)))) + ((valid-specifier-domain-p locale) + (setq domain locale)) + ;; case 3: buffer locale + ((bufferp locale) + (setq domain (derive-domain-from-locale + locale devtype-spec current-device))) + (t nil)) + ;; retrieve an instance, convert back to instantiator + (when domain + (let ((inst + (instance-to-instantiator + (specifier-instance specifier domain)))) + (list (cons nil inst)))))))))) ;;; specifier.el ends here diff --text -u 'xemacs-21.5.6/lisp/startup.el' 'xemacs-21.5.7/lisp/startup.el' Index: ././lisp/startup.el --- ././lisp/startup.el Fri Mar 29 13:46:37 2002 +++ ././lisp/startup.el Wed Jun 5 02:39:48 2002 @@ -537,8 +537,11 @@ (startup-load-autoloads) - (unwind-protect - (command-line) + (let (error-data) + (condition-case data + (command-line) + ;; catch non-error signals, especially quit + (t (setq error-data data))) ;; Do this again, in case the init file defined more abbreviations. (setq default-directory (abbreviate-file-name default-directory)) ;; Specify the file for recording all the auto save files of @@ -563,7 +566,11 @@ ;; (font-menu-add-default)) (when window-setup-hook (run-hooks 'window-setup-hook)) - (setq window-setup-hook nil)) + (setq window-setup-hook nil) + (if error-data + ;; re-signal, and don't allow continuation as that will probably + ;; wipe out the user's .emacs if she hasn't migrated yet! + (signal-error (car error-data) (cdr error-data)))) (if load-user-init-file-p (maybe-migrate-user-init-file)) @@ -718,7 +725,8 @@ ;; Actually using hooks within Emacs is bad for future maintenance. --rms. ;; ;; In this case, I completely agree. --ben - (init-menubar-at-startup) + (if (featurep 'menubar) + (init-menubar-at-startup)) ;; perhaps this should go earlier in the proecess? (if (featurep 'mule) (declare-fboundp (init-mule-at-startup))) @@ -907,6 +915,8 @@ (find-user-init-file user-init-directory))) (if (not custom-file) (setq custom-file (make-custom-file-name user-init-file))) + ;; #### should test load-user-init-file-p here, not in load-init-file + ;; see comment there (if (and user-init-file (file-readable-p user-init-file)) (load user-init-file t t t)) @@ -941,6 +951,8 @@ (debug-on-error-initial (if (eq init-file-debug t) 'startup init-file-debug))) (let ((debug-on-error debug-on-error-initial)) + ;; #### I believe this test is incorrect, it leads to custom-file + ;; (at least) being undefined (if (and load-user-init-file-p init-file-debug) (progn ;; Do this without a condition-case if the user wants to debug. diff --text -u 'xemacs-21.5.6/lisp/subr.el' 'xemacs-21.5.7/lisp/subr.el' Index: ././lisp/subr.el --- ././lisp/subr.el Mon Apr 1 12:58:10 2002 +++ ././lisp/subr.el Wed Jun 26 09:11:16 2002 @@ -301,16 +301,24 @@ (make-local-hook hook) (add-one-shot-hook hook function append t)) -(defun add-to-list (list-var element) +(defun add-to-list (list-var element &optional append) "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet. The test for presence of ELEMENT is done with `equal'. +If ELEMENT is added, it is added at the beginning of the list, +unless the optional argument APPEND is non-nil, in which case +ELEMENT is added at the end. + If you want to use `add-to-list' on a variable that is not defined until a certain package is loaded, you should put the call to `add-to-list' into a hook function that will be run only after loading the package. `eval-after-load' provides one way to do this. In some cases other hooks, such as major mode hooks, can do the job." - (or (member element (symbol-value list-var)) - (set list-var (cons element (symbol-value list-var))))) + (if (member element (symbol-value list-var)) + (symbol-value list-var) + (set list-var + (if append + (append (symbol-value list-var) (list element)) + (cons element (symbol-value list-var)))))) ;; XEmacs additions ;; called by Fkill_buffer() @@ -478,6 +486,23 @@ (and (buffer-name ,temp-buffer) (kill-buffer ,temp-buffer)))))) +(defmacro with-temp-message (message &rest body) + "Display MESSAGE temporarily while BODY is evaluated. +The original message is restored to the echo area after BODY has finished. +The value returned is the value of the last form in BODY." + (let ((current-message (make-symbol "current-message")) + (temp-message (make-symbol "with-temp-message"))) + `(let ((,temp-message ,message) + (,current-message)) + (unwind-protect + (progn + (when ,temp-message + (setq ,current-message (current-message)) + (message "%s" ,temp-message)) + ,@body) + (and ,temp-message ,current-message + (message "%s" ,current-message)))))) + (defmacro with-temp-buffer (&rest forms) "Create a temporary buffer, and evaluate FORMS there like `progn'. See also `with-temp-file' and `with-output-to-string'." @@ -580,31 +605,96 @@ (setq idx (1+ idx) i (1+ i))) string)) -;; #### This function is not compatible with FSF in some cases. Hard -;; to fix, because it is hard to trace the logic of the FSF function. -;; In case we need the exact behavior, we can always copy the FSF -;; version, which is very long and does lots of unnecessary stuff. -(defun truncate-string-to-width (str end-column &optional start-column padding) +;; From FSF 21.1; ELLIPSES is XEmacs addition. + +(defun truncate-string-to-width (str end-column &optional start-column padding + ellipses) "Truncate string STR to end at column END-COLUMN. -The optional 2nd arg START-COLUMN, if non-nil, specifies +The optional 3rd arg START-COLUMN, if non-nil, specifies the starting column; that means to return the characters occupying columns START-COLUMN ... END-COLUMN of STR. -The optional 3rd arg PADDING, if non-nil, specifies a padding character +The optional 4th arg PADDING, if non-nil, specifies a padding character to add at the end of the result if STR doesn't reach column END-COLUMN, or if END-COLUMN comes in the middle of a character in STR. PADDING is also added at the beginning of the result if column START-COLUMN appears in the middle of a character in STR. If PADDING is nil, no padding is added in these cases, so -the resulting string may be narrower than END-COLUMN." +the resulting string may be narrower than END-COLUMN. + +BUG: Currently assumes that the padding character is of width one. You +will get weird results if not. + +If ELLIPSES is non-nil, add ellipses (specified by ELLIPSES if a string, +else `...') if STR extends past END-COLUMN. The ellipses will be added in +such a way that the total string occupies no more than END-COLUMN columns +-- i.e. if the string goes past END-COLUMN, it will be truncated somewhere +short of END-COLUMN so that, with the ellipses added (and padding, if the +proper place to truncate the string would be in the middle of a character), +the string occupies exactly END-COLUMN columns." (or start-column (setq start-column 0)) - (let ((len (length str))) - (concat (substring str (min start-column len) (min end-column len)) - (and padding (> end-column len) - (make-string (- end-column len) padding))))) - + (let ((len (length str)) + (idx 0) + (column 0) + (head-padding "") (tail-padding "") + ch last-column last-idx from-idx) + + ;; find the index of START-COLUMN; bail out if end of string reached. + (condition-case nil + (while (< column start-column) + (setq ch (aref str idx) + column (+ column (char-width ch)) + idx (1+ idx))) + (args-out-of-range (setq idx len))) + (if (< column start-column) + ;; if string ends before START-COLUMN, return either a blank string + ;; or a string entirely padded. + (if padding (make-string (- end-column start-column) padding) "") + (if (and padding (> column start-column)) + (setq head-padding (make-string (- column start-column) padding))) + (setq from-idx idx) + ;; If END-COLUMN is before START-COLUMN, then bail out. + (if (< end-column column) + (setq idx from-idx ellipses "") + + ;; handle ELLIPSES + (cond ((null ellipses) (setq ellipses "")) + ((if (<= (string-width str) end-column) + ;; string fits, no ellipses + (setq ellipses ""))) + (t + ;; else, insert default value and ... + (or (stringp ellipses) (setq ellipses "...")) + ;; ... take away the width of the ellipses from the + ;; destination. do all computations with new, shorter + ;; width. the padding computed will get us exactly up to + ;; the shorted width, which is right -- it just gets added + ;; to the right of the ellipses. + (setq end-column (- end-column (string-width ellipses))))) + + ;; find the index of END-COLUMN; bail out if end of string reached. + (condition-case nil + (while (< column end-column) + (setq last-column column + last-idx idx + ch (aref str idx) + column (+ column (char-width ch)) + idx (1+ idx))) + (args-out-of-range (setq idx len))) + ;; if we went too far (stopped in middle of character), back up. + (if (> column end-column) + (setq column last-column idx last-idx)) + ;; compute remaining padding + (if (and padding (< column end-column)) + (setq tail-padding (make-string (- end-column column) padding)))) + ;; get substring ... + (setq str (substring str from-idx idx)) + ;; and construct result + (if padding + (concat head-padding str tail-padding ellipses) + (concat str ellipses))))) ;; alist/plist functions @@ -849,6 +939,41 @@ `(if (not (,(eval predicate) ,argument)) (signal-error 'wrong-type-argument (list ,predicate ,argument))))) +(defun args-out-of-range (value min max) + "Signal an error until the correct in-range value is given by the user. +This function loops, signalling a continuable `args-out-of-range' error +with VALUE, MIN and MAX as the data associated with the error and then +checking the returned value to make sure it's not outside the given +boundaries \(nil for either means no boundary on that side). At that +point, the gotten value is returned." + (loop + for newval = (signal 'args-out-of-range (list value min max)) + do (setq value newval) + finally return value + while (not (argument-in-range-p value min max)))) + +(defun argument-in-range-p (argument min max) + "Return true if ARGUMENT is within the range of [MIN, MAX]. +This includes boundaries. nil for either value means no limit on that side." + (and (or (not min) (<= min argument)) + (or (not max) (<= argument max)))) + +(defmacro check-argument-range (argument min max) + "Check that ARGUMENT is within the range [MIN, MAX]. +This is a macro, and ARGUMENT is not evaluated. If ARGUMENT is an lvalue, +this function signals a continuable `args-out-of-range' error until the +returned value is within range, and assigns the returned value +to ARGUMENT. Otherwise, this function signals a non-continuable +`args-out-of-range' error if the returned value is out of range." + (if (symbolp argument) + `(if (not (argument-in-range-p ,argument ,min ,max)) + (setq ,argument + (args-out-of-range ,argument ,min ,max))) + (let ((newsym (gensym))) + `(let ((,newsym ,argument)) + (if (not (argument-in-range-p ,newsym ,min ,max)) + (signal-error 'args-out-of-range ,newsym ,min ,max)))))) + (defun signal-error (error-symbol data) "Signal a non-continuable error. Args are ERROR-SYMBOL, and associated DATA. An error symbol is a symbol defined using `define-error'. @@ -1000,6 +1125,30 @@ (interactive) nil) +;; defined in lisp/bindings.el in GNU Emacs. +(defmacro bound-and-true-p (var) + "Return the value of symbol VAR if it is bound, else nil." + `(and (boundp (quote ,var)) ,var)) + +;; `propertize' is a builtin in GNU Emacs 21. +(defun propertize (string &rest properties) + "Return a copy of STRING with text properties added. +First argument is the string to copy. +Remaining arguments form a sequence of PROPERTY VALUE pairs for text +properties to add to the result." + (let ((str (copy-sequence string))) + (add-text-properties 0 (length str) + properties + str) + str)) + +;; `delete-and-extract-region' is a builtin in GNU Emacs 21. +(defun delete-and-extract-region (start end) + "Delete the text between START and END and return it." + (let ((region (buffer-substring start end))) + (delete-region start end) + region)) + (define-function 'eval-in-buffer 'with-current-buffer) (make-obsolete 'eval-in-buffer 'with-current-buffer) @@ -1023,8 +1172,6 @@ ;; (subrp object) ;; (compiled-function-p object) ;; (eq (car-safe object) 'lambda))) - - (defun function-interactive (function) "Return the interactive specification of FUNCTION. diff --text -u 'xemacs-21.5.6/lisp/unicode.el' 'xemacs-21.5.7/lisp/unicode.el' Index: ././lisp/unicode.el --- ././lisp/unicode.el Mon Mar 18 19:07:35 2002 +++ ././lisp/unicode.el Sun Jun 23 18:54:36 2002 @@ -82,10 +82,17 @@ "Initialize the Unicode translation tables for all standard charsets." (let ((parse-args '(("unicode/unicode-consortium" + ;; Due to the braindamaged way Mule treats the ASCII and Control-1 + ;; charsets' types, trying to load them results in out-of-range + ;; warnings at unicode.c:1439. They're no-ops anyway, they're + ;; hardwired in unicode.c (unicode_to_ichar, ichar_to_unicode). + ;; ("8859-1.TXT" ascii #x00 #x7F #x0) + ;; ("8859-1.TXT" control-1 #x80 #x9F #x-80) + ;; The 8859-1.TXT G1 assignments are half no-ops, hardwired in + ;; unicode.c ichar_to_unicode, but not in unicode_to_ichar. ("8859-1.TXT" latin-iso8859-1 #xA0 #xFF #x-80) ;; "8859-10.TXT" ;; "8859-13.TXT" - ;; "8859-14.TXT" ("8859-14.TXT" latin-iso8859-14 #xA0 #xFF #x-80) ("8859-15.TXT" latin-iso8859-15 #xA0 #xFF #x-80) ("8859-2.TXT" latin-iso8859-2 #xA0 #xFF #x-80) diff --text -u 'xemacs-21.5.6/lisp/x-faces.el' 'xemacs-21.5.7/lisp/x-faces.el' Index: ././lisp/x-faces.el --- ././lisp/x-faces.el Mon Apr 1 12:58:10 2002 +++ ././lisp/x-faces.el Fri Jun 21 06:18:04 2002 @@ -1,7 +1,7 @@ ;;; x-faces.el --- X-specific face frobnication, aka black magic. ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc. -;; Copyright (C) 1995, 1996 Ben Wing. +;; Copyright (C) 1995, 1996, 2002 Ben Wing. ;; Author: Jamie Zawinski ;; Maintainer: XEmacs Development Team @@ -617,10 +617,6 @@ ;;; specified. ;;; (defun x-init-global-faces () - (or (face-font 'default 'global) - (set-face-font 'default - "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*" - 'global '(x default))) (or (face-foreground 'default 'global) (set-face-foreground 'default "black" 'global '(x default))) (or (face-background 'default 'global) @@ -633,67 +629,43 @@ ;; ;; If the "default" face didn't have a font specified, try to pick one. ;; - (or - (face-font-instance 'default device) - ;; - ;; No font specified in the resource database; try to cope. - ;; - ;; At first I wanted to do this by just putting a font-spec in the - ;; fallback resources passed to XtAppInitialize(), but that fails - ;; if there is an Emacs app-defaults file which doesn't specify a - ;; font: apparently the fallback resources are not consulted when - ;; there is an app-defaults file, which seems pretty bogus to me. - ;; - ;; We should also probably try "*xtDefaultFont", but I think that it - ;; might be legal to specify that as "xtDefaultFont:", that is, at - ;; top level, instead of "*xtDefaultFont:", that is, applicable to - ;; every application. `x-get-resource' can't handle that right now. - ;; Anyway, xtDefaultFont is probably variable-width. - ;; - ;; Some who have LucidaTypewriter think it's a better font than Courier, - ;; but it has the bug that there are no italic and bold italic versions. - ;; We could hair this code up to try and mix-and-match fonts to get a - ;; full complement, but really, why bother. It's just a default. - ;; - (let (new-x-font) - (setq new-x-font (or - ;; - ;; We default to looking for iso8859 fonts. Using a wildcard for the - ;; encoding would be bad, because that can cause English speakers to get - ;; Kanji fonts by default. It is safe to assume that people using a - ;; language other than English have both set $LANG, and have specified - ;; their `font' and `fontList' resources. In any event, it's better to - ;; err on the side of the English speaker in this case because they are - ;; much less likely to have encountered this problem, and are thus less - ;; likely to know what to do about it. - - ;; Try for Courier. Almost everyone has that. (Does anyone not?) - (make-font-instance - "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*" device t) - (make-font-instance - "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*" device t) - ;; Next try for any "medium" charcell or monospaced iso8859 font. - (make-font-instance "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*" device t) - (make-font-instance "-*-*-medium-r-*-*-*-120-*-*-c-*-iso8859-*" device t) - ;; Next try for any charcell or monospaced iso8859 font. - (make-font-instance "-*-*-*-r-*-*-*-120-*-*-m-*-iso8859-*" device t) - (make-font-instance "-*-*-*-r-*-*-*-120-*-*-c-*-iso8859-*" device t) - ;; Ok, let's at least try to stay in 8859... - (make-font-instance "-*-*-*-r-*-*-*-120-*-*-*-*-iso8859-*" device t) - ;; Boy, we sure are losing now. Try the above, but in any encoding. - (make-font-instance "-*-*-medium-r-*-*-*-120-*-*-m-*-*-*" device t) - (make-font-instance "-*-*-medium-r-*-*-*-120-*-*-c-*-*-*" device t) - (make-font-instance "-*-*-*-r-*-*-*-120-*-*-m-*-*-*" device t) - (make-font-instance "-*-*-*-r-*-*-*-120-*-*-c-*-*-*" device t) - (make-font-instance "-*-*-*-r-*-*-*-120-*-*-*-*-*-*" device t) - ;; Hello? Please? - (make-font-instance "-*-*-*-*-*-*-*-120-*-*-*-*-*-*" device t) - (make-font-instance "*" device t) - ;; if we get to here we're screwed, and faces.c will fatal()... - )) - (if (not (face-font 'default 'global)) - (set-face-font 'default new-x-font) - (set-face-font 'default new-x-font device)))) + ;; (or + ;; (face-font-instance 'default device) + ;; + ;; [[ No font specified in the resource database; try to cope. ]] + ;; + ;; NOTE: In reality, this will never happen. The fallbacks will always + ;; be tried, and the last fallback is "*", which should get any font. No + ;; need to put the same checks here as in the fallbacks. These comments + ;; appear to be pre-19.12. --ben + + ;; [[ At first I wanted to do this by just putting a font-spec in the + ;; fallback resources passed to XtAppInitialize(), but that fails + ;; if there is an Emacs app-defaults file which doesn't specify a + ;; font: apparently the fallback resources are not consulted when + ;; there is an app-defaults file, which seems pretty bogus to me. + ;; + ;; We should also probably try "*xtDefaultFont", but I think that it + ;; might be legal to specify that as "xtDefaultFont:", that is, at + ;; top level, instead of "*xtDefaultFont:", that is, applicable to + ;; every application. `x-get-resource' can't handle that right now. + ;; Anyway, xtDefaultFont is probably variable-width. + ;; + ;; Some who have LucidaTypewriter think it's a better font than Courier, + ;; but it has the bug that there are no italic and bold italic versions. + ;; We could hair this code up to try and mix-and-match fonts to get a + ;; full complement, but really, why bother. It's just a default. ]] + ;; + ;; [[ We default to looking for iso8859 fonts. Using a wildcard for the + ;; encoding would be bad, because that can cause English speakers to get + ;; Kanji fonts by default. It is safe to assume that people using a + ;; language other than English have both set $LANG, and have specified + ;; their `font' and `fontList' resources. In any event, it's better to + ;; err on the side of the English speaker in this case because they are + ;; much less likely to have encountered this problem, and are thus less + ;; likely to know what to do about it. ]] + + ;; ;; If the "default" face didn't have both colors specified, then pick ;; some, taking into account whether one of the colors was specified. diff --text -u 'xemacs-21.5.6/lisp/x-init.el' 'xemacs-21.5.7/lisp/x-init.el' Index: ././lisp/x-init.el --- ././lisp/x-init.el Sat May 5 07:42:17 2001 +++ ././lisp/x-init.el Fri Jun 21 06:18:05 2002 @@ -269,6 +269,7 @@ (when (not x-win-initted) (defvar x-app-defaults-directory) (init-pre-x-win) + (if (featurep 'mule) (init-mule-x-win)) ;; Open the X display when this file is loaded ;; (Note that the first frame is created later.) @@ -288,7 +289,7 @@ (defun init-post-x-win () "Initialize X Windows at startup (post). Don't call this." (when (not post-x-win-initted) - (if (featurep 'mule) (init-mule-x-win)) + ;(if (featurep 'mule) (init-mule-x-win)) ;; Motif-ish bindings ;; The following two were generally unliked. ;;(define-key global-map '(shift delete) 'kill-primary-selection) diff --text -u 'xemacs-21.5.6/lwlib/ChangeLog' 'xemacs-21.5.7/lwlib/ChangeLog' Index: ././lwlib/ChangeLog --- ././lwlib/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././lwlib/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,16 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-06-20 Ben Wing + + * lwlib.c: + * lwlib.c (dialog_spec_p): Fix warning. + +2002-02-13 Stephen J. Turnbull + + * lwlib-Xm.c (make_dialog): Fix XmProcessTraversal crash. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. diff --text -u 'xemacs-21.5.6/lwlib/lwlib-Xm.c' 'xemacs-21.5.7/lwlib/lwlib-Xm.c' Index: ././lwlib/lwlib-Xm.c --- ././lwlib/lwlib-Xm.c Sat Jul 28 14:08:58 2001 +++ ././lwlib/lwlib-Xm.c Fri Apr 5 19:37:31 2002 @@ -1298,6 +1298,7 @@ list activate the default button */ XtAddCallback (value, XmNdefaultActionCallback, activate_button, button); } + /* else add nothing; it's a separator */ ac = 0; XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; @@ -1335,11 +1336,12 @@ XtInstallAccelerators (value, button); XmProcessTraversal(value, XmTRAVERSE_CURRENT); } - else + else if (radio_box) { XtInstallAccelerators (form, button); XmProcessTraversal(value, XmTRAVERSE_CURRENT); } + /* else we don' need no STEENKIN' assellerators. */ #ifdef DND_KLUDGE XtFree ((char *) dnd_override); diff --text -u 'xemacs-21.5.6/lwlib/lwlib.c' 'xemacs-21.5.7/lwlib/lwlib.c' Index: ././lwlib/lwlib.c --- ././lwlib/lwlib.c Wed Mar 13 17:52:22 2002 +++ ././lwlib/lwlib.c Fri Jun 21 06:18:13 2002 @@ -852,6 +852,8 @@ } } +#if defined (NEED_LUCID) || defined (NEED_ATHENA) || defined (NEED_MOTIF) + static widget_creation_function find_in_table (const char *type, const widget_creation_entry table[]) { @@ -861,6 +863,8 @@ return cur->function; return NULL; } + +#endif static Boolean dialog_spec_p (const char *name) diff --text -u 'xemacs-21.5.6/man/ChangeLog' 'xemacs-21.5.7/man/ChangeLog' Index: ././man/ChangeLog --- ././man/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././man/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,120 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-07-02 Stephen J. Turnbull + + * xemacs-faq.texi (Top, Customization, Q3.10.5, Q3.10.6): + New "killing is slow" FAQ and link updates. + +2002-06-17 Jerry James + + * emodules.texi (Loading other Modules): Describe why we do not + use RTLD_GLOBAL. + +2002-06-20 Adrian Aichner + + * xemacs/mule.texi (Language Environments): Typo fix suggested by + Frank Schmitt. + +2002-06-11 Adrian Aichner + + * xemacs-faq.texi (Q1.3.7): Update broken link to russian.el + (found by linklint) with Google's help. + +2002-05-25 Adrian Aichner + + * xemacs/custom.texi (Syntax Entry): Deprecate ` ' in favor of `-'. + +2002-06-05 Ben Wing + + * internals/internals.texi (Top): + * internals/internals.texi (The XEmacs Object System (Abstractly Speaking)): + * internals/internals.texi (How Lisp Objects Are Represented in C): + * internals/internals.texi (Major Textual Changes): + * internals/internals.texi (Great Integral Type Renaming): + * internals/internals.texi (Text/Char Type Renaming): + * internals/internals.texi (files): New. + +2002-05-04 Stephen J. Turnbull + + * custom.texi (The Init File): Rewrite completely. + +2002-03-19 Adrian Aichner + + * widget.texi (constants): Typo fix. + +2002-02-07 Stephen J. Turnbull + + * external-widget.texi (External Client Widget Internals): New node. + +2001-11-15 Darryl Okahata + + * lispref/glyphs.texi: + lispref/lispref.texi: Add examples of how to insert graphics into a + buffer. + +2001-12-17 Stephen J. Turnbull + + * xemacs/packages.texi (Packages): + (Package Terminology): + Carefully distinguish libraries and packages. + (Package Terminology): + More careful definitions of ``category'' and ``distribution.'' + Use ``generic'' instead of ``normal'' (N.B. package tools use + ``standard''.) + (Installing Packages): + Use @var to mark variable version strings, not @t or <>. + (Sumo): + Add disk space estimate when unpacked. + +2002-02-06 Stephen J. Turnbull + + * xemacs-faq.texi (Q1.3.8, Q1.3.9): Unicode support via Mule-UCS. + +2002-02-01 Steve Youngs + + * xemacs/packages.texi (Removing Packages): The interactive + function is 'package-get-delete-package'. + +2001-11-27 Adrian Aichner + + * xemacs-faq.texi: Hyperlink fixes. + +2002-02-04 Stephen J. Turnbull + + * xemacs-faq.texi (Q4.7.7): New FAQ on remote files. + +2002-01-24 Stephen J. Turnbull + + * xemacs-faq.texi (Q1.0.6): Update mail-to-news gateway information. + +2002-02-04 Stephen J. Turnbull + + * xemacs/files.texi (Files): + (File Names): + Document remote file editing, refer to EFS and TRAMP. + +2002-05-23 Stephen J. Turnbull + + * lispref/packaging.texi (package-info.in Fields): Typo fix. + +2002-05-11 Adrian Aichner + + * xemacs-faq.texi (Top): Add Q2.0.15 under "Installation and + Trouble Shooting". + * xemacs-faq.texi (Installation): Add Q2.0.15 to Installation + menu. + * xemacs-faq.texi (Q2.0.14): Fix unnumberedsubsec argument. + * xemacs-faq.texi (Q2.0.15): New. + +2002-05-01 Steve Youngs + + * xemacs/packages.texi (Automatically): Don't mention "Options" + menu. + (Installing Packages): Don't mention getting list of packages via + customize. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. @@ -2231,7 +2348,7 @@ * lispref/dragndrop.texi: only small changes -1998-05-15 Christian Nybø +1998-05-15 Christian Nyb,Ax(B * xemacs/killing.texi: Properly document `zap-to-char'. diff --text -u 'xemacs-21.5.6/man/custom.texi' 'xemacs-21.5.7/man/custom.texi' Index: ././man/custom.texi --- ././man/custom.texi Fri Apr 13 03:21:59 2001 +++ ././man/custom.texi Tue Jun 4 15:04:34 2002 @@ -278,12 +278,24 @@ @comment node-name, next, previous, up @section The Init File -When you save the customizations, call to @code{custom-set-variables}, -@code{custom-set-faces} are inserted into the file specified by -@code{custom-file}. By default @code{custom-file} is your @file{.emacs} -file. If you use another file, you must explicitly load it yourself. -The two functions will initialize variables and faces as you have -specified. +Customizations are saved to the file specified by @code{custom-file}, as +calls to @code{custom-set-variables} and @code{custom-set-faces}. + +When you save customizations, the current implementation removes the +calls to @code{custom-set-variables} and @code{custom-set-faces}, and +replaces them with code generated on the basis of the current +customization state in Emacs. + +By default @code{custom-file} is your @file{.emacs} file (for GNU Emacs +and older XEmacs) and is @file{custom.el} in the same directory as +@file{init.el} (in XEmacs 21.4 and later). If you use another file, you +must explicitly load it yourself. + +As of XEmacs 21.4.7, when @var{custom-file} is present, it is loaded +@emph{after} @file{init.el}. This is likely to change in the future, +because (1) actions in @file{init.el} often would like to depend on +customizations for consistent appearance and (2) Custom is quite brutal +about enforcing its idea of the correct values at initialization. @node Wishlist, , The Init File, Top @comment node-name, next, previous, up diff --text -u 'xemacs-21.5.6/man/emodules.texi' 'xemacs-21.5.7/man/emodules.texi' Index: ././man/emodules.texi --- ././man/emodules.texi Thu Mar 14 20:50:13 2002 +++ ././man/emodules.texi Tue Jun 25 07:00:17 2002 @@ -483,6 +483,20 @@ then their parents will also fail to load. This does not include previous successful calls to @code{emodules_load} at the top level. +@strong{Warning:} Modules are @emph{not} loaded with the +@code{RTLD_GLOBAL} flag. The practical upshot is that individual +modules do not have access to each other's C symbols. One module cannot +make a C function call to a function defined in another module, nor can +it read or set a C variable in another module. All interaction between +modules must, therefore, take place at the Lisp level. This is by +design. Other projects have attempted to use @code{RTLD_GLOBAL}, only +to find that spurious symbol name clashes were the result. Helper +functions often have simple names, increasing the probability of such a +clash. If you really need to share symbols between modules, create a +shared library containing those symbols, and link your modules with +that library. Otherwise, interactions between modules must take place +via Lisp function calls and Lisp variables accesses. + @node Using ellcc, Defining Functions, Anatomy of a Module, Top @chapter Using @code{ellcc} @cindex @code{ellcc} diff --text -u 'xemacs-21.5.6/man/external-widget.texi' 'xemacs-21.5.7/man/external-widget.texi' Index: ././man/external-widget.texi --- ././man/external-widget.texi Sat Feb 16 16:25:39 2002 +++ ././man/external-widget.texi Tue Jun 4 15:04:35 2002 @@ -19,7 +19,7 @@ * Using an External Client Widget:: * External Client Widget Resource Settings:: * Motif-Specific Info About the External Client Widget:: -* Example Program Using the External Client Widget:: +* External Client Widget Internals:: @end menu @@ -113,7 +113,7 @@ made by parent or child widgets. -@node Motif-Specific Info About the External Client Widget, Example Program Using the External Client Widget, External Client Widget Resource Settings, Top +@node Motif-Specific Info About the External Client Widget, External Client Widget Internals, External Client Widget Resource Settings, Top @chapter Motif-Specific Info About the External Client Widget By default, the external client widget has navigation type @@ -127,84 +127,112 @@ @kbd{Ctrl-@key{TAB}} and @kbd{Shift-@key{TAB}} are silently filtered by the external client widget and are not seen by Emacs. +@node External Client Widget Internals, , Motif-Specific Info About the External Client Widget, Top +@chapter External Client Widget Internals -@node Example Program Using the External Client Widget, , Motif-Specific Info About the External Client Widget, Top -@chapter Example Program Using the External Client Widget +The following text is lifted verbatim from Ben Wing's comments in +@file{ExternalShell.c}. -This is a very simple program. It has some issues with exiting. -Be careful to destroy the Emacs frame in the client window before -exiting the client program. +This is a special Shell that is designed to use an externally- +provided window created by someone else (possibly another process). +That other window should have an associated widget of class +ExternalClient. The two widgets communicate with each other using +ClientMessage events and properties on the external window. -@example -/* - XEmacsInside.c +Ideally this feature should be independent of Emacs. Unfortunately +there are lots and lots of specifics that need to be dealt with +for this to work properly, and some of them can't conveniently +be handled within the widget's methods. Some day the code may +be rewritten so that the embedded-widget feature can be used by +any application, with appropriate entry points that are called +at specific points within the application. - Copyright (C) 2002 Free Software Foundation +This feature is similar to the OLE (Object Linking & Embedding) +feature provided by MS Windows. - This program is part of XEmacs. XEmacs is free software. See the - file COPYING that came with XEmacs for conditions on redistribution. +Communication between this shell and the client widget: - This is an example of the XEmacs external widget facility. +Communication is through ClientMessage events with message_type +EXTW_NOTIFY and format 32. Both the shell and the client widget +communicate with each other by sending the message to the same +window (the "external window" below), and the data.l[0] value is +used to determine who sent the message. - It uses libextcli-Xt.a to interface to the X Toolkit Intrinsics. +The data is formatted as follows: - Compile with +data.l[0] = who sent this message: external_shell_send (0) or + external_client_send (1) +data.l[1] = message type (see enum en_extw_notify below) +data.l[2-4] = data associated with this message - gcc -I/path/to/XEmacs/source/src -L/path/to/XEmacs/build/src -static \ - -lextcli_Xt -lXt -lX11 -lSM -lICE \ - -o XEmacsInside XEmacsInside.c +EventHandler() handles messages from the other side. - Run it with the resource "*input: True" and a reasonable geometry spec. - It pops up a window, and prints a Lisp form on stdout. Eval the form - in an XEmacs configured with --external-widget. +extw_send_notify_3() sends a message to the other side. - Written by Stephen J. Turnbull +extw_send_geometry_value() is used when an XtWidgetGeometry structure + needs to be sent. This is too much data to fit into a + ClientMessage, so the data is stored in a property and then + extw_send_notify_3() is called. - Based on simple_text.c from _The Motif Programming Manual_ by Heller - and Ferguson, O'Reilly. -*/ +extw_get_geometry_value() receives an XtWidgetGeometry structure from a + property. -#include +extw_wait_for_response() is used when a response to a sent message + is expected. It looks for a matching event within a + particular timeout. -#include -#include -#include +The particular message types are as follows: -#include "ExternalClient.h" +1) extw_notify_init (event_window, event_mask) -main (int argc, char *argv[]) -@{ - Widget toplevel, emacs; - XtAppContext app; +This is sent from the shell to the client after the shell realizes +its EmacsFrame widget on the client's "external window". This +tells the client that it should start passing along events of the +types specified in event_mask. event_window specifies the window +of the EmacsFrame widget, which is a child of the client's +external window. - XtSetLanguageProc (NULL, NULL, NULL); +extw_notify_init (client_type) - toplevel = XtVaOpenApplication (&app, "Demo", - NULL, 0, &argc, argv, - NULL, sessionShellWidgetClass, - NULL); +When the client receives an extw_notify_init message from the +shell, it sends back a message of the same sort specifying the type +of the toolkit used by the client (Motif, generic Xt, or Xlib). - emacs = XtVaCreateManagedWidget ("externalWidget", externalClientWidgetClass, - toplevel, - NULL); +2) extw_notify_end () - XtRealizeWidget (toplevel); +This is sent from the shell to the client when the shell's +EmacsFrame widget is destroyed, and tells the client to stop +passing events along. - printf ("(make-frame '(window-id \"%d\"))\n", XtWindow(emacs)); +3) extw_notify_qg (result) - XtAppMainLoop (app); -@} +This is sent from the client to the shell when a QueryGeometry +request is received on the client. The XtWidgetGeometry structure +specified in the QueryGeometry request is passed on in the +EXTW_QUERY_GEOMETRY property (of type EXTW_WIDGET_GEOMETRY) on the +external window. result is unused. -/* This function doesn't belong here but somehow it's not getting resolved - from the library. */ -void -fatal (char *msg) -@{ - fprintf (stderr, "%s", msg); - exit (1); -@} -@end example +In response, the shell passes the QueryGeometry request down the +widget tree, and when a response is received, sends a message of +type extw_notify_qg back to the client, with result specifying the +GeometryResult value. If this value is XtGeometryAlmost, the +returned XtWidgetGeometry structure is stored into the same property +as above. [BPW is there a possible race condition here?] +4) extw_notify_gm (result) + +A very similar procedure to that for extw_notify_qg is followed +when the shell's RootGeometryManager method is called, indicating +that a child widget wishes to change the shell's geometry. The +XtWidgetGeometry structure is stored in the EXTW_GEOMETRY_MANAGER +property. + +5) extw_notify_focus_in (), extw_notify_focus_out () + +These are sent from the client to the shell when the client gains +or loses the keyboard focus. It is done this way because Xt +maintains its own concept of keyboard focus and only the client +knows this information. @summarycontents @contents diff --text -u 'xemacs-21.5.6/man/internals/internals.texi' 'xemacs-21.5.7/man/internals/internals.texi' Index: ././man/internals/internals.texi --- ././man/internals/internals.texi Wed Apr 3 19:47:42 2002 +++ ././man/internals/internals.texi Wed Jun 5 21:00:46 2002 @@ -116,6 +116,7 @@ * XEmacs From the Inside:: * The XEmacs Object System (Abstractly Speaking):: * How Lisp Objects Are Represented in C:: +* Major Textual Changes:: * Rules When Writing New C Code:: * CVS Techniques:: * A Summary of the Various XEmacs Modules:: @@ -1759,7 +1760,7 @@ nor do most complex objects, which contain too much state to be easily initialized through a read syntax. -@node How Lisp Objects Are Represented in C, Rules When Writing New C Code, The XEmacs Object System (Abstractly Speaking), Top +@node How Lisp Objects Are Represented in C, Major Textual Changes, The XEmacs Object System (Abstractly Speaking), Top @chapter How Lisp Objects Are Represented in C @cindex Lisp objects are represented in C, how @cindex objects are represented in C, how Lisp @@ -1846,7 +1847,335 @@ nothing unless the corresponding configure error checking flag was specified. -@node Rules When Writing New C Code, CVS Techniques, How Lisp Objects Are Represented in C, Top +@node Major Textual Changes, Rules When Writing New C Code, How Lisp Objects Are Represented in C, Top +@chapter Major Textual Changes +@cindex textual changes, major +@cindex major textual changes + +Sometimes major textual changes are made to the source. This means that +a search-and-replace is done to change type names and such. Some people +disagree with such changes, and certainly if done without good reason +will just lead to headaches. But it's important to keep the code clean +and understable, and consistent naming goes a long way towards this. + +An example of the right way to do this was the so-called "great integral +type renaming". + +@menu +* Great Integral Type Renaming:: +* Text/Char Type Renaming:: +@end menu + +@node Great Integral Type Renaming +@section Great Integral Type Renaming +@cindex Great Integral Type Renaming +@cindex integral type renaming, great +@cindex type renaming, integral +@cindex renaming, integral types + +The purpose of this is to rationalize the names used for various +integral types, so that they match their intended uses and follow +consist conventions, and eliminate types that were not semantically +different from each other. + +The conventions are: + +@itemize @bullet +@item +All integral types that measure quantities of anything are signed. Some +people disagree vociferously with this, but their arguments are mostly +theoretical, and are vastly outweighed by the practical headaches of +mixing signed and unsigned values, and more importantly by the far +increased likelihood of inadvertent bugs: Because of the broken "viral" +nature of unsigned quantities in C (operations involving mixed +signed/unsigned are done unsigned, when exactly the opposite is nearly +always wanted), even a single error in declaring a quantity unsigned +that should be signed, or even the even more subtle error of comparing +signed and unsigned values and forgetting the necessary cast, can be +catastrophic, as comparisons will yield wrong results. -Wsign-compare +is turned on specifically to catch this, but this tends to result in a +great number of warnings when mixing signed and unsigned, and the casts +are annoying. More has been written on this elsewhere. + +@item +All such quantity types just mentioned boil down to EMACS_INT, which is +32 bits on 32-bit machines and 64 bits on 64-bit machines. This is +guaranteed to be the same size as Lisp objects of type `int', and (as +far as I can tell) of size_t (unsigned!) and ssize_t. The only type +below that is not an EMACS_INT is Hashcode, which is an unsigned value +of the same size as EMACS_INT. + +@item +Type names should be relatively short (no more than 10 characters or +so), with the first letter capitalized and no underscores if they can at +all be avoided. + +@item +"count" == a zero-based measurement of some quantity. Includes sizes, +offsets, and indexes. + +@item +"bpos" == a one-based measurement of a position in a buffer. "Charbpos" +and "Bytebpos" count text in the buffer, rather than bytes in memory; +thus Bytebpos does not directly correspond to the memory representation. +Use "Membpos" for this. + +@item +"Char" refers to internal-format characters, not to the C type "char", +which is really a byte. +@end itemize + +For the actual name changes, see the script below. + +I ran the following script to do the conversion. (NOTE: This script is +idempotent. You can safely run it multiple times and it will not screw +up previous results -- in fact, it will do nothing if nothing has +changed. Thus, it can be run repeatedly as necessary to handle patches +coming in from old workspaces, or old branches.) There are two tags, +just before and just after the change: @samp{pre-integral-type-rename} +and @samp{post-integral-type-rename}. When merging code from the main +trunk into a branch, the best thing to do is first merge up to +@samp{pre-integral-type-rename}, then apply the script and associated +changes, then merge from @samp{post-integral-type-change} to the +present. (Alternatively, just do the merging in one operation; but you +may then have a lot of conflicts needing to be resolved by hand.) + +Script @samp{fixtypes.sh} follows: + +@example +----------------------------------- cut ------------------------------------ +files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]" +gr Memory_Count Bytecount $files +gr Lstream_Data_Count Bytecount $files +gr Element_Count Elemcount $files +gr Hash_Code Hashcode $files +gr extcount bytecount $files +gr bufpos charbpos $files +gr bytind bytebpos $files +gr memind membpos $files +gr bufbyte intbyte $files +gr Extcount Bytecount $files +gr Bufpos Charbpos $files +gr Bytind Bytebpos $files +gr Memind Membpos $files +gr Bufbyte Intbyte $files +gr EXTCOUNT BYTECOUNT $files +gr BUFPOS CHARBPOS $files +gr BYTIND BYTEBPOS $files +gr MEMIND MEMBPOS $files +gr BUFBYTE INTBYTE $files +gr MEMORY_COUNT BYTECOUNT $files +gr LSTREAM_DATA_COUNT BYTECOUNT $files +gr ELEMENT_COUNT ELEMCOUNT $files +gr HASH_CODE HASHCODE $files +----------------------------------- cut ------------------------------------ +@end example + +The @samp{gr} script, and the scripts it uses, are documented in +@file{README.global-renaming}, because if placed in this file they would +need to have their @@ characters doubled, meaning you couldn't easily +cut and paste from the source. + +In addition to those programs, I needed to fix up a few other +things, particularly relating to the duplicate definitions of +types, now that some types merged with others. Specifically: + +@enumerate +@item +in lisp.h, removed duplicate declarations of Bytecount. The changed +code should now look like this: (In each code snippet below, the first +and last lines are the same as the original, as are all lines outside of +those lines. That allows you to locate the section to be replaced, and +replace the stuff in that section, verifying that there isn't anything +new added that would need to be kept.) + +@example +--------------------------------- snip ------------------------------------- +/* Counts of bytes or chars */ +typedef EMACS_INT Bytecount; +typedef EMACS_INT Charcount; + +/* Counts of elements */ +typedef EMACS_INT Elemcount; + +/* Hash codes */ +typedef unsigned long Hashcode; + +/* ------------------------ dynamic arrays ------------------- */ +--------------------------------- snip ------------------------------------- +@end example + +@item +in lstream.h, removed duplicate declaration of Bytecount. Rewrote the +comment about this type. The changed code should now look like this: + +@example +--------------------------------- snip ------------------------------------- +#endif + +/* The have been some arguments over the what the type should be that + specifies a count of bytes in a data block to be written out or read in, + using Lstream_read(), Lstream_write(), and related functions. + Originally it was long, which worked fine; Martin "corrected" these to + size_t and ssize_t on the grounds that this is theoretically cleaner and + is in keeping with the C standards. Unfortunately, this practice is + horribly error-prone due to design flaws in the way that mixed + signed/unsigned arithmetic happens. In fact, by doing this change, + Martin introduced a subtle but fatal error that caused the operation of + sending large mail messages to the SMTP server under Windows to fail. + By putting all values back to be signed, avoiding any signed/unsigned + mixing, the bug immediately went away. The type then in use was + Lstream_Data_Count, so that it be reverted cleanly if a vote came to + that. Now it is Bytecount. + + Some earlier comments about why the type must be signed: This MUST BE + SIGNED, since it also is used in functions that return the number of + bytes actually read to or written from in an operation, and these + functions can return -1 to signal error. + + Note that the standard Unix read() and write() functions define the + count going in as a size_t, which is UNSIGNED, and the count going + out as an ssize_t, which is SIGNED. This is a horrible design + flaw. Not only is it highly likely to lead to logic errors when a + -1 gets interpreted as a large positive number, but operations are + bound to fail in all sorts of horrible ways when a number in the + upper-half of the size_t range is passed in -- this number is + unrepresentable as an ssize_t, so code that checks to see how many + bytes are actually written (which is mandatory if you are dealing + with certain types of devices) will get completely screwed up. + + --ben +*/ + +typedef enum lstream_buffering +--------------------------------- snip ------------------------------------- +@end example + +@item +in dumper.c, there are four places, all inside of switch() statements, +where XD_BYTECOUNT appears twice as a case tag. In each case, the two +case blocks contain identical code, and you should *REMOVE THE SECOND* +and leave the first. +@end enumerate + +@node Text/Char Type Renaming +@section Text/Char Type Renaming +@cindex Text/Char Type Renaming +@cindex type renaming, text/char +@cindex renaming, text/char types + +The purpose of this was + +@enumerate +@item +To distinguish between ``charptr'' when it refers to operations on +the pointer itself and when it refers to operations on text +@item +To use consistent naming for everything referring to internal format, i.e. +@end enumerate + +@example + Itext == text in internal format + Ibyte == a byte in such text + Ichar == a char as represented in internal character format +@end example + +Thus e.g. + +@example + set_charptr_emchar -> set_itext_ichar +@end example + +This was done using a script like this: + +@example +files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]" +gr Intbyte Ibyte $files +gr INTBYTE IBYTE $files +gr intbyte ibyte $files +gr EMCHAR ICHAR $files +gr emchar ichar $files +gr Emchar Ichar $files +gr INC_CHARPTR INC_IBYTEPTR $files +gr DEC_CHARPTR DEC_IBYTEPTR $files +gr VALIDATE_CHARPTR VALIDATE_IBYTEPTR $files +gr valid_charptr valid_ibyteptr $files +gr CHARPTR ITEXT $files +gr charptr itext $files +gr Charptr Itext $files +@end example + +See above for the source to @samp{gr}. + +As in the integral-types change, there are pre and post tags before and +after the change: + +@example + pre-internal-format-textual-renaming + post-internal-format-textual-renaming +@end example + +When merging a large branch, follow the same sort of procedure +documented above, using these tags -- essentially sync up to the pre +tag, then apply the script yourself, then sync from the post tag to the +present. You can probably do the same if you don't have a separate +workspace, but do have lots of outstanding changes and you'd rather not +just merge all the textual changes directly. Use something like this: + +(WARNING: I'm not a CVS guru; before trying this, or any large operation +that might potentially mess things up, *DEFINITELY* make a backup of +your existing workspace.) + +@example +cup -r pre-internal-format-textual-renaming + +cup -A -j post-internal-format-textual-renaming -j HEAD +@end example + +This might also work: + +@example +cup -j pre-internal-format-textual-renaming + +cup -j post-internal-format-textual-renaming -j HEAD +@end example + +ben + +The following is a script to go in the opposite direction: + +@example +files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]" + +# Evidently Perl considers _ to be a word char ala \b, even though XEmacs +# doesn't. We need to be careful here with ibyte/ichar because of words +# like Richard, eicharlen(), multibyte, HIBYTE, etc. + +gr Ibyte Intbyte $files +gr '\bIBYTE' INTBYTE $files +gr '\bibyte' intbyte $files +gr '\bICHAR' EMCHAR $files +gr '\bichar' emchar $files +gr '\bIchar' Emchar $files +gr '\bIBYTEPTR' CHARPTR $files +gr '\bibyteptr' charptr $files +gr '\bITEXT' CHARPTR $files +gr '\bitext' charptr $files +gr '\bItext' CHARPTR $files + +gr '_IBYTE' _INTBYTE $files +gr '_ibyte' _intbyte $files +gr '_ICHAR' _EMCHAR $files +gr '_ichar' _emchar $files +gr '_Ichar' _Emchar $files +gr '_IBYTEPTR' _CHARPTR $files +gr '_ibyteptr' _charptr $files +gr '_ITEXT' _CHARPTR $files +gr '_itext' _charptr $files +gr '_Itext' _CHARPTR $files +@end example + +@node Rules When Writing New C Code, CVS Techniques, Major Textual Changes, Top @chapter Rules When Writing New C Code @cindex writing new C code, rules when @cindex C code, rules when writing new diff --text -u 'xemacs-21.5.6/man/lispref/packaging.texi' 'xemacs-21.5.7/man/lispref/packaging.texi' Index: ././man/lispref/packaging.texi --- ././man/lispref/packaging.texi Sun Mar 3 18:09:51 2002 +++ ././man/lispref/packaging.texi Mon Jun 3 19:10:12 2002 @@ -915,7 +915,7 @@ The @file{package-info.in} literals provided by the maintainer generally should not change over the life of the package. (The exception is the @samp{provides} field, which should be generated, but isn't yet.) -Values described as ``literal'' below are unquoted literal test. These +Values described as ``literal'' below are unquoted literal text. These are normally interpreted as symbols by the package build process. The maintainer literals are diff --text -u 'xemacs-21.5.6/man/xemacs-faq.texi' 'xemacs-21.5.7/man/xemacs-faq.texi' Index: ././man/xemacs-faq.texi --- ././man/xemacs-faq.texi Wed Mar 13 17:52:24 2002 +++ ././man/xemacs-faq.texi Tue Jul 2 21:27:58 2002 @@ -7,7 +7,7 @@ @finalout @titlepage @title XEmacs FAQ -@subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2002/03/13 08:52:24 $ +@subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2002/07/02 12:27:58 $ @sp 1 @author Tony Rossini @author Ben Wing @@ -151,6 +151,7 @@ * Q2.0.12:: Why can't I strip XEmacs? * Q2.0.13:: I don't need no steenkin' packages. Do I? (NEW) * Q2.0.14:: How do I figure out which packages to install? (NEW) +* Q2.0.15:: EFS fails with "500 AUTH not understood" (NEW) Trouble Shooting: * Q2.1.1:: XEmacs just crashed on me! @@ -267,6 +268,7 @@ * Q3.10.3:: Can I turn off the highlight during isearch? * Q3.10.4:: How do I turn off highlighting after @kbd{C-x C-p} (mark-page)? * Q3.10.5:: The region disappears when I hit the end of buffer while scrolling. +* Q3.10.6:: Why is killing so slow? Major Subsystems @@ -1061,7 +1063,7 @@ which can be obtained from @end quotation -@uref{http://ftpsearch.lycos.com/?query=russian.el.Z&form=medium}. +@uref{http://www.math.uga.edu/~valery/russian.el}. @email{d.barsky@@ee.surrey.ac.uk, Dima Barsky} writes: @@ -1272,6 +1274,7 @@ * Q2.0.12:: Why can't I strip XEmacs? * Q2.0.13:: I don't need no steenkin' packages. Do I? (NEW) * Q2.0.14:: I don't want to install a million .els one at a time! (NEW) +* Q2.0.15:: EFS fails with "500 AUTH not understood" (NEW) Trouble Shooting: * Q2.1.1:: XEmacs just crashed on me! @@ -1644,8 +1647,8 @@ will be available with no packages installed, so installing packages is an essential part of making your installed XEmacs _useful_. -@node Q2.0.14, Q2.1.1, Q2.0.13, Installation -@unnumberedsubsec Q2.0.12: How do I figure out which packages to install? (NEW) +@node Q2.0.14, Q2.0.15, Q2.0.13, Installation +@unnumberedsubsec Q2.0.14: How do I figure out which packages to install? (NEW) Many people really liked the old way that packages were bundled and do not want to mess with packages at all. You can grab all the packages at @@ -1671,7 +1674,22 @@ packages, it is recommended that you use the automatic package tools afterwards to pick up any recent updates. -@node Q2.1.1, Q2.1.2, Q2.0.14, Installation +@node Q2.0.15, Q2.1.1, Q2.0.14, Installation +@unnumberedsubsec Q2.0.15: EFS fails with "500 AUTH not understood" (NEW) + +A typical error: FTP Error: USER request failed; 500 AUTH not understood. + +Thanks to giacomo boffi @email{giacomo.boffi@@polimi.it} who recommends +on comp.emacs.xemacs: + + tell your ftp client to not attempt AUTH authentication (or do not + use FTP servers that don't understand AUTH) + +and notes that you need to add an element (often "-u") to +`efs-ftp-program-args'. Use M-x customize-variable, and verify the +needed flag with `man ftp' or other local documentation. + +@node Q2.1.1, Q2.1.2, Q2.0.15, Installation @unnumberedsec 2.1: Trouble Shooting @unnumberedsubsec Q2.1.1: Help! XEmacs just crashed on me! @@ -2498,6 +2516,7 @@ * Q3.10.3:: Can I turn off the highlight during isearch? * Q3.10.4:: How do I turn off highlighting after @kbd{C-x C-p} (mark-page)? * Q3.10.5:: The region disappears when I hit the end of buffer while scrolling. +* Q3.10.6:: Why is killing so slow? @end menu @node Q3.0.1, Q3.0.2, Customization, Customization @@ -3790,7 +3809,7 @@ Also see @ref{Q3.10.1}. -@node Q3.10.5, , Q3.10.4, Customization +@node Q3.10.5, Q3.10.6, Q3.10.4, Customization @unnumberedsubsec Q3.10.5: The region disappears when I hit the end of buffer while scrolling. This has been fixed by default starting with XEmacs-20.3. @@ -3820,6 +3839,73 @@ Thanks to @email{raman@@adobe.com, T. V. Raman} for assistance in deriving this answer. + +@node Q3.10.6, , Q3.10.5, Customization +@unnumberedsubsec Q3.10.6: Why is killing so slow? + +This actually is an X Windows question, although you'll notice it with +keyboard operations as well as while using the GUI. Basically, there +are four ways to communicate interprogram via the X server: + +@table @strong +@item Primary selection +a transient selection that gets replaced every time a new selection is made + +@item Secondary selection +for "exchanging" with the primary selection + +@item Cut buffers +a clipboard internal to the X server (deprecated) + +@item Clipboard selection +a selection with a notification protocol that allows a separate app to +manage the clipboard +@end table + +The cut buffers are deprecated because managing them is even more +inefficient than the clipboard notification protocol. The primary +selection works fine for many users and applications, but is not very +robust under intensive or sophisticated use. + +In Motif and MS Windows, a clipboard has become the primary means for +managing cut and paste. These means that "modern" applications tend to +be oriented toward a true clipboard, rather than the primary selection. +(On Windows, there is nothing equivalent to the primary selection.) +It's not that XEmacs doesn't support the simple primary selection +method, it's that more and more other applications don't. + +So the slowdown occurs because XEmacs now engages in the clipboard +notification protocol on @emph{every} kill. This is especially slow on +Motif. + +With most people running most clients and server on the same host, and +many of the rest working over very fast communication, you may expect +that the situation is not going to improve. + +There are a number of workarounds. The most effective is to use a +special command to do selection ownership only when you intend to paste +to another application. Useful commands are @code{kill-primary-selection} +and @code{copy-primary-selection}. These work only on text selected +with the mouse (probably; experiment), and are bound by default to the +@kbd{Cut} and @kbd{Copy}, respectively, buttons on the toolbar. +@code{copy-primary-selection} is also bound to @kbd{C-Insert}. You can +yank the clipboard contents with @code{yank-primary-selection}, bound to +the @kbd{Paste} toolbar button and @kbd{Sh-Insert}. + +If you are communicating by cut and paste with applications that use the +primary selection, then you can customize +@code{interprogram-cut-function} to @code{nil}, restoring the XEmacs +version 20 behavior. How can you tell if a program will support this? +Motifly-correct programs require the clipboard; you lose. For others, +only by trying it. You also need to customize the complementary +@code{interprogram-paste-function} to @code{nil}. (Otherwise +XEmacs-to-XEmacs pastes will not work correctly.) + +You may get some relief on Motif by setting +@code{x-selection-strict-motif-ownership} to nil, but this means you will +only intermittently be able to paste XEmacs kills to Motif applications. + +Thanks to Jeff Mincy and Glynn Clements for corrections. @node Subsystems, Miscellaneous, Customization, Top @unnumbered 4 Major Subsystems diff --text -u 'xemacs-21.5.6/man/xemacs/custom.texi' 'xemacs-21.5.7/man/xemacs/custom.texi' Index: ././man/xemacs/custom.texi --- ././man/xemacs/custom.texi Thu Mar 14 20:50:17 2002 +++ ././man/xemacs/custom.texi Wed Jun 12 04:28:22 2002 @@ -1455,8 +1455,9 @@ table of syntactic classes, with the characters that specify them. @table @samp -@item @w{ } -The class of whitespace characters. +@item @w{-} +The class of whitespace characters. Please don't use the formerly +advertised @w{ }, which is not supported by GNU Emacs. @item w The class of word-constituent characters. @item _ diff --text -u 'xemacs-21.5.6/man/xemacs/mule.texi' 'xemacs-21.5.7/man/xemacs/mule.texi' Index: ././man/xemacs/mule.texi --- ././man/xemacs/mule.texi Fri Jun 1 17:17:05 2001 +++ ././man/xemacs/mule.texi Fri Jun 21 06:39:21 2002 @@ -71,7 +71,7 @@ @cindex language environments All supported character sets are supported in XEmacs buffers if it is -compile with mule; there is no need to select a particular language in +compiled with mule; there is no need to select a particular language in order to display its characters in an XEmacs buffer. However, it is important to select a @dfn{language environment} in order to set various defaults. The language environment really represents a choice of diff --text -u 'xemacs-21.5.6/man/xemacs/packages.texi' 'xemacs-21.5.7/man/xemacs/packages.texi' Index: ././man/xemacs/packages.texi --- ././man/xemacs/packages.texi Sat Feb 2 10:53:09 2002 +++ ././man/xemacs/packages.texi Wed May 1 17:25:52 2002 @@ -100,23 +100,14 @@ install packages from a local disk or CDROM. The file @file{etc/PACKAGES} in the core distribution contains a list of -the @ref{Available Packages} at the time of the XEmacs release. Packages are -also listed on the @code{Options} menu under: - -@example - Options->Customize->Emacs->Packages -@end example - -However, don't select any of these menu picks unless you actually want -to install the given package (and have properly configured your system -to do so). +the @ref{Available Packages} at the time of the XEmacs release. You can also get a list of available packages, and whether or not they are installed, using the visual package browser and installer. You can access it via the menus: @example - Options->Manage Packages->List & Install + Tools -> Packages -> List and Install @end example Or, you can get to it via the keyboard: @@ -244,14 +235,10 @@ After installing these by hand, fire up XEmacs and follow these steps. -Note: The menus in XEmacs 21.2.x and up have changed slightly, so -where I mention "Options -> Manage Packages", substitute "Tools -> -Packages". - @enumerate 1 @item Choose a download site. -via menu: Options -> Manages Packages -> Add Download Site +via menu: Tools -> Packages -> Add Download Site via keyb: @code{M-x customize-variable RET package-get-remote RET} (put in the details of remote host and directory) @@ -261,7 +248,7 @@ @item Obtain a list of packages and display the list in a buffer named @file{*Packages*}. -menu: Options -> Manage Packages -> List & Install +menu: Tools -> Packages -> List & Install keyb: @code{M-x pui-list-packages RET} XEmacs will now connect to the remote site and download the diff --text -u 'xemacs-21.5.6/modules/ChangeLog' 'xemacs-21.5.7/modules/ChangeLog' Index: ././modules/ChangeLog --- ././modules/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././modules/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,7 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. diff --text -u 'xemacs-21.5.6/netinstall/ChangeLog' 'xemacs-21.5.7/netinstall/ChangeLog' Index: ././netinstall/ChangeLog Prereq: 1.15 --- ././netinstall/ChangeLog Fri Apr 5 17:57:32 2002 +++ ././netinstall/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,53 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-02-04 Andy Piper + + * install.cc (install_one): Munge installed filename to fit inside + dialog. + +2001-12-17 Andy Piper + + * desktop.cc (do_desktop_setup): register the whole gamut of C++ + file types. + +2001-12-12 Andy Piper + + * win32.h (CDECL): reorder to remove warnings. + + * Makefile.in.in: add new dependencies. + + * desktop.h: new file. + + * uninstall.cc: use it. + + * install.cc (uninstall_one): when uninstalling xemacs remove + shortcuts also. + + * desktop.cc (remove_xemacs_setup): split out from + remove_desktop_setup. + (remove_desktop_setup): call it. + +2001-12-05 Andy Piper + + * win32.h: re-order declarations for native windows from Fabrice + Popineau. + +2001-11-22 Andy Piper + + * Makefile.in.in (setup-bin.ini): cope with kit revisions. + + * source.cc (save_dialog): warning removal. + (load_dialog): ditto. + + * msg.cc: remove cvs id. + + * desktop.cc (find_xemacs_version): new function. Cope with kit + revisions. + (find_xemacs_exe_path): use it. + (find_xemacs_exe_name): ditto. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. @@ -405,7 +455,6 @@ * all: port from cygwin setup. -%%% $Id: ChangeLog,v 1.15 2002/04/05 08:57:32 stephent Exp $ -$Revision: 1.15 $ - +%%% $Id: ChangeLog,v 1.20 2002/07/02 15:01:01 stephent Exp $ +$Revision: 1.20 $ diff --text -u 'xemacs-21.5.6/netinstall/desktop.cc' 'xemacs-21.5.7/netinstall/desktop.cc' Index: ././netinstall/desktop.cc --- ././netinstall/desktop.cc Thu Dec 20 14:49:40 2001 +++ ././netinstall/desktop.cc Fri Apr 26 03:03:41 2002 @@ -315,7 +315,10 @@ log (0, "Registering .cpp files"); setup_explorer ("cpp", "C++ Source file", batname); setup_explorer ("cc", "C++ Source file", batname); + setup_explorer ("cxx", "C++ Source file", batname); setup_explorer ("hh", "C++ Header file", batname); + setup_explorer ("hpp", "C++ Header file", batname); + setup_explorer ("hxx", "C++ Header file", batname); } if (reg_c) { diff --text -u /dev/null 'xemacs-21.5.7/netinstall/init.cc' Index: ././netinstall/init.cc --- ././netinstall/init.cc Thu Jan 1 09:00:00 1970 +++ ././netinstall/init.cc Fri Apr 26 03:03:42 2002 @@ -0,0 +1,65 @@ +/* Initialisation for netinstall. + Copyright (C) 2001 Andy Piper. + +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 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. */ + +#include "win32.h" +#include +#include +#include "dialog.h" +#include "log.h" +#include "resource.h" +#include "state.h" +#include "msg.h" +#include "regedit.h" +#include "reginfo.h" +#include "version.h" + +static void +init_root () +{ + int isnative, issystem; + root_dir = find_root_location (&issystem, &isnative); + if (root_dir) + { + if (isnative) + install_type = IDC_INSTALL_NATIVE; + else + install_type = IDC_INSTALL_CYGWIN; + + if (issystem) + root_scope = IDC_ROOT_SYSTEM; + else + root_scope = IDC_ROOT_USER; + root_dir_default = 0; + } +} + +void +do_init (HINSTANCE h) +{ + char cwd[_MAX_PATH]; + GetCurrentDirectory (sizeof (cwd), cwd); + local_dir = strdup (cwd); + log (0, "Current Directory: %s", cwd); + + HANDLE gnu = LoadImage (h, MAKEINTRESOURCE (IDB_GNU), + IMAGE_BITMAP, 0, 0, 0); + init_root(); +} + diff --text -u 'xemacs-21.5.6/netinstall/install.cc' 'xemacs-21.5.7/netinstall/install.cc' Index: ././netinstall/install.cc --- ././netinstall/install.cc Thu Dec 20 14:49:40 2001 +++ ././netinstall/install.cc Fri Apr 26 03:03:42 2002 @@ -282,6 +282,7 @@ for (cp=local; *cp; cp++) if (*cp == '/' || *cp == '\\' || *cp == ':') base = cp+1; + SetWindowText (ins_pkgname, base); if (!exists (local) && exists (base)) @@ -315,14 +316,27 @@ tar_open (local); while ((fn = tar_next_file ())) { - char *dest_file; + char *dest_file, *disp_file; + int len; if (lst) fprintf (lst, "%s\n", fn); dest_file = map_filename (fn, type); + + // The installer uses a variable width font. Assume roughly 32 chars + // will fit and munge the file accordingly. +#define MAX_DISP_SIZE 50 + disp_file = strdup(dest_file); + if ((len = strlen(dest_file)) > MAX_DISP_SIZE) { + disp_file += (len - MAX_DISP_SIZE); + disp_file[0] = '.'; + disp_file[1] = '.'; + disp_file[2] = '.'; + } +#undef MAX_DISP_SIZE + SetWindowText (ins_filename, disp_file); - SetWindowText (ins_filename, dest_file); log (LOG_BABBLE, "Installing file %s", dest_file); if (tar_read_file (dest_file) != 0) { diff --text -u 'xemacs-21.5.6/netinstall/res.rc' 'xemacs-21.5.7/netinstall/res.rc' Index: ././netinstall/res.rc Prereq: 1.8 --- ././netinstall/res.rc Wed Mar 13 17:52:27 2002 +++ ././netinstall/res.rc Fri Apr 26 03:03:43 2002 @@ -1,546 +1,546 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_SOURCE DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Next >",IDOK,199,176,45,15, WS_GROUP - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - CONTROL "Download from the Internet",IDC_SOURCE_DOWNLOAD,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,127,102,152,10 - CONTROL "Install from the Internet",IDC_SOURCE_NETINST,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,127,121,87,10 - CONTROL "Install from Local Directory",IDC_SOURCE_CWD,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,127,140,104,10 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "Setup will use the following installation method.", - IDC_STATIC,112,11,170,17 - LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, - 32,166,17 - GROUPBOX "Installation method",IDC_STATIC,113,84,188,77 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Local package directory" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Next >",IDOK,199,176,45,15,WS_DISABLED - PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - EDITTEXT IDC_LOCAL_DIR,120,138,122,12,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",IDC_LOCAL_DIR_BROWSE,252,137,38,14 - LTEXT "Setup will use the following folder to install XEmacs and / or packages from.", - IDC_STATIC,112,10,170,17 - LTEXT "To select a different folder, click Browse and select another folder.", - IDC_STATIC,112,36,170,18 - LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, - 63,166,17 - GROUPBOX "Local Package Directory",IDC_STATIC,112,126,186,31 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_ROOT DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 - PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - EDITTEXT IDC_ROOT_DIR,120,138,122,12,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",IDC_ROOT_BROWSE,252,137,38,14 - LTEXT "Setup will use the following folder in which to install XEmacs and / or packages.", - IDC_STATIC,112,10,170,17 - LTEXT "To select a different folder, click Browse and select another folder.", - IDC_STATIC,112,35,170,18 - LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, - 63,166,17 - GROUPBOX "Installation Root Directory",IDC_STATIC,112,126,186,31 - CONTROL "All",IDC_ROOT_SYSTEM,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,177,110,25,8 - CONTROL "Just Me",IDC_ROOT_USER,"Button",BS_AUTORADIOBUTTON,220, - 110,50,8 - LTEXT "Installation Type :",IDC_STATIC,112,95,60,8 - LTEXT "Install For :",IDC_STATIC,112,110,43,8 - CONTROL "Native",IDC_INSTALL_NATIVE,"Button",BS_AUTORADIOBUTTON, - 177,93,37,10 - CONTROL "Cygwin",IDC_INSTALL_CYGWIN,"Button",BS_AUTORADIOBUTTON, - 220,93,39,10 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_SITE DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 - PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "Select Download Site",IDC_STATIC,113,11,135,11 - LISTBOX IDC_URL_LIST,121,24,179,136,LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_OTHER_URL DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 - PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - EDITTEXT IDC_OTHER_URL,120,138,170,12,ES_AUTOHSCROLL - LTEXT "Setup will use the following URL to install XEmacs and / or packages from.", - IDC_STATIC,112,10,170,17 - LTEXT "To select a different URL, edit the text.",IDC_STATIC, - 112,36,170,18 - LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, - 58,166,17 - GROUPBOX "Select URL to download from",IDC_STATIC,112,126,186,31 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_NET DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Next >",IDOK,199,176,45,15,WS_GROUP - PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "Setup will use the following connection method.", - IDC_STATIC,112,11,170,17,NOT WS_GROUP - LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, - 32,166,17,NOT WS_GROUP - CONTROL "Use IE5 Settings",IDC_NET_IE5,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,128,93,69,10 - CONTROL "Direct Connection",IDC_NET_DIRECT,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,128,109,73,10 - CONTROL "Use HTTP/FTP Proxy:",IDC_NET_PROXY,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,128,124,88,10 - EDITTEXT IDC_PROXY_HOST,128,141,80,12,ES_AUTOHSCROLL | - WS_DISABLED - LTEXT "Proxy",IDC_STATIC,10,55,50,15,SS_CENTERIMAGE, - WS_EX_RIGHT - LTEXT "Port",IDC_STATIC,229,139,20,15,SS_CENTERIMAGE, - WS_EX_RIGHT - EDITTEXT IDC_PROXY_PORT,257,141,30,12,ES_AUTOHSCROLL | - WS_DISABLED - GROUPBOX "Installation method",IDC_STATIC,113,78,188,83 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_DLSTATUS DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | - WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "Downloading Packages",IDC_STATIC,112,10,170,17 - LTEXT "(URL)",IDC_DLS_URL,112,26,170,11 - LTEXT "(RATE)",IDC_DLS_RATE,112,41,166,11 - CONTROL "Progress1",IDC_DLS_PROGRESS,"msctls_progress32", - WS_BORDER,123,143,165,10 - GROUPBOX "Progress",IDC_STATIC,112,130,186,31 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_INSTATUS DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | - WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "Installing Packages",IDC_STATIC,112,10,170,17 - LTEXT "(PKG)",IDC_INS_PKG,112,26,170,11 - LTEXT "(FILE)",IDC_INS_FILE,112,41,166,11 - CONTROL "Progress1",IDC_INS_DISKFULL,"msctls_progress32", - WS_BORDER,123,143,165,10 - CONTROL "Progress1",IDC_INS_IPROGRESS,"msctls_progress32", - WS_BORDER,125,106,163,10 - CONTROL "Progress1",IDC_INS_PPROGRESS,"msctls_progress32", - WS_BORDER,125,67,163,10 - GROUPBOX "Disk",IDC_STATIC,112,130,186,31 - GROUPBOX "Package",IDC_STATIC,112,54,186,31 - GROUPBOX "Total",IDC_STATIC,112,93,186,31 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_UNINSTALL DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Uninstall XEmacs" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Cancel",IDCANCEL,199,176,45,15 - DEFPUSHBUTTON "Uninstall",IDOK,256,176,45,15 - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "Uninstalling Packages",IDC_STATIC,112,10,170,17 - LTEXT "(PKG)",IDC_UNINS_PKG,112,26,170,11 - LTEXT "(FILE)",IDC_UNINS_FILE,112,41,166,11 - CONTROL "Progress1",IDC_UNINS_DISKFULL,"msctls_progress32", - WS_BORDER,123,143,165,10 - CONTROL "Progress1",IDC_UNINS_IPROGRESS,"msctls_progress32", - WS_BORDER,125,106,163,10 - CONTROL "Progress1",IDC_UNINS_PPROGRESS,"msctls_progress32", - WS_BORDER,125,67,163,10 - GROUPBOX "Disk",IDC_STATIC,112,130,186,31 - GROUPBOX "Package",IDC_STATIC,112,54,186,31 - GROUPBOX "Total",IDC_STATIC,112,93,186,31 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_PROXY_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDI_XEMACS,IDC_STATIC,5,5,20,20 - EDITTEXT IDC_NET_USER,65,28,145,12,ES_AUTOHSCROLL - LTEXT "Proxy User ID",IDC_STATIC,5,28,55,15,SS_CENTERIMAGE, - WS_EX_RIGHT - EDITTEXT IDC_NET_PASSWD,65,43,145,12,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Password",IDC_STATIC,10,43,50,15,SS_CENTERIMAGE, - WS_EX_RIGHT - LTEXT "Proxy Authorization Required",IDC_STATIC,65,10,145,10 - DEFPUSHBUTTON "OK",IDOK,100,75,45,15,WS_DISABLED - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 -END - -IDD_NET_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDI_XEMACS,IDC_STATIC,5,5,20,20 - EDITTEXT IDC_NET_USER,65,28,145,12,ES_AUTOHSCROLL - LTEXT "User ID",IDC_STATIC,5,28,55,15,SS_CENTERIMAGE, - WS_EX_RIGHT - EDITTEXT IDC_NET_PASSWD,65,43,145,12,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Password",IDC_STATIC,10,43,50,15,SS_CENTERIMAGE, - WS_EX_RIGHT - LTEXT "Server Authorization Required",IDC_STATIC,65,10,145,10 - DEFPUSHBUTTON "OK",IDOK,100,75,45,15,WS_DISABLED - PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 -END - -IDD_SPLASH DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - ICON IDI_XEMACS,IDC_STATIC,107,10,20,20 - LTEXT "Welcome to the XEmacs Net Release Setup Program. This will install XEmacs and/or associated packages on your computer.", - IDC_STATIC,133,10,158,29 - LTEXT "Version (unknown)",IDC_VERSION,112,117,120,10 - LTEXT "Copyright (C) 2000 Red Hat Inc",IDC_STATIC,111,132,135, - 8 - LTEXT "http://www.xemacs.org/",IDC_STATIC,111,147,150,10 - LTEXT "It is strongly recommended that you exit all Windows programs before running this utility.", - IDC_STATIC,110,43,191,19 - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 -END - -IDD_CHOOSE DIALOG DISCARDABLE 0, 0, 311, 239 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Next >",IDOK,199,214,45,15 - PUSHBUTTON "< Back",IDC_BACK,154,214,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,214,45,15 - LTEXT "",IDC_STATIC,10,201,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "Select packages to install",IDC_STATIC,55,5,85,8 - ICON IDI_XEMACS,IDC_STATIC,5,5,21,20 - LTEXT "",IDC_LISTVIEW_POS,55,15,230,155,SS_SUNKEN | NOT - WS_VISIBLE | NOT WS_GROUP - CONTROL "SPIN",IDC_STATIC,"Static",SS_BITMAP,55,170,15,13 - LTEXT "= click to choose action, (p) = previous version, (x) = experimental", - IDC_STATIC,65,170,220,8 - PUSHBUTTON "Full/Part",IDC_CHOOSE_FULLPART,250,5,35,10 - PUSHBUTTON "Exp",IDC_CHOOSE_EXP,215,5,25,10 - PUSHBUTTON "Curr",IDC_CHOOSE_CURR,190,5,25,10 - PUSHBUTTON "Prev",IDC_CHOOSE_PREV,165,5,25,10 -END - -IDD_DESKTOP DIALOG DISCARDABLE 0, 0, 311, 201 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "XEmacs Setup" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Finish",IDOK,199,176,45,15 - PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 - PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 - LTEXT "Setup has now finished. To create desktop shortcuts, please select from the following options.", - IDC_STATIC,112,11,170,17 - LTEXT "To complete setup click Finish.",IDC_STATIC,112,32,166, - 17 - CONTROL "Create Desktop Icon",IDC_ROOT_DESKTOP,"Button", - BS_AUTOCHECKBOX,113,50,100,8 - CONTROL "Add to Start Menu",IDC_ROOT_MENU,"Button", - BS_AUTOCHECKBOX,113,66,100,8 - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 - CONTROL "Text",IDC_TXT_TYPE,"Button",BS_AUTOCHECKBOX,209,101,38, - 8 - CONTROL "Java",IDC_JAVA_TYPE,"Button",BS_AUTOCHECKBOX,113,100,50, - 8 - CONTROL "C",IDC_C_TYPE,"Button",BS_AUTOCHECKBOX,113,116,41,8 - CONTROL "C++",IDC_CPP_TYPE,"Button",BS_AUTOCHECKBOX,113,133,38,8 - CONTROL "E-Lisp",IDC_ELISP_TYPE,"Button",BS_AUTOCHECKBOX,113,148, - 38,8 - LTEXT "Register XEmacs for these file types:",IDC_STATIC,113, - 84,166,13 - LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP - LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP - CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 - CONTROL "IDL",IDC_IDL_TYPE,"Button",BS_AUTOCHECKBOX,209,116,38,8 -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_XEMACS ICON DISCARDABLE "xemacs.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// FILE -// - -XEMACS.ICON FILE DISCARDABLE "xemacs.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_SOURCE, DIALOG - BEGIN - VERTGUIDE, 113 - VERTGUIDE, 127 - END - - IDD_LOCAL_DIR, DIALOG - BEGIN - VERTGUIDE, 112 - HORZGUIDE, 10 - END - - IDD_ROOT, DIALOG - BEGIN - VERTGUIDE, 112 - HORZGUIDE, 103 - HORZGUIDE, 118 - END - - IDD_SITE, DIALOG - BEGIN - HORZGUIDE, 11 - HORZGUIDE, 161 - END - - IDD_NET, DIALOG - BEGIN - VERTGUIDE, 128 - BOTTOMMARGIN, 191 - HORZGUIDE, 153 - END - - IDD_INSTATUS, DIALOG - BEGIN - VERTGUIDE, 112 - VERTGUIDE, 125 - VERTGUIDE, 288 - END - - IDD_PROXY_AUTH, DIALOG - BEGIN - BOTTOMMARGIN, 49 - END - - IDD_NET_AUTH, DIALOG - BEGIN - BOTTOMMARGIN, 49 - END - - IDD_SPLASH, DIALOG - BEGIN - LEFTMARGIN, 10 - RIGHTMARGIN, 301 - TOPMARGIN, 10 - BOTTOMMARGIN, 191 - END - - IDD_CHOOSE, DIALOG - BEGIN - BOTTOMMARGIN, 229 - HORZGUIDE, 214 - END - - IDD_DESKTOP, DIALOG - BEGIN - VERTGUIDE, 113 - VERTGUIDE, 209 - HORZGUIDE, 124 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -SPIN BITMAP DISCARDABLE "choose-spin.bmp" -IDB_SPIN BITMAP DISCARDABLE "choose-spin.bmp" -IDB_RTARROW BITMAP DISCARDABLE "choose-rtarrow.bmp" -IDB_CHECK_YES BITMAP DISCARDABLE "check-yes.bmp" -IDB_CHECK_NO BITMAP DISCARDABLE "check-no.bmp" -IDB_CHECK_NA BITMAP DISCARDABLE "check-na.bmp" -GNU BITMAP DISCARDABLE "gnu.bmp" -IDB_GNU BITMAP DISCARDABLE "gnu.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ROOT_SLASH "Warning: we recommend you do NOT use the root of your hard drive as the XEmacs root. Proceed anyway?" - IDS_ROOT_SPACE "You should not choose a root path that include spaces in directory names. Proceed anyway?" - IDS_MIRROR_LST "http://www.xemacs.org/Download/mirrors.lst" - IDS_DIALOG_FAILED "Unable to create Dialog Box" - IDS_CYGWIN_FUNC_MISSING "Error: unable to find function `%s' in %s" - IDS_DOWNLOAD_SHORT "Download error: %s too short (%d, wanted %d)" - IDS_ERR_OPEN_WRITE "Can't open %s for writing: %s" - IDS_SETUPINI_MISSING "Unable to get setup.ini from %s" - IDS_OLD_SETUPINI "This setup.ini is older than the one you used last time you installed cygwin. Proceed anyway?" - IDS_ERR_RENAME "Can't rename %s to %s: %s" - IDS_NOTHING_INSTALLED "Nothing needed to be installed" - IDS_INSTALL_COMPLETE "Installation Complete" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ERR_OPEN_READ "Can't open %s for reading: %s" - IDS_ROOT_ABSOLUTE "The install directory must be absolute, with both a drive letter and leading slash, like C:\\Cygwin" - IDS_DOWNLOAD_COMPLETE "Download Complete" - IDS_CVSID "\n%%% $Id: res.rc,v 1.8 2002/03/13 08:52:27 ben Exp $\n" - IDS_NOLOGFILE "Cannot open log file %s for writing" - IDS_UNINSTALL_COMPLETE "Uninstalls complete." - IDS_WININET "Unable to find or load the Internet Explorer 5 DLLs" - IDS_ERR_CHDIR "Could not change dir to %s" - IDS_CREATE_DIR "The directory %s does not exist, create it?" - IDS_OLD_SETUP_VERSION "This setup is version %s, but setup.ini claims version %s is available.\nYou might want to upgrade to get the latest features and bug fixes." - IDS_DOWNLOAD_FAILED "Unable to download %s" - IDS_DOWNLOAD_INCOMPLETE "Download Incomplete. Try again?" - IDS_INSTALL_INCOMPLETE "Installation incomplete. Check /setup.log.full for details" - IDS_ROOT_NOCYGWIN "You should not install the Cygwin version without Cygwin installed. Proceed anyway?" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_SOURCE DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Next >",IDOK,199,176,45,15,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + CONTROL "Download from the Internet",IDC_SOURCE_DOWNLOAD,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,127,102,152,10 + CONTROL "Install from the Internet",IDC_SOURCE_NETINST,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,127,121,87,10 + CONTROL "Install from Local Directory",IDC_SOURCE_CWD,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,127,140,104,10 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Setup will use the following installation method.", + IDC_STATIC,112,11,170,17 + LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, + 32,166,17 + GROUPBOX "Installation method",IDC_STATIC,113,84,188,77 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Local package directory" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Next >",IDOK,199,176,45,15,WS_DISABLED + PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + EDITTEXT IDC_LOCAL_DIR,120,138,122,12,ES_AUTOHSCROLL + PUSHBUTTON "Browse...",IDC_LOCAL_DIR_BROWSE,252,137,38,14 + LTEXT "Setup will use the following folder to install XEmacs and / or packages from.", + IDC_STATIC,112,10,170,17 + LTEXT "To select a different folder, click Browse and select another folder.", + IDC_STATIC,112,36,170,18 + LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, + 63,166,17 + GROUPBOX "Local Package Directory",IDC_STATIC,112,126,186,31 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_ROOT DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 + PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + EDITTEXT IDC_ROOT_DIR,120,138,122,12,ES_AUTOHSCROLL + PUSHBUTTON "Browse...",IDC_ROOT_BROWSE,252,137,38,14 + LTEXT "Setup will use the following folder in which to install XEmacs and / or packages.", + IDC_STATIC,112,10,170,17 + LTEXT "To select a different folder, click Browse and select another folder.", + IDC_STATIC,112,35,170,18 + LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, + 63,166,17 + GROUPBOX "Installation Root Directory",IDC_STATIC,112,126,186,31 + CONTROL "All",IDC_ROOT_SYSTEM,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,177,110,25,8 + CONTROL "Just Me",IDC_ROOT_USER,"Button",BS_AUTORADIOBUTTON,220, + 110,50,8 + LTEXT "Installation Type :",IDC_STATIC,112,95,60,8 + LTEXT "Install For :",IDC_STATIC,112,110,43,8 + CONTROL "Native",IDC_INSTALL_NATIVE,"Button",BS_AUTORADIOBUTTON, + 177,93,37,10 + CONTROL "Cygwin",IDC_INSTALL_CYGWIN,"Button",BS_AUTORADIOBUTTON, + 220,93,39,10 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_SITE DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 + PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Select Download Site",IDC_STATIC,113,11,135,11 + LISTBOX IDC_URL_LIST,121,24,179,136,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_OTHER_URL DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 + PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + EDITTEXT IDC_OTHER_URL,120,138,170,12,ES_AUTOHSCROLL + LTEXT "Setup will use the following URL to install XEmacs and / or packages from.", + IDC_STATIC,112,10,170,17 + LTEXT "To select a different URL, edit the text.",IDC_STATIC, + 112,36,170,18 + LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, + 58,166,17 + GROUPBOX "Select URL to download from",IDC_STATIC,112,126,186,31 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_NET DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Next >",IDOK,199,176,45,15,WS_GROUP + PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Setup will use the following connection method.", + IDC_STATIC,112,11,170,17,NOT WS_GROUP + LTEXT "To exit setup click Cancel at any time.",IDC_STATIC,112, + 32,166,17,NOT WS_GROUP + CONTROL "Use IE5 Settings",IDC_NET_IE5,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,128,93,69,10 + CONTROL "Direct Connection",IDC_NET_DIRECT,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,128,109,73,10 + CONTROL "Use HTTP/FTP Proxy:",IDC_NET_PROXY,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,128,124,88,10 + EDITTEXT IDC_PROXY_HOST,128,141,80,12,ES_AUTOHSCROLL | + WS_DISABLED + LTEXT "Proxy",IDC_STATIC,10,55,50,15,SS_CENTERIMAGE, + WS_EX_RIGHT + LTEXT "Port",IDC_STATIC,229,139,20,15,SS_CENTERIMAGE, + WS_EX_RIGHT + EDITTEXT IDC_PROXY_PORT,257,141,30,12,ES_AUTOHSCROLL | + WS_DISABLED + GROUPBOX "Installation method",IDC_STATIC,113,78,188,83 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_DLSTATUS DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Downloading Packages",IDC_STATIC,112,10,170,17 + LTEXT "(URL)",IDC_DLS_URL,112,26,170,11 + LTEXT "(RATE)",IDC_DLS_RATE,112,41,166,11 + CONTROL "Progress1",IDC_DLS_PROGRESS,"msctls_progress32", + WS_BORDER,123,143,165,10 + GROUPBOX "Progress",IDC_STATIC,112,130,186,31 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_INSTATUS DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Installing Packages",IDC_STATIC,112,10,170,17 + LTEXT "(PKG)",IDC_INS_PKG,112,26,170,11 + LTEXT "(FILE)",IDC_INS_FILE,112,41,183,11 + CONTROL "Progress1",IDC_INS_DISKFULL,"msctls_progress32", + WS_BORDER,123,143,165,10 + CONTROL "Progress1",IDC_INS_IPROGRESS,"msctls_progress32", + WS_BORDER,125,106,163,10 + CONTROL "Progress1",IDC_INS_PPROGRESS,"msctls_progress32", + WS_BORDER,125,67,163,10 + GROUPBOX "Disk",IDC_STATIC,112,130,186,31 + GROUPBOX "Package",IDC_STATIC,112,54,186,31 + GROUPBOX "Total",IDC_STATIC,112,93,186,31 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_UNINSTALL DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Uninstall XEmacs" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,199,176,45,15 + DEFPUSHBUTTON "Uninstall",IDOK,256,176,45,15 + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Uninstalling Packages",IDC_STATIC,112,10,170,17 + LTEXT "(PKG)",IDC_UNINS_PKG,112,26,170,11 + LTEXT "(FILE)",IDC_UNINS_FILE,112,41,166,11 + CONTROL "Progress1",IDC_UNINS_DISKFULL,"msctls_progress32", + WS_BORDER,123,143,165,10 + CONTROL "Progress1",IDC_UNINS_IPROGRESS,"msctls_progress32", + WS_BORDER,125,106,163,10 + CONTROL "Progress1",IDC_UNINS_PPROGRESS,"msctls_progress32", + WS_BORDER,125,67,163,10 + GROUPBOX "Disk",IDC_STATIC,112,130,186,31 + GROUPBOX "Package",IDC_STATIC,112,54,186,31 + GROUPBOX "Total",IDC_STATIC,112,93,186,31 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_PROXY_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_XEMACS,IDC_STATIC,5,5,20,20 + EDITTEXT IDC_NET_USER,65,28,145,12,ES_AUTOHSCROLL + LTEXT "Proxy User ID",IDC_STATIC,5,28,55,15,SS_CENTERIMAGE, + WS_EX_RIGHT + EDITTEXT IDC_NET_PASSWD,65,43,145,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Password",IDC_STATIC,10,43,50,15,SS_CENTERIMAGE, + WS_EX_RIGHT + LTEXT "Proxy Authorization Required",IDC_STATIC,65,10,145,10 + DEFPUSHBUTTON "OK",IDOK,100,75,45,15,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 +END + +IDD_NET_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_XEMACS,IDC_STATIC,5,5,20,20 + EDITTEXT IDC_NET_USER,65,28,145,12,ES_AUTOHSCROLL + LTEXT "User ID",IDC_STATIC,5,28,55,15,SS_CENTERIMAGE, + WS_EX_RIGHT + EDITTEXT IDC_NET_PASSWD,65,43,145,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Password",IDC_STATIC,10,43,50,15,SS_CENTERIMAGE, + WS_EX_RIGHT + LTEXT "Server Authorization Required",IDC_STATIC,65,10,145,10 + DEFPUSHBUTTON "OK",IDOK,100,75,45,15,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 +END + +IDD_SPLASH DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Next >",IDOK,199,176,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + ICON IDI_XEMACS,IDC_STATIC,107,10,20,20 + LTEXT "Welcome to the XEmacs Net Release Setup Program. This will install XEmacs and/or associated packages on your computer.", + IDC_STATIC,133,10,158,29 + LTEXT "Version (unknown)",IDC_VERSION,112,117,120,10 + LTEXT "Copyright (C) 2000 Red Hat Inc",IDC_STATIC,111,132,135, + 8 + LTEXT "http://www.xemacs.org/",IDC_STATIC,111,147,150,10 + LTEXT "It is strongly recommended that you exit all Windows programs before running this utility.", + IDC_STATIC,110,43,191,19 + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 +END + +IDD_CHOOSE DIALOG DISCARDABLE 0, 0, 311, 239 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Next >",IDOK,199,214,45,15 + PUSHBUTTON "< Back",IDC_BACK,154,214,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,214,45,15 + LTEXT "",IDC_STATIC,10,201,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "Select packages to install",IDC_STATIC,55,5,85,8 + ICON IDI_XEMACS,IDC_STATIC,5,5,21,20 + LTEXT "",IDC_LISTVIEW_POS,55,15,230,155,SS_SUNKEN | NOT + WS_VISIBLE | NOT WS_GROUP + CONTROL "SPIN",IDC_STATIC,"Static",SS_BITMAP,55,170,15,13 + LTEXT "= click to choose action, (p) = previous version, (x) = experimental", + IDC_STATIC,65,170,220,8 + PUSHBUTTON "Full/Part",IDC_CHOOSE_FULLPART,250,5,35,10 + PUSHBUTTON "Exp",IDC_CHOOSE_EXP,215,5,25,10 + PUSHBUTTON "Curr",IDC_CHOOSE_CURR,190,5,25,10 + PUSHBUTTON "Prev",IDC_CHOOSE_PREV,165,5,25,10 +END + +IDD_DESKTOP DIALOG DISCARDABLE 0, 0, 311, 201 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "XEmacs Setup" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Finish",IDOK,199,176,45,15 + PUSHBUTTON "< Back",IDC_BACK,154,176,45,15 + PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 + LTEXT "Setup has now finished. To create desktop shortcuts, please select from the following options.", + IDC_STATIC,112,11,170,17 + LTEXT "To complete setup click Finish.",IDC_STATIC,112,32,166, + 17 + CONTROL "Create Desktop Icon",IDC_ROOT_DESKTOP,"Button", + BS_AUTOCHECKBOX,113,50,100,8 + CONTROL "Add to Start Menu",IDC_ROOT_MENU,"Button", + BS_AUTOCHECKBOX,113,66,100,8 + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 + CONTROL "Text",IDC_TXT_TYPE,"Button",BS_AUTOCHECKBOX,209,101,38, + 8 + CONTROL "Java",IDC_JAVA_TYPE,"Button",BS_AUTOCHECKBOX,113,100,50, + 8 + CONTROL "C",IDC_C_TYPE,"Button",BS_AUTOCHECKBOX,113,116,41,8 + CONTROL "C++",IDC_CPP_TYPE,"Button",BS_AUTOCHECKBOX,113,133,38,8 + CONTROL "E-Lisp",IDC_ELISP_TYPE,"Button",BS_AUTOCHECKBOX,113,148, + 38,8 + LTEXT "Register XEmacs for these file types:",IDC_STATIC,113, + 84,166,13 + LTEXT "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP + LTEXT "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP + CONTROL "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62 + CONTROL "IDL",IDC_IDL_TYPE,"Button",BS_AUTOCHECKBOX,209,116,38,8 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_XEMACS ICON DISCARDABLE "xemacs.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// FILE +// + +XEMACS.ICON FILE DISCARDABLE "xemacs.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_SOURCE, DIALOG + BEGIN + VERTGUIDE, 113 + VERTGUIDE, 127 + END + + IDD_LOCAL_DIR, DIALOG + BEGIN + VERTGUIDE, 112 + HORZGUIDE, 10 + END + + IDD_ROOT, DIALOG + BEGIN + VERTGUIDE, 112 + HORZGUIDE, 103 + HORZGUIDE, 118 + END + + IDD_SITE, DIALOG + BEGIN + HORZGUIDE, 11 + HORZGUIDE, 161 + END + + IDD_NET, DIALOG + BEGIN + VERTGUIDE, 128 + BOTTOMMARGIN, 191 + HORZGUIDE, 153 + END + + IDD_INSTATUS, DIALOG + BEGIN + VERTGUIDE, 112 + VERTGUIDE, 125 + VERTGUIDE, 288 + END + + IDD_PROXY_AUTH, DIALOG + BEGIN + BOTTOMMARGIN, 49 + END + + IDD_NET_AUTH, DIALOG + BEGIN + BOTTOMMARGIN, 49 + END + + IDD_SPLASH, DIALOG + BEGIN + LEFTMARGIN, 10 + RIGHTMARGIN, 301 + TOPMARGIN, 10 + BOTTOMMARGIN, 191 + END + + IDD_CHOOSE, DIALOG + BEGIN + BOTTOMMARGIN, 229 + HORZGUIDE, 214 + END + + IDD_DESKTOP, DIALOG + BEGIN + VERTGUIDE, 113 + VERTGUIDE, 209 + HORZGUIDE, 124 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +SPIN BITMAP DISCARDABLE "choose-spin.bmp" +IDB_SPIN BITMAP DISCARDABLE "choose-spin.bmp" +IDB_RTARROW BITMAP DISCARDABLE "choose-rtarrow.bmp" +IDB_CHECK_YES BITMAP DISCARDABLE "check-yes.bmp" +IDB_CHECK_NO BITMAP DISCARDABLE "check-no.bmp" +IDB_CHECK_NA BITMAP DISCARDABLE "check-na.bmp" +GNU BITMAP DISCARDABLE "gnu.bmp" +IDB_GNU BITMAP DISCARDABLE "gnu.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ROOT_SLASH "Warning: we recommend you do NOT use the root of your hard drive as the XEmacs root. Proceed anyway?" + IDS_ROOT_SPACE "You should not choose a root path that include spaces in directory names. Proceed anyway?" + IDS_MIRROR_LST "http://www.xemacs.org/Download/mirrors.lst" + IDS_DIALOG_FAILED "Unable to create Dialog Box" + IDS_CYGWIN_FUNC_MISSING "Error: unable to find function `%s' in %s" + IDS_DOWNLOAD_SHORT "Download error: %s too short (%d, wanted %d)" + IDS_ERR_OPEN_WRITE "Can't open %s for writing: %s" + IDS_SETUPINI_MISSING "Unable to get setup.ini from %s" + IDS_OLD_SETUPINI "This setup.ini is older than the one you used last time you installed cygwin. Proceed anyway?" + IDS_ERR_RENAME "Can't rename %s to %s: %s" + IDS_NOTHING_INSTALLED "Nothing needed to be installed" + IDS_INSTALL_COMPLETE "Installation Complete" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERR_OPEN_READ "Can't open %s for reading: %s" + IDS_ROOT_ABSOLUTE "The install directory must be absolute, with both a drive letter and leading slash, like C:\\Cygwin" + IDS_DOWNLOAD_COMPLETE "Download Complete" + IDS_CVSID "\n%%% $Id: res.rc,v 1.9 2002/04/25 18:03:43 andyp Exp $\n" + IDS_NOLOGFILE "Cannot open log file %s for writing" + IDS_UNINSTALL_COMPLETE "Uninstalls complete." + IDS_WININET "Unable to find or load the Internet Explorer 5 DLLs" + IDS_ERR_CHDIR "Could not change dir to %s" + IDS_OLD_SETUP_VERSION "This setup is version %s, but setup.ini claims version %s is available.\nYou might want to upgrade to get the latest features and bug fixes." + IDS_DOWNLOAD_FAILED "Unable to download %s" + IDS_DOWNLOAD_INCOMPLETE "Download Incomplete. Try again?" + IDS_INSTALL_INCOMPLETE "Installation incomplete. Check /setup.log.full for details" + IDS_ROOT_NOCYGWIN "You should not install the Cygwin version without Cygwin installed. Proceed anyway?" + IDS_CREATE_DIR "The directory %s does not exist, create it?" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --text -u 'xemacs-21.5.6/nt/ChangeLog' 'xemacs-21.5.7/nt/ChangeLog' Index: ././nt/ChangeLog --- ././nt/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././nt/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,225 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-06-25 Adrian Aichner + + * xemacs.mak (DEBUG_DEFINES): Initialize to empty for + DEBUG_XEMACS=0. + +2002-06-20 Ben Wing + + * config.inc.samp (OPTIMIZED_BUILD): + * config.inc.samp (USE_FASTCALL): New. + * config.inc.samp (PROFILE_SUPPORT): New. + * config.inc.samp (DEBUG_XEMACS): + * config.inc.samp (HAVE_VC6): New. + * config.inc.samp (USE_PORTABLE_DUMPER): + Clean up, add args to control fastcall (not yet supported! the + changes needed are in another ws of mine), profile support, vc6 + support, union-type. + + * xemacs.dsp (CFG): + * xemacs.mak (HAVE_DIALOGS): + * xemacs.mak (HAVE_MSW_C_DIRED): Removed. + * xemacs.mak (USE_FASTCALL): New. + * xemacs.mak (PROFILE_SUPPORT): New. + * xemacs.mak (HAVE_VC6): New. + * xemacs.mak (QUICK_BUILD): + * xemacs.mak (VERBOSECC): New. + * xemacs.mak (DEPEND): New. + * xemacs.mak (CONFIG_ERROR): + * xemacs.mak (CCV): + * xemacs.mak (DEBUGFLAGS): Removed. + * xemacs.mak (OPTFLAGS): Removed. + * xemacs.mak (DEBUG_FLAGS_COMPILE): New. + * xemacs.mak (DEBUG_FLAGS_LINK): New. + * xemacs.mak (DEBUG_DEFINES): New. + * xemacs.mak (BROWSERFLAGS): New. + * xemacs.mak (LIBC_LIB): + * xemacs.mak (OPTFLAGS_FASTCALL): New. + * xemacs.mak (OPTFLAGS_CDECL): New. + * xemacs.mak (PROFILE_FLAGS): New. + * xemacs.mak (CFLAGS_NO_OPT): New. + * xemacs.mak (CFLAGS_CDECL_NO_LIB): New. + * xemacs.mak (CFLAGS_CDECL): New. + * xemacs.mak (MSW_LIBS): + * xemacs.mak (MSW_DEFINES): Removed. + * xemacs.mak (MSW_C_DIRED_OBJ): Removed. + * xemacs.mak (MULE_DEFINES): + * xemacs.mak (DEBUG_FLAGS): Removed. + * xemacs.mak (LINK_DEPENDENCY_ARGS): + * xemacs.mak (ETAGS_DEPS): + * xemacs.mak (LIB_SRC_TOOLS): + * xemacs.mak (TEMACS_LFLAGS): + * xemacs.mak (TEMACS_CPP_FLAGS): Removed. + * xemacs.mak (TEMACS_CPP_FLAGS_NO_CFLAGS): New. + * xemacs.mak (TEMACS_CPP_CDECL_FLAGS): New. + * xemacs.mak (TEMACS_MSW_OBJS): + * xemacs.mak (TEMACS_OBJS): + * xemacs.mak (.SUFFIXES): + * xemacs.mak (create-list-file): New. + * xemacs.mak (compile-list-file): New. + * xemacs.mak (TEMACS_DUMP_ID_OBJ): New. + * xemacs.mak (PROGNAME): + * xemacs.mak (temacs_loadup): + * xemacs.mak (check): + * xemacs.mak (check-temacs): + * xemacs.mak (make-docargs): + * xemacs.mak (update-elc): + * xemacs.mak (install): + * xemacs.mak (mostlyclean): + * xemacs.mak (versionclean): + * xemacs.mak (OS): + Semi-major overhaul. + + Fix bug where dump-id was always getting recomputed, forcing a + redump even when nothing changed. + + Add support for fastcall. Support edit-and-continue (on by + default) with vc6. Use incremental linking when doing a debug + compilation. Add support for profiling. + + Consolidate the various debug flags. + + Partial support for "batch-compiling" -- compiling many files on a + single invocation of the compiler. Doesn't seem to help that much + for me, so it's not finished or enabled by default. + + Remove HAVE_MSW_C_DIRED, we always do. + + Correct some sloppy use of directories. + +2002-03-29 Jonathan Harris + + * xemacs.mak: Define STACK_TRACE_EYE_CATCHER. + +2002-05-28 Ben Wing + + * xemacs.mak (CFLAGS_NO_LIB): + * xemacs.mak (X_DEFINES): + Add -DSTRICT. + +2002-05-23 Ben Wing + + * xemacs.mak (TEMACS_OBJS): + Add alloca.o. + +2002-05-14 Ben Wing + + * xemacs.mak (batch_test_emacs): + * xemacs.mak (check): + Run tests with the packages so we don't get errors about + advice not present, etc. + +2002-05-14 Ben Wing + + * xemacs.mak (CONFIG_VALUES): + * xemacs.mak (LINK_DEPENDENCY_ARGS): New. + * xemacs.mak (LINK_STANDARD_LIBRARY_ARGS): New. + * xemacs.mak (ETAGS_DEPS): + * xemacs.mak (LIB_SRC_TOOLS): + Increase the stack of etags to 0x800000 (8 MB), same as for XEmacs + and enough to prevent regex crashes with complex multiline + regexps. (More specifically, we reach the built-in failure limit before + crashing the stack. etags complains, but keeps on processing.) + +2002-05-06 Jonathan Harris + + * README: + Remove references to obsolete MSVC5 and NT 3.51 configurations. + + * config.inc.samp (HAVE_TIFF): Update PNG version to 1.0.9. + + * xemacs.mak (HAVE_MENUBARS): New + * xemacs.mak (HAVE_SCROLLBARS): New + * xemacs.mak (MSW_DEFINES): + * xemacs.mak (MSW_LIBS): + * xemacs.mak (TEMACS_MSW_OBJS): + * xemacs.mak (TEMACS_OBJS): + Make HAVE_MENUBARS and HAVE_SCROLLBARS optional. + + * xemacs.mak (LIB_SRC_TOOLS): + Generate correctly-named debug program databases for lib-src helpers. + + * xemacs-vc50.dsp: Removed. + * xemacs-vc50.dsw: Removed. + +2002-05-05 Ben Wing + + * xemacs.mak (CFLAGS_NO_LIB): New. + * xemacs.mak (CFLAGS): + * xemacs.mak (ETAGS_DEPS): + * xemacs.mak (LIB_SRC_TOOLS): + Split up CFLAGS into a version without flags specifying the C + library. The problem seems to be that minitar depends on zlib, + which depends specifically on libc.lib, not on any of the other C + libraries. Unless you compile with libc.lib, you get errors -- + specifically, no _errno in the other libraries, which must make it + something other than an int. (#### But this doesn't seem to obtain + in XEmacs, which also uses zlib, and can be linked with any of the + C libraries. Maybe zlib is used differently and doesn't need + errno, or maybe XEmacs provides an int errno; ... I don't + understand. + +2002-03-26 Vin Shelton + + * xemacs.mak: Added special rule to build winclient.exe. + +2002-04-23 Jonathan Harris + + * README: Document build for latest versions of zlib & png + * xpm.mak: Default to using MSVCRT as the C runtime + +2002-04-14 Ben Wing + + * config.inc.samp (HAVE_MS_WINDOWS): + * config.inc.samp (X11_DIR): + * config.inc.samp (ZLIB_DIR): + * config.inc.samp (MAKEINFO): + * config.inc.samp (OPTIMIZED_BUILD): New. + * config.inc.samp (DEPEND): + * config.inc.samp (USE_MINIMAL_TAGBITS): Removed. + * config.inc.samp (USE_INDEXED_LRECORD_IMPLEMENTATION): Removed. + * config.inc.samp (GUNG_HO): Removed. + * xemacs.mak (USE_MINITAR): + * xemacs.mak (USE_MINIMAL_TAGBITS): Removed. + * xemacs.mak (USE_INDEXED_LRECORD_IMPLEMENTATION): Removed. + * xemacs.mak (GUNG_HO): Removed. + * xemacs.mak (CONFIG_ERROR): + * xemacs.mak (DEBUGFLAGS): New. + * xemacs.mak (OPT): Removed. + * xemacs.mak (OPTFLAGS): New. + * xemacs.mak (CFLAGS): + * xemacs.mak (QUICK_DEFINES): + * xemacs.mak (TAGBITS_DEFINES): Removed. + * xemacs.mak (ERROR_CHECK_DEFINES): New. + * xemacs.mak (LRECORD_DEFINES): Removed. + * xemacs.mak (DEFINES): + * xemacs.mak (TEMACS_OBJS): + * xemacs.mak (OS): + Separate out debug and optimize flags. + Remove all vestiges of USE_MINIMAL_TAGBITS, + USE_INDEXED_LRECORD_IMPLEMENTATION, and GUNG_HO, since those + ifdefs have long been removed. + Make error-checking support actually work. + Some rearrangement of config.inc.samp to make it more logical. + Remove callproc.c and ntproc.c from xemacs.mak, no longer used. + + Make pdump the default. + +2002-04-13 Jonathan Harris + + * README: Document MSVC6 required + * minitar.c: Fix MSVC compiler warnings + * minitar.mak: Removed + * xemacs.mak: Build minitar directly from this makefile + * xemacs.mak (check-temacs): + * xemacs.mak (make-docargs): + * xemacs.mak (update-elc): + Remove obsolete references to EMACSBOOTSTRAPLOADPATH and + EMACSBOOTSTRAPMODULEPATH environment variables. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. diff --text -u 'xemacs-21.5.6/nt/README' 'xemacs-21.5.7/nt/README' Index: ././nt/README --- ././nt/README Wed Mar 13 17:52:29 2002 +++ ././nt/README Mon May 6 23:14:36 2002 @@ -7,29 +7,28 @@ This is a port of XEmacs to Windows 95/98/NT/2000. If you are looking for a port of GNU Emacs, see http://www.cs.washington.edu/homes/voelker/ntemacs.html. -NT 3.51 or later is required for building on Windows NT. Note that the +NT 4.0 or later is required for building on Windows NT. Note that the developers typically use NT 4.0 and Windows 2000, and there may possibly be -problems under Windows 95/98 and NT 3.51. If so, please report them to +problems under Windows 95/98. If so, please report them to xemacs-nt@xemacs.org; we are committed to maintaining compatibility with all systems listed. * Required tools and sources ============================ -1. You will need Visual C++ V4.0 or later to compile everything. Personally - we have tested V4.0, V4.2, V5.0 and v6.0. +1. You will need Visual C++ V6.0 or later to compile everything. Note that Visual C++ assumes that the environment variables INCLUDE and LIB are set to specify the location of the includes and libraries. - Your PATH environment variable also needs to include the DevStudio + Your PATH environment variable also needs to include the Visual Studio vc\bin and sharedide\bin directories. Visual C++ V5.0 and later install a batch file called vcvars32.bat in - c:\Program Files\DevStudio\VC\bin\ (or wherever you installed it) that you - can run before building to set up all of these environment variables. - Alternatively, you can choose at setup time to have these - environment variables automatically set up in the registry, which - is generally a good idea. + c:\Program Files\Microsoft Visual Studio\VC98\bin\ (or wherever you + installed it) that you can run before building to set up all of these + environment variables. Alternatively, you can choose at setup time to + have these environment variables automatically set up in the registry, + which is generally a good idea. 2. Grab the latest XEmacs source from @@ -87,11 +86,11 @@ for more than 15 days. XEmacs also runs (barely) under the free XWin server that comes as part of the Cygwin XFree86 package, available at - ftp://sources.redhat.com/pub/cygwin/xfree/ + ftp://sources.redhat.com/pub/cygwin/xfree/ or numerous mirrors, such as - ftp://ftp.freesoftware.com/pub/sourceware/cygwin/xfree/ + ftp://ftp.freesoftware.com/pub/sourceware/cygwin/xfree/ There are numerous other X servers available in the same package or at the same location, but unfortunately most of them behave even worse @@ -114,35 +113,34 @@ * Optional libraries ==================== -1. You really want the XPM library. Grab the latest version of the - xpm sources (xpm-3.4k.tar.gz at time of writing) from - ftp://ftp.xemacs.org/pub/xemacs/aux/ and unpack them somewhere. - Copy nt\xpm.mak from the xemacs sources to the lib subdirectory of the - xpm sources, cd to that directory and build xpm with 'nmake -f xpm.mak'. - -2. You probably also want PNG image support. Grab the latest versions of zlib - and libpng (zlib-1.1.3 and libpng-1.0.2 at time of writing) from - ftp://ftp.xemacs.org/pub/xemacs/aux/, unpack them somewhere and read - the respective READMEs for details on how to build them. The following - build procedure works for zlib-1.1.3 and libpng-1.0.2: +1. You really want the XPM library. Grab the latest version of the xpm + sources (xpm-3.4k.tar.gz as of 2002-04-27) from + ftp://ftp.xemacs.org/pub/xemacs/aux/ and unpack them somewhere. Copy + nt\xpm.mak from the xemacs sources to the lib subdirectory of the xpm + sources, cd to that directory and build xpm with 'nmake -f xpm.mak'. + +2. You probably also want PNG image support. Grab the latest versions of + zlib and libpng (zlib-1.1.4 and libpng-1.0.9 as of 2002-04-27) from + ftp://ftp.xemacs.org/pub/xemacs/aux/, unpack them somewhere and read the + respective READMEs for details on how to build them. The following + build procedure works for zlib-1.1.4 and libpng-1.0.9: - cd to the zlib directory, type 'copy msdos\makefile.w32 Makefile' and - then type 'nmake'. + cd to the zlib directory and type 'nmake -f msdos\makefile.w32'. cd to the libpng directory, rename or move the zlib directory to ..\zlib - and type 'nmake -f scripts\makefile.w32'. + and type 'nmake -f scripts\makefile.vcwin32'. 3. If you want TIFF support, grap the latest version of libtiff (tiff-v3.4 - at time of writing) from ftp://ftp.xemacs.org/pub/xemacs/aux/ and unpack + as of 2002-04-27) from ftp://ftp.xemacs.org/pub/xemacs/aux/ and unpack it somewhere. Copy nt\tiff.mak from the xemacs sources to the contrib\winnt subdirectory of the tiff sources, cd to that directory and build libtiff with 'nmake -f tiff.mak'. Note: tiff.mak has only been verified to work under WinNT, not Win95 or 98. However, the latest - distribution of libtiff includes a contrib\win95\makefile.w95; that might - work. + distribution of libtiff includes a contrib\win95\makefile.w95; that + might work. -4. If you want JPEG support grab the latest version of jpegsrc (jpeg-6b at - time of writing) from ftp://ftp.xemacs.org/pub/xemacs/aux/ and read the +4. If you want JPEG support grab the latest version of jpegsrc (jpeg-6b as + of 2002-04-27) from ftp://ftp.xemacs.org/pub/xemacs/aux/ and read the README for details on how to build it. 5. If you want X-Face support, grab the compface distribution from @@ -222,7 +220,7 @@ INSTALL_DIR="x:\your\installation\directory" (By default, XEmacs will be installed in directories under the directory - "c:\Program Files\XEmacs\XEmacs-21.2".) + "c:\Program Files\XEmacs\XEmacs-21.5".) 3. If you want to build xemacs on the command line, use `nmake install -f xemacs.mak', or just `nmake -f xemacs.mak' if you want @@ -232,23 +230,22 @@ If you chose to install XEmacs, the file that you should run to start XEmacs will be installed (by default) as - "c:\Program Files\XEmacs\XEmacs-21.2\i586-pc-win32\xemacs.exe". + "c:\Program Files\XEmacs\XEmacs-21.5\i586-pc-win32\xemacs.exe". - To run from the build directory, run the file "nt\xemacs.exe" off of the + To run from the build directory, run the file "src\xemacs.exe" off of the root of the build directory. You may want to create a shortcut to the file from your Desktop or Start Menu. 4. To build using MS Developer Studio, you can use the workspace file - `nt/xemacs.dsw'. This was prepared for Visual C++ 6.0. If you are using - Visual C++ 5.0, you can use the workspace file `nt/xemacs-vc50.dsw'. If - you have a different version and neither file works, just open up - `nt/xemacs.mak' from within MS Developer Studio and it will offer to wrap - this Makefile in a workspace file, from which you can build. Assuming - you want to run from the build directory (which you will want to do if - you are planning on doing any development work on XEmacs), use the - following settings in Project/Settings...: + `nt/xemacs.dsw'. This was prepared for Visual C++ 6.0. If you have a + different version and neither file works, just open up `nt/xemacs.mak' + from within MS Developer Studio and it will offer to wrap this Makefile + in a workspace file, from which you can build. Assuming you want to run + from the build directory (which you will want to do if you are planning + on doing any development work on XEmacs), use the following settings in + Project/Settings...: Under the General tab: diff --text -u 'xemacs-21.5.6/nt/config.inc.samp' 'xemacs-21.5.7/nt/config.inc.samp' Index: ././nt/config.inc.samp --- ././nt/config.inc.samp Sun Mar 31 17:27:29 2002 +++ ././nt/config.inc.samp Fri Jun 21 06:18:16 2002 @@ -14,11 +14,12 @@ # Native MS Windows support. HAVE_MS_WINDOWS=1 -# X Windows support. +# X Windows support. Not working at all and probably never will. If you +# want X support under MS Windows, compile with Cygwin instead. HAVE_X_WINDOWS=0 X11_DIR= -# GTK support. Do NOT set this to 1; as of xemacs-21.2-b44 +# GTK support. Do NOT set this to 1; as of xemacs-21.5-b6 # gtk-xemacs is not supported on MSWindows (mingw or msvc). # Yes, we know that gtk has been ported to native MSWindows # but XEmacs is not yet ready to use that port. @@ -38,8 +39,8 @@ # Set this to enable PNG support (virtually mandatory), and specify # the directories containing png and zlib. HAVE_PNG=1 -PNG_DIR=c:\src\libpng-1.0.5 -ZLIB_DIR=c:\src\zlib-1.1.3 +PNG_DIR=c:\src\libpng-1.0.9 +ZLIB_DIR=c:\src\zlib # Set this to enable TIFF support, and specify the directory containing tiff. HAVE_TIFF=0 @@ -62,9 +63,33 @@ ############################################################################ -# Set this to enable some debug code that doesn't slow things down. +# Set this to turn on optimization when compiling. +OPTIMIZED_BUILD=0 + +# Set this to build with the fastcall calling convention, which uses registers +# instead of the stack and should speed things up a bit +# #### Change to 1 when I check in the ws with support for fastcall +USE_FASTCALL=0 + +# Set this to compile in support for profiling. If you want line-by-line +# profiling under VC++, you also need debugging turned on. +PROFILE_SUPPORT=0 + +############################################################################ +# Development options # +############################################################################ + +# Set this to enable debug code in XEmacs that doesn't slow things down, +# and to add debugging information to the executable. (The code that's +# enabled in XEmacs is primarily extra commands that aid in debugging +# problems. The kind of debugging code that slows things down -- +# i.e. internal error-checking -- is controlled by the ERROR_CHECK_ALL +# variable, below.) DEBUG_XEMACS=1 +# True if running VC++ 6 or later. +HAVE_VC6=1 + # Uncomment this to turn off or on the error-checking code, which adds # abundant internal error checking (and slows things down a lot). Normally, # leave this alone -- it will be on for beta builds and off for release @@ -82,11 +107,21 @@ # Requires cygwin or ActiveState versions of Perl to be installed. DEPEND=0 -############################################################################ - -# Some technical options. - -USE_MINIMAL_TAGBITS=0 -USE_INDEXED_LRECORD_IMPLEMENTATION=0 -USE_PORTABLE_DUMPER=0 -GUNG_HO=0 +# Set this to use the portable dumper for dumping the preloaded Lisp +# routines, instead of the older "unexec" routines in unexnt.c. +USE_PORTABLE_DUMPER=1 + +# Set this to get improved type checking of Lisp_Objects -- with this +# setting, they're declared as unions instead of ints, and so places where +# a Lisp_Object is mistakenly passed to a routine expecting an int (or +# vice-versa), or a check is written `if (foo)' instead of `if (!NILP +# (foo))', will be flagged as errors. (All of these do NOT lead to the +# expected results! Qnil is not represented as 0 (so if (foo) will +# *ALWAYS* be true for a Lisp_Object), the representation of an integer as +# a Lisp_Object is not just the integer's numeric value (but usually 2x the +# integer +/- 1). + +# Some also claim it simplifies debugging, but I don't really believe them. +# Definitely don't do your normal builds this way, because you may well get +# less efficiency, and could conceivably trigger compiler bugs (has definitely happened, many times, with gcc). +# USE_UNION_TYPE=1 diff --text -u 'xemacs-21.5.6/nt/installer/Wise/ChangeLog' 'xemacs-21.5.7/nt/installer/Wise/ChangeLog' Index: ././nt/installer/Wise/ChangeLog --- ././nt/installer/Wise/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././nt/installer/Wise/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,7 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. diff --text -u 'xemacs-21.5.6/nt/minitar.c' 'xemacs-21.5.7/nt/minitar.c' Index: ././nt/minitar.c --- ././nt/minitar.c Tue May 1 18:36:44 2001 +++ ././nt/minitar.c Sun Apr 14 05:31:28 2002 @@ -13,9 +13,13 @@ #include +#include #include #include #include +#ifdef WIN32_NATIVE +# include /* For mkdir */ +#endif #include diff --text -u 'xemacs-21.5.6/nt/xemacs.dsp' 'xemacs-21.5.7/nt/xemacs.dsp' Index: ././nt/xemacs.dsp --- ././nt/xemacs.dsp Fri Apr 13 03:23:00 2001 +++ ././nt/xemacs.dsp Fri Jun 21 06:18:16 2002 @@ -58,7 +58,7 @@ # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\src" # PROP Intermediate_Dir "obj" -# PROP Cmd_Line "NMAKE /f xemacs.mak" +# PROP Cmd_Line "NMAKE /k /f xemacs.mak" # PROP Rebuild_Opt "/a" # PROP Target_File "..\src\xemacs.exe" # PROP Bsc_Name "..\src\temacs.bsc" diff --text -u 'xemacs-21.5.6/nt/xemacs.mak' 'xemacs-21.5.7/nt/xemacs.mak' Index: ././nt/xemacs.mak --- ././nt/xemacs.mak Sun Mar 31 17:27:29 2002 +++ ././nt/xemacs.mak Wed Jun 26 06:20:47 2002 @@ -152,24 +152,40 @@ !if !defined(HAVE_GTK) HAVE_GTK=0 !endif +!if !defined(HAVE_MENUBARS) +HAVE_MENUBARS=1 +!endif +!if !defined(HAVE_SCROLLBARS) +HAVE_SCROLLBARS=1 +!endif !if !defined(HAVE_TOOLBARS) HAVE_TOOLBARS=$(HAVE_XPM) !endif !if !defined(HAVE_DIALOGS) HAVE_DIALOGS=1 !endif -!if !defined(HAVE_MSW_C_DIRED) -HAVE_MSW_C_DIRED=1 -!endif !if !defined(HAVE_NATIVE_SOUND) HAVE_NATIVE_SOUND=1 !endif !if !defined(HAVE_WIDGETS) HAVE_WIDGETS=1 !endif +!if !defined(OPTIMIZED_BUILD) +OPTIMIZED_BUILD=1 +!endif +!if !defined(USE_FASTCALL) +# #### Change to 1 when I check in the ws with support for fastcall +USE_FASTCALL=0 +!endif +!if !defined(PROFILE_SUPPORT) +PROFILE_SUPPORT=0 +!endif !if !defined(DEBUG_XEMACS) DEBUG_XEMACS=0 !endif +!if !defined(HAVE_VC6) +HAVE_VC6=1 +!endif !if !defined(ERROR_CHECK_ALL) # Turn off when not a beta XEmacs. ERROR_CHECK_ALL=1 @@ -177,24 +193,21 @@ !if !defined(QUICK_BUILD) QUICK_BUILD=0 !endif +!if !defined(VERBOSECC) +VERBOSECC=0 +!endif +!if !defined(DEPEND) +DEPEND=0 +!endif +!if !defined(USE_PORTABLE_DUMPER) +USE_PORTABLE_DUMPER=1 +!endif !if !defined(USE_UNION_TYPE) USE_UNION_TYPE=0 !endif !if !defined(USE_MINITAR) USE_MINITAR=$(HAVE_ZLIB) !endif -!if !defined(USE_MINIMAL_TAGBITS) -USE_MINIMAL_TAGBITS=0 -!endif -!if !defined(USE_INDEXED_LRECORD_IMPLEMENTATION) -USE_INDEXED_LRECORD_IMPLEMENTATION=0 -!endif -!if !defined(USE_PORTABLE_DUMPER) -USE_PORTABLE_DUMPER=0 -!endif -!if !defined(GUNG_HO) -GUNG_HO=0 -!endif # A little bit of adhockery. Default to use system malloc and # DLL version of the C runtime library when using portable @@ -321,19 +334,8 @@ !endif # -# Handle GUNG_HO -# -!if defined(GUNG_HO) -USE_MINIMAL_TAGBITS=$(GUNG_HO) -USE_INDEXED_LRECORD_IMPLEMENTATION=$(GUNG_HO) -!endif - -# # Whether to use dependency information generated by make-src-depend # -!if !defined(DEPEND) -DEPEND=0 -!endif !if $(DEPEND) && exist("$(SRC)\depend") ! if [if not exist $(OUTDIR)\nul mkdir "$(OUTDIR)"] ! endif @@ -349,9 +351,6 @@ # # Compiler command echo control. Define VERBOSECC=1 to get verbose compilation. # -!if !defined(VERBOSECC) -VERBOSECC=0 -!endif !if $(VERBOSECC) CCV=$(CC) !else @@ -359,25 +358,80 @@ !endif !if $(DEBUG_XEMACS) -OPT=-Od -Zi + +# ---- Debugging support ---- +! if $(HAVE_VC6) +# support edit-and-continue +DEBUG_FLAGS_COMPILE=-ZI +! else +DEBUG_FLAGS_COMPILE=-Zi +! endif +DEBUG_FLAGS_LINK=-debug:full +DEBUG_DEFINES=-DDEBUG_XEMACS -D_DEBUG +#BROWSERFLAGS=-Fr -Fd$(OUTDIR)\temacs.pdb +BROWSERFLAGS=-Fr$*.sbr -Fd$(OUTDIR)\temacs.pdb + !else -OPT=-O2 -G5 + +# ---- No debugging support ---- +DEBUG_FLAGS_COMPILE= +DEBUG_FLAGS_LINK=-incremental:no +DEBUG_DEFINES= +BROWSERFLAGS= + !endif !if $(USE_CRTDLL) -!if $(DEBUG_XEMACS) +! if $(DEBUG_XEMACS) C_LIBFLAG=-MDd LIBC_LIB=msvcrtd.lib -!else +! else C_LIBFLAG=-MD LIBC_LIB=msvcrt.lib -!endif +! endif !else C_LIBFLAG=-ML LIBC_LIB=libc.lib !endif -CFLAGS=-nologo -W3 $(OPT) $(C_LIBFLAG) +!if $(OPTIMIZED_BUILD) +# -G5 means optimize for Pentium. (According to the code-optimization +# article, -GB is the same as -G5, and -G6, i.e. optimze for Pentium Pro, +# gains you little over -G5 for PPro's but causes big slowdowns for +# Pentiums.) -GF means put strings in read-only memory; -Gr means use +# fastcall convention. Another possible addition: -Ob2 -- allows inlining +# of any function, not just those declared inline. Potential code size +# increase, though. +# +# #### Note: fastcall doesn't actually seem to make any difference, at least +# not using the (admittedly unscientific) test of (hanoi 6). The +# optimization article claims 1-2% improvement in both speed and size. +OPTFLAGS_FASTCALL =-O2 -G5 -Gr -Ob2 +OPTFLAGS_CDECL =-O2 -G5 -Ob2 +!else +OPTFLAGS_FASTCALL =-Od +OPTFLAGS_CDECL =-Od +!endif + +!if $(USE_FASTCALL) +OPTFLAGS = $(OPTFLAGS_FASTCALL) +!else +OPTFLAGS = $(OPTFLAGS_CDECL) +!endif + +!if $(PROFILE_SUPPORT) +PROFILE_FLAGS=-profile +!else +PROFILE_FLAGS= +!endif + +CFLAGS_NO_OPT=-nologo -W3 -DSTRICT $(DEBUG_FLAGS_COMPILE) + +CFLAGS_NO_LIB=$(CFLAGS_NO_OPT) $(OPTFLAGS) +CFLAGS=$(CFLAGS_NO_LIB) $(C_LIBFLAG) + +CFLAGS_CDECL_NO_LIB=$(CFLAGS_NO_OPT) $(OPTFLAGS_CDECL) +CFLAGS_CDECL=$(CFLAGS_CDECL_NO_LIB) $(C_LIBFLAG) !if $(HAVE_X_WINDOWS) X_DEFINES=-DHAVE_X_WINDOWS @@ -386,13 +440,10 @@ !endif !if $(HAVE_MS_WINDOWS) -MSW_DEFINES=-DHAVE_MS_WINDOWS -DHAVE_SCROLLBARS -DHAVE_MENUBARS +MSW_DEFINES=-DHAVE_MS_WINDOWS MSW_INCLUDES= -MSW_LIBS= -!if $(HAVE_MSW_C_DIRED) -MSW_DEFINES=$(MSW_DEFINES) -DHAVE_MSW_C_DIRED -MSW_C_DIRED_OBJ=$(OUTDIR)\dired-msw.obj -!endif +MSW_LIBS=comctl32.lib + !if $(HAVE_XPM) MSW_DEFINES=$(MSW_DEFINES) -DHAVE_XPM -DFOR_MSW MSW_INCLUDES=$(MSW_INCLUDES) -I"$(XPM_DIR)" -I"$(XPM_DIR)\lib" @@ -427,6 +478,14 @@ MSW_INCLUDES=$(MSW_INCLUDES) -I"$(ZLIB_DIR)" MSW_LIBS=$(MSW_LIBS) "$(ZLIB_DIR)\zlib.lib" !endif +!if $(HAVE_MENUBARS) +MSW_DEFINES=$(MSW_DEFINES) -DHAVE_MENUBARS +MSW_MENUBAR_OBJ=$(OUTDIR)\menubar.obj $(OUTDIR)\menubar-msw.obj +!endif +!if $(HAVE_SCROLLBARS) +MSW_DEFINES=$(MSW_DEFINES) -DHAVE_SCROLLBARS +MSW_SCROLLBAR_OBJ=$(OUTDIR)\scrollbar.obj $(OUTDIR)\scrollbar-msw.obj +!endif !if $(HAVE_TOOLBARS) MSW_DEFINES=$(MSW_DEFINES) -DHAVE_TOOLBARS MSW_TOOLBAR_OBJ=$(OUTDIR)\toolbar.obj $(OUTDIR)\toolbar-msw.obj @@ -434,9 +493,6 @@ !if $(HAVE_WIDGETS) MSW_DEFINES=$(MSW_DEFINES) -DHAVE_WIDGETS !endif -!if $(HAVE_TOOLBARS) || $(HAVE_WIDGETS) -MSW_LIBS=$(MSW_LIBS) comctl32.lib -!endif !if $(HAVE_DIALOGS) MSW_DEFINES=$(MSW_DEFINES) -DHAVE_DIALOGS MSW_DIALOG_OBJ=$(OUTDIR)\dialog.obj $(OUTDIR)\dialog-msw.obj @@ -450,21 +506,14 @@ MULE_DEFINES=-DMULE !endif -!if $(DEBUG_XEMACS) -DEBUG_DEFINES=-DDEBUG_XEMACS -D_DEBUG -DEBUG_FLAGS=-debug:full -!endif - !if $(QUICK_BUILD) QUICK_DEFINES=-DQUICK_BUILD !endif -!if $(USE_MINIMAL_TAGBITS) -TAGBITS_DEFINES=-DUSE_MINIMAL_TAGBITS -!endif -!if $(USE_INDEXED_LRECORD_IMPLEMENTATION) -LRECORD_DEFINES=-DUSE_INDEXED_LRECORD_IMPLEMENTATION +!if $(ERROR_CHECK_ALL) +ERROR_CHECK_DEFINES=-DERROR_CHECK_ALL !endif + !if $(USE_UNION_TYPE) UNION_DEFINES=-DUSE_UNION_TYPE !endif @@ -493,9 +542,9 @@ INCLUDES=$(X_INCLUDES) $(MSW_INCLUDES) -I$(NT)\inc -I$(SRC) -I$(LWLIB_SRCDIR) -DEFINES=$(X_DEFINES) $(MSW_DEFINES) $(MULE_DEFINES) \ - $(TAGBITS_DEFINES) $(LRECORD_DEFINES) $(UNION_DEFINES) \ +DEFINES=$(X_DEFINES) $(MSW_DEFINES) $(MULE_DEFINES) $(UNION_DEFINES) \ $(DUMPER_DEFINES) $(MALLOC_DEFINES) $(QUICK_DEFINES) \ + $(ERROR_CHECK_DEFINES) \ -DWIN32_LEAN_AND_MEAN -DWIN32_NATIVE -Demacs \ -DHAVE_CONFIG_H $(PROGRAM_DEFINES) $(PATH_DEFINES) @@ -553,26 +602,36 @@ !if [echo PACKAGE_PATH>>$(CONFIG_VALUES) && echo $(PATH_PACKAGEPATH)>>$(CONFIG_VALUES)] !endif + +LINK_DEPENDENCY_ARGS = -Fe$@ -Fd$* $** -link $(DEBUG_FLAGS_LINK) +LINK_STANDARD_LIBRARY_ARGS = setargv.obj user32.lib wsock32.lib + # Inferred rule {$(LIB_SRC)}.c{$(LIB_SRC)}.exe : cd $(LIB_SRC) - $(CCV) -I. -I$(XEMACS)/src -I$(XEMACS)/nt/inc $(LIB_SRC_DEFINES) $(CFLAGS) -Fe$@ $** -link -incremental:no setargv.obj + $(CCV) -I$(LIB_SRC) -I$(SRC) $(LIB_SRC_DEFINES) $(CFLAGS) $(LINK_DEPENDENCY_ARGS) $(LINK_STANDARD_LIBRARY_ARGS) cd $(NT) # Individual dependencies -ETAGS_DEPS = $(LIB_SRC)/getopt.c $(LIB_SRC)/getopt1.c $(LIB_SRC)/../src/regex.c +ETAGS_DEPS = $(LIB_SRC)/getopt.c $(LIB_SRC)/getopt1.c $(SRC)/regex.c $(LIB_SRC)/etags.exe : $(LIB_SRC)/etags.c $(ETAGS_DEPS) -$(LIB_SRC)/movemail.exe: $(LIB_SRC)/movemail.c $(LIB_SRC)/pop.c $(ETAGS_DEPS) cd $(LIB_SRC) - $(CCV) -I. -I$(XEMACS)/src -I$(XEMACS)/nt/inc $(LIB_SRC_DEFINES) $(CFLAGS) -Fe$@ $** wsock32.lib -link -incremental:no + $(CCV) -I$(LIB_SRC) -I$(SRC) $(LIB_SRC_DEFINES) $(CFLAGS) $(LINK_DEPENDENCY_ARGS) -stack:0x800000 $(LINK_STANDARD_LIBRARY_ARGS) + cd $(NT) + +$(LIB_SRC)/movemail.exe : $(LIB_SRC)/movemail.c $(LIB_SRC)/pop.c $(ETAGS_DEPS) + +# Minitar uses zlib so just use cdecl to simplify things +$(LIB_SRC)/minitar.exe : $(NT)/minitar.c + cd $(LIB_SRC) + $(CCV) -I"$(ZLIB_DIR)" $(LIB_SRC_DEFINES) $(CFLAGS_CDECL_NO_LIB) $(LINK_DEPENDENCY_ARGS) "$(ZLIB_DIR)\zlib.lib" cd $(NT) -$(LIB_SRC)/minitar.exe : $(NT)/minitar.mak $(NT)/minitar.c - nmake -nologo -f minitar.mak ZLIB="$(ZLIB_DIR)" NT="$(NT)" LIB_SRC="$(LIB_SRC)" LIB_SRC_TOOLS = \ $(LIB_SRC)/etags.exe \ $(LIB_SRC)/hexl.exe \ $(LIB_SRC)/i.exe \ + $(LIB_SRC)/winclient.exe \ $(LIB_SRC)/make-docfile.exe \ $(LIB_SRC)/mmencode.exe \ $(LIB_SRC)/movemail.exe \ @@ -590,18 +649,6 @@ $(LIB_SRC_TOOLS) !endif -# Shorthand target -minitar: $(LIB_SRC)/minitar.exe - -#------------------------------------------------------------------------------ - -# dump-id.c file that contains the dump id - -$(SRC)\dump-id.c : $(LIB_SRC)/make-dump-id.exe - cd $(SRC) - $(LIB_SRC)\make-dump-id.exe - cd $(NT) - #------------------------------------------------------------------------------ # LASTFILE Library @@ -691,12 +738,11 @@ oldnames.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib \ shell32.lib wsock32.lib netapi32.lib winmm.lib winspool.lib ole32.lib \ mpr.lib uuid.lib imm32.lib $(LIBC_LIB) -TEMACS_LFLAGS=-nologo $(LIBRARIES) $(DEBUG_FLAGS) -base:0x1000000\ +TEMACS_LFLAGS=-nologo $(LIBRARIES) $(DEBUG_FLAGS_LINK) -base:0x1000000\ -stack:0x800000 $(TEMACS_ENTRYPOINT) -subsystem:windows\ -pdb:$(TEMACS_DIR)\temacs.pdb -map:$(TEMACS_DIR)\temacs.map \ - -heap:0x00100000 -nodefaultlib -incremental:no setargv.obj -TEMACS_CPP_FLAGS=-c \ - $(CFLAGS) $(INCLUDES) $(DEFINES) $(DEBUG_DEFINES) \ + -heap:0x00100000 -nodefaultlib $(PROFILE_FLAGS) setargv.obj +TEMACS_CPP_FLAGS_NO_CFLAGS=-c $(INCLUDES) $(DEFINES) $(DEBUG_DEFINES) \ -DEMACS_MAJOR_VERSION=$(emacs_major_version) \ -DEMACS_MINOR_VERSION=$(emacs_minor_version) \ $(EMACS_BETA_VERSION) \ @@ -704,6 +750,8 @@ -DXEMACS_CODENAME=\"$(xemacs_codename:&=and)\" \ -DEMACS_CONFIGURATION=\"$(EMACS_CONFIGURATION)\" \ -DPATH_PACKAGEPATH=\"$(PATH_PACKAGEPATH)\" +TEMACS_CPP_FLAGS=$(CFLAGS) $(TEMACS_CPP_FLAGS_NO_CFLAGS) +TEMACS_CPP_CDECL_FLAGS=$(CFLAGS_CDECL) $(TEMACS_CPP_FLAGS_NO_CFLAGS) !if $(HAVE_X_WINDOWS) TEMACS_X_OBJS=\ @@ -738,12 +786,12 @@ $(OUTDIR)\frame-msw.obj \ $(OUTDIR)\glyphs-msw.obj \ $(OUTDIR)\gui-msw.obj \ - $(OUTDIR)\menubar-msw.obj \ $(OUTDIR)\objects-msw.obj \ $(OUTDIR)\redisplay-msw.obj \ - $(OUTDIR)\scrollbar-msw.obj \ $(OUTDIR)\select-msw.obj \ - $(MSW_C_DIRED_OBJ) \ + $(OUTDIR)\dired-msw.obj \ + $(MSW_MENUBAR_OBJ) \ + $(MSW_SCROLLBAR_OBJ) \ $(MSW_TOOLBAR_OBJ) \ $(MSW_DIALOG_OBJ) \ $(MSW_GIF_OBJ) @@ -793,11 +841,11 @@ $(TEMACS_DUMP_OBJS)\ $(OUTDIR)\abbrev.obj \ $(OUTDIR)\alloc.obj \ + $(OUTDIR)\alloca.obj \ $(OUTDIR)\blocktype.obj \ $(OUTDIR)\buffer.obj \ $(OUTDIR)\bytecode.obj \ $(OUTDIR)\callint.obj \ - $(OUTDIR)\callproc.obj \ $(OUTDIR)\casefiddle.obj \ $(OUTDIR)\casetab.obj \ $(OUTDIR)\chartab.obj \ @@ -844,17 +892,17 @@ $(OUTDIR)\intl-encap-win32.obj \ $(OUTDIR)\intl-auto-encap-win32.obj \ $(OUTDIR)\keymap.obj \ + $(OUTDIR)\libinterface.obj \ $(OUTDIR)\line-number.obj \ $(OUTDIR)\lread.obj \ $(OUTDIR)\lstream.obj \ $(OUTDIR)\macros.obj \ - $(OUTDIR)\menubar.obj \ $(OUTDIR)\marker.obj \ $(OUTDIR)\md5.obj \ $(OUTDIR)\minibuf.obj \ +# #### Leave the next one out when integrating my working ws $(OUTDIR)\nt.obj \ $(OUTDIR)\ntplay.obj \ - $(OUTDIR)\ntproc.obj \ $(OUTDIR)\objects.obj \ $(OUTDIR)\opaque.obj \ $(OUTDIR)\print.obj \ @@ -866,7 +914,6 @@ $(OUTDIR)\redisplay-output.obj \ $(OUTDIR)\redisplay.obj \ $(OUTDIR)\regex.obj \ - $(OUTDIR)\scrollbar.obj \ $(OUTDIR)\search.obj \ $(OUTDIR)\select.obj \ $(OUTDIR)\signal.obj \ @@ -889,22 +936,27 @@ .SUFFIXES: .SUFFIXES: .c .obj .texi .info -# nmake rule -!if $(DEBUG_XEMACS) -{$(TEMACS_SRC)}.c{$(OUTDIR)}.obj: - $(CCV) $(TEMACS_CPP_FLAGS) $< -Fo$@ -Fr$*.sbr -Fd$(OUTDIR)\temacs.pdb -!else +# nmake rule with batching: +#{$(TEMACS_SRC)}.c{$(OUTDIR)}.obj: +# echo $< >> $(OUTDIR)\listfile.tmp + {$(TEMACS_SRC)}.c{$(OUTDIR)}.obj: - $(CCV) $(TEMACS_CPP_FLAGS) $< -Fo$@ -!endif + $(CCV) $(TEMACS_CPP_FLAGS) $< -Fo$@ $(BROWSERFLAGS) -$(OUTDIR)\emacs.obj: $(XEMACS)\version.sh +# An explicit rule looks like this ($< works only in implicit rules): +# $(OUTDIR)\foo.obj: $(TEMACS_SRC)\foo.c +# $(CCV) $(TEMACS_CPP_FLAGS) $(TEMACS_SRC)\$(@B).c -Fo$@ $(BROWSERFLAGS) -$(OUTDIR)\TopLevelEmacsShell.obj: $(TEMACS_SRC)\EmacsShell-sub.c - $(CCV) $(TEMACS_CPP_FLAGS) -DDEFINE_TOP_LEVEL_EMACS_SHELL $(TEMACS_SRC)\$(@B).c -Fo$@ +$(OUTDIR)\emacs.obj: $(XEMACS)\version.sh + +$(OUTDIR)\TopLevelEmacsShell.obj: $(TEMACS_SRC)\EmacsShell-sub.c + $(CCV) $(TEMACS_CPP_FLAGS) -DDEFINE_TOP_LEVEL_EMACS_SHELL $(TEMACS_SRC)\$(@B).c -Fo$@ $(BROWSERFLAGS) $(OUTDIR)\TransientEmacsShell.obj: $(TEMACS_SRC)\EmacsShell-sub.c - $(CCV) $(TEMACS_CPP_FLAGS) -DDEFINE_TRANSIENT_EMACS_SHELL $(TEMACS_SRC)\$(@B).c -Fo$@ + $(CCV) $(TEMACS_CPP_FLAGS) -DDEFINE_TRANSIENT_EMACS_SHELL $(TEMACS_SRC)\$(@B).c -Fo$@ $(BROWSERFLAGS) + +$(OUTDIR)\libinterface.obj: $(TEMACS_SRC)\libinterface.c + $(CCV) $(TEMACS_CPP_CDECL_FLAGS) $(TEMACS_SRC)\$(@B).c -Fo$@ $(BROWSERFLAGS) #$(TEMACS_SRC)\Emacs.ad.h: $(XEMACS)\etc\Emacs.ad # !"sed -f ad2c.sed < $(XEMACS)\etc\Emacs.ad > $(TEMACS_SRC)\Emacs.ad.h" @@ -912,31 +964,57 @@ #$(TEMACS_SRC)\paths.h: $(TEMACS_SRC)\paths.h.in # !"cd $(TEMACS_SRC); cp paths.h.in paths.h" -$(TEMACS): $(TEMACS_INCLUDES) $(TEMACS_OBJS) $(OUTDIR)\xemacs.res -!if $(DEBUG_XEMACS) +create-list-file: + @if exist $(OUTDIR)\listfile.tmp del $(OUTDIR)\listfile.tmp + +compile-list-file: + cd $(OUTDIR) + @if exist listfile.tmp $(CC) $(TEMACS_CPP_FLAGS) @listfile.tmp $(BROWSERFLAGS) + +$(TEMACS_BROWSE): $(TEMACS_OBJS) @dir /b/s $(OUTDIR)\*.sbr > $(OUTDIR)\bscmake.tmp bscmake -nologo -o$(TEMACS_BROWSE) @$(OUTDIR)\bscmake.tmp -$(DEL) $(OUTDIR)\bscmake.tmp + +# dump-id.c file that contains the dump id + +$(OUTDIR)\dump-id.obj : $(SRC)\dump-id.c + cd $(OUTDIR) + $(CCV) $(TEMACS_CPP_FLAGS) $(TEMACS_SRC)\$(@B).c $(BROWSERFLAGS) + +$(SRC)\dump-id.c : $(LIB_SRC)/make-dump-id.exe $(TEMACS_OBJS) + cd $(SRC) + $(LIB_SRC)\make-dump-id.exe + cd $(NT) + +!if $(USE_PORTABLE_DUMPER) +TEMACS_DUMP_ID_OBJ = $(OUTDIR)\dump-id.obj +!else +TEMACS_DUMP_ID_OBJ = +!endif + +!if $(DEBUG_XEMACS) +$(TEMACS): $(TEMACS_OBJS) $(OUTDIR)\temacs.res $(TEMACS_BROWSE) $(TEMACS_DUMP_ID_OBJ) +!else +$(TEMACS): $(TEMACS_OBJS) $(OUTDIR)\temacs.res $(TEMACS_DUMP_ID_OBJ) !endif !if $(USE_PORTABLE_DUMPER) - @if exist $(SRC)\dump-id.c $(DEL) $(SRC)\dump-id.c -# make a new dump id file. There is probably a better way to do this, but this works - @if exist $(OUTDIR)\dump-id.obj $(DEL) $(OUTDIR)\dump-id.obj - nmake -nologo -f xemacs.mak OUTDIR=$(OUTDIR) $(OUTDIR)\dump-id.obj + cd $(NT) link.exe @<< - $(TEMACS_LFLAGS) -out:$@ $(TEMACS_OBJS) $(TEMACS_LIBS) $(OUTDIR)\dump-id.obj + $(TEMACS_LFLAGS) -out:$@ $(TEMACS_OBJS) $(TEMACS_LIBS) $(TEMACS_DUMP_ID_OBJ) << !else link.exe @<< - $(TEMACS_LFLAGS) -out:$@ $(TEMACS_OBJS) $(OUTDIR)\xemacs.res $(TEMACS_LIBS) + $(TEMACS_LFLAGS) -out:$@ $(TEMACS_OBJS) $(OUTDIR)\temacs.res $(TEMACS_LIBS) << !endif -$(OUTDIR)\xemacs.res: xemacs.rc +$(OUTDIR)\temacs.res: $(NT)\xemacs.rc + cd $(NT) rc -Fo$@ xemacs.rc -PROGNAME=$(SRC)\xemacs.exe +PROGNAME=$(TEMACS_DIR)\xemacs.exe BATCH = -no-packages -batch BATCH_PACKAGES = -vanilla -batch TEMACS_BATCH = "$(LIB_SRC)\i" "$(TEMACS)" $(BATCH) @@ -947,24 +1025,22 @@ # Section handling automated tests starts here blddir=$(MAKEDIR:\=\\)\\.. -temacs_loadup=$(TEMACS_BATCH) -l $(LISP)/loadup.el +temacs_loadup= dump_temacs = $(temacs_loadup) dump run_temacs = $(temacs_loadup) run-temacs ## We have automated tests!! testdir=../tests/automated -batch_test_emacs=$(BATCH) -l $(testdir)/test-harness.el -f batch-test-emacs $(testdir) +batch_test_emacs=$(BATCH_PACKAGES) -l $(testdir)/test-harness.el -f batch-test-emacs $(testdir) # .PHONY: check check-temacs check: - cd $(SRC) + cd $(TEMACS_DIR) $(PROGNAME) $(batch_test_emacs) check-temacs: - cd $(SRC) - set EMACSBOOTSTRAPLOADPATH=$(LISP) - set EMACSBOOTSTRAPMODULEPATH=$(MODULES) - $(run_temacs) $(batch_test_emacs) + cd $(TEMACS_DIR) + $(TEMACS_BATCH) -l $(LISP)/loadup.el run-temacs $(batch_test_emacs) # Section handling automated tests ends here @@ -1211,15 +1287,13 @@ $(DOC): $(LIB_SRC)\make-docfile.exe make-docargs if exist $(DOC) $(DEL) $(DOC) - set EMACSBOOTSTRAPLOADPATH=$(LISP);$(PACKAGE_PATH) - set EMACSBOOTSTRAPMODULEPATH=$(MODULES) - $(TEMACS_BATCH) -l $(TEMACS_DIR)\..\lisp\make-docfile.el -- -o $(DOC) -i $(XEMACS)\site-packages + cd $(TEMACS_DIR) + $(TEMACS_BATCH) -l $(LISP)\make-docfile.el -- -o $(DOC) -i $(XEMACS)\site-packages $(LIB_SRC)\make-docfile.exe -a $(DOC) @$(OUTDIR)\make-docfile.tmp update-elc: - set EMACSBOOTSTRAPLOADPATH=$(LISP);$(PACKAGE_PATH) - set EMACSBOOTSTRAPMODULEPATH=$(MODULES) - $(TEMACS_BATCH) -l $(TEMACS_DIR)\..\lisp\update-elc.el + cd $(TEMACS_DIR) + $(TEMACS_BATCH) -l $(LISP)\update-elc.el # This file is touched by update-elc.el when redumping is necessary. $(TEMACS_DIR)\NEEDTODUMP : @@ -1228,12 +1302,12 @@ # This rule dumps xemacs and then possibly spawns sub-make if PURESPACE # requirements have changed. +$(TEMACS_DIR)\SATISFIED: $(PROGNAME) + $(PROGNAME) : $(TEMACS) $(TEMACS_DIR)\NEEDTODUMP @echo >$(TEMACS_DIR)\SATISFIED cd $(TEMACS_DIR) - set EMACSBOOTSTRAPLOADPATH=$(LISP);$(PACKAGE_PATH) - set EMACSBOOTSTRAPMODULEPATH=$(MODULES) - $(TEMACS_BATCH) -l $(TEMACS_DIR)\..\lisp\loadup.el dump + $(TEMACS_BATCH) -l $(LISP)\loadup.el dump !if $(USE_PORTABLE_DUMPER) rc -d INCLUDE_DUMP -Fo $(OUTDIR)\xemacs.res $(NT)\xemacs.rc # Make the resource section read/write since almost all of it is the dump @@ -1244,7 +1318,7 @@ -$(DEL) $(TEMACS_DIR)\xemacs.dmp !endif cd $(NT) - @if not exist $(TEMACS_DIR)\SATISFIED nmake -nologo -f xemacs.mak $@ + @if not exist $(TEMACS_DIR)\SATISFIED $(MAKE) /$(MAKEFLAGS) -nologo -f xemacs.mak $@ #------------------------------------------------------------------------------ # use this rule to build the complete system @@ -1265,7 +1339,7 @@ @$(COPY) $(LIB_SRC)\*.exe "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)\" @$(COPY) $(LIB_SRC)\DOC "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)" @$(COPY) $(CONFIG_VALUES) "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)" - @$(COPY) $(SRC)\xemacs.exe "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)" + @$(COPY) $(TEMACS_DIR)\xemacs.exe "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)" @$(COPYDIR) $(XEMACS)\etc "$(INSTALL_DIR)\etc\" @$(COPYDIR) $(XEMACS)\info "$(INSTALL_DIR)\info\" @$(COPYDIR) $(XEMACS)\lisp "$(INSTALL_DIR)\lisp\" @@ -1285,10 +1359,10 @@ -$(DEL) $(OUTDIR)\*.pdb -$(DEL) $(OUTDIR)\*.res -$(DEL) $(OUTDIR)\*.sbr - -$(DEL) $(SRC)\*.exe - -$(DEL) $(SRC)\*.map + -$(DEL) $(TEMACS_DIR)\*.exe + -$(DEL) $(TEMACS_DIR)\*.map -$(DEL) $(SRC)\*.bsc - -$(DEL) $(SRC)\*.pdb + -$(DEL) $(TEMACS_DIR)\*.pdb -$(DEL) $(LIB_SRC)\*.exe -$(DEL) $(LIB_SRC)\*.obj -$(DEL) $(LIB_SRC)\*.pdb @@ -1336,7 +1410,7 @@ realclean: distclean versionclean: - -$(DEL) $(SRC)\xemacs.exe + -$(DEL) $(TEMACS_DIR)\xemacs.exe -$(DEL) $(LIB_SRC)\DOC #not sure about those wildcards. DOS wildcards are stupid compared to Unix, @@ -1372,6 +1446,8 @@ XEmacs $(XEMACS_VERSION_STRING) $(xemacs_codename:"=\") configured for `$(EMACS_CONFIGURATION)'. + Building XEmacs using \"$(MAKE:\=\\)\". + Building XEmacs using make flags \"$(MAKEFLAGS)\". Building XEmacs in \"$(MAKEDIR:\=\\)\". !if defined(CCV) Using compiler \"$(CC) $(CFLAGS)\". @@ -1385,7 +1461,7 @@ Compiling in support for Microsoft Windows native GUI. !endif !if $(HAVE_X_WINDOWS) - Compiling in support for X-Windows. + Compiling in support for X Windows. !endif !if $(MULE) Compiling in international (MULE) support. @@ -1445,21 +1521,6 @@ !if $(HAVE_NATIVE_SOUND) Compiling in support for native sounds. !endif -!if $(HAVE_MSW_C_DIRED) - Compiling in fast dired implementation. -!else - -------------------------------------------------------------------- - WARNING: Define HAVE_MSW_C_DIRED to be non-zero if you want XEmacs - WARNING: to use C primitives to significantly speed up dired, at the - WARNING: expense of an additional ~4KB of code. - -------------------------------------------------------------------- -!endif -!if $(USE_MINIMAL_TAGBITS) - Using minimal tagbits. -!endif -!if $(USE_INDEXED_LRECORD_IMPLEMENTATION) - Using indexed lrecord implementation. -!endif !if $(USE_UNION_TYPE) Using union type for Lisp object storage. !endif @@ -1472,8 +1533,14 @@ !if $(USE_CRTDLL) Using DLL version of C runtime library !endif +!if $(ERROR_CHECK_ALL) + Compiling in extra internal error-checking. XEmacs will be slow! +!endif !if $(DEBUG_XEMACS) - Compiling in extra debug checks. XEmacs will be slow! + Compiling in debugging support (no slowdown). +!endif +!if $(OPTIMIZED_BUILD) + Compiling with optimization. !endif !if $(QUICK_BUILD) Disabling non-essential build actions. Use with care! diff --text -u 'xemacs-21.5.6/nt/xpm.mak' 'xemacs-21.5.7/nt/xpm.mak' Index: ././nt/xpm.mak --- ././nt/xpm.mak Fri Apr 13 03:23:01 2001 +++ ././nt/xpm.mak Tue Apr 23 09:44:30 2002 @@ -10,7 +10,7 @@ !endif !if !defined(USE_CRTDLL) -USE_CRTDLL=0 +USE_CRTDLL=1 !endif !if $(DEBUG) @@ -67,9 +67,4 @@ mkdir ..\X11 Xpm.lib: $(OBJS) -!if $(USE_CRTDLL) -# Target is ok, link builds lib as a side effect. - link -nologo -dll -def:xpm.def -out:Xpm.dll gdi32.lib $(OBJS) -!else lib -nologo -out:$@ $(OBJS) -!endif diff --text -u 'xemacs-21.5.6/src/ChangeLog' 'xemacs-21.5.7/src/ChangeLog' Index: ././src/ChangeLog --- ././src/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././src/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,3788 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-07-02 Stephen J. Turnbull + + * frame-impl.h (struct frame): Make comment refer to new file. + +2002-06-27 Mike Sperber + + * eval.c (Ffuncall): Run `post-gc-hook' if GC just happened. + + * alloc.c (garbage_collect_1): Delay running `post-gc-hook' until later. + + * data.c (prune_weak_boxes): Rewrite for better readability. + +2002-06-23 Martin Köbele + Jens Müller + Mike Sperber + + * lrecord.h (lrecord_type): add lrecord_type_ephemeron + to lrecord_type enumeration. + + * lisp.h (XEPHEMERON): + (XEPHEMERON_REF): + (XEPHEMERON_NEXT): + (XEPHEMERON_FINALIZER): + (XSET_EPHEMERON_NEXT): + (XSET_EPHEMERON_VALUE): + (XSET_EPHEMERON_KEY): + (wrap_ephemeron): + (EPHEMERONP): + (CHECK_EPHEMERON): + (CONCHECK_EPHEMERON): + (struct ephemeron): Add representation of ephemerons. + + * alloc.c (garbage_collect_1): + (finish_marking_ephemerons): + (prune_ephemerons): Call. + + * data.c: + (finish_marking_ephemerons): + (prune_ephemerons): + (mark_ephemeron): + (print_ephemeron): + (ephemeron_equal) + (ephemeron_hash):: + (make_ephemeron): + (Fmake_ephemeron): + (Fephemeronp): + (Fephemeron_ref): + (syms_of_data): + (vars_of_data): Add implementation of ephemerons + +2002-06-28 Steve Youngs + + * inline.c: Include device-impl.h, extents-impl.h, frame-impl.h, + and objects-impl.h to pick up some error_check_* functions. + Remove console.h, extents.h, frame.h and objects.h because the + *-impl.h files include them. + +2002-06-17 Jerry James + + * sysdll.c: Remove RTLD_GLOBAL initialization. + * sysdll.c (dll_open): Do not use RTLD_GLOBAL. + +2002-06-24 Mike Sperber + + * search.c (skip_chars): Fix a crash if NILP(lim). + +2002-06-23 Stephen J. Turnbull + + * unicode.c: More comment and string fiddling. + +2002-06-23 Stephen J. Turnbull + + * unicode.c: Improve top-level comments and many docstrings. + + (Fparse_unicode_translation_table): Use right function name in error. + + (unicode_to_ichar): Renamed from unicode_to_char. + (Funicode_to_char): + (decode_unicode_char): + Use new name. + + (add_charsets_to_precedence_list): Change the dynarr argument + instead of the global precedence list. + + (Funicode_precedence_list): New function. + (Fset_language_unicode_precedence_list, + Flanguage_unicode_precedence_list, + Fset_default_unicode_precedence_list, + Fdefault_unicode_precedence_list): + Docstrings refer to docstring of Funicode_precedence_list. + + (set_unicode_conversion): Assert attempts to change Basic Latin + (Unicode BMP, row 00). + (Fset_unicode_conversion): Signal error on changes to Basic Latin. + +2002-06-23 Malcolm Purvis + + * dialog-gtk.c: + * gpmevent.c: + * gtk-glue.c: + * gtk-xemacs.c: + * menubar-gtk.c: Add required #include files to unbreak the build. + + * event-gtk.c (reinit_vars_of_event_gtk): Reinitialise new stream + fields to unbreak the build. + +2002-06-22 Stephen J. Turnbull + + * ExternalShell.c (hack_event_masks_1): Fix signed-unsigned warning. + + * eldap.c: #include process.h for report_process_error. + + * editfns.c: #include commands.h for zmacs_region_* declarations. + +2002-06-22 Mike Sperber + + * faces.c (face_property_matching_instance): Only set cdr of + matchspec if it's actually a cons. + + * console.h: Define opaque console_methods to unbreak the build. + + * objects.c (initialize_charset_font_caches): + (invalidate_charset_font_caches): Only define if we're MULE. + (font_instantiate): Unbreak for non-MULE. + +2002-06-20 Ben Wing + + * s/cygwin32.h: + Allow pdump to work under Cygwin (mmap is broken, so need to undefine + HAVE_MMAP). + + * s/win32-common.h: + * s/win32-common.h (NO_MATHERR): + * s/windowsnt.h: + + Support for fastcall. Add WIN32_ANY for identifying all Win32 + variants (Cygwin, native, MinGW). Both of these are properly used + in another ws. + +2002-06-20 Ben Wing + + * alloc.c: + * alloc.c (disksave_object_finalization): + * alloc.c (garbage_collect_1): + * balloon-x.c: + * balloon-x.c (alloc_color): + * balloon-x.c (init): + * buffer.c: + * buffer.c (Fkill_buffer): + * bytecode.c: + * callint.c: + * cm.c: + * cmdloop.c: + * cmdloop.c (Frecursive_edit): + * cmdloop.c (Fcommand_loop_1): + * cmds.c: + * console-gtk.c: + * console-gtk.h: + * console-msw.c: + * console-msw.h: + * console-msw.h (struct): + * console-msw.h (wrap_mswindows_dialog_id): + * console-stream.c: + * console-stream.h: + * console-stream.h (stream_canonicalize_device_connection): + * console-tty.c: + * console-tty.h: + * console-x.c: + * console-x.h: + * console-x.h (Xt_SET_VALUE): + * console.c: + * console.c (Fcdfw_console): + * console.h: + * console.h (CDFW_CONSOLE): + * device-gtk.c: + * device-gtk.c (gtk_delete_device): + * device-gtk.c (Fgtk_display_visual_class): + * device-gtk.c (syms_of_device_gtk): + * device-gtk.c (vars_of_device_gtk): + * device-msw.c: + * device-tty.c: + * device-x.c: + * device-x.c (x_init_device): + * device-x.c (x_delete_device): + * device-x.c (x_get_resource_prefix): + * device-x.c (Fdefault_x_device): + * device-x.c (vars_of_device_x): + * device.c: + * device.c (allocate_device): + * device.c (device_console): + * device.c (init_global_resources): + * device.c (init_device_resources): + * device.c (Fdefault_device): + * device.c (Fmake_device): + * device.c (delete_device_internal): + * device.c (call_critical_lisp_code): + * device.c (syms_of_device): + * device.c (vars_of_device): + * device.h: + * devslots.h: + * dialog-gtk.c: + * dialog-msw.c: + * dialog-x.c: + * dialog.c: + * dialog.c (Fmake_dialog_box_internal): + * dired-msw.c: + * editfns.c: + * emacs.c: + * event-Xt.c: + * event-Xt.c (change_frame_visibility): + * event-gtk.c: + * event-gtk.c (change_frame_visibility): + * event-gtk.c (gtk_event_to_emacs_event): + * event-msw.c: + * event-stream.c: + * event-tty.c: + * event-unixoid.c: + * events.c: + * extents.c: + * extents.h: + * extents.h (glyph_layout): + * faces.c: + * faces.c (face_property_matching_instance): + * faces.c (init_global_faces): + * faces.c (init_device_faces): + * faces.c (complex_vars_of_faces): + * fileio.c: + * fns.c: + * frame-gtk.c: + * frame-gtk.c (INTERNAL_BORDER_WIDTH): + * frame-msw.c: + * frame-tty.c: + * frame-x.c: + * frame.c: + * frame.c (decode_frame_or_selected): + * frame.h: + * frame.h (FW_FRAME): + * frame.h (Value): Removed. + * frame.h (0): Removed. + * glyphs-eimage.c: + * glyphs-gtk.c: + * glyphs-gtk.c (gtk_locate_pixmap_file): + * glyphs-msw.c: + * glyphs-widget.c: + * glyphs-x.c: + * glyphs-x.c (x_locate_pixmap_file): + * glyphs.c: + * glyphs.c (decode_device_ii_format): + * glyphs.c (Fimage_instance_instantiator): + * glyphs.c (syms_of_glyphs): + * glyphs.h: + * gui-gtk.c: + * gui-msw.c: + * gui-x.c: + * gui-x.c (popup_selection_callback): + * gui.c: + * gutter.c: + * input-method-xlib.c: + * intl-encap-win32.c: + * intl-win32.c: + * intl-win32.c (getacp): + * intl-win32.c (mswindows_get_registry_charset): + * intl-win32.c (syms_of_intl_win32): + * intl-win32.c (vars_of_intl_win32): + * keymap.c: + * lisp.h: + * macros.c: + * menubar-gtk.c: + * menubar-msw.c: + * menubar-x.c: + * menubar.c: + * menubar.h: + * minibuf.c: + * mule-charset.c: + * mule-charset.c (Fset_charset_ccl_program): + * nt.c: + * objects-gtk.c: + * objects-gtk.c (gtk_initialize_font_instance): + * objects-gtk.c (gtk_print_font_instance): + * objects-gtk.c (gtk_font_instance_truename): + * objects-gtk.c (gtk_font_spec_matches_charset): + * objects-gtk.c (console_type_create_objects_gtk): + * objects-gtk.c (gtk_find_charset_font): + * objects-gtk.h: + * objects-msw.c: + * objects-msw.c (charset_map): + * objects-msw.c (font_enum_callback_2): + * objects-msw.c (sort_font_list_function): + * objects-msw.c (mswindows_enumerate_fonts): + * objects-msw.c (parse_font_spec): + * objects-msw.c (create_hfont_from_font_spec): + * objects-msw.c (initialize_font_instance): + * objects-msw.c (mswindows_list_fonts): + * objects-msw.c (mswindows_font_instance_truename): + * objects-msw.c (mswindows_font_spec_matches_charset_stage_1): + * objects-msw.c (mswindows_font_spec_matches_charset_stage_2): + * objects-msw.c (mswindows_font_spec_matches_charset): + * objects-msw.c (mswindows_find_charset_font): + * objects-msw.h: + * objects-msw.h (mswindows_color_to_string): + * objects-tty.c: + * objects-tty.c (tty_font_spec_matches_charset): + * objects-tty.c (tty_find_charset_font): + * objects-tty.h: + * objects-x.c: + * objects-x.c (x_initialize_font_instance): + * objects-x.c (x_print_font_instance): + * objects-x.c (x_font_instance_truename): + * objects-x.c (x_font_spec_matches_charset): + * objects-x.c (x_find_charset_font): + * objects-x.c (console_type_create_objects_x): + * objects-x.h: + * objects.c: + * objects.c (mark_font_instance): + * objects.c (Fmake_font_instance): + * objects.c (font_validate_matchspec): + * objects.c (initialize_charset_font_caches): + * objects.c (font_instantiate): + * objects.c (reinit_vars_of_objects): + * objects.h: + * postgresql.c: + * print.c: + * process.h: + * redisplay-gtk.c: + * redisplay-msw.c: + * redisplay-output.c: + * redisplay-tty.c: + * redisplay-x.c: + * redisplay.c: + * redisplay.c (text_cursor_visible_p_changed): + * redisplay.h: + * scrollbar-gtk.c: + * scrollbar-msw.c: + * scrollbar-x.c: + * scrollbar.c: + * select-gtk.c: + * select-msw.c: + * select-x.c: + * select.c: + * signal.c: + * sound.c: + * specifier.c: + * specifier.c (print_specifier): + * specifier.c (setup_device_initial_specifier_tags): + * specifier.c (Fspecifier_matching_instance): + * symbols.c: + * syntax.c (signal_syntax_table_extent_changed): + * sysdep.c: + * syssignal.h: + * syswindows.h: + * toolbar-common.c: + * toolbar-gtk.c: + * toolbar-msw.c: + * toolbar-msw.c (mswindows_clear_toolbar): + * toolbar-msw.c (mswindows_free_frame_toolbars): + * toolbar-x.c: + * toolbar.c: + * unicode.c: + * window.c: + * window.c (decode_window): + * window.h: + * window.h (WINDOW_XFRAME): + * window.h (XWINDOW_FRAME): + * window.h (CHECK_LIVE_WINDOW): + * window.h (window_divider_width): + + The following are the major changes made: + + (1) Separation of various header files into an external and an + internal version, similar to the existing separation of process.h + and procimpl.h. Eventually this should be done for all Lisp + objects. The external version has the same name as currently; the + internal adds -impl. The external file has XFOO() macros for + objects, but the structure is opaque and defined only in the + internal file. It's now reasonable to move all prototypes in + lisp.h into the appropriate external file, and this should be + done. Currently, separation has been done on extents.h, + objects*.h, console.h, device.h, frame.h, and window.h. + + For c/d/f/w, the most basic properties are available in the + external header file, with the macros resolving to functions. In + the internal header file, the macros are redefined to directly + access the structure. Also, the global MARK_FOO_CHANGED macros + have been made into functions so that they can be accessed without + needing to include lots of -impl headers -- they are used in + almost exclusively in non-time-critical functions, and take up + enough time that the function overhead will be negligible. + Similarly, the function overhead from making the basic properties + mentioned above into functions is negligible, and code that does + heavy accessing of c/d/f/w structures inevitably ends up needing + the internal header files, anyway. + + (2) More face changes. + + -- Major rewrite of objects-msw.c. Now handles wildcard specs + properly, rather than "truenaming" (or even worse, signalling an + error, which previously happened with some of the fallbacks if you + tried to use them in make-font-instance!). + + -- Split charset matching of fonts into two stages -- one to find + a font specifically designed for a particular charset (by + examining its registry), the second to find a Unicode font that + can support the charset. This needs to proceed as two complete, + separate instantiations in order to work properly (otherwise many + of the fonts in the HELLO page look wrong). This should also make + it easy to support iso10646 (Unicode) fonts under X. + + -- All default values for fonts are now completely specified in + the fallbacks. Stuff from mule-x-init.el has all been moved here, + merged with the existing specs, and totally rethought so you get + sensible results. (HELLO now looks much better!). + + -- Generalize the "default X/GTK device" stuff into a + per-device-type "default device". + + -- Add mswindows-{set-}charset-registry. In time, + charset<->code-page conversion functions will be removed. + + -- Wrap protective code around calls to compute device specifier tags, + and do this computation before calling the face initialization code + because the latter may need these tags to be correctly updated. + + (3) Other changes. + + * EmacsFrame.c: + * EmacsFrame.c (EmacsFrameSetValues): + * glyphs-msw.c: + * eval.c: + * gui-x.c: + * intl-encap-win32.c: + * search.c (Fstore_match_data): + * search.c: + * signal.c: + * toolbar-msw.c: + * unicode.c: + Warning fixes. + + * config.h.in: + #undefs meant to be frobbed by configure *MUST* go inside of + #ifndef WIN32_NO_CONFIGURE, and everything else *MUST* go outside! + + * eval.c (Fbacktrace): + Let detailed backtraces be detailed. + * specifier.c: + Don't override user's print-string-length/print-length settings. + + * glyphs.c: New function image-instance-instantiator. + + * config.h.in: + * sysdep.c (set_descriptor_non_blocking): + * sysdep.c (SIG_PARAM_TYPE): + * sysdep.c (struct save_signal): + * sysdep.c (save_signal_handlers): + * sysdep.c (retry_open): + * sysdep.c (qxe_open): + Changes for fastcall. + + * sysdep.c (qxe_rename): + * nt.c (mswindows_rename): + Fix up a previous botched patch that tried to add support for both + EEXIST and EACCES. IF THE BOTCHED PATCH WENT INTO 21.4, THIS FIXUP + NEEDS TO GO IN, TOO. + + * search.c (skip_chars): + Fix *evil* crash due to incorrect synching of syntax-cache code + with 21.1. THIS SHOULD GO INTO 21.4. + +2002-06-07 William M. Perry + + * frame-x.c (init_x_prop_symbols): Don't attempt to expose the + toolbar pixels from the EmacsFrame widget, they no longer exist. + (x_frame_properties): Ditto. + (x_internal_frame_property_p): Don't check them for internal-ness + either. + + * EmacsFrame.c: Removed references to the resources for toolbar + colors. These are now controlled completely by the 'toolbar' + face. + + * EmacsFrameP.h: Removed obsolete toolbar pixel slots. + +2002-06-05 Ben Wing + + * README.integral-types: Removed. + * README.global-renaming: Added. + + Stuff specific to the integral types rename was moved to the + Internals Manual. The general scripts, suitable for any type + of global search-and-replace, were moved to README.global-renaming. + (In the internals manual, they need to be munged by replacing @ + with @@, and this precludes just cutting and pasting from the source + file, which is what people are naturally going to do.) + +2002-06-05 Ben Wing + + * abbrev.c (abbrev_match_mapper): + * abbrev.c (abbrev_oblookup): + * abbrev.c (obarray_has_blank_p): + * abbrev.c (abbrev_count_case): + * alloc.c (make_uninit_string): + * alloc.c (resize_string): + * alloc.c (set_string_char): + * alloc.c (Fmake_string): + * alloc.c (Fstring): + * alloc.c (init_string_ascii_begin): + * alloc.c (make_string): + * alloc.c (build_intstring): + * alloc.c (build_string): + * alloc.c (build_msg_intstring): + * alloc.c (build_msg_string): + * alloc.c (make_string_nocopy): + * alloc.c (debug_string_purity_print): + * alloc.c (garbage_collect_1): + * buffer.c: + * buffer.c (Fgenerate_new_buffer_name): + * buffer.c (directory_is_current_directory): + * buffer.c (get_initial_directory): + * buffer.c (init_initial_directory): + * buffer.h: + * buffer.h (struct buffer_text): + * buffer.h (VALIDATE_BYTEBPOS_BACKWARD): + * buffer.h (VALIDATE_BYTEBPOS_FORWARD): + * buffer.h (BYTE_BUF_FETCH_CHAR): + * buffer.h (BYTE_BUF_FETCH_CHAR_RAW): + * buffer.h (BYTE_BUF_ITEXT_COPY_ICHAR): + * buffer.h (BUFFER_TEXT_LOOP): + * buffer.h (BUFFER_ALLOC): + * bytecode.c (invalid_byte_code): + * bytecode.c (READ_INSTRUCTION_CHAR): + * bytecode.c (optimize_byte_code): + * bytecode.c (compiled_function_instructions): + * callint.c (callint_prompt): + * callint.c (PROMPT): + * casefiddle.c (casify_object): + * casefiddle.c (casify_region_internal): + * casetab.c (compute_up_or_eqv_mapper): + * casetab.c (convert_old_style_syntax_string): + * casetab.c (complex_vars_of_casetab): + * charset.h: + * charset.h (ichar_charset): + * charset.h (BREAKUP_ICHAR): + * charset.h (struct Lisp_Charset): + * charset.h (CHARSET_LEADING_BYTE): + * charset.h (struct charset_lookup): + * charset.h (ICHAR_FIELD1_MASK): + * charset.h (ichar_field1): + * charset.h (MIN_ICHAR_FIELD2_OFFICIAL): + * charset.h (MIN_ICHAR_FIELD1_OFFICIAL): + * charset.h (MIN_ICHAR_FIELD2_PRIVATE): + * charset.h (MIN_ICHAR_FIELD1_PRIVATE): + * charset.h (MIN_CHAR_OFFICIAL_TYPE9N): + * charset.h (BREAKUP_ICHAR_1_UNSAFE): + * chartab.c (get_non_ascii_char_table_value): + * chartab.c (put_char_table): + * chartab.c (map_over_charset_ascii_1): + * chartab.c (map_over_charset_row): + * chartab.c (map_over_other_charset): + * chartab.c (map_char_table): + * chartab.c (chartab_instantiate): + * chartab.c (check_category_char): + * chartab.c (Fcheck_category_at): + * chartab.c (Fchar_in_category_p): + * chartab.c (word_boundary_p): + * chartab.h: + * chartab.h (struct chartab_range): + * cmds.c: + * cmds.c (Fself_insert_command): + * cmds.c (internal_self_insert): + * console-gtk.h: + * console-msw.c (GetConsoleHwnd): + * console-msw.c (mswindows_output_console_string): + * console-msw.c (Fmswindows_debugging_output): + * console-msw.c (write_string_to_mswindows_debugging_output): + * console-msw.c (DSTRING): + * console-msw.c (DSYMNAME): + * console-msw.h: + * console-stream.c (stream_text_width): + * console-tty.c (tty_init_console): + * console-x.c (split_up_display_spec): + * console-x.c (x_semi_canonicalize_console_connection): + * console-x.h: + * console.h (struct console_methods): + * console.h (struct console): + * data.c (Fsubr_interactive): + * data.c (Faref): + * device-msw.c (msprinter_default_printer): + * device-msw.c (sync_printer_with_devmode): + * device-x.c (sanity_check_geometry_resource): + * device-x.c (signal_if_x_error): + * device-x.c (x_IO_error_handler): + * device-x.c (Fx_get_resource_prefix): + * dialog-msw.c (button_width): + * dialog-msw.c (handle_question_dialog_box): + * dired-msw.c (struct): + * dired-msw.c (mswindows_get_files): + * dired-msw.c (mswindows_format_file): + * dired-msw.c (Fmswindows_insert_directory): + * dired.c (Fdirectory_files): + * dired.c (file_name_completion_stat): + * dired.c (file_name_completion): + * dired.c (struct user_name): + * dired.c (user_name_completion): + * dired.c (make_directory_hash_table): + * dired.c (Ffile_attributes): + * doc.c (unparesseuxify_doc_string): + * doc.c (get_doc_string): + * doc.c (weird_doc): + * doc.c (Fsnarf_documentation): + * doc.c (Fsubstitute_command_keys): + * doprnt.c (union printf_arg): + * doprnt.c (doprnt_2): + * doprnt.c (parse_off_posnum): + * doprnt.c (parse_doprnt_spec): + * doprnt.c (get_doprnt_args): + * doprnt.c (emacs_doprnt_1): + * doprnt.c (emacs_doprnt_va): + * doprnt.c (emacs_doprnt): + * doprnt.c (emacs_vsprintf_string_lisp): + * doprnt.c (emacs_sprintf_string_lisp): + * doprnt.c (emacs_vsprintf_malloc_lisp): + * doprnt.c (emacs_sprintf_malloc_lisp): + * doprnt.c (emacs_vsprintf_string): + * doprnt.c (emacs_sprintf_string): + * doprnt.c (emacs_vsprintf_malloc): + * doprnt.c (emacs_sprintf_malloc): + * doprnt.c (emacs_vsprintf): + * doprnt.c (emacs_sprintf): + * editfns.c: + * editfns.c (init_editfns): + * editfns.c (Fchar_to_string): + * editfns.c (Fstring_to_char): + * editfns.c (Ftemp_directory): + * editfns.c (Fuser_login_name): + * editfns.c (user_login_name): + * editfns.c (Fuser_full_name): + * editfns.c (get_home_directory): + * editfns.c (Fuser_home_directory): + * editfns.c (Fcurrent_time_string): + * editfns.c (Fcurrent_time_zone): + * editfns.c (Finsert_char): + * editfns.c (Fcompare_buffer_substrings): + * editfns.c (Fsubst_char_in_region): + * editfns.c (Ftranslate_region): + * editfns.c (Fchar_equal): + * eldap.c (Fldap_open): + * emodules.c (emodules_load): + * emodules.c (emodules_doc_subr): + * emodules.c (emodules_doc_sym): + * eval.c (print_subr): + * eval.c (build_error_data): + * eval.c (signal_error): + * eval.c (maybe_signal_error): + * eval.c (signal_continuable_error): + * eval.c (maybe_signal_continuable_error): + * eval.c (signal_error_2): + * eval.c (maybe_signal_error_2): + * eval.c (signal_continuable_error_2): + * eval.c (maybe_signal_continuable_error_2): + * eval.c (signal_ferror): + * eval.c (maybe_signal_ferror): + * eval.c (signal_continuable_ferror): + * eval.c (maybe_signal_continuable_ferror): + * eval.c (signal_ferror_with_frob): + * eval.c (maybe_signal_ferror_with_frob): + * eval.c (signal_continuable_ferror_with_frob): + * eval.c (maybe_signal_continuable_ferror_with_frob): + * eval.c (syntax_error): + * eval.c (syntax_error_2): + * eval.c (maybe_syntax_error): + * eval.c (sferror): + * eval.c (sferror_2): + * eval.c (maybe_sferror): + * eval.c (invalid_argument): + * eval.c (invalid_argument_2): + * eval.c (maybe_invalid_argument): + * eval.c (invalid_constant): + * eval.c (invalid_constant_2): + * eval.c (maybe_invalid_constant): + * eval.c (invalid_operation): + * eval.c (invalid_operation_2): + * eval.c (maybe_invalid_operation): + * eval.c (invalid_change): + * eval.c (invalid_change_2): + * eval.c (maybe_invalid_change): + * eval.c (invalid_state): + * eval.c (invalid_state_2): + * eval.c (maybe_invalid_state): + * eval.c (wtaerror): + * eval.c (stack_overflow): + * eval.c (out_of_memory): + * eval.c (printing_unreadable_object): + * eval.c (struct call_trapping_problems): + * eval.c (call_trapping_problems): + * eval.c (va_call_trapping_problems): + * eval.c (calln_trapping_problems): + * eval.c (call0_trapping_problems): + * eval.c (call1_trapping_problems): + * eval.c (call2_trapping_problems): + * eval.c (call3_trapping_problems): + * eval.c (call4_trapping_problems): + * eval.c (call5_trapping_problems): + * eval.c (eval_in_buffer_trapping_problems): + * eval.c (run_hook_trapping_problems): + * eval.c (safe_run_hook_trapping_problems): + * eval.c (run_hook_with_args_in_buffer_trapping_problems): + * eval.c (run_hook_with_args_trapping_problems): + * eval.c (va_run_hook_with_args_trapping_problems): + * eval.c (va_run_hook_with_args_in_buffer_trapping_problems): + * eval.c (warn_when_safe): + * event-Xt.c (x_keysym_to_character): + * event-Xt.c (x_to_emacs_keysym): + * event-Xt.c (x_event_to_emacs_event): + * event-Xt.c (check_for_tty_quit_char): + * event-gtk.c (gtk_to_emacs_keysym): + * event-gtk.c (dragndrop_data_received): + * event-gtk.c (check_for_tty_quit_char): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (mswindows_wnd_proc): + * event-stream.c (allocate_command_builder): + * event-stream.c (echo_key_event): + * event-stream.c (maybe_kbd_translate): + * event-stream.c (command_builder_find_leaf_no_mule_processing): + * event-stream.c (command_builder_find_leaf): + * event-stream.c (lookup_command_event): + * event-stream.c (dribble_out_event): + * event-unixoid.c (read_event_from_tty_or_stream_desc): + * event-unixoid.c (event_stream_unixoid_create_io_streams): + * events.c (character_to_event): + * events.c (event_to_character): + * events.c (Fevent_to_character): + * events.c (nth_of_key_sequence_as_event): + * events.h: + * events.h (struct key_data): + * events.h (struct command_builder): + * file-coding.c (setup_eol_coding_systems): + * file-coding.c (make_coding_system_1): + * file-coding.c (no_conversion_convert): + * file-coding.c (convert_eol_convert): + * file-coding.c (look_for_coding_system_magic_cookie): + * file-coding.h: + * fileio.c: + * fileio.c (report_file_type_error): + * fileio.c (report_error_with_errno): + * fileio.c (report_file_error): + * fileio.c (lisp_strerror): + * fileio.c (Ffile_name_directory): + * fileio.c (Ffile_name_nondirectory): + * fileio.c (file_name_as_directory): + * fileio.c (Ffile_name_as_directory): + * fileio.c (directory_file_name): + * fileio.c (Fdirectory_file_name): + * fileio.c (Fmake_temp_name): + * fileio.c (if): + * fileio.c (Ffile_truename): + * fileio.c (Fsubstitute_in_file_name): + * fileio.c (Ffile_name_absolute_p): + * fileio.c (check_writable): + * fileio.c (Ffile_writable_p): + * fileio.c (Ffile_symlink_p): + * fileio.c (a_write): + * filelock.c (struct): + * filelock.c (MAKE_LOCK_NAME): + * filelock.c (fill_in_lock_file_name): + * filelock.c (lock_file_1): + * filelock.c (current_lock_owner): + * filelock.c (lock_if_free): + * filelock.c (lock_file): + * filelock.c (unlock_file): + * filelock.c (Ffile_locked_p): + * fns.c: + * fns.c (Fstring_lessp): + * fns.c (concat): + * fns.c (split_string_by_ichar_1): + * fns.c (split_external_path): + * fns.c (split_env_path): + * fns.c (Fsplit_string_by_char): + * fns.c (Fsplit_path): + * fns.c (Ffillarray): + * fns.c (mapcar1): + * fns.c (ADVANCE_INPUT): + * fns.c (base64_encode_1): + * fns.c (STORE_BYTE): + * fns.c (base64_decode_1): + * fns.c (Fbase64_encode_region): + * fns.c (Fbase64_encode_string): + * fns.c (Fbase64_decode_region): + * fns.c (Fbase64_decode_string): + * fns.c (vars_of_fns): + * font-lock.c (struct context_cache): + * font-lock.c (find_context): + * frame-gtk.c (gtk_set_frame_text_value): + * frame-gtk.c (gtk_set_title_from_ibyte): + * frame-gtk.c (gtk_set_icon_name_from_ibyte): + * frame-gtk.c (console_type_create_frame_gtk): + * frame-msw.c (mswindows_set_title_from_ibyte): + * frame-msw.c (console_type_create_frame_mswindows): + * frame-x.c (color_to_string): + * frame-x.c (x_set_frame_text_value): + * frame-x.c (x_set_title_from_ibyte): + * frame-x.c (x_set_icon_name_from_ibyte): + * frame-x.c (x_cde_transfer_callback): + * frame-x.c (Fx_window_id): + * frame-x.c (console_type_create_frame_x): + * frame.c: + * frame.c (allocate_frame_core): + * frame.c (Fmake_frame): + * frame.c (generate_title_string): + * frame.c (update_frame_title): + * frame.c (init_frame): + * glyphs-eimage.c (my_jpeg_output_message): + * glyphs-eimage.c (gif_instantiate): + * glyphs-msw.c (struct color_symbol): + * glyphs-msw.c (xpm_to_eimage): + * glyphs-msw.c (struct): + * glyphs-msw.c (resource_name_to_resource): + * glyphs-msw.c (mswindows_xface_instantiate): + * glyphs-msw.c (charset_of_text): + * glyphs-msw.c (mswindows_widget_instantiate): + * glyphs-x.c (x_locate_pixmap_file): + * glyphs-x.c (x_xface_instantiate): + * glyphs-x.c (safe_XLoadFont): + * glyphs-x.c (font_instantiate): + * glyphs.c (print_image_instance): + * glyphs.c (signal_image_error): + * glyphs.c (signal_image_error_2): + * glyphs.c (signal_double_image_error): + * glyphs.c (signal_double_image_error_2): + * glyphs.c (query_string_geometry): + * glyphs.c (query_string_font): + * glyphs.c (display_table_entry): + * glyphs.h: + * gpmevent.c (tty_get_foreign_selection): + * gui-x.c (menu_separator_style_and_to_external): + * gui-x.c (add_accel_and_to_external): + * gui-x.c (button_item_to_widget_value): + * gui-x.h: + * gui.c (separator_string_p): + * gui.c (gui_name_accelerator): + * gui.h: + * hpplay.c (player_error_internal): + * indent.c (column_at_point): + * indent.c (string_column_at_point): + * indent.c (byte_spaces_at_point): + * indent.c (Fmove_to_column): + * insdel.c (gap_left): + * insdel.c (gap_right): + * insdel.c (make_gap): + * insdel.c (fixup_internal_substring): + * insdel.c (buffer_insert_string_1): + * insdel.c (buffer_insert_raw_string_1): + * insdel.c (buffer_insert_c_string_1): + * insdel.c (buffer_insert_emacs_char_1): + * insdel.c (buffer_insert_c_char_1): + * insdel.c (buffer_delete_range): + * insdel.c (buffer_replace_char): + * insdel.h: + * intl-win32.c (convert_multibyte_to_internal_malloc): + * keymap.c (make_key_description): + * keymap.c (keymap_lookup_directly): + * keymap.c (keymap_store): + * keymap.c (define_key_check_and_coerce_keysym): + * keymap.c (Fdefine_key): + * keymap.c (Flookup_key): + * keymap.c (map_keymap_sort_predicate): + * keymap.c (Fkey_description): + * keymap.c (Ftext_char_description): + * keymap.c (describe_map): + * keymap.c (vars_of_keymap): + * line-number.c (insert_invalidate_line_number_cache): + * line-number.h: + * lisp-disunion.h: + * lisp-union.h: + * lisp.h: + * lisp.h (struct): + * lisp.h (struct Lisp_String): + * lisp.h (XCHAR): + * lisp.h (DECLARE_INLINE_HEADER): + * lread.c: + * lread.c (readchar): + * lread.c (unreadchar): + * lread.c (Fload_internal): + * lread.c (locate_file_map_suffixes): + * lread.c (locate_file_in_directory_mapper): + * lread.c (locate_file_construct_suffixed_files_mapper): + * lread.c (readevalloop): + * lread.c (read0): + * lread.c (read_escape): + * lread.c (read_atom_0): + * lread.c (read_atom): + * lread.c (parse_integer): + * lread.c (read_bit_vector): + * lread.c (read_structure): + * lread.c (reader_nextchar): + * lread.c (read1): + * lread.c (isfloat_string): + * lread.c (sequence_reader): + * lread.c (read_list_conser): + * lread.c (read_list): + * lread.c (read_vector): + * lread.c (read_compiled_function): + * lrecord.h: + * lstream.c: + * lstream.c (Lstream_really_write): + * lstream.c (Lstream_read_1): + * lstream.c (struct filedesc_stream): + * lstream.c (filedesc_writer): + * lstream.c (filedesc_stream_set_pty_flushing): + * lstream.c (lisp_string_reader): + * lstream.c (lisp_string_rewinder): + * lstream.c (lisp_buffer_reader): + * lstream.c (lisp_buffer_writer): + * lstream.h: + * lstream.h (Lstream_get_ichar): + * md5.c (Fmd5): + * menubar-msw.c: + * menubar-msw.c (mswindows_translate_menu_or_dialog_item): + * menubar-msw.c (displayable_menu_item): + * menubar-msw.c (populate_menu_add_item): + * menubar-msw.c (mswindows_char_is_accelerator): + * menubar-x.c (menu_item_descriptor_to_widget_value_1): + * menubar.c (Fnormalize_menu_item_name): + * minibuf.c (scmp_1): + * minibuf.c (regexp_ignore_completion_p): + * minibuf.c (Fall_completions): + * minibuf.c (echo_area_append): + * minibuf.c (echo_area_message): + * minibuf.c (message_internal): + * minibuf.c (message_append_internal): + * minibuf.c (message_1): + * minibuf.c (message_append_1): + * mule-ccl.c: + * mule-ccl.c (CCL_WRITE_CHAR): + * mule-ccl.c (CCL_WRITE_STRING): + * mule-ccl.c (CCL_MAKE_CHAR): + * mule-charset.c (make_charset): + * mule-charset.c (Fmake_charset): + * mule-coding.c (shift_jis_convert): + * mule-coding.c (Fdecode_shift_jis_char): + * mule-coding.c (Fencode_shift_jis_char): + * mule-coding.c (big5_convert): + * mule-coding.c (decode_big5_char): + * mule-coding.c (Fdecode_big5_char): + * mule-coding.c (Fencode_big5_char): + * mule-coding.c (charset_by_attributes_or_create_one): + * mule-coding.c (iso2022_decode): + * mule-coding.c (iso2022_encode): + * mule-wnnfns.c (Fwnn_dict_list): + * mule-wnnfns.c (Fwnn_fuzokugo_get): + * mule-wnnfns.c (m2w): + * ndir.h: + * nt.c: + * nt.c (getpwnam): + * nt.c (parse_root): + * nt.c (get_long_basename): + * nt.c (mswindows_get_long_filename): + * nt.c (is_unc_volume): + * nt.c (nt_get_resource): + * nt.c (init_mswindows_environment): + * nt.c (volume_info_data): + * nt.c (lookup_volume_info): + * nt.c (add_volume_info): + * nt.c (get_cached_volume_information): + * nt.c (get_volume_info): + * nt.c (is_exec): + * nt.c (mswindows_opendir): + * nt.c (mswindows_readdir): + * nt.c (open_unc_volume): + * nt.c (read_unc_volume): + * nt.c (unc_volume_file_attributes): + * nt.c (mswindows_access): + * nt.c (mswindows_link): + * nt.c (mswindows_rename): + * nt.c (mswindows_unlink): + * nt.c (mswindows_fstat): + * nt.c (mswindows_stat): + * nt.c (mswindows_getdcwd): + * nt.c (open_input_file): + * nt.c (open_output_file): + * nt.c (mswindows_executable_type): + * nt.c (Fmswindows_short_file_name): + * nt.c (Fmswindows_long_file_name): + * nt.c (init_nt): + * objects-gtk.c (gtk_parse_nearest_color): + * objects-gtk.c (gtk_font_spec_matches_charset): + * objects-gtk.c (gtk_find_charset_font): + * objects-gtk.h: + * objects-msw.c (hexval): + * objects-msw.c (mswindows_string_to_color): + * objects-msw.c (match_font): + * objects-msw.c (font_enum_callback_2): + * objects-msw.c (create_hfont_from_font_spec): + * objects-msw.c (initialize_font_instance): + * objects-msw.c (mswindows_list_fonts): + * objects-msw.c (mswindows_font_instance_truename): + * objects-msw.c (mswindows_font_spec_matches_charset_stage_1): + * objects-msw.c (mswindows_font_spec_matches_charset): + * objects-tty.c (tty_initialize_font_instance): + * objects-tty.c (tty_font_spec_matches_charset): + * objects-tty.c (tty_find_charset_font): + * objects-x.c (x_font_instance_properties): + * objects-x.c (x_font_spec_matches_charset): + * objects-x.c (x_find_charset_font): + * objects.c (font_spec_matches_charset): + * objects.h: + * postgresql.c (init_postgresql_from_environment): + * print.c: + * print.c (write_string_to_stdio_stream): + * print.c (std_handle_out_va): + * print.c (stderr_out): + * print.c (stdout_out): + * print.c (debug_out): + * print.c (fatal): + * print.c (output_string): + * print.c (write_string_1): + * print.c (write_string): + * print.c (write_c_string): + * print.c (write_fmt_string): + * print.c (write_fmt_string_lisp): + * print.c (stderr_out_lisp): + * print.c (Fwrite_char): + * print.c (float_to_string): + * print.c (print_string): + * print.c (print_internal): + * print.c (print_symbol): + * print.c (Falternate_debugging_output): + * print.c (write_string_to_alternate_debugging_output): + * print.c (Fexternal_debugging_output): + * process-nt.c (mswindows_compare_env): + * process-nt.c (nt_create_process): + * process-nt.c (nt_send_process): + * process-unix.c: + * process-unix.c (allocate_pty): + * process-unix.c (relocate_fd): + * process-unix.c (child_setup): + * process-unix.c (unix_create_process): + * process-unix.c (unix_send_process): + * process-unix.c (unix_process_send_eof): + * process-unix.c (unix_kill_child_process): + * process-unix.c (unix_canonicalize_host_name): + * process-unix.c (unix_open_network_stream): + * process.c (read_process_output): + * process.c (send_process): + * process.c (status_message): + * process.c (decode_signal): + * process.c (getenv_internal): + * process.c (putenv_internal): + * process.c (Fgetenv): + * process.c (egetenv): + * process.c (eputenv): + * process.c (init_xemacs_process): + * procimpl.h: + * realpath.c: + * realpath.c (mswindows_readlink_and_correct_case): + * realpath.c (cygwin_readlink_and_correct_case): + * realpath.c (mswindows_abs_start): + * realpath.c (qxe_realpath): + * redisplay-gtk.c: + * redisplay-gtk.c (separate_textual_runs): + * redisplay-gtk.c (gtk_text_width): + * redisplay-gtk.c (gtk_output_display_block): + * redisplay-gtk.c (gtk_output_string): + * redisplay-msw.c (separate_textual_runs): + * redisplay-msw.c (mswindows_output_cursor): + * redisplay-msw.c (mswindows_output_string): + * redisplay-msw.c (mswindows_output_display_block): + * redisplay-msw.c (mswindows_text_width): + * redisplay-output.c (redisplay_output_layout): + * redisplay-tty.c: + * redisplay-tty.c (tty_text_width): + * redisplay-tty.c (tty_output_display_block): + * redisplay-tty.c (tty_output_ibyte_string): + * redisplay-tty.c (tty_output_ichar_dynarr): + * redisplay-tty.c (substitute_in_dynamic_color_string): + * redisplay-tty.c (set_foreground_to): + * redisplay-tty.c (set_background_to): + * redisplay-x.c: + * redisplay-x.c (separate_textual_runs): + * redisplay-x.c (x_text_width): + * redisplay-x.c (x_output_display_block): + * redisplay-x.c (x_output_string): + * redisplay.c: + * redisplay.c (position_redisplay_data_type): + * redisplay.c (struct prop_block): + * redisplay.c (redisplay_text_width_ichar_string): + * redisplay.c (redisplay_text_width_string): + * redisplay.c (redisplay_frame_text_width_string): + * redisplay.c (add_ichar_rune_1): + * redisplay.c (add_ichar_rune): + * redisplay.c (add_ibyte_string_runes): + * redisplay.c (ADD_NEXT_OCTAL_RUNE_CHAR): + * redisplay.c (add_octal_runes): + * redisplay.c (add_control_char_runes): + * redisplay.c (add_disp_table_entry_runes_1): + * redisplay.c (add_propagation_runes): + * redisplay.c (add_glyph_rune): + * redisplay.c (create_text_block): + * redisplay.c (create_overlay_glyph_block): + * redisplay.c (generate_formatted_string_db): + * redisplay.c (add_string_to_fstring_db_runes): + * redisplay.c (generate_fstring_runes): + * redisplay.c (create_string_text_block): + * redisplay.c (decode_mode_spec): + * redisplay.c (init_redisplay): + * redisplay.h: + * redisplay.h (struct rune): + * regex.c: + * regex.c (RE_TRANSLATE_1): + * regex.c (itext_ichar): + * regex.c (INC_IBYTEPTR): + * regex.c (PATFETCH_RAW): + * regex.c (PATUNFETCH): + * regex.c (regex_compile): + * regex.c (compile_range): + * regex.c (compile_extended_range): + * regex.c (re_compile_fastmap): + * regex.c (re_search_2): + * regex.c (re_match_2_internal): + * search.c: + * search.c (TRANSLATE): + * search.c (fixup_search_regs_for_string): + * search.c (fast_string_match): + * search.c (byte_scan_buffer): + * search.c (scan_buffer): + * search.c (byte_find_next_ichar_in_string): + * search.c (skip_chars): + * search.c (trivial_regexp_p): + * search.c (search_buffer): + * search.c (simple_search): + * search.c (boyer_moore): + * search.c (wordify): + * search.c (Freplace_match): + * search.c (Fregexp_quote): + * select-common.h (lisp_data_to_selection_data): + * select-gtk.c (atom_to_symbol): + * select-x.c (x_atom_to_symbol): + * select-x.c (hack_motif_clipboard_selection): + * select-x.c (Fx_store_cutbuffer_internal): + * sound.h (sound_perror): + * symbols.c (intern_int): + * symbols.c (intern): + * symbols.c (intern_converting_underscores_to_dashes): + * symbols.c (oblookup): + * symbols.c (hash_string): + * symbols.c (init_symbols_once_early): + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_nodump): + * symbols.c (defsymbol): + * symbols.c (defvar_magic): + * syntax.c (struct lisp_parse_state): + * syntax.c (syntax_match): + * syntax.c (WORD_BOUNDARY_P): + * syntax.c (scan_words): + * syntax.c (find_start_of_comment): + * syntax.c (Fforward_comment): + * syntax.c (scan_lists): + * syntax.c (Fbackward_prefix_chars): + * syntax.c (scan_sexps_forward): + * syntax.c (complex_vars_of_syntax): + * syntax.h: + * sysdep.c: + * sysdep.c (sys_subshell): + * sysdep.c (get_eof_char): + * sysdep.c (init_system_name): + * sysdep.c (qxe_open): + * sysdep.c (qxe_interruptible_open): + * sysdep.c (qxe_fopen): + * sysdep.c (qxe_chdir): + * sysdep.c (qxe_mkdir): + * sysdep.c (qxe_opendir): + * sysdep.c (qxe_readdir): + * sysdep.c (qxe_rmdir): + * sysdep.c (qxe_allocating_getcwd): + * sysdep.c (qxe_access): + * sysdep.c (qxe_eaccess): + * sysdep.c (qxe_lstat): + * sysdep.c (qxe_readlink): + * sysdep.c (qxe_stat): + * sysdep.c (qxe_chmod): + * sysdep.c (qxe_link): + * sysdep.c (qxe_rename): + * sysdep.c (qxe_symlink): + * sysdep.c (qxe_unlink): + * sysdep.c (qxe_execve): + * sysdep.c (qxe_getpwnam): + * sysdep.c (qxe_ctime): + * sysdep.h: + * sysdir.h: + * sysdir.h (qxe_allocating_getcwd): + * sysfile.h: + * sysfile.h (DECLARE_INLINE_HEADER): + * sysproc.h: + * syspwd.h: + * systime.h: + * syswindows.h: + * syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR): + * syswindows.h (LOCAL_TO_WIN32_FILE_FORMAT): + * syswindows.h (WIN32_TO_LOCAL_FILE_FORMAT): + * syswindows.h (LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR): + * syswindows.h (file_data): + * syswindows.h (DECLARE_INLINE_HEADER): + * termcap.c (tgetent): + * tests.c (Ftest_data_format_conversion): + * text.c: + * text.c (qxesprintf): + * text.c (qxestrcasecmp): + * text.c (ascii_strcasecmp): + * text.c (qxestrcasecmp_c): + * text.c (qxestrcasecmp_i18n): + * text.c (qxestrncasecmp): + * text.c (ascii_strncasecmp): + * text.c (qxestrncasecmp_c): + * text.c (qxestrncasecmp_i18n): + * text.c (qxememcmp): + * text.c (qxememcmp4): + * text.c (qxememcasecmp): + * text.c (qxememcasecmp4): + * text.c (qxetextcmp): + * text.c (qxetextcmp_matching): + * text.c (qxetextcasecmp): + * text.c (qxetextcasecmp_matching): + * text.c (lisp_strcasecmp): + * text.c (convert_ibyte_string_into_ichar_dynarr): + * text.c (convert_ibyte_string_into_ichar_string): + * text.c (convert_ichar_string_into_ibyte_dynarr): + * text.c (convert_ichar_string_into_malloced_string): + * text.c (COPY_TEXT_BETWEEN_FORMATS): + * text.c (copy_text_between_formats): + * text.c (copy_buffer_text_out): + * text.c (find_charsets_in_ibyte_string): + * text.c (find_charsets_in_ichar_string): + * text.c (ibyte_string_displayed_columns): + * text.c (ichar_string_displayed_columns): + * text.c (ibyte_string_nonascii_chars): + * text.c (eistr_casefiddle_1): + * text.c (eito_malloc_1): + * text.c (eicmp_1): + * text.c (eicpyout_malloc_fmt): + * text.c (skip_ascii): + * text.c (bytecount_to_charcount_fun): + * text.c (charcount_to_bytecount_fun): + * text.c (struct): + * text.c (dfc_convert_to_external_format): + * text.c (dfc_convert_to_internal_format): + * text.c (non_ascii_set_itext_ichar): + * text.c (non_ascii_itext_ichar): + * text.c (non_ascii_valid_ichar_p): + * text.c (non_ascii_itext_copy_ichar): + * text.c (Lstream_get_ichar_1): + * text.c (Lstream_fput_ichar): + * text.c (Lstream_funget_ichar): + * text.c (Fmake_char): + * text.c (Fchar_charset): + * text.c (Fchar_octet): + * text.c (Fsplit_char): + * text.c (lookup_composite_char): + * text.c (composite_char_string): + * text.c (Fcomposite_char_string): + * text.c (reinit_vars_of_text): + * text.h: + * text.h (MAX_ICHAR_LEN): + * text.h (ibyte_first_byte_p): + * text.h (ibyte_leading_byte_p): + * text.h (ichar_multibyte_p): + * text.h (ichar_ascii_p): + * text.h (ichar_16_bit_fixed_p): + * text.h (ichar_to_raw): + * text.h (valid_ibyteptr_p): + * text.h (assert_valid_ibyteptr): + * text.h (INC_IBYTEPTR): + * text.h (INC_IBYTEPTR_FMT): + * text.h (DEC_IBYTEPTR): + * text.h (DEC_IBYTEPTR_FMT): + * text.h (VALIDATE_IBYTEPTR_BACKWARD): + * text.h (VALIDATE_IBYTEPTR_FORWARD): + * text.h (validate_ibyte_string_backward): + * text.h (itext_ichar_len): + * text.h (INC_BYTECOUNT): + * text.h (simple_itext_ichar): + * text.h (itext_ichar): + * text.h (valid_ichar_p): + * text.h (CHAR_INTP): + * text.h (ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE): + * text.h (LISP_STRING_TO_ALLOCA): + * text.h (alloca_ibytes): + * text.h (struct): + * text.h (EI_ALLOC): + * text.h (eicpy_lstr_off): + * text.h (eicpy_raw_fmt): + * text.h (eicpy_rawz_fmt): + * text.h (eicpy_ch): + * text.h (eireset): + * text.h (eito_alloca): + * text.h (DECLARE_INLINE_HEADER): + * text.h (eigetch): + * text.h (eicat_c): + * text.h (eicat_raw): + * text.h (eicat_rawz): + * text.h (eicat_ch): + * text.h (eisub_1): + * text.h (eisub_ch): + * text.h (EI_CASECHANGE): + * text.h (DFC_LISP_STRING_USE_CONVERTED_DATA): + * text.h (GET_STRERROR): + * toolbar-common.c (common_output_toolbar_button): + * tooltalk.c (check_status): + * tooltalk.c (tt_message_arg_bval_vector): + * ui-gtk.c (lisp_to_gtk_type): + * unexnt.c (unexec): + * unexnt.c (get_bss_info_from_map_file): + * unicode.c: + * unicode.c (sledgehammer_check_from_table): + * unicode.c (sledgehammer_check_to_table): + * unicode.c (set_unicode_conversion): + * unicode.c (ichar_to_unicode): + * unicode.c (unicode_to_char): + * unicode.c (Fchar_to_unicode): + * unicode.c (Funicode_to_char): + * unicode.c (decode_unicode_char): + * unicode.c (encode_unicode_char): + * unicode.c (unicode_convert): + * win32.c (urlify_filename): + * win32.c (tstr_to_local_file_format): + * win32.c (mswindows_canonicalize_filename): + * win32.c (mswindows_lisp_error_1): + * win32.c (Fmswindows_cygwin_to_win32_path): + + Text/char naming rationalization. + + [a] distinguish between "charptr" when it refers to operations on + the pointer itself and when it refers to operations on text; and + [b] use consistent naming for everything referring to internal + format, i.e. + + Itext == text in internal format + Ibyte == a byte in such text + Ichar == a char as represented in internal character format + + thus e.g. + + set_charptr_emchar -> set_itext_ichar + + The pre and post tags on either side of this change are: + + pre-internal-format-textual-renaming + post-internal-format-textual-renaming + + See the Internals Manual for details of exactly how this was done, + how to handle the change in your workspace, etc. + +2002-06-04 Andy Piper + + * glyphs-widget.c (widget_logical_unit_height): don't try and + determine geometry of nil strings. + +2002-06-03 Andy Piper + + * frame.c (frame_conversion_internal): add conversion appropriate + for setting frame dimensions in pixels. + + * console.h (struct console_methods): add device-specific widget + layout functions. + + * emacs.c (main_1): initialize glyph vars. + + * event-Xt.c (handle_focus_event_1): call handle_focus_event_2 + (handle_focus_event_2): new function. Allow focus to + be set to a particular window and widget. + (enqueue_focus_event): new function. Create a + synthetic focus event. + (emacs_Xt_handle_magic_event): call + handle_focus_event_2. + + * frame.c (Fset_frame_pixel_height): new function. Allow + pixel-based sizing. Does the right thing on character-oriented + displays. + (Fset_frame_pixel_width): ditto. + (Fset_frame_pixel_size): ditto. + (syms_of_frame): declare. + + * general-slots.h: add :vertically-justify and + :horizontally-justify. + + * glyphs-msw.c (xbm_create_bitmap_from_data): warning fix. + (mswindows_widget_border_width): new function. + (mswindows_combo_box_instantiate): set border widths. + (console_type_create_glyphs_mswindows): declare. + + * glyphs-widget.c: + (check_valid_justification): allow vertical and horizontal + justification. + (widget_border_width): new function. Call device methods. + (widget_instance_border_width): ditto. + (logical_unit_height): new function. Determine the height of a + logical-unit. Logical units are intended to provide grid-like + layout for subcontrols in a layout. If the layout is + :vertically-justify top then subcontrols will be positioned on + logical-unit boundaries, thus allowing adjacent subcontrols to + line up. + (widget_logical_unit_height): ditto for widgets. + (redisplay_widget): misc cleanup. + (widget_spacing): new function. Call device specific + methods. Intended to be the default gap between adjacent widgets. + (widget_query_geometry): use new spacing functions to determine + appropriate geometry. + (initialize_widget_image_instance): initialize horizontal and + vertical justification. + (widget_instantiate): use logica-units where appropriate for + sizing large widgets. + (button_query_geometry): use widget_instance_border_width. + (tree_view_query_geometry): ditto. + (tab_control_query_geometry): ditto. + (edit_field_query_geometry): new function. + (layout_update): pick up :justify, :horizontally-justify and + :vertically-justify none of which worked previously. :justify is + used as a fallback for both horizontal and vertical justification. + (layout_query_geometry): use logical units to size appropriately. + (layout_layout): ditto. + (Fwidget_logical_to_character_width): new function. Allow users to + convert from logical units to characters so that frame sizes can + be set appropriately. + (Fwidget_logical_to_character_height): ditto. + (syms_of_glyphs_widget): declare. + (image_instantiator_edit_fields): add edit_field_query_geometry. + (VALID_LAYOUT_KEYWORDS): declare :vertically-justify and + :horizontally-justify. + (specifier_vars_of_glyphs_widget): new function. Declare + Vwidget_border_width which is not yet used. + + * glyphs-x.c (x_map_subwindow): enqueue appropriate focus events. + (x_widget_border_width): new function. + (x_widget_instantiate): create a sensible name for widgets. + (console_type_create_glyphs_x): declare x_widget_border_width. + + * glyphs.h (DEFAULT_WIDGET_BORDER_WIDTH): new macro. + (struct Lisp_Image_Instance): add :vertically-justify and + :horizontally-justify. + (LAYOUT_JUSTIFY_TOP): new. + (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY): new. + (ROUND_UP): new macro. Round argument up to next integral + interval. + + * redisplay-output.c (redisplay_output_layout): misc formatting. + + * symsinit.h: declare specifier_vars_of_glyphs_widget. + +2002-05-16 Mathias Grimmberger + + * sysdep.c (sys_rename): Make sys_rename work for the case where + Windows rename sets errno to EACCES if target file exists. + +2002-05-21 Jonathan Harris + + * device-msw.c (mswindows_handle_page_setup_dialog_box): + Fix detection of metric units to work on Win95 + +2002-05-25 Andy Piper + + * select-x.c (vars_of_select_x): Fix docstring of + x-selection-strict-motif-ownership + +2002-05-07 Nix + + Supersedes 2002-04-17 patch. + + * process.h (PROCESS_LIVE_P): Use the process status as + evidence of health, not the state of the input stream. + (PROCESS_READABLE_P): Say if the process is readable + from. (It may be dead nonetheless.) + (CHECK_READABLE_PROCESS): Test for that condition. + + * process.c (create_process): Use PROCESS_READABLE_P. + (read_process_output, set_process_filter): Likewise. + + * process.c (Fprocess_input_coding_system): Use CHECK_READABLE_PROCESS. + (Fset_process_input_coding_system, Fprocess_coding_system): Likewise. + + This code is #if 0'd, this is not the time to add new functions: + + * process.c (Fprocess_readable_p): Report readability status. + * process.c (Qprocess_readable_p): New, associated symbol... + * process.c (syms_of_process): ... initialize it. + +2002-05-06 Andy Piper + + * process.h (PROCESS_LIVE_P): revert previous change because of + tty problems. + +2002-04-27 Andy Piper + + * glyphs-msw.c (mswindows_widget_instantiate): remove dead-code. + +2002-04-26 Andy Piper + + * glyphs-msw.c (mswindows_map_subwindow): observe :initial-focus + behavior. + + * config.h.in: pull in 21.5.x change to stop alloca warnings under + cygwin. + +2002-06-02 Michael Sperber [Mr. Preprocessor] + + * process.c (remove_process): Don't invalidate the process marker + after the process has died to make point synchronization in + `call-process-internal' possible. + +2002-06-01 Ben Wing + + * buffer.c (init_initial_directory): + Fix bug noted by someone. + + * console-tty.h: + * device.h (struct device): + * emacs.c: + * filelock.c: + * nt.c: + * process-nt.c: + * process-unix.c: + * process.c: + * redisplay-tty.c: + * sysdep.c: + * sysproc.h: + * win32.c: + Redo problem with syssignal.h/sysproc.h dependence noted by Didier + -- rather than require one included before the other + (error-prone), just include syssignal.h from sysproc.h + where it's needed. + + * inline.c: + Include sysfile.h due to inline funs in that header. + + * extents.c (Fset_extent_parent): + Fix bug noted by Andrew Cohen . + + * process-unix.c (unix_open_network_stream): + * process-unix.c (unix_open_multicast_group): + Fix other bug noted by Andrew Cohen . + + * process.c (syms_of_process): + Add process-has-separate-stderr-p, used by call-process-internal. + +2002-05-28 Martin Köbele , Jens Müller + + * lrecord.h (lrecord_type): Add lrecord_type_weak_box to + lrecord_type enumeration. + + * alloc.c (garbage_collect_1): Call prune_weak_boxes(). + + * lisp.h (struct weak_box): + * data.c: + (prune_weak_boxes): + (mark_weak_box): + (print_weak_box): + (weak_box_equal): + (weak_box_hash): + (make_weak_box): + (Fmake_weak_box): + (Fweak_box_ref): + (Fweak_boxp): + (syms_of_data): + (vars_of_data): Add implementation of weak boxes. + +2002-05-29 Ben Wing + + * event-msw.c: + Oops, paren in wrong place. + Oops, manifest constant needed earlier than defined. + +2002-05-29 Didier Verna + + * process-unix.c (unix_canonicalize_host_name): change gai_error + to gai_err to avoid shadow declaration. + * process-unix.c (unix_open_network_stream): ditto. + +2002-05-28 Didier Verna + + * emacs.c: comment the inclusion order of syssignal.h and sysproc.h. + * filelock.c: ditto. + * nt.c: ditto. + * sysproc.h: ditto. + * process-nt.c: ditto. + * process-unix.c: include syssignal.h before sysproc.h. + * process.c: ditto. + * sysdep.c: ditto. + * win32.c: ditto. + +2002-05-28 Ben Wing + + ================================================================ + ALLOW SEPARATION OF STDOUT AND STDERR IN PROCESSES + ================================================================ + + Standard output and standard error can be processed separately in + a process. Each can have its own buffer, its own mark in that buffer, + and its filter function. You can specify a separate buffer for stderr + in `start-process' to get things started, or use the new primitives: + + set-process-stderr-buffer + process-stderr-buffer + process-stderr-mark + set-process-stderr-filter + process-stderr-filter + + Also, process-send-region takes a 4th optional arg, a buffer. + + Currently always uses a pipe() under Unix to read the error output. + (#### Would a PTY be better?) + + * sysdep.h: + * sysproc.h: + * unexfreebsd.c (unexec): + * unexsunos4.c (unexec): + * nt.c (init_user_info): + * emacs.c: + * emacs.c (main_1): + * callproc.c: + * symsinit.h: + * sysdep.c: + * sysdep.c (wait_for_termination): + * Makefile.in.in (objs): + * process-unix.c (child_setup): + Delete callproc.c. Move child_setup() to process-unix.c. + wait_for_termination() now only needed on a few really old systems. + + * console-msw.h: + * event-Xt.c (emacs_Xt_select_process): + * event-Xt.c (emacs_Xt_unselect_process): + * event-Xt.c (emacs_Xt_create_io_streams): + * event-Xt.c (emacs_Xt_delete_io_streams): + * event-Xt.c (debug_process_finalization): + * event-Xt.c (reinit_vars_of_event_Xt): + * event-msw.c (get_process_stderr_waitable): + * event-msw.c (emacs_mswindows_select_process): + * event-msw.c (emacs_mswindows_unselect_process): + * event-msw.c (emacs_mswindows_create_io_streams): + * event-msw.c (emacs_mswindows_delete_io_streams): + * event-msw.c (debug_process_finalization): + * event-msw.c (reinit_vars_of_event_mswindows): + * event-msw.c (vars_of_event_mswindows): + * event-msw.c (lstream_type_create_mswindows_selectable): + * event-stream.c (event_stream_select_process): + * event-stream.c (event_stream_unselect_process): + * event-stream.c (event_stream_create_io_streams): + * event-stream.c (event_stream_delete_io_streams): + * event-stream.c (Faccept_process_output): + * event-tty.c (emacs_tty_select_process): + * event-tty.c (emacs_tty_unselect_process): + * event-tty.c (emacs_tty_create_io_streams): + * event-tty.c (emacs_tty_delete_io_streams): + * event-tty.c (reinit_vars_of_event_tty): + * event-unixoid.c: + * event-unixoid.c (get_process_infd): + * event-unixoid.c (get_process_errfd): + * event-unixoid.c (event_stream_unixoid_select_process): + * event-unixoid.c (event_stream_unixoid_unselect_process): + * event-unixoid.c (event_stream_unixoid_create_io_streams): + * event-unixoid.c (event_stream_unixoid_delete_io_streams): + * events.h: + * events.h (struct event_stream): + * process-nt.c: + * process-nt.c (struct nt_process_data): + * process-nt.c (nt_create_process): + * process-nt.c (get_internet_address): + * process-nt.c (nt_open_network_stream): + * process-unix.c: + * process-unix.c (struct unix_process_data): + * process-unix.c (UNIX_DATA): + * process-unix.c (close_process_descs_mapfun): + * process-unix.c (close_process_descs): + * process-unix.c (connect_to_file_descriptor): + * process-unix.c (process_signal_char): + * process-unix.c (unix_alloc_process_data): + * process-unix.c (unix_init_process_io_handles): + * process-unix.c (unix_create_process): + * process-unix.c (io_failure): Removed. + * process-unix.c (unix_tooltalk_connection_p): + * process-unix.c (unix_set_window_size): + * process-unix.c (unix_reap_exited_processes): + * process-unix.c (unix_deactivate_process): + * process-unix.c (unix_kill_child_process): + * process.c: + * process.c (mark_process): + * process.c (get_process_streams): + * process.c (get_process_from_usid): + * process.c (get_process_selected_p): + * process.c (set_process_selected_p): + * process.c (make_process_internal): + * process.c (init_process_io_handles): + * process.c (create_process): + * process.c (Fstart_process_internal): + * process.c (Fopen_multicast_group_internal): + * process.c (process_setup_for_insertion): + * process.c (read_process_output): + * process.c (Fset_process_stderr_buffer): + * process.c (Fprocess_stderr_mark): + * process.c (set_process_filter): + * process.c (Fset_process_filter): + * process.c (Fset_process_stderr_filter): + * process.c (Fprocess_stderr_filter): + * process.c (exec_sentinel_unwind): + * process.c (exec_sentinel): + * process.c (status_notify): + * process.c (Fprocess_send_eof): + * process.c (deactivate_process): + * process.c (syms_of_process): + * process.c (vars_of_process): + * process.h: + * procimpl.h: + * procimpl.h (struct process_methods): + * procimpl.h (struct Lisp_Process): + * procimpl.h (DATA_ERRSTREAM): + Rewrite the process methods to handle a separate channel for + error input. Create Lstreams for reading in the error channel. + Many process methods need change. In general the changes are + fairly clear as they involve duplicating what's used for reading + the normal stdout and changing for stderr -- although tedious, + as such changes are required throughout the entire process code. + Rewrote the code that reads process output to do two loops, one + for stdout and one for stderr. + + * gpmevent.c (get_process_infd): + * gpmevent.c (Fgpm_enable): + * tooltalk.c: + * tooltalk.c (init_tooltalk): + set_process_filter takes an argument for stderr. + + ================================================================ + NEW ERROR-TRAPPING MECHANISM + ================================================================ + + Totally rewrite error trapping code to be unified and support more + features. Basic function is call_trapping_problems(), which lets + you specify, by means of flags, what sorts of problems you want + trapped. these can include + + -- quit + -- errors + -- throws past the function + -- creation of "display objects" (e.g. buffers) + -- deletion of already-existing "display objects" (e.g. buffers) + -- modification of already-existing buffers + -- entering the debugger + -- gc + -- errors->warnings (ala suspended errors) + + etc. All other error funs rewritten in terms of this one. + Various older mechanisms removed or rewritten. + + * window.c (mark_window_as_deleted): + * window.c (Fdelete_window): + * window.c (Fset_window_configuration): + * insdel.c (prepare_to_modify_buffer): + * insdel.c (buffer_insert_string_1): + * console.c (create_console): + * buffer.c (finish_init_buffer): + * device.c (allocate_device): + * device.c (Fmake_device): + * frame.c: + * frame.c (Fmake_frame): + * frame.c (allocate_frame_core): + * frame.c (setup_normal_frame): + * frame.c (delete_frame_internal): + * window.c (Fsplit_window): + * device.c (delete_device_internal): + * console.c (delete_console_internal): + * buffer.c (Fkill_buffer): + When creating a display object, added call to + note_object_created(), for use with trapping_problems mechanism. + When deleting, call check_allowed_operation() and note_object + deleted(). + + The trapping-problems code records the objects created since the + call-trapping-problems began. Those objects can be deleted, but + none others (i.e. previously existing ones). + + * bytecode.c (execute_rare_opcode): + * cmdloop.c: + * cmdloop.c (initial_command_loop): + * cmdloop.c (Frecursive_edit): + * cmdloop.c (call_command_loop): + internal_catch takes another arg. + + * eval.c: + Add long comments describing the "five lists" used to maintain + state (backtrace, gcpro, specbind, etc.) in the Lisp engine. + + * backtrace.h: + * eval.c (current_warning_level): + * eval.c (call_debugger): + * eval.c (signal_call_debugger): + * eval.c (Fwhen): + * eval.c (Fcatch): + * eval.c (internal_catch): + * eval.c (unwind_to_catch): + * eval.c (throw_or_bomb_out): + * eval.c (condition_bind_unwind): + * eval.c (condition_case_1): + * eval.c (Fcall_with_condition_handler): + * eval.c (call_with_condition_handler): + * eval.c (Fsignal): + * eval.c (check_catchlist_sanity): + * eval.c (check_specbind_stack_sanity): + * eval.c (signal_quit): + * eval.c (Feval): + * eval.c (run_hook_list_with_args): + * eval.c (run_hook): + * eval.c (get_inhibit_flags): + * eval.c (check_allowed_operation): + * eval.c (note_object_created): + * eval.c (note_object_deleted): + * eval.c (struct call_trapping_problems): + * eval.c (flagged_a_squirmer): + * eval.c (call_trapping_problems_2): + * eval.c (call_trapping_problems_1): + * eval.c (call_trapping_problems): + * eval.c (struct va_call_trapping_problems): + * eval.c (va_call_trapping_problems_1): + * eval.c (va_call_trapping_problems): + * eval.c (call_with_suspended_errors): + * eval.c (struct calln_trapping_problems): + * eval.c (calln_trapping_problems_1): + * eval.c (calln_trapping_problems): + * eval.c (call1_trapping_problems): + * eval.c (call2_trapping_problems): + * eval.c (call3_trapping_problems): + * eval.c (call4_trapping_problems): + * eval.c (call5_trapping_problems): + * eval.c (eval_in_buffer_trapping_problems_1): + * eval.c (eval_in_buffer_trapping_problems): + * eval.c (run_hook_trapping_problems): + * eval.c (safe_run_hook_trapping_problems_1): + * eval.c (safe_run_hook_trapping_problems): + * eval.c (struct run_hook_with_args_in_buffer_trapping_problems): + * eval.c (run_hook_with_args_in_buffer_trapping_problems_1): + * eval.c (run_hook_with_args_in_buffer_trapping_problems): + * eval.c (va_run_hook_with_args_trapping_problems): + * eval.c (va_run_hook_with_args_in_buffer_trapping_problems): + * eval.c (reinit_vars_of_eval): + * eval.c (vars_of_eval): + Implement trapping-problems mechanism, eliminate old mechanisms or + redo in terms of new one. + + * frame.c (enter_redisplay_critical_section): + * frame.c (exit_redisplay_critical_section): + * gutter.c (redraw_exposed_gutters): + * gutter.c (Fset_default_gutter_position): + * gutter.c (Fredisplay_gutter_area): + Flush out the concept of "critical display section", defined by + the in_display() var. Use an internal_bind() to get it reset, + rather than just doing it at end, because there may be a non-local + exit. + + * event-msw.c (struct mswindows_protect_modal_loop): + * event-msw.c (mswindows_protect_modal_loop_1): + * event-msw.c (mswindows_protect_modal_loop): + * event-msw.c (mswindows_unmodalize_signal_maybe): + * event-msw.c (mswindows_pump_outstanding_events): + * event-msw.c (mswindows_need_event): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (mswindows_wnd_proc): + * event-msw.c: + * event-msw.c (vars_of_event_mswindows): + * event-msw.c (struct ntpipe_slurp_stream_shared_data): + * event-msw.c (struct ntpipe_shove_stream): + * event-stream.c (pre_command_hook): + * event-stream.c (post_command_hook): + * event-stream.c (vars_of_event_stream): + * event-stream.c (run_pre_idle_hook): + * console-msw.h: + * device.c (call_critical_lisp_code): Rewrite. + * dialog-msw.c (dialog_proc): + * frame.c (adjust_frame_size): + * frame.h: + * intl.c (init_intl): + * toolbar.c (Fset_default_toolbar_position): + * toolbar.c (update_toolbar_button): + * menubar-msw.c (unsafe_handle_wm_initmenu_1): + * menubar-msw.c (mswindows_handle_wm_initmenupopup): + * menubar-msw.c (mswindows_handle_wm_initmenu): + * redisplay.c: + * redisplay.c (call_redisplay_end_triggers): + * redisplay.c (redisplay_frame): + * redisplay.c (redisplay_no_pre_idle_hook): + * redisplay.c (eval_within_redisplay): + * redisplay.c (Fredisplay_echo_area): + * alloc.c (garbage_collect_1): + * menubar-x.c: + * menubar-x.c (menu_item_descriptor_to_widget_value_1): + * menubar-x.c (struct menu_item_descriptor_to_widget_value): + * menubar-x.c (protected_menu_item_descriptor_to_widget_value_1): + * menubar-x.c (protected_menu_item_descriptor_to_widget_value): + * menubar-x.c (pre_activate_callback): + Make use of new trapping-errors stuff and rewrite code based on + old mechanisms. + + * glyphs-widget.c (widget_query_geometry): + * glyphs-widget.c (layout_query_geometry): + * redisplay.h: + Protect calling Lisp in redisplay. + + * insdel.c (signal_first_change): + * insdel.c (signal_before_change): + * insdel.c (signal_after_change): + Protect hooks against deleting existing buffers. + + * frame-msw.c (mswindows_init_frame_1): + Use EQ, not EQUAL in hash tables whose keys are just numbers. + Otherwise we run into stickiness in redisplay because + internal_equal() can QUIT. + + ================================================================ + SIGNAL, C-G CHANGES + ================================================================ + + Here we change the way that C-g interacts with event reading. The + idea is that a C-g occurring while we're reading a user event + should be read as C-g, but elsewhere should be a QUIT. The former + code did all sorts of bizarreness -- requiring that no QUIT occurs + anywhere in event-reading code (impossible to enforce given the + stuff called or Lisp code invoked), and having some weird system + involving enqueue/dequeue of a C-g and interaction with Vquit_flag + -- and it didn't work. + + Now, we simply enclose all code where we want C-g read as an event + with {begin/end}_dont_check_for_quit(). This completely turns off + the mechanism that checks (and may remove or alter) C-g in the + read-ahead queues, so we just get the C-g normal. + + Signal.c documents this very carefully. + + * cmdloop.c (Fcommand_loop_1): + Correct use of dont_check_for_quit to new scheme, remove old + out-of-date comments. + + * event-stream.c (maybe_echo_keys): + * event-stream.c (enqueue_command_event_1): + * event-stream.c (next_event_internal): + * event-stream.c (Fnext_event): + * event-stream.c (Fnext_command_event): + * event-stream.c (Fdispatch_non_command_events): + * event-stream.c (Fdiscard_input): + * event-stream.c (Fsleep_for): + * event-stream.c (Fsit_for): + * event-stream.c (wait_delaying_user_input): + * event-stream.c (execute_internal_event): + * event-stream.c (lookup_command_event): + * event-stream.c (Fread_key_sequence): + * event-stream.c: + * event-stream.c (event_stream_next_event): + Fix C-g handling to actually work. + + * device-x.c (get_device_from_display): + * device-x.c (x_error_handler): + * device-x.c (x_IO_error_handler): + Disable quit checking when err out. + + * signal.c: + * signal.c (handle_async_timeout_signal): + * signal.c (check_what_happened): + * signal.c (begin_dont_check_for_quit): + * signal.c (check_quit): + Cleanup. Add large descriptive comment. + + * process-unix.c (unix_open_network_stream): + * process-unix.c (unix_open_multicast_group): + * process-nt.c (nt_open_network_stream): + * sysdep.c (retry_read_1): + * sysdep.c (retry_write_1): + Use QUIT instead of REALLY_QUIT. + It's not necessary to use REALLY_QUIT and just confuses the issue. + + * lisp.h (INTERNAL_QUITP): Comment quit handlers. + + ================================================================ + CONS CHANGES + ================================================================ + + free_cons() now takes a Lisp_Object not the result of XCONS(). + car and cdr have been renamed so that they don't get used directly; + go through XCAR(), XCDR() instead. + + * alloc.c (Fcons): + * alloc.c (free_cons): + * alloc.c (free_list): + * alloc.c (free_alist): + * dired.c (file_name_completion_unwind): + * dired.c (user_name_completion_unwind): + * editfns.c (save_excursion_save): + * editfns.c (save_excursion_restore): + * editfns.c (save_restriction_restore): + * emodules.c (module_load_unwind): + * fns.c: + * fns.c (delq_no_quit_and_free_cons): + * fns.c (merge_pred_function): + * fns.c (tweaked_internal_equal): + * glyphs-msw.c (extract_xpm_color_names): + * glyphs-x.c (extract_xpm_color_names): + * glyphs.c (image_instantiate_cache_result): + * glyphs.c (image_instance_changed): + * keymap.c (traverse_keymaps): + * minibuf.c (read_minibuffer_internal_unwind): + * search.c (free_created_dynarrs): + * eval.c (specbind_unwind_local): + * lread.c (various): + * lisp.h (struct Lisp_Cons): + * lisp.h (cons_car): + Correct free_cons calling convention: now takes Lisp_Object, + not Lisp_Cons + + * chartab.c (word_boundary_p): + Eliminate direct use of ->car, ->cdr, should be black box. + + + * callint.c (quotify_args): + Rewrote using EXTERNAL_LIST_LOOP to avoid use of Lisp_Cons. + + ================================================================ + USE INTERNAL-BIND-* + ================================================================ + + * eval.c (restore_lisp_object): + * eval.c (restore_int): + Cleanups of these funs. + + * alloc.c (begin_gc_forbidden): + * fileio.c: + * fileio.c (close_file_unwind): + * fileio.c (Fdo_auto_save): + * undo.c: + * undo.c (Fprimitive_undo): + * specifier.c: + * specifier.c (unlock_ghost_specifiers_protected): + * specifier.c (set_specifier_caching): + * text.c (dfc_convert_to_external_format): + * text.c (dfc_convert_to_internal_format): + * profile.c (struct get_profiling_info_closure): + * profile.c (Fget_profiling_info): + * lread.c: + * lread.c (load_unwind): + * lread.c (Fload_internal): + * lread.c (read0): + * lread.c (read1): + * lread.c (read_list_conser): + * lread.c (read_vector): + * lread.c (read_compiled_function): + * redisplay.c (Fredraw_frame): + * redisplay.c (Fredisplay_frame): + * redisplay.c (Fredraw_device): + * redisplay.c (Note): New. + * redisplay.c (Fredisplay_device): + * redisplay.c (redisplay_without_hooks): + * menubar-x.c (pre_activate_callback): + * macros.c (Fexecute_kbd_macro): + Rewrote to use internal_bind_int() and internal_bind_lisp_object() + in place of whatever varied and cumbersome mechanisms were + formerly there. + + + ================================================================ + SPECBIND SANITY + ================================================================ + + * backtrace.h: + - Improved comments + + * backtrace.h (SPECBIND): + * backtrace.h (SPECBIND_FAST_UNSAFE): + * backtrace.h (UNBIND_TO_GCPRO): + * backtrace.h (UNBIND_TO): + * backtrace.h (UNBIND_TO_GCPRO_VARIABLES_ONLY): + * bytecode.c (execute_optimized_program): + * eval.c (grow_specpdl): + * eval.c (specbind): + * eval.c (specbind_magic): + * eval.c (record_unwind_protect): + * eval.c (unbind_to_1): + * eval.c (unbind_to_hairy): + Add new mechanism check_specbind_stack_sanity() for sanity + checking code each time the catchlist or specbind stack change. + Removed older prototype of same mechanism. + + ================================================================ + MISC + ================================================================ + + * lisp.h: + * insdel.c: + * window.c: + * device.c: + * console.c: + * buffer.c: + Fleshed out authorship. + + * device-msw.c (mswindows_handle_page_setup_dialog_box): + Correct bad Unicode-ization. + + * print.c (debug_print_no_newline): + * print.c (debug_backtrace): + Be more careful when not initialized or in fatal error handling. + + * search.c (looking_at_1): + * search.c (string_match_1): + * search.c (search_buffer): + * search.c (Fstore_match_data): + Eliminate running_asynch_code, an FSF holdover. + + * alloc.c (vars_of_alloc): + * alloc.c: + Added comments about gc-cons-threshold. + + * dialog-x.c: + * dialog-x.c (dbox_descriptor_to_widget_value): + Use begin_gc_forbidden() around code to build up a widget value + tree, like in menubar-x.c. + + * gui.c (gui_item_id_hash): Use Qunbound not Qnil as the default for + gethash. + + * lisp-disunion.h: + * lisp-union.h: + Added warnings on use of VOID_TO_LISP(). + + * lisp.h: + Use ERROR_CHECK_STRUCTURES to turn on + ERROR_CHECK_TRAPPING_PROBLEMS and ERROR_CHECK_TYPECHECK + + * lisp.h (assert_with_message): + Add assert_with_message. + + * lisp.h (GCPRO1_ARRAY): + * lisp.h (NGCPRO1_ARRAY): + * lisp.h (NNGCPRO1_ARRAY): + Add macros for gcproing entire arrays. (You could do this before + but it required manual twiddling the gcpro structure.) + + * lisp.h: + Add prototypes for new functions defined elsewhere. + +2002-05-23 Ben Wing + + * Makefile.in.in (objs): + * Makefile.in.in (Emacs.ad.h): + * Makefile.in.in (alloca.o): Removed. + * Makefile.in.in (allocax.o): New. + Add alloca.o. Ensure that alloca.s doesn't compile into alloca.o, + but allocax.o (not that it's currently used or anything.) + + * EmacsFrame.c (Xt_StringToScrollBarPlacement): + * abbrev.c (abbrev_oblookup): + * alloc.c: + * alloc.c (allocate_lisp_storage): + * alloc.c (recompute_funcall_allocation_flag): + * alloc.c (recompute_need_to_garbage_collect): + * alloc.c (common_init_alloc_once_early): + * alloca.c: + * alloca.c (hdr): + * alloca.c (xemacs_c_alloca): + * callint.c (Fcall_interactively): + * callproc.c (Fold_call_process_internal): + * config.h.in: + * config.h.in (XEMACS_WANTS_C_ALLOCA): + * device-msw.c (msprinter_default_printer): + * device-msw.c (Fmswindows_printer_list): + * device-x.c (x_init_device): + * dired.c (Fdirectory_files): + * dired.c (file_name_completion_stat): + * doc.c (get_doc_string): + * editfns.c (Fformat_time_string): + * emacs.c (main_1): + * emodules.c (emodules_load): + * eval.c (Ffuncall): + * event-Xt.c (x_to_emacs_keysym): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (mswindows_wnd_proc): + * event-stream.c (Fnext_event): + * file-coding.c (setup_eol_coding_systems): + * fileio.c: + * fileio.c (Fdirectory_file_name): + * fileio.c (if): + * fileio.c (Fsubstitute_in_file_name): + * fileio.c (Fencrypt_string): + * fileio.c (Fdecrypt_string): + * filelock.c (MAKE_LOCK_NAME): + * filelock.c (lock_file_1): + * filelock.c (current_lock_owner): + * filelock.c (lock_file): + * fns.c (concat): + * fns.c (mapcar1): + * fns.c (Fbase64_encode_region): + * fns.c (Fbase64_encode_string): + * fns.c (Fbase64_decode_region): + * fns.c (Fbase64_decode_string): + * glyphs-gtk.c (gtk_xface_instantiate): + * glyphs-msw.c (mswindows_xface_instantiate): + * glyphs-msw.c (mswindows_widget_property): + * glyphs-msw.c (mswindows_combo_box_property): + * glyphs-x.c (x_xface_instantiate): + * gui-x.c (add_accel_and_to_external): + * input-method-xlib.c (EmacsXtCvtStringToXIMStyles): + * intl-win32.c (Fmswindows_get_valid_keyboard_layouts): + * lisp.h: + * lisp.h (alloca_new): + * lisp.h (NOTE): New. + * lisp.h (MAX_STRING_ASCII_BEGIN): + * lread.c (Fload_internal): + * lread.c (locate_file_map_suffixes): + * menubar-gtk.c (menu_descriptor_to_widget_1): + * menubar-msw.c (mswindows_translate_menu_or_dialog_item): + * menubar.c (Fnormalize_menu_item_name): + * mule-wnnfns.c (Fwnn_open): + * nt.c (init_mswindows_environment): + * objects-msw.c (mswindows_string_to_color): + * objects-msw.c (mswindows_font_instance_truename): + * process-nt.c (nt_create_process): + * realpath.c (cygwin_readlink_and_correct_case): + * redisplay-gtk.c: + * redisplay-gtk.c (gtk_text_width): + * redisplay-gtk.c (gtk_output_string): + * redisplay-output.c: + * redisplay-output.c (compare_runes_2): + * redisplay-x.c: + * redisplay-x.c (x_text_width): + * redisplay-x.c (x_output_string): + * redisplay.c (generate_displayable_area): + * redisplay.c (regenerate_window): + * search.c (wordify): + * search.c (Fregexp_quote): + * select-msw.c (mswindows_own_selection): + * sysdep.c (sys_subshell): + * sysdep.c (init_system_name): + * syswindows.h (LOCAL_TO_WIN32_FILE_FORMAT): + * syswindows.h (WIN32_TO_LOCAL_FILE_FORMAT): + * text.c (convert_emchar_string_into_malloced_string): + * text.h: + * text.h (EI_ALLOC): + * text.h (eito_alloca): + * text.h (EI_CASECHANGE): + * text.h (DFC_ALLOCA_USE_CONVERTED_DATA): + * text.h (DFC_C_STRING_ALLOCA_USE_CONVERTED_DATA): + * text.h (GET_STRERROR): + * ui-byhand.c (Fgtk_curve_get_vector): + * ui-byhand.c (Fgtk_curve_set_vector): + + Fix Raymond Toy's crash. Repeat to self: 2^21 - 1 is NOT the + same as (2 << 21) - 1. + + Fix crashes due to excessive alloca(). replace alloca() with + ALLOCA(), which calls the C alloca() [which uses xmalloc()] + when the size is too big. Insert in various places calls to + try to flush the C alloca() stored info if there is any. + + Add MALLOC_OR_ALLOCA(), for places that expect to be alloca()ing + large blocks. This xmalloc()s when too large and records an + unwind-protect to free -- relying on the caller to unbind_to() + elsewhere in the function. Use it in concat(). + + Use MALLOC instead of ALLOCA in select-msw.c. + +2002-05-21 Jonathan Harris + + * device-msw.c (mswindows_handle_page_setup_dialog_box): + Fix detection of metric units to work on Win95 + +2002-05-17 Stephen J. Turnbull + + * eldap.c (print_ldap): swap arguments of write_c_string. + +2002-05-16 Ben Wing + + * bytecode.c (execute_rare_opcode): + * editfns.c: + * editfns.c (save_restriction_save): + * editfns.c (save_restriction_restore): + * editfns.c (Fsave_restriction): + * lisp.h: + * lread.c (Feval_region): + Fix save-restriction to use markers rather than pseudo-markers + (integers representing the amount of text on either side of the + region). That way, all inserts are handled correctly, not just + those inside old restriction. + + Add buffer argument to save_restriction_save(). + + * process.c: + * process.c (process_setup_for_insertion): + * process.c (read_process_output): + * process.c (status_notify): + Clean up very dirty and kludgy code that outputs into a buffer -- + use proper unwind protects, etc. + + * font-lock.c (find_context): + Do save-restriction/widen around the function -- otherwise, incorrect + results will ensue when a buffer has been narrowed before a call to + e.g. `buffer-syntactic-context' -- something that happens quite often. + + * fileio.c: + * fileio.c (Fmake_temp_name): + * fileio.c (syms_of_fileio): + Look for a handler for make-temp-name. + + * window.c: + * window.c (allocate_window): + * window.c (Fset_window_point): + * window.c (unshow_buffer): + * window.c (Fset_window_buffer): + * window.c (make_dummy_parent): + * winslots.h: + Try to solve this annoying problem: have two frames displaying the + buffer, in different places; in one, temporarily switch away to + another buffer and then back -- and you've lost your position; + it's reset to the other one in the other frame. My current + solution involves window-level caches of buffers and points (also + a cache for window-start); when set-window-buffer is called, it + looks to see if the buffer was previously visited in the window, + and if so, uses the most recent point at that time. (It's a + marker, so it handles changes.) + + #### Note: It could be argued that doing it on the frame level + would be better -- e.g. if you visit a buffer temporarily through + a grep, and then go back to that buffer, you presumably want the + grep's position rather than some previous position provided + everything was in the same frame, even though the grep was in + another window in the frame. However, doing it on the frame level + fails when you have two windows on the same frame. Perhaps we + keep both a window and a frame cache, and use the frame cache if + there are no other windows on the frame showing the buffer, else + the window's cache? This is probably something to be configurable + using a specifier. Suggestions please please please? + + * window.c (window_scroll): + * window.c (Fmove_to_window_line): + Clean up a bit code that deals with the annoyance of window-point + vs. point. + +2002-05-16 Stephen J. Turnbull + + * select.c (Fown_selection_internal): + * select.c (Fget_selection_internal): + Revert Jerry James's 2002-04-23 patch. + +2002-05-14 Ben Wing + + * font-lock.c (find_context): + Don't use off the beginning position to initiate syntax cache. + +2002-05-14 Ben Wing + + * text.c (copy_buffer_text_out): Fix bug leading to crashes + with multibyte text. + * win32.c (Fmswindows_shell_execute): Fix crash due to errant + xfree(). + +2002-05-14 Ben Wing + + * callproc.c (Fold_call_process_internal): + Use Fget_buffer_create() with a string buffer, as documented. + + * extents.c (signal_extent_changed): indentation. + + * lstream.c (lisp_buffer_reader): fix a bug in selective-display + handling; not the crash we're seeing. + + * marker.c: + * marker.c (byte_marker_position): + * marker.c (set_byte_marker_position): + delete superfluous error-checking -- it's already there in + bytebpos_to_membpos() and vice-versa. + +2002-05-13 Ben Wing + + * config.h.in: + * font-lock.c: + Reenable font-lock code since it's used by mouse.el. The flag for + this exists in config.h.in but not currently controllable through + configure. + +2002-05-13 Adrian Aichner + + * callproc.c: Process-related docstring improvements spurred by + Norbert Koch. + +2002-05-09 Ben Wing + + * doprnt.c (emacs_doprnt_1): + Use make_int() not make_char() when error about bad charval, + or abort will occur. + + * extents.c (signal_extent_changed): + Loop over children, not ourself -- avoid infinite loop. + + * lisp-disunion.h: + * lisp-union.h: + Rename make_char() to make_char_1 for error-checking purposes. + + * lread.c (read_escape): + Syntax error if escape is outside of ISO-8859-1 range. + Remove hopelessly broken (and unworkable) FSF_KEYS code. + + * mule-coding.c (Fdecode_shift_jis_char): + * search.c (skip_chars): + Spacing changes. + + * text.h: + New make_char() -- verify that the char value is legal. + +2002-04-23 Jerry James + + * select.c (Fown_selection_internal): Document connection with + interprogram-cut-function. + * select.c (Fget_selection_internal): return Qnil if XEmacs owns + the selection and it does not need coercion. + Document connection with interprogram-paste-function. + +2002-05-06 Jonathan Harris + + * console-msw.h: + * event-msw.c (mswindows_wnd_proc): + Condition references to menu accelerator functions on HAVE_MENUBARS. + + * frame-msw.c (mswindows_init_frame_3): + Remove obsolete runemacs hack which called ShowWindow() twice. + + * intl-auto-encap-win32.c: + * intl-auto-encap-win32.h: + * intl-encap-win32.c: + Use handwritten version of GetEnvironmentStrings() in + intl-encap-win32.c. + + * ntproc.c: Removed. + + * s/windowsnt.h: + Disable .data section renaming hack when using portable dumping. + Force _WIN32_WINNT = 0x0400 since intl-auto-encap-win32.[ch] + requires this. + +2002-05-05 Ben Wing + + * Makefile.in.in (batch_test_emacs): + + Fix so that packages are around when testing. + + * abbrev.c (struct abbrev_match_mapper_closure): + * abbrev.c (abbrev_match_mapper): + * abbrev.c (abbrev_match): + * abbrev.c (Fexpand_abbrev): + * alloc.c (deadbeef_memory): + * alloc.c (STRING_FULLSIZE): + * alloc.c (sledgehammer_check_ascii_begin): + * alloc.c (make_uninit_string): + * alloc.c (set_string_char): + * alloc.c (init_string_ascii_begin): + * alloc.c (make_string_nocopy): + * alloc.c (compact_string_chars): + * alloc.c (debug_string_purity_print): + * buffer.c (mark_buffer): + * buffer.c (print_buffer): + * buffer.c (finish_init_buffer): + * buffer.c (Fother_buffer): + * buffer.c (Fkill_buffer): + * buffer.h: + * buffer.h (struct buffer_text): + * buffer.h (struct buffer): + * buffer.h (BYTE_BUF_BEG): + * buffer.h (BYTE_BUF_BEGV): + * buffer.h (BYTE_BUF_ZV): + * buffer.h (BYTE_BUF_Z): + * buffer.h (BYTE_BUF_PT): + * buffer.h (INC_BYTEBPOS): + * buffer.h (make_charbpos): + * buffer.h (BYTE_BUF_FETCH_CHAR_RAW): + * buffer.h (BYTE_BUF_CHARPTR_COPY_EMCHAR): + * buffer.h (SET_BOTH_BUF_BEGV): + * buffer.h (SET_BOTH_BUF_ZV): + * buffer.h (BOTH_BUF_SET_PT): + * buffer.h (BUF_NARROWED): + * buffer.h (BYTE_BUF_CEILING_OF_IGNORE_ACCESSIBLE): + * buffer.h (BYTE_BUF_FLOOR_OF_IGNORE_ACCESSIBLE): + * bytecode.c (optimize_compiled_function): + * bytecode.c (print_compiled_function): + * bytecode.c (Fcompiled_function_annotation): + * callint.c (Fcall_interactively): + * casefiddle.c: + * casefiddle.c (casify_object): + * casefiddle.c (casify_region_internal): + * casetab.c: + * casetab.c (STRING256_P): + * casetab.c (print_case_table): + * casetab.c (allocate_case_table): + * casetab.c (Fmake_case_table): + * casetab.c (case_table_char): + * casetab.c (Fget_case_table): + * casetab.c (Fput_case_table): + * casetab.c (Fput_case_table_pair): + * casetab.c (Fcopy_case_table): + * casetab.c (compute_canon_mapper): + * casetab.c (compute_up_or_eqv_mapper): + * casetab.c (recompute_case_table): + * casetab.c (convert_old_style_syntax_string): + * casetab.c (set_case_table): + * casetab.c (Fset_standard_case_table): + * casetab.c (syms_of_casetab): + * casetab.c (complex_vars_of_casetab): + * casetab.h: + * casetab.h (struct Lisp_Case_Table): + * charset.h: + * charset.h (emchar_charset): + * charset.h (leading_byte_private_p): + * charset.h (private_leading_byte_prefix): + * charset.h (CHARSET_PRIVATE_P): + * charset.h (EMCHAR_FIELD1_MASK): + * charset.h (emchar_field1): + * charset.h (MIN_EMCHAR_FIELD2_OFFICIAL): + * charset.h (MIN_EMCHAR_FIELD1_OFFICIAL): + * charset.h (MIN_EMCHAR_FIELD2_PRIVATE): + * charset.h (MIN_EMCHAR_FIELD1_PRIVATE): + * charset.h (MIN_CHAR_OFFICIAL_TYPE9N): + * charset.h (BREAKUP_EMCHAR_1_UNSAFE): + * charset.h (BREAKUP_EMCHAR): + * chartab.c: + * chartab.c (char_table_entry_hash): + * chartab.c (decode_char_table_range): + * chartab.c (encode_char_table_range): + * chartab.c (struct ptemap): + * chartab.c (print_table_entry): + * chartab.c (print_char_table): + * chartab.c (char_table_equal): + * chartab.c (char_table_hash): + * chartab.c (set_char_table_default): + * chartab.c (fill_char_table): + * chartab.c (Freset_char_table): + * chartab.c (Fmake_char_table): + * chartab.c (get_non_ascii_char_table_value): + * chartab.c (Fchar_table_default): + * chartab.c (Fget_char_table): + * chartab.c (copy_mapper): + * chartab.c (copy_char_table_range): + * chartab.c (get_range_char_table): + * chartab.c (Fget_range_char_table): + * chartab.c (put_char_table): + * chartab.c (Fput_char_table): + * chartab.c (Fremove_char_table): + * chartab.c (map_over_charset_ascii_1): + * chartab.c (map_over_charset_control_1): + * chartab.c (map_over_charset_row): + * chartab.c (map_over_other_charset): + * chartab.c (map_char_table): + * chartab.c (slow_map_char_table_fun): + * chartab.c (Fmap_char_table): + * chartab.c (check_category_char): + * chartab.c (CATEGORY_SET): + * chartab.c (word_boundary_p): + * chartab.c (syms_of_chartab): + * chartab.h: + * chartab.h (struct Lisp_Char_Table): + * cmds.c: + * cmds.c (internal_self_insert): + * console-msw.h: + * console-stream.c (stream_clear_region): + * console-stream.c (stream_ring_bell): + * console-x.c (x_semi_canonicalize_console_connection): + * console.c (find_nonminibuffer_frame_not_on_console_predicate): + * console.h: + * data.c (eq_with_ebola_notice): + * data.c (Faref): + * data.c (Faset): + * device-msw.c (print_devmode): + * device.c (find_nonminibuffer_frame_not_on_device_predicate): + * device.h: + * device.h (struct pixel_to_glyph_translation_cache): + * dialog-msw.c (dialog_proc): + * dialog-x.c (maybe_run_dbox_text_callback): + * dired-msw.c: + * dired-msw.c (mswindows_get_files): + * dired.c: + * dired.c (Fdirectory_files): + * dired.c (file_name_completion): + * dired.c (user_name_completion): + * doc.c (unparesseuxify_doc_string): + * doprnt.c (emacs_doprnt_1): + * dumper.c: + * dumper.c (PDUMP_READ_ALIGNED): + * dumper.c (pdump_structure_size): + * dumper.c (pdump): + * dumper.c (pdump_load_finish): + * editfns.c: + * editfns.c (Fstring_to_char): + * editfns.c (Ftranslate_region): + * editfns.c (Fdelete_region): + * editfns.c (widen_buffer): + * editfns.c (Fnarrow_to_region): + * editfns.c (save_restriction_restore): + * elhash.c (print_hash_table_data): + * elhash.c (print_hash_table): + * elhash.c (Finternal_hash_value): + * emacs.c: + * emacs.c (main_1): + * emacs.c (standard_args): + * eval.c (print_subr): + * eval.c (Fuser_variable_p): + * eval.c (backtrace_specials): + * eval.c (Fbacktrace): + * event-Xt.c (USE_CHARSET): + * event-Xt.c (x_keysym_to_character): + * event-Xt.c (emacs_Xt_format_magic_event): + * event-gtk.c (emacs_gtk_format_magic_event): + * event-msw.c (mswindows_wnd_proc): + * event-msw.c (mswindows_find_frame): + * event-msw.c (FROB): + * event-msw.c (emacs_mswindows_format_magic_event): + * event-stream.c (external_debugging_print_event): + * event-stream.c (command_builder_find_leaf): + * event-stream.c (dribble_out_event): + * events.c (print_event_1): + * events.c (print_event): + * events.c (nth_of_key_sequence_as_event): + * events.c (Fevent_next): + * events.c (Fset_event_next): + * events.h: + * extents.c: + * extents.c (stack_of_extents): + * extents.c (memxpos_to_startind): + * extents.c (buffer_or_string_bytexpos_to_startind): + * extents.c (buffer_or_string_bytexpos_to_endind): + * extents.c (gap_array_adjust_markers): + * extents.c (gap_array_move_gap): + * extents.c (extent_list_locate_from_pos): + * extents.c (extent_list_at): + * extents.c (soe_dump): + * extents.c (soe_move): + * extents.c (extent_endpoint_byte): + * extents.c (extent_endpoint_char): + * extents.c (signal_single_extent_changed): + * extents.c (signal_extent_changed): + * extents.c (signal_extent_property_changed): + * extents.c (extent_attach): + * extents.c (extent_detach): + * extents.c (extent_in_region_p): + * extents.c (map_extents): + * extents.c (adjust_extents): + * extents.c (adjust_extents_for_deletion): + * extents.c (extent_find_end_of_run): + * extents.c (extent_find_beginning_of_run): + * extents.c (extent_fragment_update): + * extents.c (print_extent_1): + * extents.c (print_extent): + * extents.c (extent_remprop): + * extents.c (extent_endpoint_external): + * extents.c (Fextent_length): + * extents.c (Fnext_extent_change): + * extents.c (Fprevious_extent_change): + * extents.c (Fset_extent_parent): + * extents.c (set_extent_endpoints_1): + * extents.c (set_extent_endpoints): + * extents.c (set_extent_openness): + * extents.c (make_extent): + * extents.c (Fmake_extent): + * extents.c (Fset_extent_endpoints): + * extents.c (Fextent_in_region_p): + * extents.c (Fmap_extents): + * extents.c (struct slow_map_extent_children_arg): + * extents.c (slow_map_extent_children_function): + * extents.c (Fmap_extent_children): + * extents.c (struct extent_at_arg): + * extents.c (decode_extent_at_flag): + * extents.c (extent_at): + * extents.c (Fextent_at): + * extents.c (Fextents_at): + * extents.c (struct verify_extents_arg): + * extents.c (verify_extent_modification): + * extents.c (struct process_extents_for_insertion_arg): + * extents.c (process_extents_for_insertion_mapper): + * extents.c (process_extents_for_insertion): + * extents.c (struct process_extents_for_deletion_arg): + * extents.c (process_extents_for_deletion): + * extents.c (report_extent_modification_mapper): + * extents.c (report_extent_modification): + * extents.c (set_extent_invisible): + * extents.c (Fset_extent_face): + * extents.c (Fset_extent_mouse_face): + * extents.c (set_extent_glyph): + * extents.c (Fset_extent_begin_glyph_layout): + * extents.c (Fset_extent_end_glyph_layout): + * extents.c (Fset_extent_priority): + * extents.c (Fset_extent_property): + * extents.c (extent_properties): + * extents.c (ADD_PROP): + * extents.c (Fextent_properties): + * extents.c (do_highlight): + * extents.c (run_extent_copy_paste_internal): + * extents.c (run_extent_copy_function): + * extents.c (run_extent_paste_function): + * extents.c (run_extent_paste_function_char): + * extents.c (insert_extent): + * extents.c (struct add_string_extents_arg): + * extents.c (add_string_extents_mapper): + * extents.c (struct add_string_extents_the_hard_way_arg): + * extents.c (add_string_extents_the_hard_way_mapper): + * extents.c (add_string_extents): + * extents.c (struct splice_in_string_extents_arg): + * extents.c (splice_in_string_extents_mapper): + * extents.c (struct splice_in_string_extents_the_hard_way_arg): + * extents.c (splice_in_string_extents_the_hard_way_mapper): + * extents.c (splice_in_string_extents): + * extents.c (copy_string_extents_mapper): + * extents.c (copy_string_extents): + * extents.c (get_char_property): + * extents.c (get_char_property_char): + * extents.c (Fget_text_property): + * extents.c (Fget_char_property): + * extents.c (struct put_text_prop_arg): + * extents.c (put_text_prop_mapper): + * extents.c (put_text_prop_openness_mapper): + * extents.c (put_text_prop): + * extents.c (Fput_text_property): + * extents.c (Fadd_text_properties): + * extents.c (Fremove_text_properties): + * extents.c (next_single_property_change): + * extents.c (previous_single_property_change): + * extents.h: + * extents.h (struct extent): + * faces.c (print_face): + * faces.c (update_face_inheritance_mapper): + * faces.c (ensure_face_cachel_complete): + * faces.c (face_cachel_charset_font_metric_info): + * file-coding.c (print_coding_system): + * file-coding.c (print_coding_system_in_print_method): + * file-coding.c (chain_print): + * file-coding.c (no_conversion_convert): + * file-coding.c (undecided_print): + * file-coding.c (gzip_print): + * file-coding.h (DECLARE_CODING_SYSTEM_TYPE): + * file-coding.h (DECODE_ADD_BINARY_CHAR): + * fileio.c (Ffile_truename): + * fileio.c (expand_and_dir_to_file): + * fns.c (print_bit_vector): + * fns.c (Flength): + * fns.c (Fstring_lessp): + * fns.c (Fsplit_path): + * fns.c (Ffillarray): + * fns.c (Fbase64_encode_string): + * fns.c (Fbase64_decode_string): + * font-lock.c: + * font-lock.c (find_context): + * frame-gtk.c (gtk_set_frame_text_value): + * frame-msw.c (mswindows_get_mouse_position): + * frame-msw.c (mswindows_get_frame_parent): + * frame-x.c: + * frame-x.c (x_set_frame_text_value): + * frame.c: + * frame.c (allocate_frame_core): + * frame.c (Fignore_event): + * frame.h: + * glade.c (connector): + * glyphs-gtk.c: + * glyphs-gtk.c (convert_EImage_to_GDKImage): + * glyphs-gtk.c (gtk_print_image_instance): + * glyphs-gtk.c (gtk_locate_pixmap_file): + * glyphs-msw.c (mswindows_locate_pixmap_file): + * glyphs-msw.c (mswindows_print_image_instance): + * glyphs-msw.c (charset_of_text): + * glyphs-msw.h: + * glyphs-x.c (LISP_DEVICE_TO_X_SCREEN): + * glyphs-x.c (convert_EImage_to_XImage): + * glyphs-x.c (x_print_image_instance): + * glyphs-x.c (x_locate_pixmap_file): + * glyphs.c (check_instance_cache_mapper): + * glyphs.c (print_image_instance): + * glyphs.c (query_string_font): + * glyphs.c (check_valid_xbm_inline): + * glyphs.c (display_table_entry): + * glyphs.h: + * gui-msw.c (mswindows_handle_gui_wm_command): + * gui-x.c (mark_widget_value_mapper): + * gui-x.c (popup_selection_callback): + * gui.h: + * gutter.h (GUTTER_POS_LOOP): + * hash.h: + * indent.c: + * indent.c (column_at_point): + * indent.c (string_column_at_point): + * indent.c (byte_spaces_at_point): + * indent.c (Fcurrent_indentation): + * indent.c (Fmove_to_column): + * insdel.c (BYTE_BUF_GPT): + * insdel.c (SET_BYTE_BUF_GPT): + * insdel.c (SET_END_SENTINEL): + * insdel.c (set_buffer_point): + * insdel.c (gap_left): + * insdel.c (gap_right): + * insdel.c (move_gap): + * insdel.c (merge_gap_with_end_gap): + * insdel.c (make_gap): + * insdel.c (signal_before_change): + * insdel.c (signal_after_change): + * insdel.c (buffer_insert_string_1): + * insdel.c (buffer_delete_range): + * insdel.c (buffer_replace_char): + * insdel.c (make_string_from_buffer_1): + * insdel.c (init_buffer_text): + * intl-win32.c: + * intl-win32.c (Fmswindows_get_valid_code_pages): + * intl-win32.c (Fmswindows_get_console_code_page): + * intl-win32.c (Fmswindows_set_console_code_page): + * intl-win32.c (Fmswindows_get_console_output_code_page): + * intl-win32.c (Fmswindows_set_console_output_code_page): + * intl-win32.c (Fmswindows_get_code_page_charset): + * intl-win32.c (Fmswindows_get_valid_keyboard_layouts): + * intl-win32.c (Fmswindows_get_keyboard_layout): + * intl-win32.c (Fmswindows_set_keyboard_layout): + * intl-win32.c (mswindows_multibyte_to_unicode_print): + * intl.c: + * intl.c (Fignore_defer_gettext): + * keymap.c (print_keymap): + * keymap.c (keymap_lookup_directly): + * keymap.c (keymap_store): + * keymap.c (define_key_check_and_coerce_keysym): + * keymap.c (Fdefine_key): + * keymap.c (Flookup_key): + * keymap.c (map_keymap_mapper): + * keymap.c (Fkey_description): + * lisp-disunion.h: + * lisp-disunion.h (VALMASK): + * lisp-disunion.h (VOID_TO_LISP): + * lisp-union.h: + * lisp-union.h (union Lisp_Object): + * lisp-union.h (XPNTRVAL): + * lisp-union.h (XREALINT): + * lisp-union.h (INTP): + * lisp.h: + * lisp.h (DECLARE_POINTER_TYPE_ARITH_COUNT): + * lisp.h (MAX_ALIGN_SIZE): + * lisp.h (struct Lisp_String): + * lisp.h (set_lispstringp_length): + * lisp.h (XSET_STRING_LENGTH): + * lisp.h (FLEXIBLE_ARRAY_STRUCT_SIZEOF): + * lisp.h (SYMBOL_IS_KEYWORD): + * lread.c: + * lrecord.h: + * lrecord.h (DECLARE_LRECORD): + * lrecord.h (DECLARE_EXTERNAL_LRECORD): + * lrecord.h (DECLARE_NONRECORD): + * lstream.c (aligned_sizeof_lstream): + * lstream.c (Lstream_really_write): + * lstream.c (make_lisp_buffer_stream_1): + * lstream.c (make_lisp_buffer_input_stream): + * lstream.c (lisp_buffer_reader): + * lstream.c (lisp_buffer_writer): + * lstream.h: + * marker.c (print_marker): + * marker.c (byte_marker_position): + * marker.c (marker_position): + * marker.c (set_byte_marker_position): + * marker.c (set_marker_position): + * marker.c (Fbuffer_has_markers_at): + * menubar-gtk.c (__torn_off_sir): + * menubar-gtk.c (__activate_menu): + * menubar-gtk.c (__generic_button_callback): + * menubar-msw.c: + * menubar-x.c (pre_activate_callback): + * menubar-x.c (command_builder_operate_menu_accelerator): + * menubar-x.c (command_builder_find_menu_accelerator): + * menubar.c: + * menubar.c (Fnormalize_menu_item_name): + * minibuf.c: + * minibuf.c (Ftry_completion): + * minibuf.c (Fall_completions): + * minibuf.c (Fminibuffer_prompt): + * minibuf.c (Fminibuffer_prompt_width): + * minibuf.c (echo_area_append): + * mule-ccl.c: + * mule-ccl.c (CCL_WRITE_CHAR): + * mule-ccl.c (CCL_WRITE_STRING): + * mule-ccl.c (CCL_MAKE_CHAR): + * mule-ccl.c (ccl_driver): + * mule-charset.c (Fmake_charset): + * mule-charset.c (Fcharset_from_attributes): + * mule-coding.c (byte_shift_jis_two_byte_1_p): + * mule-coding.c (byte_shift_jis_two_byte_2_p): + * mule-coding.c (byte_shift_jis_katakana_p): + * mule-coding.c (shift_jis_convert): + * mule-coding.c (Fdecode_shift_jis_char): + * mule-coding.c (Fencode_shift_jis_char): + * mule-coding.c (byte_big5_two_byte_1_p): + * mule-coding.c (byte_big5_two_byte_2_p): + * mule-coding.c (big5_convert): + * mule-coding.c (decode_big5_char): + * mule-coding.c (Fencode_big5_char): + * mule-coding.c (charset_by_attributes_or_create_one): + * mule-coding.c (iso2022_decode): + * mule-coding.c (iso2022_encode): + * mule-coding.c (iso2022_print): + * mule-coding.c (iso2022_detect): + * mule-wnnfns.c (m2w): + * nas.c: + * objects-msw.c (mswindows_string_to_color): + * objects-msw.c (mswindows_font_spec_matches_charset): + * objects-x.c (x_font_instance_properties): + * opaque.c (aligned_sizeof_opaque): + * postgresql.c (print_pgconn): + * postgresql.c (print_pgresult): + * print.c: + * print.c (output_string): + * print.c (write_string_1): + * print.c (write_string): + * print.c (write_c_string): + * print.c (write_eistring): + * print.c (write_fmt_string): + * print.c (write_fmt_string_lisp): + * print.c (stderr_out_lisp): + * print.c (Fterpri): + * print.c (Fprint): + * print.c (print_error_message): + * print.c (print_vector_internal): + * print.c (print_cons): + * print.c (print_string): + * print.c (print_internal): + * print.c (print_float): + * print.c (print_symbol): + * process-nt.c (nt_create_process): + * process-unix.c (close_process_descs_mapfun): + * process.c (print_process): + * process.c (get_process_from_usid): + * process.c (Fstart_process_internal): + * process.c (status_message): + * process.c (status_notify): + * process.c (Fprocess_connection): + * process.c (getenv_internal): + * process.c (putenv_internal): + * process.h: + * profile.c (get_profiling_info_maphash): + * profile.c (mark_profiling_info_maphash): + * rangetab.c (print_range_table): + * rangetab.c (unified_range_table_copy_data): + * rangetab.c (align_the_damn_table): + * redisplay-gtk.c: + * redisplay-gtk.c (separate_textual_runs): + * redisplay-gtk.c (gtk_output_display_block): + * redisplay-msw.c (separate_textual_runs): + * redisplay-msw.c (mswindows_output_display_block): + * redisplay-output.c: + * redisplay-output.c (ADJ_CHARPOS): + * redisplay-output.c (redisplay_move_cursor): + * redisplay-output.c (redisplay_update_line): + * redisplay-x.c (separate_textual_runs): + * redisplay-x.c (x_output_display_block): + * redisplay.c: + * redisplay.c (position_redisplay_data_type): + * redisplay.c (struct prop_block): + * redisplay.c (generate_display_line): + * redisplay.c (add_hscroll_rune): + * redisplay.c (add_emchar_rune_1): + * redisplay.c (add_blank_rune): + * redisplay.c (add_octal_runes): + * redisplay.c (add_control_char_runes): + * redisplay.c (add_disp_table_entry_runes_1): + * redisplay.c (add_propagation_runes): + * redisplay.c (add_glyph_rune): + * redisplay.c (create_text_block): + * redisplay.c (add_margin_blank): + * redisplay.c (generate_modeline): + * redisplay.c (generate_fstring_runes): + * redisplay.c (create_string_text_block): + * redisplay.c (generate_string_display_line): + * redisplay.c (generate_displayable_area): + * redisplay.c (REGEN_INC_FIND_START_END): + * redisplay.c (regenerate_window_extents_only_changed): + * redisplay.c (regenerate_window_incrementally): + * redisplay.c (point_visible): + * redisplay.c (point_at_center): + * redisplay.c (update_internal_cache_list): + * redisplay.c (UPDATE_CACHE_RETURN): + * redisplay.c (pixel_to_glyph_translation): + * redisplay.h: + * redisplay.h (struct rune): + * redisplay.h (struct display_line): + * redisplay.h (struct extent_fragment): + * regex.c: + * regex.c (RE_TRANSLATE_1): + * regex.c (charptr_emchar): + * regex.c (INC_CHARPTR_FMT): + * regex.c (SYNTAX): + * regex.c (EXTEND_BUFFER): + * regex.c (regex_compile): + * regex.c (compile_range): + * regex.c (compile_extended_range): + * regex.c (re_compile_fastmap): + * regex.c (re_search): + * regex.c (re_search_2): + * regex.c (REGEX_PREFETCH): + * regex.c (WORDCHAR_P): + * regex.c (re_match): + * regex.c (re_match_2): + * regex.c (re_match_2_internal): + * regex.c (re_compile_pattern): + * regex.c (re_comp): + * regex.c (make-backup-files): Removed. + * regex.c (version-control): Removed. + * regex.c (trim-versions-without-asking): Removed. + * regex.c (End): Removed. + * regex.h: + * regex.h (RE_LISP_SHORT_CONTEXT_ARGS_DECL): + * scrollbar-msw.c (mswindows_free_scrollbar_instance): + * scrollbar-msw.c (mswindows_handle_scrollbar_event): + * scrollbar-msw.c (mswindows_handle_mousewheel_event): + * search.c: + * search.c (matcher_overflow): + * search.c (compile_pattern_1): + * search.c (compile_pattern): + * search.c (fixup_search_regs_for_buffer): + * search.c (looking_at_1): + * search.c (Fposix_looking_at): + * search.c (string_match_1): + * search.c (fast_string_match): + * search.c (byte_scan_buffer): + * search.c (scan_buffer): + * search.c (byte_find_next_newline_no_quit): + * search.c (byte_find_next_emchar_in_string): + * search.c (find_before_next_newline): + * search.c (skip_chars): + * search.c (search_command): + * search.c (trivial_regexp_p): + * search.c (search_buffer): + * search.c (simple_search): + * search.c (boyer_moore): + * search.c (set_search_regs): + * search.c (wordify): + * search.c (Freplace_match): + * search.c (match_limit): + * search.c (Fmatch_data): + * search.c (Fstore_match_data): + * select-x.c (hack_motif_clipboard_selection): + * select-x.c (Fx_store_cutbuffer_internal): + * specifier.c (print_specifier): + * specifier.c (aligned_sizeof_specifier): + * specifier.c (recompute_cached_specifier_everywhere_mapfun): + * specifier.h: + * specifier.h (DECLARE_SPECIFIER_TYPE): + * symbols.c (Fintern): + * symsinit.h: + * syntax.c: + * syntax.c (struct lisp_parse_state): + * syntax.c (find_defun_start): + * syntax.c (Fset_syntax_table): + * syntax.c (init_syntax_cache): + * syntax.c (update_syntax_cache): + * syntax.c (Fchar_syntax): + * syntax.c (charset_syntax): + * syntax.c (syntax_match): + * syntax.c (Fmatching_paren): + * syntax.c (WORD_BOUNDARY_P): + * syntax.c (scan_words): + * syntax.c (find_start_of_comment): + * syntax.c (find_end_of_comment): + * syntax.c (Fforward_comment): + * syntax.c (scan_lists): + * syntax.c (char_quoted): + * syntax.c (Fbackward_prefix_chars): + * syntax.c (scan_sexps_forward): + * syntax.c (Fparse_partial_sexp): + * syntax.c (copy_to_mirrortab): + * syntax.c (copy_if_not_already_present): + * syntax.c (update_just_this_syntax_table): + * syntax.c (update_syntax_table): + * syntax.c (syms_of_syntax): + * syntax.c (vars_of_syntax): + * syntax.c (complex_vars_of_syntax): + * syntax.h: + * syntax.h (SYNTAX_CODE): + * syntax.h (SYNTAX_FROM_CODE): + * syntax.h (SYNTAX_PREFIX): + * syntax.h (struct syntax_cache): + * syswindows.h: + * tests.c (Ftest_data_format_conversion): + * text.c: + * text.c (convert_emchar_string_into_malloced_string): + * text.c (COPY_TEXT_BETWEEN_FORMATS): + * text.c (copy_buffer_text_out): + * text.c (find_charsets_in_intbyte_string): + * text.c (find_charsets_in_emchar_string): + * text.c (intbyte_string_displayed_columns): + * text.c (emchar_string_displayed_columns): + * text.c (intbyte_string_nonascii_chars): + * text.c (eicpyout_malloc_fmt): + * text.c (skip_ascii): + * text.c (charcount_to_bytecount_fun): + * text.c (charbpos_to_bytebpos_func): + * text.c (bytebpos_to_charbpos_func): + * text.c (buffer_mule_signal_inserted_region): + * text.c (buffer_mule_signal_deleted_region): + * text.c (get_buffer_range_char): + * text.c (get_buffer_range_byte): + * text.c (get_string_pos_char): + * text.c (get_string_range_char): + * text.c (get_buffer_or_string_pos_char): + * text.c (get_buffer_or_string_pos_byte): + * text.c (get_buffer_or_string_range_char): + * text.c (get_buffer_or_string_range_byte): + * text.c (buffer_or_string_accessible_begin_char): + * text.c (buffer_or_string_accessible_end_char): + * text.c (buffer_or_string_accessible_begin_byte): + * text.c (buffer_or_string_accessible_end_byte): + * text.c (buffer_or_string_absolute_begin_char): + * text.c (buffer_or_string_absolute_end_char): + * text.c (buffer_or_string_absolute_begin_byte): + * text.c (buffer_or_string_absolute_end_byte): + * text.c (dfc_convert_to_external_format): + * text.c (dfc_convert_to_internal_format): + * text.c (non_ascii_set_charptr_emchar): + * text.c (non_ascii_charptr_emchar): + * text.c (non_ascii_valid_emchar_p): + * text.c (non_ascii_charptr_copy_emchar): + * text.c (Lstream_get_emchar_1): + * text.c (Fmake_char): + * text.c (Fchar_charset): + * text.c (Fchar_octet): + * text.c (Fsplit_char): + * text.c (lookup_composite_char): + * text.c (Fmake_composite_char): + * text.c (Fcomposite_char_string): + * text.h: + * text.h (rep_bytes_by_first_byte): + * text.h (byte_ascii_p): + * text.h (intbyte_leading_byte_p): + * text.h (emchar_multibyte_p): + * text.h (emchar_ascii_p): + * text.h (assert_valid_charptr): + * text.h (INC_CHARPTR): + * text.h (INC_CHARPTR_FMT): + * text.h (DEC_CHARPTR_FMT): + * text.h (VALIDATE_CHARPTR_BACKWARD): + * text.h (validate_intbyte_string_backward): + * text.h (simple_charptr_copy_emchar): + * text.h (charptr_emchar): + * text.h (valid_emchar_p): + * text.h (CHAR_INTP): + * text.h (eicpy_lstr): + * text.h (eicpy_raw_fmt): + * text.h (eicpy_raw): + * text.h (eicpy_rawz_fmt): + * text.h (eicpy_rawz): + * text.h (eicpyout_alloca): + * text.h (eicat_lstr): + * text.h (GET_STRERROR): + * tooltalk.c (tooltalk_message_callback): + * tooltalk.c (tooltalk_pattern_callback): + * ui-byhand.c (__generic_toolbar_callback): + * ui-byhand.c (__emacs_gtk_ctree_recurse_internal): + * ui-gtk.c (emacs_gtk_object_printer): + * ui-gtk.c (__internal_callback_destroy): + * ui-gtk.c (__internal_callback_marshal): + * ui-gtk.c (emacs_gtk_boxed_printer): + * ui-gtk.c (gtk_type_to_lisp): + * unicode.c (sledgehammer_check_from_table): + * unicode.c (sledgehammer_check_to_table): + * unicode.c (set_unicode_conversion): + * unicode.c (emchar_to_unicode): + * unicode.c (unicode_to_char): + * unicode.c (recalculate_unicode_precedence): + * unicode.c (Fchar_to_unicode): + * unicode.c (encode_unicode_char): + * unicode.c (unicode_convert): + * unicode.c (unicode_print): + * win32.c: + * win32.c (tstr_to_local_file_format): + * win32.c (mswindows_lisp_error_1): + * win32.c (Fmswindows_shell_execute): + * window.c (print_window): + * window.c (print_window_config): + * window.c (Fcurrent_pixel_column): + Another big Ben patch. + + -- FUNCTIONALITY CHANGES: + + add partial support for 8-bit-fixed, 16-bit-fixed, and + 32-bit-fixed formats. not quite done yet. (in particular, needs + functions to actually convert the buffer.) NOTE: lots of changes + to regex.c here. also, many new *_fmt() inline funs that take an + Internal_Format argument. + + redo syntax cache code. make the cache per-buffer; keep the cache + valid across calls to functions that use it. also keep it valid + across insertions/deletions and extent changes, as much as is + possible. eliminate the junky regex-reentrancy code by passing in + the relevant lisp info to the regex routines as local vars. + + add general mechanism in extents code for signalling extent changes. + + fix numerous problems with the case-table implementation; yoshiki + never properly transferred many algorithms from old-style to + new-style case tables. + + redo char tables to support a default argument, so that mapping + only occurs over changed args. change many chartab functions to + accept Lisp_Object instead of Lisp_Char_Table *. + + comment out the code in font-lock.c by default, because + font-lock.el no longer uses it. we should consider eliminating it + entirely. + + Don't output bell as ^G in console-stream when not a TTY. + + add -mswindows-termination-handle to interface with i.c, so we can + properly kill a build. + + add more error-checking to buffer/string macros. + + add some additional buffer_or_string_() funs. + + -- INTERFACE CHANGES AFFECTING MORE CODE: + + switch the arguments of write_c_string and friends to be + consistent with write_fmt_string, which must have printcharfun + first. + + change BI_* macros to BYTE_* for increased clarity; similarly for + bi_* local vars. + + change VOID_TO_LISP to be a one-argument function. eliminate + no-longer-needed CVOID_TO_LISP. + + -- char/string macro changes: + + rename MAKE_CHAR() to make_emchar() for slightly less confusion + with make_char(). (The former generates an Emchar, the latter a + Lisp object. Conceivably we should rename make_char() -> wrap_char() + and similarly for make_int(), make_float().) + + Similar changes for other *CHAR* macros -- we now consistently use + names with `emchar' whenever we are working with Emchars. Any + remaining name with just `char' always refers to a Lisp object. + + rename macros with XSTRING_* to string_* except for those that + reference actual fields in the Lisp_String object, following + conventions used elsewhere. + + rename set_string_{data,length} macros (the only ones to work with + a Lisp_String_* instead of a Lisp_Object) to set_lispstringp_* + to make the difference clear. + + try to be consistent about caps vs. lowercase in macro/inline-fun + names for chars and such, which wasn't the case before. we now + reserve caps either for XFOO_ macros that reference object fields + (e.g. XSTRING_DATA) or for things that have non-function semantics, + e.g. directly modifying an arg (BREAKUP_EMCHAR) or evaluating an + arg (any arg) more than once. otherwise, use lowercase. + + here is a summary of most of the macros/inline funs changed by all + of the above changes: + + BYTE_*_P -> byte_*_p + XSTRING_BYTE -> string_byte + set_string_data/length -> set_lispstringp_data/length + XSTRING_CHAR_LENGTH -> string_char_length + XSTRING_CHAR -> string_emchar + INTBYTE_FIRST_BYTE_P -> intbyte_first_byte_p + INTBYTE_LEADING_BYTE_P -> intbyte_leading_byte_p + charptr_copy_char -> charptr_copy_emchar + LEADING_BYTE_* -> leading_byte_* + CHAR_* -> EMCHAR_* + *_CHAR_* -> *_EMCHAR_* + *_CHAR -> *_EMCHAR + CHARSET_BY_ -> charset_by_* + BYTE_SHIFT_JIS* -> byte_shift_jis* + BYTE_BIG5* -> byte_big5* + REP_BYTES_BY_FIRST_BYTE -> rep_bytes_by_first_byte + char_to_unicode -> emchar_to_unicode + valid_char_p -> valid_emchar_p + +2002-04-30 Charles G. Waldman + + * sysdep.c (sys_siglist): change "signum" to "signal" + +2001-04-21 Martin Buchholz + + * s/darwin.h: New file. + Thanks to Greg Parker . + +2002-04-23 Andreas Jaeger + + * s/linux.h (LIB_STANDARD): Define correctly for x86-64 and s390x + which use lib64 for 64-bit libs. + (START_FILES): Likewise. + +2002-02-11 Mike Sperber + + * device-x.c: + (x_IO_error_handler): + (x_init_device): Temporarily keep device in static variable + `device_being_initialized' so we can recover gracefully from + internal XOpenDevice failure. (XOpenDevice is documented to + return NULL on failure, but sometimes calls the IO error handler + instead.) + +2002-01-31 John H. Palmieri + + * dired.c (Ffile_name_all_completions): Change documentation -- + remove reference to completion-ignored-extensions. + * dired.c (vars_of_dired): Change documentation for + completion-ignored-extensions -- remove reference to + file-name-all-completions. + +2002-03-06 Jerry James + + * emodules.c (emodules_load): Fix multiple loading of same module. + +2002-01-25 Andrew Begel + * sysdll.c (dll_open): Changed to use RTLD_NOW instead of + RTLD_LAZY to avoid incorrect symbol binding when using nested + shared libraries on Solaris. + +2002-02-12 Stephen J. Turnbull + + * fileio.c (Ffind_file_name_handler): Improve docstring. + +2002-01-20 Stephen J. Turnbull + + * fns.c (Fmapconcat): Improve docstring. + +2002-01-03 Eric Gillespie, Jr. + + * device-gtk.c: Add prototype for + emacs_gtk_selection_clear_event_handle. + (gtk_init_device): Call gtk_selection_add_target for CLIPBOARD + selection. Setup signal handler for "selection_clear_event" + (emacs_gtk_selection_clear_event_handle). + + * select-gtk.c (emacs_gtk_selection_clear_event_handle): Handle + other applications owning the clipboard (based on + x_handle_selection_clear). + +2001-12-23 William M. Perry + + * menubar-gtk.c (gtk_popup_menu) Add sanity checks, fix crash. + +2002-01-04 Martin Buchholz + + * keymap.c (define_key_alternate_name): Parenthesize EQ. + +2001-12-17 Stephen J. Turnbull + + * XEmacs 21.4.6 "Common Lisp" is released. + + Change intbyte_strcmp -> qxestrcmp_c (duplicated functionality). + + -- INTERFACE CHANGES AFFECTING LESS CODE: + + use DECLARE_INLINE_HEADER in various places. + + remove '#ifdef emacs' from XEmacs-only files. + + eliminate CHAR_TABLE_VALUE(), which duplicated the functionality + of get_char_table(). + + add BUFFER_TEXT_LOOP to simplify iterations over buffer text. + + define typedefs for signed and unsigned types of fixed sizes + (INT_32_BIT, UINT_32_BIT, etc.). + + create ALIGN_FOR_TYPE as a higher-level interface onto ALIGN_SIZE; + fix code to use it. + + add charptr_emchar_len to return the text length of the character + pointed to by a ptr; use it in place of + charcount_to_bytecount(..., 1). add emchar_len to return the text + length of a given character. + + add types Bytexpos and Charxpos to generalize Bytebpos/Bytecount + and Charbpos/Charcount, in code (particularly, the extents code + and redisplay code) that works with either kind of index. rename + redisplay struct params with names such as `charbpos' to + e.g. `charpos' when they are e.g. a Charxpos, not a Charbpos. + + eliminate xxDEFUN in place of DEFUN; no longer necessary with + changes awhile back to doc.c. + + split up big ugly combined list of EXFUNs in lisp.h on a + file-by-file basis, since other prototypes are similarly split. + + rewrite some "*_UNSAFE" macros as inline funs and eliminate the + _UNSAFE suffix. + + move most string code from lisp.h to text.h; the string code and + text.h code is now intertwined in such a fashion that they need + to be in the same place and partially interleaved. (you can't + create forward references for inline funs) + +2002-04-30 Charles G. Waldman + + * sysdep.c (sys_siglist): change "signum" to "signal" + +2002-04-24 Andy Piper + + * redisplay.c (create_text_block): Don't actually add propagation + data if the line ends after we have added a glyph. + + * lisp.h (Dynarr_end): Fix definition. + +2002-04-22 Andy Piper + + * extents.c (extent_fragment_update): check for glyphs we have + previously displayed. + * extents.c (print_extent_1): warning removal. + * extents.h: change prototype. + * redisplay-output.c (redisplay_normalize_glyph_area): calculate + widths correctly for wide glyphs. + * redisplay.c (position_redisplay_data_type): add end_glyph_width. + * redisplay.c (prop_type): add PROP_GLYPH. + * redisplay.c (struct prop_block): add glyph type + * redisplay.c (add_glyph_rune): when adding part of a glyph add it + to the propagation data. + * redisplay.c (create_text_block): if there is a glyph in the + propagation data use it to salt extent_fragment_update. + * redisplay.c (create_string_text_block): ditto. + +2002-04-13 Nix + + * redisplay.h (struct rune): Add ascent, descent, and yoffset fields. + * redisplay-output.c (compare_runes): Compare them. + * redisplay.c: Update copyright date. + * redisplay.c (pos_data): Add need_baseline_computation field. + * redisplay.c (add_glyph_rune): Update ascent, descent, and + need_baseline_computation; zero yoffset. Set max_pixmap_height + for all pixmaps, not just automatically positioned ones. + * redisplay.c (calculate_yoffset): New, compute yoffset values. + * redisplay.c (calculate_baseline): New, compute textual baseline. + * redisplay.c (add_glyph_rune): Call them. + * redisplay.c (create_text_block): Likewise. + * redisplay.c (create_overlay_glyph_block): Likewise. + * redisplay.c (add_margin_runes): Likewise. + * redisplay.c (create_string_text_block): Likewise. Fix tabdamage. + + * redisplay.h: (redisplay_calculate_display_boxes): Change prototype. + * redisplay-output.c (redisplay_calculate_display_boxes): Use yoffset. + * redisplay-msw.c (mswindows_output_blank): Pass 0 as yoffset. + * redisplay-msw.c (mswindows_output_string): Likewise. + * redisplay-msw.c (mswindows_output_display_block): Pass yoffset. + * redisplay-gtk.c (gtk_output_display_block): Likewise. + * redisplay-x.c (x_output_display_block): Likewise. + +2002-04-02 Andy Piper + + * dired-msw.c (mswindows_get_files): + * nt.c (mswindows_stat): SetErrorMode() so that file errors are + completely handled by XEmacs. Suggested by Thomas Vogler + . + +2002-04-01 Andy Piper + + * emacs.c (Fkill_emacs): Only output message box in interactive + mode. + +2002-03-14 Mike Alexander + + * event-msw.c (mswindows_unwait_process): New, remove process from + wait list + * process-nt.c (nt_finalize_process_data): Call + mswindows_unwait_process + * console-msw.h: Declare mswindows_unwait_process + +2002-03-20 Andy Piper + + * menubar-msw.c (mswindows_popup_menu): warning removal. + * dialog-msw.c (dialog_popped_down): ditto. + +2002-02-13 Andy Piper + + * event-msw.c (mswindows_wnd_proc): only mark the frame visible if + we did in fact enqueue the XM_MAPFRAME event. + +2002-02-06 Adrian Aichner + + * src/window.c (window_loop): Implement new UNDEDICATE_BUFFER + operation. + * src/buffer.c (kill_buffer): Undedicate windows showing BUF + before replacing them. + + * redisplay.c (mark_redisplay): Remove call to + update_frame_window_mirror. + + * src/window.c (undedicate_windows): Use it. + * src/window.h: Add prototype. + +2002-01-03 Andy Piper + + * realpath.c (ABS_LENGTH): dtrt for cygwin systems using drive + letters. + (xrealpath): ditto. + +2001-12-11 Andy Piper + + * dialog-msw.c (dialog_popped_down): new function. unset popup_up_p. + * dialog-msw.c (mswindows_make_dialog_box_internal): set + popup_up_p. + * menubar-msw.c (unsafe_handle_wm_initmenupopup_1): ditto. + * menubar-msw.c (mswindows_handle_wm_command): ditto. + * menubar-msw.c (mswindows_popup_menu): ditto. + +2001-11-24 Andy Piper + + * window.c (Fsplit_window): Doc return type. + +2001-07-30 Adrian Aichner + + * event-msw.c: Typo fix. + * event-msw.c (mswindows_wnd_proc): Set FRAME_VISIBLE_P after + magic XM_MAPFRAME event has been sent. + +2001-11-23 Andy Piper + + * event-msw.c (mswindows_wnd_proc): Don't pump mousewheel events. + +2001-11-21 Andy Piper + + * scrollbar-msw.c (mswindows_handle_mousewheel_event): cope with + mouse events outside the frame. + +2001-11-15 Andy Piper + + (Fmswindows_shell_execute): fix handling of URL's under cygwin (again). + +2001-11-14 Andy Piper + + * nt.c (REG_ROOT): change registry key to XEmacs. + +2001-10-29 Andy Piper + + * dialog-msw.c (handle_directory_dialog_box): quit if the user + cancels. + +2002-04-15 Ben Wing + + * process.c: Need sysdep.h for environ. + +2002-04-14 Ben Wing + + * lisp.h: + Add support for strong type-checking of Bytecount, Bytebpos, + Charcount, Charbpos, and others, by making them classes, + overloading the operators to provide integer-like operation and + carefully controlling what operations are allowed. Not currently + enabled in C++ builds because there are still a number of compile + errors, and it won't really work till we merge in my "8-bit-Mule" + workspace, in which I make use of the new types Charxpos, + Bytexpos, Memxpos, representing a "position" either in a buffer or + a string. (This is especially important in the extent code.) + + * abbrev.c: + * abbrev.c (abbrev_oblookup): + * alloc.c (STRING_CHARS_BLOCK_SIZE): + * alloc.c (allocate_string_chars_struct): + * alloc.c (make_uninit_string): + * alloc.c (set_string_char): + * alloc.c (build_intstring): + * eval.c (record_unwind_protect_restoring_lisp_object): + * eval.c (record_unwind_protect_restoring_int): + * buffer.c (init_initial_directory): + * buffer.h (BI_BUF_PTR_BYTE_POS): + * buffer.h (real_charbpos_to_bytebpos): + * editfns.c (Fuser_full_name): + * editfns.c (Finsert_char): + * fns.c (Ffillarray): + * text.h: + * text.h (REP_BYTES_BY_FIRST_BYTE_1): + * text.h (simple_set_charptr_emchar): + * text.h (DECLARE_INLINE_HEADER): + * text.h (endif): + Warning fixes, some of them related to new C++ strict type + checking of Bytecount, Charbpos, etc. + + * dired.c (file_name_completion): + Caught an actual error due to strong type checking -- char len + being passed when should be byte len. + + * alloc.c: + * alloc.c (DECREMENT_CONS_COUNTER): + * alloc.c (memory_full): + * alloc.c (Fmake_byte_code): + * alloc.c (garbage_collect_1): + * alloc.c (recompute_need_to_garbage_collect): + * alloc.c (common_init_alloc_once_early): + * backtrace.h: + * backtrace.h (SPECBIND_FAST_UNSAFE): + * bytecode.c: + * bytecode.c (execute_optimized_program): + * bytecode.c (mark_compiled_function): + * bytecode.h: + * bytecode.h (struct Lisp_Compiled_Function): + * eval.c: + * eval.c (handle_compiled_function_with_and_rest): + * eval.c (funcall_compiled_function): + * eval.c (Feval): + * eval.c (Ffuncall): + * eval.c (function_argcount): + * sysdep.c (total_data_usage): + Further optimize Ffuncall: + + -- process arg list at compiled-function creation time, converting + into an array for extra-quick access at funcall time. + -- rewrite funcall_compiled_function to use it, and inline this + function. + -- change the order of check for magic stuff in + SPECBIND_FAST_UNSAFE to be faster. + -- move the check for need to garbage collect into the allocation + code, so only a single flag needs to be checked in funcall. + + + * buffer.c (Fstring_char_byte_converion_info): + * buffer.c (syms_of_buffer): + * symbols.c: + * symbols.c (intern_converting_underscores_to_dashes): + + add debug funs to check on mule optimization info in buffers and + strings. + + * eval.c (init_eval_semi_early): + * emacs.c (main_1): + * text.c (reinit_eistring_once_early): + * regex.c (vars_of_regex): + * scrollbar-msw.c (vars_of_scrollbar_mswindows): + * search.c (vars_of_search): + Fix evil crashes due to eistrings not properly reinitialized under + pdump. Redo a bit some of the init routines; convert some + complex_vars_of() into simple vars_of(), because they didn't need + complex processing. + + * callproc.c: + * callproc.c (call_process_kill): + * callproc.c (call_process_cleanup): + * callproc.c (Fold_call_process_internal): + * callproc.c (child_setup): + * callproc.c (syms_of_callproc): + * callproc.c (getenv): Removed. + * emacs.c: + * emacs.c (main_1): + * event-stream.c (check_event_stream_ok): + * event-stream.c (init_event_stream): + * nt.c: + * nt.c (init_mswindows_environment): + * nt.c (Fmswindows_long_file_name): + * nt.c (init_nt): + * process.c: + * process.c (init_process_io_handles): + * process.c (Fstart_process_internal): + * process.c (getenv_internal): + * process.c (putenv_internal): + * process.c (getenv): New. + * process.c (DEFUN): + * process.c (Fgetenv): + * process.c (egetenv): + * process.c (init_xemacs_process): + * process.c (syms_of_process): + * process.c (vars_of_process): + * process.h: + * sysdep.c (wait_for_termination): + * sysdep.c (init_baud_rate): + * sysdep.c (emacs_get_tty): + * sysdep.c (emacs_set_tty): + * sysdep.c (tty_init_sys_modes_on_device): + * sysdep.h: + * syssignal.h: + * syswindows.h: + * ntproc.c: Delete. Hallelujah, praise the Lord, there is no god + but Allah!!! + + fix so that processes can be invoked in bare temacs -- thereby + eliminating any need for callproc.c. (currently only eliminated + under NT.) remove all crufty and unnecessary old process code in + ntproc.c and elsewhere. move non-callproc-specific stuff (mostly + environment) into process.c, so callproc.c can be left out under + NT. + + * console-tty.c (tty_init_console): + * doc.c: + * doc.c (unparesseuxify_doc_string): + * doc.c (get_doc_string): + * doc.c (Fsnarf_documentation): + * file-coding.c: + * file-coding.c (coding_reader): + * file-coding.c (set_coding_character_mode): + * file-coding.c (make_coding_stream_1): + * file-coding.c (make_coding_output_stream): + * file-coding.c (detect_coding_stream): + * file-coding.h: + * file-coding.h (struct coding_stream): + * file-coding.h (LSTREAM_FL_NO_CLOSE_OTHER): + * lstream.c: + * lstream.c (Lstream_read_1): + * lstream.c (Lstream_read): + * lstream.c (Lstream_fgetc): + * lstream.h (lstream_implementation): + + fix doc string handling so it works with Japanese, etc docs. + change handling of "character mode" so callers don't have to + manually set it (quite error-prone). + + * event-msw.c (init_event_mswindows_late): spacing fixes. + + * lread.c: + * lread.c (pas_de_holgazan_ici): + * lread.c (load_force_doc_string_unwind): + * lread.c (readevalloop): + * lread.c (read_list_conser): + * lread.c (read_vector): + + eliminate unused crufty vintage-19 "FSF defun hack" code. + + * lrecord.h: improve pdump description docs. + + * buffer.c: + * ntheap.c: + * ntheap.c (round_to_next): + * ntheap.c (get_data_start): + * ntheap.c (get_data_end): + * ntheap.c (allocate_heap): + * ntheap.c (sbrk): + * ntheap.c (recreate_heap): + * unexnt.c: + * unexnt.c (_start): + * unexnt.c (unexec): + * unexnt.c (get_bss_info_from_map_file): + * unexnt.c (get_section_info): + * unexnt.c (copy_executable_and_dump_data_section): + * unexnt.c (dump_bss_and_heap): + * unexnt.c (read_in_bss): + * unexnt.c (map_in_heap): + * win32.c: + * win32.c (mswindows_get_module_file_name): + * emacs.c (make_arg_list_1): + * emacs.c (Fdump_emacs): + Mule-ize some unexec and startup code. It was pseudo-Mule-ized + before by simply always calling the ...A versions of functions, + but that won't cut it -- eventually we want to be able to run + properly even if XEmacs has been installed in a Japanese + directory. (The current problem is the timing of the loading of + the Unicode tables; this will eventually be fixed.) Go through and + fix various other places where the code was not Mule-clean. + Provide a function mswindows_get_module_file_name() to get our own + name without resort to PATH_MAX and such. Add a big comment in + main() about the problem with Unicode table load timing that I + just alluded to. + + * emacs.c (guts_of_fatal_error_signal): + * emacs.c (mswindows_handle_hardware_exceptions_1): + When error-checking is enabled (interpreted as "user is developing + XEmacs"), don't ask user to "pause to read messages" when a fatal + error has occurred, because it will wedge if we are in an inner + modal loop (typically when a menu is popped up) and make us unable + to get a useful stack trace in the debugger. + + * text.c (update_entirely_ascii_p_flag): + * text.c (charbpos_to_bytebpos_func): + * text.c (bytebpos_to_charbpos_func): + Correct update_entirely_ascii_p_flag to actually work. + + * lisp.h: + * symsinit.h: + declarations for above changes. + +2002-04-13 Jonathan Harris + + * unexnt.c (_start): + * unexnt.c (unexec): + * unexnt.c (map_in_heap): + Clean up one remaining file where nonintercepted Windows calls + were being used. + +2002-04-07 William M. Perry + + * event-gtk.c: + * device-gtk.c: + * glyphs-gtk.c: + * frame-gtk.c: + * gtk-xemacs.c: + * menubar-gtk.c: + * redisplay-gtk.c: Need to include device.h and window.h in a few + places. Not sure which .h has changed that was transparently + pulling them in before, but... + +2002-03-06 Jerry James + + * emodules.c (emodules_load): Fix multiple loading of same module. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. @@ -40,14 +3825,14 @@ 19.12.) Anyway, this introduced buffering issues, in which instead of one char being read, it tried to read 1024 chars. I tried setting the stdin descriptor non-blocking, but it doesn't appear - to work on Cygwin. (#### Andy, do you know anything about this?) + to work on Cygwin. (#### Andy, do you know anything about this?) So I fixed it elsewhere. If you get weirdness on the TTY, look in console-tty.c and see how it gets the coding system; maybe there's a way to change it (and if not, there should be!). Also fix warning in sysdep.c. - 2002-03-31 Ben Wing +2002-03-31 Ben Wing * alloc.c: * alloc.c (INCREMENT_CONS_COUNTER): @@ -133,7 +3918,7 @@ Add volatile_make_int() to fix warning in unix_send_process(). - + 2002-03-31 Ben Wing * s/windowsnt.h: @@ -384,14 +4169,14 @@ Clean up remaining places where nonintercepted Windows calls are being used. - + 2002-03-29 Jonathan Harris * device-msw.c (plist_get_margin): Add arg specifying mm or inches * device-msw.c (plist_set_margin): Fix multiplicand used for mm * device-msw.c (mswindows_handle_page_setup_dialog_box): Detect and handle case where machine is set up for metric units - + * intl-auto-encap-win32.c: * intl-auto-encap-win32.h: * intl-encap-win32.c: @@ -399,9 +4184,9 @@ 2002-03-29 William M. Perry - * ui-gtk.c (Fgtk_import_function_internal): - (emacs_gtk_object_finalizer): - (build_gtk_object): + * ui-gtk.c (Fgtk_import_function_internal): + (emacs_gtk_object_finalizer): + (build_gtk_object): (build_gtk_boxed): Use wrap_emacs_*() instead of wrap_*() for gtk_boxed, gtk_object, ffi @@ -410,7 +4195,7 @@ * Makefile.in.in (gui_objs): * Makefile.in.in (objs): Always include gui.c, to fix compile error when TTY-only. - + * EmacsFrame.c (EmacsFrameSetValues): * abbrev.c: * abbrev.c (abbrev_match_mapper): @@ -1152,11 +4937,11 @@ New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. - + Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). - + Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as @@ -1188,13 +4973,13 @@ like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now. - + 2002-03-14 Mike Alexander * event-msw.c (mswindows_unwait_process): New, remove process from wait list * process-nt.c (nt_finalize_process_data): Call - mswindows_unwait_process + mswindows_unwait_process * console-msw.h: Declare mswindows_unwait_process 2002-03-21 William M. Perry @@ -1216,7 +5001,7 @@ * chartab.c (Fcheck_category_at): * chartab.c (Fchar_in_category_p): Fix bugs in implementation and doc strings. - + * config.h.in (type_checking_assert_at_line): Add foo_checking_assert_at_line() macros. Not clear whether these are actually useful, though; I'll take them out if not. @@ -1227,7 +5012,7 @@ Some improvements to the timeline. Rearrange a bit the init calls. Add call for reinit_vars_of_object_mswindows() and declare in symsinit.h. - + * event-Xt.c: * event-Xt.c (emacs_Xt_format_magic_event): * event-Xt.c (describe_event_window): @@ -1271,7 +5056,7 @@ stream, not always to stderr, so it can be used elsewhere. (e.g. in print-event when a magic event is encountered?) - + * lisp.h: * lisp.h (XCHAR_1): * lisp.h (XCHAR): @@ -1293,14 +5078,14 @@ assert_at_line(). Happens only when error-checking is defined so doesn't slow down non-error-checking builds. Fix XCHAR, XINT, XCHAR_OR_INT, XFOO, and wrap_foo() in this fashion. - + * lstream.c: * lstream.c (resizing_buffer_stream_ptr): * lstream.h: Add resizing_buffer_to_lisp_string(). - + * objects-gtk.c (gtk_find_charset_font): Fix typo. - + * objects-msw.c: * objects-msw.c (create_hfont_from_font_spec): * objects-msw.c (initialize_font_instance): @@ -1317,7 +5102,7 @@ char-by-char), and see if any of the font's supported ranges include the charset's range. also do some caching in Vfont_signature_data of previous inquiries. - + * charset.h: * text.c (Fmake_char): * mule-charset.c (get_charset_limits): New fun; extracted out of @@ -1430,7 +5215,7 @@ * .cvsignore: ignore .tmp files that are getting auto-created by VC. - + * Makefile.in.in (release): * Makefile.in.in (fastdump): * Makefile.in.in (dynodump_deps): @@ -1485,7 +5270,7 @@ 2002-02-11 Mike Sperber - * device-x.c: + * device-x.c: (x_IO_error_handler): (x_init_device): Temporarily keep device in static variable `device_being_initialized' so we can recover gracefully from @@ -1607,9 +5392,9 @@ expose it in our method structure. (gtk_ring_bell): Don't ring the bell if volume <= 0 - * toolbar-gtk.c (gtk_output_toolbar_button): - (gtk_output_frame_toolbars): - (gtk_redraw_exposed_toolbars): + * toolbar-gtk.c (gtk_output_toolbar_button): + (gtk_output_frame_toolbars): + (gtk_redraw_exposed_toolbars): (gtk_redraw_frame_toolbars): These are now just aliases for the common_XXX() routines in toolbar-common.c @@ -2766,7 +6551,12 @@ * dumper.c: remove duplicate case tag XD_BYTECOUNT, and the accompanying duplicate code, from 4 switchs tatements. - See README.integral-types in this directory for more details. + [[See README.integral-types in this directory for more + details.]] --invalid. + + See the Internals Manual, under Major Type Changes, and also + README.global-renaming. + 2001-09-17 Ben Wing @@ -2813,12 +6603,6 @@ * (Ffile_name_absolute_p): ditto. * (Ffile_readable_p): ditto. -2001-07-30 Adrian Aichner - - * event-msw.c: Typo fix. - * event-msw.c (mswindows_wnd_proc): Set FRAME_VISIBLE_P after - magic XM_MAPFRAME event has been sent. - 2001-09-07 Stephen J. Turnbull * XEmacs 21.5.3 "asparagus" is released. @@ -6208,7 +9992,7 @@ Fix compile warnings. * menubar.c (vars_of_menubar): - Provide `menu-accelerator-support' to indicate that we properly + Provide `menu-accelerator-support' to indicate that we Properly support %_ in menu specifications, so that package code can conditionalize on this (and remove %_ from menu specifications on older versions). @@ -8943,8 +12727,8 @@ 2000-04-26 IKEYAMA Tomonori - * redisplay-msw.c (mswindows_output_dibitmap): Set foreground - color if the image is a mono pixmap. + * redisplay-msw.c (mswindows_output_dibitmap): Set foreground + color if the image is a mono pixmap. 2000-07-30 Ben Wing @@ -9546,53 +13330,365 @@ (tiff_normalize): add dest_mask so that it can be proprogated by layout_normalize. - * elhash.c: - (print_hash_table): - (hash_table_weakness_validate): - (decode_hash_table_weakness): - (Fhash_table_weakness): - (Fhash_table_type): - (syms_of_elhash): use Ben's naming scheme for hashtable types.. + * elhash.c: + (print_hash_table): + (hash_table_weakness_validate): + (decode_hash_table_weakness): + (Fhash_table_weakness): + (Fhash_table_type): + (syms_of_elhash): use Ben's naming scheme for hashtable types.. + + * console.h (struct console_methods): move update_* to + redisplay_*. + +2000-07-20 Ben Wing + + * *.[ch] (XSETOBJ): remove unused middle argument. + lisp-disunion.h: correct wrap_object() to one argument. + +2000-07-15 Ben Wing + + * s/cygwin32.h: + * s/cygwin32.h (CYGWIN_CONV_PATH): + Add missing logb prototype for v1.1. + Use post-b20 names and alias to pre-b20 names when pre-b20. + + * s/windowsnt.h: [5]. + +2000-07-15 Ben Wing + + * Makefile.in.in (x_objs): + * Makefile.in.in (sheap_objs): + * Makefile.in.in (objs): + added win32.o, cosmetic cleanups. + + * alloc.c (Fmake_byte_code): + [[[1]]]: Changes for new LIST_LOOP, EXTERNAL_LIST_LOOP, + etc. macros which declare their own args now. + + * alloc.c (syms_of_alloc): + [[[2]]]: Use DEFSYMBOL, DEFKEYWORD, DEFERROR and friends. + + * buffer.c: + Moved buffer-dedicated-frame, set-buffer-dedicated-frame into lisp. + + * buffer.c (Fget_file_buffer): + Fixed GCPRO problem. + + * glyphs-msw.c (bmp_normalize): + (mswindows_resource_normalize): add dest_mask so that it can be + proprogated by layout_normalize. + (begin_defer_window_pos): make optional because it may not be the + right thing to do and it introduces differences with X. + (mswindows_unmap_subwindow): ditto. + (mswindows_map_subwindow): ditto. + (mswindows_redisplay_subwindow): renamed from + mswindows_update_subwindow. + (mswindows_redisplay_widget): ditto. + (mswindows_button_redisplay): renamed from + mswindows_button_update. Update is now what the instantiation + function does for a changed instantiator. + (mswindows_progress_gauge_instantiate): set the progress value + here if appropriate. + (mswindows_tab_control_redisplay): cope with re-ordering of the + members of the tab widget by simply selecting the new top + widget. This makes things appear ok if you click on a tab. + (mswindows_combo_box_instantiate): image_instance_layout now takes + position as well as size. + (mswindows_progress_gauge_redisplay): renamed from + mswindows_progress_gauge_update. + (console_type_create_glyphs_mswindows): fix update -> redisplay. + (image_instantiator_format_create_glyphs_mswindows): ditto. + + * glyphs-eimage.c (jpeg_normalize): + (gif_normalize): + (png_normalize): + (tiff_normalize): add dest_mask so that it can be proprogated by + layout_normalize. + + * elhash.c: + (print_hash_table): + (hash_table_weakness_validate): + (decode_hash_table_weakness): + (Fhash_table_weakness): + (Fhash_table_type): + (syms_of_elhash): use Ben's naming scheme for hashtable types.. + + * console.h (struct console_methods): move update_* to + redisplay_*. + +2000-07-20 Ben Wing + + * *.[ch] (XSETOBJ): remove unused middle argument. + lisp-disunion.h: correct wrap_object() to one argument. + +2000-07-15 Ben Wing + + * s/cygwin32.h: + * s/cygwin32.h (CYGWIN_CONV_PATH): + Add missing logb prototype for v1.1. + Use post-b20 names and alias to pre-b20 names when pre-b20. + + * s/windowsnt.h: [5]. + +2000-07-15 Ben Wing + + * Makefile.in.in (x_objs): + * Makefile.in.in (sheap_objs): + * Makefile.in.in (objs): + added win32.o, cosmetic cleanups. + + * alloc.c (Fmake_byte_code): + [[[1]]]: Changes for new LIST_LOOP, EXTERNAL_LIST_LOOP, + etc. macros which declare their own args now. + + * alloc.c (syms_of_alloc): + [[[2]]]: Use DEFSYMBOL, DEFKEYWORD, DEFERROR and friends. + + * buffer.c: + Moved buffer-dedicated-frame, set-buffer-dedicated-frame into lisp. + + * buffer.c (Fget_file_buffer): + Fixed GCPRO problem. + + * buffer.c (get_truename_buffer): + Fixed comment about GC checking. + + * buffer.c (syms_of_buffer): + Undeclared those dedicated frame funs. + [2]. + + * buffer.h: + Define convenience macros for internal/external conversions. + [[[3]]]: Define codesys aliases Qcommand_argument_encoding + and Qenvironment_variable_encoding for cleaner code. + + * bufslots.h: + Remove dedicated-frame; in lisp. + + * bytecode.c (funcall_compiled_function): + [1]. + + * bytecode.c (syms_of_bytecode): + [2]. + + * console-msw.c: + * console-msw.c (mswindows_show_console): Rewrote. + + * console-msw.c (Fmswindows_debugging_output): New. + Sends to OutputDebugString (special MSWin debugger interface). + + * console-msw.c (Fmswindows_message_box): + Fixed stupid bugs so it works when called from kill-emacs. + + * console-msw.c (syms_of_console_mswindows): + Declare Fmswindows_debugging_output. + + * console-msw.h: + New MSWin prototypes. + + * console-msw.h (struct mswindows_frame): + New entry last-click-mods for improved button-modifier support. + + * console-msw.h (FRAME_MSWINDOWS_POPUP): + New struct entry `popup' with corresponding accessor. + + * console-x.c: + * console-x.c (split_up_display_spec): + * console-x.c (get_display_arg_connection): + * console-x.c (x_semi_canonicalize_console_connection): + * console-x.c (x_canonicalize_device_connection): + [[[6]]]: Change char to more specific type. + [[[8]]]: Make use of abstracting codesys aliases defined in [3], [4]; + + * console-x.c (x_semi_canonicalize_console_connection): + * console-x.c (x_canonicalize_device_connection): + [[[9]]]: Fix up error signalling to use new structured error system. + + * console-x.h: + [[[4]]]: Define codesys aliases: + Qlwlib_encoding, Qx_atom_name_encoding, Qx_font_name_encoding, + Qx_color_name_encoding, Qx_display_name_encoding. + + * console.h (struct console_methods): + New method make_dialog_box_internal supersedes older + popup_dialog_box method. + + * data.c: + Define many new errors, part of new structured errors. + + * data.c (init_errors_once_early): + * data.c (syms_of_data): + [2]. + + * device-msw.c (mswindows_init_device): + [[[5]]]: Cleanup to support NT 3.51. + + * device-msw.c (decode_devmode): Cleanup. + + * device-msw.c (mswindows_handle_print_setup_dialog_box): + * device-msw.c (mswindows_handle_print_dialog_box): + * device-msw.c (mswindows_handle_page_setup_dialog_box): + * device-msw.c (syms_of_device_mswindows): + Delete the dialog box primitives recently introduced by Kirill and + instead interface to general dialog box interface. + + * device-x.c: + * device-x.c (compute_x_app_name): + * device-x.c (x_init_device): + * device-x.c (Fx_valid_keysym_name_p): + * device-x.c (Fx_set_font_path): + [6]. + [7]. + + * device.h (wrap_device): New. + First of its kind; meant to replace XSETDEVICE. + + * dialog-msw.c: Many file-dialog symbols. + + * dialog-msw.c (mswindows_register_popup_frame): New. + * dialog-msw.c (mswindows_is_dialog_msg): New. + For supporting kbd traversal in dialog boxes. + + * dialog-msw.c (dialog_proc): + Support hitting ESC in dialogs. + + * dialog-msw.c (struct): + Common dialog box errors. + + * dialog-msw.c (handle_file_dialog_box): New. + Add file dialog code. + + * dialog-msw.c (handle_question_dialog_box): + Redo existing code to support new question dialog syntax. + + * dialog-msw.c (console_type_create_dialog_mswindows): + We support new dialog console method. + + * dialog-msw.c (syms_of_dialog_mswindows): + * dialog-msw.c (vars_of_dialog_mswindows): + New file dialog symbols, vars. + + * dialog-x.c: + * dialog-x.c (maybe_run_dbox_text_callback): + * dialog-x.c (dbox_descriptor_to_widget_value): + * dialog-x.c (x_make_dialog_box_internal): + * dialog-x.c (console_type_create_dialog_x): + Mule-ize entire file. + Redo to support question dialog syntax. + [6]. + + * dialog.c: + * dialog.c (Fmake_dialog_box_internal): + * dialog.c (syms_of_dialog): + Kill old popup-dialog-box, replace with new primitive. + Just call device method or signal error. + + * eldap.c (Fldap_open): + * eldap.c (Fldap_search_basic): + * eldap.c (Fldap_add): + * eldap.c (Fldap_modify): + [1]. + [7]. + + * emacs.c: + * emacs.c (make_arg_list_1): + * emacs.c (make_arg_list): + Mule-ize call to dll_init(). + [6]. + [8]. + + * emacs.c (make_argc_argv): + * emacs.c (free_argc_argv): + * emacs.c (init_cmdargs): + * emacs.c (main_1): + * emacs.c (Fkill_emacs): + * emacs.c (Fdump_emacs): + Update comments about what can be used in syms_* etc. + Call init_win32() when necessary. + Fix up MS Win dialog box in kill-buffer to actually work right. + [7]. + + * eval.c: + * eval.c (For): + * eval.c (Fand): + * eval.c (Fprogn): + * eval.c (Fprog1): + * eval.c (Fprog2): + * eval.c (FletX): + * eval.c (Flet): + * eval.c (condition_case_3): + * eval.c (Feval): + * eval.c (function_argcount): + * eval.c (funcall_lambda): + [1]. + + * eval.c (type_error): New. + * eval.c (maybe_type_error): New. + * eval.c (continuable_type_error): New. + * eval.c (maybe_continuable_type_error): New. + * eval.c (type_error_with_frob): New. + * eval.c (maybe_type_error_with_frob): New. + * eval.c (continuable_type_error_with_frob): New. + * eval.c (maybe_continuable_type_error_with_frob): New. + New functions for use with structured errors. - * console.h (struct console_methods): move update_* to - redisplay_*. + * event-Xt.c: + * event-Xt.c (x_event_to_emacs_event): + Buttons are now modifiers too. -2000-07-20 Ben Wing + * event-Xt.c (emacs_Xt_current_event_timestamp): + Implement new event method. + * event-Xt.c (reinit_vars_of_event_Xt): Set it. - * *.[ch] (XSETOBJ): remove unused middle argument. - lisp-disunion.h: correct wrap_object() to one argument. + * event-msw.c: + * event-msw.c (ntpipe_shove_writer): [5]. + * event-msw.c (mswindows_enqueue_mouse_button_event): + * event-msw.c (mswindows_drain_windows_queue): + * event-msw.c (mswindows_wnd_proc): [7]. + * event-msw.c (mswindows_current_layout_has_AltGr): [5]. + * event-msw.c (mswindows_modifier_state): + Throughout: support new button modifiers. -2000-07-15 Ben Wing + * event-msw.c (emacs_mswindows_current_event_timestamp): + Implement new event method. + * event-msw.c (reinit_vars_of_event_mswindows): Set it. - * s/cygwin32.h: - * s/cygwin32.h (CYGWIN_CONV_PATH): - Add missing logb prototype for v1.1. - Use post-b20 names and alias to pre-b20 names when pre-b20. + * event-stream.c: + * event-stream.c (event_stream_current_event_timestamp): New. + * event-stream.c (maybe_kbd_translate): New functionality. + * event-stream.c (vars_of_event_stream): + Document new kbd-translate-table functionality. - * s/windowsnt.h: [5]. + * event-stream.c (Fcurrent_event_timestamp): New. + New primitive for use in fabricated events. + * event-stream.c (syms_of_event_stream): [2]. Declare new primitive. -2000-07-15 Ben Wing + * events-mod.h (XEMACS_MOD_BUTTON1): new button modifiers. - * Makefile.in.in (x_objs): - * Makefile.in.in (sheap_objs): - * Makefile.in.in (objs): - added win32.o, cosmetic cleanups. + * events.c: + * events.c (Fmake_event): + * events.c (WRONG_EVENT_TYPE_FOR_PROPERTY): + [1]. + [9]. - * alloc.c (Fmake_byte_code): - [[[1]]]: Changes for new LIST_LOOP, EXTERNAL_LIST_LOOP, - etc. macros which declare their own args now. + * events.c (format_event_object): fix gcc warnings. - * alloc.c (syms_of_alloc): - [[[2]]]: Use DEFSYMBOL, DEFKEYWORD, DEFERROR and friends. + * events.c (Fevent_timestamp): Document new primitives. - * buffer.c: - Moved buffer-dedicated-frame, set-buffer-dedicated-frame into lisp. + * events.c (TIMESTAMP_HALFSPACE): New. - * buffer.c (Fget_file_buffer): - Fixed GCPRO problem. + * events.c (Fevent_timestamp_lessp): New. New primitive for + comparing timestamps correctly (half-space algorithm). - * buffer.c (get_truename_buffer): - Fixed comment about GC checking. + * events.c (Fevent_modifier_bits): Doc fix. + + * buffer.c (get_truename_buffer): Fixed comment about GC + checking. + + * events.c (Fevent_modifiers): Major doc addition. + * events.c (event_x_y_pixel_internal): Typo fix. + * events.c (syms_of_events): Declare new primitives. * buffer.c (syms_of_buffer): Undeclared those dedicated frame funs. @@ -10027,172 +14123,376 @@ Add prototypes for structured error functions. Add long comments describing looping macros and change interface so that lvalues are automatically declared. + + * events.h: + Update long comment for button modifiers, timestamps. + + * events.h (struct event_stream): + New current_event_timestamp method. + + * extents.c: + * extents.c (extent_in_region_p): + * extents.c (decode_extent): + * extents.c (Fset_extent_parent): + * extents.c (decode_map_extents_flags): + Fix gcc warnings. + [9]. + + * extents.c (struct extent_at_arg): + * extents.c (decode_extent_at_flag): + * extents.c (extent_at_mapper): + * extents.c (extent_at_bytind): + * extents.c (Fextent_at): Adapt to new lower-level interface. [9]. + * extents.c (Fextents_at): New primitive. [9]. + * extents.c (symbol_to_glyph_layout): [9]. + Support new primitive `extents-at'. + + + * extents.c (get_text_property_bytind): + extent_at_bytind has another arg. + [9]. + + * extents.c (syms_of_extents): New primitive. + + * file-coding.c (Fmake_coding_system): [1]. + * file-coding.c (subsidiary_coding_system): fix gcc warning + * file-coding.c (syms_of_file_coding): [2]. + + * fileio.c (Fexpand_file_name): + * fileio.c (Fsysnetunam): + * fileio.c (Ffile_exists_p): + * fileio.c (Ffile_executable_p): + * fileio.c (Fverify_visited_file_modtime): + Clean up GCPROing. + + * fileio.c (syms_of_fileio): [2]. + + * filelock.c (lock_file_1): + * filelock.c (current_lock_owner): + * filelock.c (lock_if_free): + * filelock.c (lock_file): + * filelock.c (unlock_file): + Clean up GCPROing. + + * fns.c (concat): Fix gcc warning. + + * fns.c (Fmember): + * fns.c (Fold_member): + * fns.c (Fmemq): + * fns.c (Fold_memq): + * fns.c (memq_no_quit): + * fns.c (Fassoc): + * fns.c (Fold_assoc): + * fns.c (Fassq): + * fns.c (Fold_assq): + * fns.c (assq_no_quit): + * fns.c (Frassoc): + * fns.c (Fold_rassoc): + * fns.c (Frassq): + * fns.c (Fold_rassq): + * fns.c (rassq_no_quit): + * fns.c (Fdelete): + * fns.c (Fold_delete): + * fns.c (Fdelq): + * fns.c (Fold_delq): + * fns.c (delq_no_quit): + * fns.c (Fremassoc): + * fns.c (Fremassq): + * fns.c (remassq_no_quit): + * fns.c (Fremrassoc): + * fns.c (Fremrassq): + * fns.c (remrassq_no_quit): + * fns.c (Freverse): + * fns.c (mapcar1): + [1]. + + * frame-msw.c (mswindows_init_frame_1): + * frame-msw.c (mswindows_delete_frame): + Register popups with dialog code so keyboard traversing works. + + * frame-tty.c (tty_raise_frame_no_select): [1]. + + * frame-x.c: + * frame-x.c (x_set_frame_text_value): + * frame-x.c (x_set_frame_properties): + * frame-x.c (x_create_widgets): + [7]. + + * frame.c: + * frame.c (Fmouse_pixel_position): Minor doc fixes. + + * frame.h (wrap_frame): New. + Macro like wrap_device. + + * general.c: + * general.c (SYMBOL): + * general.c (syms_of_general): + Major reorg. This is now just a wrapper and symbols themselves + are listed in general-slots.h. + + * glyphs-eimage.c (tiff_instantiate): Need cast to fix warning. + * glyphs-msw.c (mswindows_resource_instantiate): [5]. + + * glyphs-msw.c (mswindows_native_layout_instantiate): + Add DS_CONTROL so keyboard traversal will work. + + * glyphs-widget.c: + * glyphs-widget.c (syms_of_glyphs_widget): + Move some symbols to general-slots.h. + + * glyphs-x.c: + * glyphs-x.c (xbm_instantiate_1): + * glyphs-x.c (x_xbm_instantiate): + * glyphs-x.c (x_xface_instantiate): + * glyphs-x.c (autodetect_instantiate): + * glyphs-x.c (cursor_font_instantiate): + * glyphs-x.c (x_update_widget): + * glyphs-x.c (x_widget_instantiate): + * glyphs.c (bitmap_to_lisp_data): + * glyphs.c (pixmap_to_lisp_data): + [7]. + + * glyphs.c (syms_of_glyphs): + [2]. + + * gui-x.c: + * gui-x.c (print_widget_value): + * gui-x.c (menu_separator_style_and_to_external): + * gui-x.c (add_accel_and_to_external): + * gui-x.c (button_item_to_widget_value): + * gui-x.c (gui_items_to_widget_values_1): + * gui-x.c (gui_items_to_widget_values): + * gui-x.c (syms_of_gui_x): + * gui-x.c (vars_of_gui_x): + Mule-ize entire file. Move menu-no-selection-hook to gui.c. + [9]. + + * gui-x.h: + Muleize, prototype changes matching gui-x.c. + + * gui.c: + * gui.c (separator_string_p): + * gui.c (gui_item_add_keyval_pair): + * gui.c (make_gui_item_from_keywords_internal): + * gui.c (signal_too_long_error): + * gui.c (parse_gui_item_tree_item): + * gui.c (syms_of_gui): + * gui.c (vars_of_gui): + * gui.h: + menu-no-selection-hook moved here (used by MSWin). + Move some symbols to general-slots.h. + [6]. + [9]. + + * insdel.c (get_buffer_pos_char): + * insdel.c (get_buffer_range_char): + Add GC comments. + + * keymap.c (keymap_lookup_directly): + * keymap.c (keymap_store): + * keymap.c (ensure_meta_prefix_char_keymapp): + * keymap.c (describe_map): + * keymap.h: + Support new button modifiers. + + * lisp-disunion.h (wrap_object): + * lisp-disunion.h (XSETOBJ): + Rename make_obj to wrap_object. + + * lisp-union.h: + * lisp-union.h (make_int): + * lisp-union.h (make_char): + Support wrap_object. + + * lisp.h: + * lisp.h (LIST_LOOP): + * lisp.h (EXTERNAL_LIST_LOOP): + * lisp.h (LIST_LOOP_2): + * lisp.h (EXTERNAL_LIST_LOOP_1): + * lisp.h (EXTERNAL_LIST_LOOP_2): + * lisp.h (EXTERNAL_LIST_LOOP_3): + * lisp.h (EXTERNAL_LIST_LOOP_4_NO_DECLARE): + * lisp.h (PRIVATE_EXTERNAL_LIST_LOOP_6): + * lisp.h (GET_EXTERNAL_LIST_LENGTH): + * lisp.h (EXTERNAL_ALIST_LOOP_5): + * lisp.h (EXTERNAL_ALIST_LOOP_6): + * lisp.h (EXTERNAL_ALIST_LOOP_6_NO_DECLARE): + * lisp.h (EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE): + * lisp.h (EXTERNAL_PROPERTY_LIST_LOOP_7): + * lisp.h (struct Lisp_Symbol): + * lisp.h (maybe_continuable_error_with_frob): + Fix up section comments. + Add new types for char to indicate usage. + Delete symbols auto-generated from general-slots.h. + Add prototypes for structured error functions. + Add long comments describing looping macros and change interface + so that lvalues are automatically declared. Add NO_DECLARE macro in case callers want to declare lvalues themselves. - * lread.c (read_syntax_error): - * lread.c (continuable_read_syntax_error): - * lread.c (read_structure): - * lread.c (sequence_reader): - * lread.c (read_list_conser): - * lread.c (read_compiled_function): - Rename syntax_error and continuable_syntax_error to avoid clash - with same-named structured error functions. - - * menubar-msw.c (mswindows_translate_menu_or_dialog_item): - * menubar-msw.c (populate_menu_add_item): - * menubar-msw.c (populate_or_checksum_helper): - [5]. - [9]. + * lread.c (read_syntax_error): + * lread.c (continuable_read_syntax_error): + * lread.c (read_structure): + * lread.c (sequence_reader): + * lread.c (read_list_conser): + * lread.c (read_compiled_function): + Rename syntax_error and continuable_syntax_error to avoid clash + with same-named structured error functions. + + * menubar-msw.c (mswindows_translate_menu_or_dialog_item): + * menubar-msw.c (populate_menu_add_item): + * menubar-msw.c (populate_or_checksum_helper): + [5]. + [9]. - * menubar-x.c: - * menubar-x.c (menu_item_descriptor_to_widget_value_1): - Mule-ize whole file. + * menubar-x.c: + * menubar-x.c (menu_item_descriptor_to_widget_value_1): + Mule-ize whole file. - * menubar.c (Fnormalize_menu_item_name): Add optimization. + * menubar.c (Fnormalize_menu_item_name): Add optimization. - * mule-charset.c (Fmake_charset): - * mule-wnnfns.c (Fwnn_set_param): - [1]. + * mule-charset.c (Fmake_charset): + * mule-wnnfns.c (Fwnn_set_param): + [1]. - * ntproc.c (create_child): - * ntproc.c (Fwin32_set_current_locale): - Add comments portending doom. - - * objects-msw.c: - * objects-msw.c (old_font_enum_callback_2): - * objects-msw.c (font_enum_callback_1): - * objects-msw.c (mswindows_enumerate_fonts): - [5]. - - * objects-x.c: - * objects-x.c (allocate_nearest_color): - * objects-x.c (x_parse_nearest_color): - * objects-x.c (x_initialize_color_instance): - * objects-x.c (x_print_color_instance): - * objects-x.c (x_finalize_color_instance): - * objects-x.c (x_valid_color_name_p): - * objects-x.c (x_initialize_font_instance): - * objects-x.c (x_print_font_instance): - * objects-x.c (valid_x_font_name_p): - * objects-x.c (truename_via_FONT_prop): - * objects-x.c (truename_via_random_props): - * objects-x.c (truename_via_XListFonts): - * objects-x.c (x_font_truename): - * objects-x.c (x_font_instance_truename): - * objects-x.c (x_font_instance_properties): - * objects-x.c (x_list_fonts): - * objects-x.c (x_find_charset_font): - Mule-ize entire file. - [7]. + * ntproc.c (create_child): + * ntproc.c (Fwin32_set_current_locale): + Add comments portending doom. - * objects-x.h: - Mule-verify. + * objects-msw.c: + * objects-msw.c (old_font_enum_callback_2): + * objects-msw.c (font_enum_callback_1): + * objects-msw.c (mswindows_enumerate_fonts): + [5]. - * print.c: - * print.c (std_handle_out_external): - * print.c (debug_print_no_newline): - * print.c (syms_of_print): - Output to all debugger kinds in debug-print. - Fix console-output code under MSWin to actually work. - - * process-nt.c (send_signal): - * process-nt.c (nt_create_process): - Use newer Unicode macros. - - * process-unix.c (unix_create_process): - * process-unix.c (unix_canonicalize_host_name): - * process-unix.c (unix_open_network_stream): - [7]. + * objects-x.c: + * objects-x.c (allocate_nearest_color): + * objects-x.c (x_parse_nearest_color): + * objects-x.c (x_initialize_color_instance): + * objects-x.c (x_print_color_instance): + * objects-x.c (x_finalize_color_instance): + * objects-x.c (x_valid_color_name_p): + * objects-x.c (x_initialize_font_instance): + * objects-x.c (x_print_font_instance): + * objects-x.c (valid_x_font_name_p): + * objects-x.c (truename_via_FONT_prop): + * objects-x.c (truename_via_random_props): + * objects-x.c (truename_via_XListFonts): + * objects-x.c (x_font_truename): + * objects-x.c (x_font_instance_truename): + * objects-x.c (x_font_instance_properties): + * objects-x.c (x_list_fonts): + * objects-x.c (x_find_charset_font): + Mule-ize entire file. + [7]. - * scrollbar-x.c: - Mule-verify. + * objects-x.h: + Mule-verify. - * search.c (syms_of_search): - [2]. + * print.c: + * print.c (std_handle_out_external): + * print.c (debug_print_no_newline): + * print.c (syms_of_print): + Output to all debugger kinds in debug-print. + Fix console-output code under MSWin to actually work. - * select-msw.c (mswindows_destroy_selection): - Use LIST_LOOP_2. + * process-nt.c (send_signal): + * process-nt.c (nt_create_process): + Use newer Unicode macros. - * select-x.c (symbol_to_x_atom): - [7]. + * process-unix.c (unix_create_process): + * process-unix.c (unix_canonicalize_host_name): + * process-unix.c (unix_open_network_stream): + [7]. - * select.c (syms_of_select): - [2]. + * scrollbar-x.c: + Mule-verify. - * sound.c (Fplay_sound_file): - [7]. + * search.c (syms_of_search): + [2]. - * specifier.c: - * specifier.c (decode_specifier_type): - * specifier.c (Fvalid_specifier_locale_type_p): - * specifier.c (check_valid_locale_or_locale_type): - * specifier.c (decode_locale): - * specifier.c (decode_locale_type): - * specifier.c (decode_locale_list): - * specifier.c (check_valid_domain): - * specifier.c (decode_specifier_tag_set): - * specifier.c (Fcanonicalize_tag_set): - * specifier.c (Fdefine_specifier_tag): - * specifier.c (Fspecifier_tag_predicate): - * specifier.c (check_valid_inst_list): - * specifier.c (check_valid_spec_list): - * specifier.c (decode_how_to_add_specification): - * specifier.c (check_modifiable_specifier): - * specifier.c (specifier_add_spec): - * specifier.c (boolean_validate): - * specifier.c (display_table_validate): - [9]. + * select-msw.c (mswindows_destroy_selection): + Use LIST_LOOP_2. - * specifier.c (syms_of_specifier): - Move some symbols to general-slots.h. - [2]. + * select-x.c (symbol_to_x_atom): + [7]. - * symbols.c: - * symbols.c (Fmapatoms): - * symbols.c (Fapropos_internal): - Add GCPROs. + * select.c (syms_of_select): + [2]. - * symbols.c (set_default_buffer_slot_variable): - * symbols.c (set_default_console_slot_variable): - [1]. + * sound.c (Fplay_sound_file): + [7]. + + * specifier.c: + * specifier.c (decode_specifier_type): + * specifier.c (Fvalid_specifier_locale_type_p): + * specifier.c (check_valid_locale_or_locale_type): + * specifier.c (decode_locale): + * specifier.c (decode_locale_type): + * specifier.c (decode_locale_list): + * specifier.c (check_valid_domain): + * specifier.c (decode_specifier_tag_set): + * specifier.c (Fcanonicalize_tag_set): + * specifier.c (Fdefine_specifier_tag): + * specifier.c (Fspecifier_tag_predicate): + * specifier.c (check_valid_inst_list): + * specifier.c (check_valid_spec_list): + * specifier.c (decode_how_to_add_specification): + * specifier.c (check_modifiable_specifier): + * specifier.c (specifier_add_spec): + * specifier.c (boolean_validate): + * specifier.c (display_table_validate): + [9]. - * symbols.c (defsymbol_massage_name_1): - * symbols.c (defkeyword_massage_name): - * symbols.c (deferror_1): - * symbols.c (deferror): - * symbols.c (deferror_massage_name_and_message): - * symeval.h: - * symeval.h (DEFSYMBOL): - Support DEFSYMBOL*, DEFKEYWORD, DEFERROR + * specifier.c (syms_of_specifier): + Move some symbols to general-slots.h. + [2]. - * symbols.c (syms_of_symbols): - [2]. + * symbols.c: + * symbols.c (Fmapatoms): + * symbols.c (Fapropos_internal): + Add GCPROs. - * symsinit.h: - * symsinit.h (init_win32): New. - Also new is syms_of_dialog_mswindows. + * symbols.c (set_default_buffer_slot_variable): + * symbols.c (set_default_console_slot_variable): + [1]. - * syswindows.h: + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defkeyword_massage_name): + * symbols.c (deferror_1): + * symbols.c (deferror): + * symbols.c (deferror_massage_name_and_message): + * symeval.h: + * symeval.h (DEFSYMBOL): + Support DEFSYMBOL*, DEFKEYWORD, DEFERROR + + * symbols.c (syms_of_symbols): + [2]. + + * symsinit.h: + * symsinit.h (init_win32): New. + Also new is syms_of_dialog_mswindows. + + * syswindows.h: Add new Unicode macros, missing Cygwin wide-char functions, convenience conversion macros for Qmswindows_tstr, macros for encapsulating required MSWin <-> Cygwin filename conversions, prototype for dynamically-extracted (not in NT 3.51) functions. - * toolbar-x.c: - Mule-verify. + * toolbar-x.c: + Mule-verify. - * tooltalk.c (Fadd_tooltalk_message_arg): - * tooltalk.c (Fadd_tooltalk_pattern_attribute): - * tooltalk.c (Fadd_tooltalk_pattern_arg): - [7]. + * tooltalk.c (Fadd_tooltalk_message_arg): + * tooltalk.c (Fadd_tooltalk_pattern_attribute): + * tooltalk.c (Fadd_tooltalk_pattern_arg): + [7]. - * tooltalk.c (syms_of_tooltalk): - [2]. + * tooltalk.c (syms_of_tooltalk): + [2]. - * unexnt.c: - * unexnt.c (unexec): - Fix up headers, declaration of unexec() to be more standard. + * unexnt.c: + * unexnt.c (unexec): + Fix up headers, declaration of unexec() to be more standard. 2000-07-20 Martin Buchholz @@ -10255,7 +14555,7 @@ * mule-canna.c (CANNA_mode_keys): make static. Use proper prototypes, even for functions of no arguments. - Remove external prototype for Fding(). + RemOve external prototype for Fding(). * symsinit.h: Add missing prototype for reinit_vars_of_mule_wnn. @@ -10490,36 +14790,36 @@ 2000-07-05 Craig Lanning - * Makefile.in.in: Add support for including the Windows resources - when building with the cygwin and mingw targets. + * Makefile.in.in: Add support for including the Windows resources + when building with the cygwin and mingw targets. - * buffer.c: from Dan Holmsand, on Windows $PWD is most likely either - not set or not correct. - (directory_is_current_directory): Don't compile for WIN32_NATIVE. - (init_initial_directory): Don't try to use $PWD on the - WIN32_NATIVE target. + * buffer.c: from Dan Holmsand, on Windows $PWD is most likely either + not set or not correct. + (directory_is_current_directory): Don't compile for WIN32_NATIVE. + (init_initial_directory): Don't try to use $PWD on the + WIN32_NATIVE target. - * s\cygwin32.h: + * s\cygwin32.h: [[Add -mwindows to eliminate console window.]] not required --ben - (HAVE_NATIVE_SOUND): removed; now handled by configure. - (MAIL_USE_POP): removed; now handled by configure. + (HAVE_NATIVE_SOUND): removed; now handled by configure. + (MAIL_USE_POP): removed; now handled by configure. - * s\mingw32.h: [[Add -mwindows to eliminate console window.]] not in + * s\mingw32.h: [[Add -mwindows to eliminate console window.]] not in C_SWITCH_SYSTEM or it will affect lib-src progs. --ben - (HAVE_NATIVE_SOUND): removed; now handled by configure. - (MAIL_USE_POP): removed; now handled by configure. - (ENCAPSULATE_STAT): from Dan Holmsand, added. - (ENCAPSULATE_FSTAT): from Dan Holmsand, added. - (DIRECTORY_SEP): from Dan Holmsand, use lisp variable instead of - constant string. - (HAVE_TIMEVAL): from Dan Holmsand, added; struct timeval is picked - up from via systime.h. - (HAVE_GETPAGESIZE): from Dan Holmsand, added. - (getpagesize): from Dan Holmsand, added. - Added #endif which was left dangling by Ben's mega patch; added - comment to help prevent this in the future. + (HAVE_NATIVE_SOUND): removed; now handled by configure. + (MAIL_USE_POP): removed; now handled by configure. + (ENCAPSULATE_STAT): from Dan Holmsand, added. + (ENCAPSULATE_FSTAT): from Dan Holmsand, added. + (DIRECTORY_SEP): from Dan Holmsand, use lisp variable instead of + constant string. + (HAVE_TIMEVAL): from Dan Holmsand, added; struct timeval is picked + up from via systime.h. + (HAVE_GETPAGESIZE): from Dan Holmsand, added. + (getpagesize): from Dan Holmsand, added. + Added #endif which was left dangling by Ben's mega patch; added + comment to help prevent this in the future. - * sysdll.c: added #include for WIN32_NATIVE case. + * sysdll.c: added #include for WIN32_NATIVE case. 2000-07-05 Kirill 'Big K' Katsnelson @@ -10617,13 +14917,13 @@ 2000-06-08 Mike Alexander - (MAX_SHOVE_BUFFER_SIZE): Change to 512 to match stream buffer size - (shove_thread): Don't write the same output twice - (make_ntpipe_output_stream): Increase priority of shove thread - (ntpipe_shove_writer): Call SwitchToThread to give shove thread a - chance to run - (ntpipe_shove_closer): Don't delete the pipe until we're done with - it. + (MAX_SHOVE_BUFFER_SIZE): Change to 512 to match stream buffer size + (shove_thread): Don't write the same output twice + (make_ntpipe_output_stream): Increase priority of shove thread + (ntpipe_shove_writer): Call SwitchToThread to give shove thread a + chance to run + (ntpipe_shove_closer): Don't delete the pipe until we're done with + it. 2000-06-12 Ben Wing @@ -12414,12 +16714,12 @@ * redisplay.c (add_glyph_rune): Don't set 0 to bufpos for text image glyph if allow_cursor. - (add_hscroll_rune): Don't allow cursor to border glyph. - (create_text_block): Ditto. + (add_hscroll_rune): Don't allow cursor to border glyph. + (create_text_block): Ditto. * redisplay-output.c (redisplay_move_cursor): Do nothing even if text not in buffer. - (redisplay_output_layout): Call ensure_face_cachel_complete for + (redisplay_output_layout): Call ensure_face_cachel_complete for text image glyph. @@ -12998,7 +17298,7 @@ * alloc.c (pdump_register_struct): * alloc.c (pdump_dump_data): * alloc.c (pdump_reloc_one): - Minor cleanups. + Minor cleanups. * console-msw.c: * console-msw.c (GetConsoleHwnd): @@ -13008,16 +17308,16 @@ * console-msw.c (msw_output_console_string): * console-msw.c (console_type_create_mswindows): - a) Added functions to manipulate the console window for use with - shell support. + a) Added functions to manipulate the console window for use with + shell support. - b) Added support for writing text to the console, which is now - used under Windows when xemacs is not being run non-interactively, - to write text that would otherwise be destined for stdout because - under these circumstances, text written to stdout tends to - disappear and not be seen. + b) Added support for writing text to the console, which is now + used under Windows when xemacs is not being run non-interactively, + to write text that would otherwise be destined for stdout because + under these circumstances, text written to stdout tends to + disappear and not be seen. - * console-msw.h: + * console-msw.h: * event-Xt.c: * event-Xt.c (x_event_to_emacs_event): * event-Xt.c (describe_event_window): @@ -13071,20 +17371,20 @@ * device-msw.c (msw_get_workspace_coords): * device-msw.c (mswindows_device_system_metrics): and various other files, added support for a new - device property called offset-workspace which returns the position - of the upper left corner of the workspace area and goes along with - the existing size-workspace property. + device property called offset-workspace which returns the position + of the upper left corner of the workspace area and goes along with + the existing size-workspace property. * dialog-msw.c: * dialog-msw.c (push_bufbyte_string_as_unicode): * dialog-msw.c (mswindows_popup_dialog_box): - Added support for XEmacs-style accelerator specifications in - button text. Note: I didn't add support for this under X Windows, - and somebody needs to do this. + Added support for XEmacs-style accelerator specifications in + button text. Note: I didn't add support for this under X Windows, + and somebody needs to do this. * dialog.c: * dialog.c (Fpopup_dialog_box): - Documented the support for accelerators that was just mentioned. + Documented the support for accelerators that was just mentioned. editfns.c (get_home_directory): Changed behavior under Windows when HOME not defined; former behavior was irretrievably broken. @@ -13103,9 +17403,9 @@ * print.c (debug_print): * print.c (debug_backtrace): * print.c (debug_short_backtrace): - Cleaned up the code that prints text to stdout so that this can be - changed to output into a console window instead under MS Windows, - as described above. + Cleaned up the code that prints text to stdout so that this can be + changed to output into a console window instead under MS Windows, + as described above. * eval.c: * eval.c (DEFEND_AGAINST_THROW_RECURSION): @@ -13127,14 +17427,14 @@ * event-msw.c (mswindows_modifier_state): * event-msw.c (emacs_mswindows_quit_p): * event-msw.c (vars_of_event_mswindows): - a) Added support for using the alt key to select menu items as is - standard under MS Windows. This is controlled using the variable - menu-accelerator-enabled, just like under X Windows. There is an - option on the options menu to turn this support on. I really - think that it should be on by default under Windows, but I'm not - going to make this change yet. + a) Added support for using the alt key to select menu items as is + standard under MS Windows. This is controlled using the variable + menu-accelerator-enabled, just like under X Windows. There is an + option on the options menu to turn this support on. I really + think that it should be on by default under Windows, but I'm not + going to make this change yet. - b) Added support for dynamic display size changes under Windows. + b) Added support for dynamic display size changes under Windows. * event-stream.c: * event-stream.c (maybe_echo_keys): @@ -13149,30 +17449,30 @@ * event-stream.c (complex_vars_of_event_stream): * events.h (struct command_builder): - a) Tried to clean up a little bit the horribly written x-specific - accelerator code that crept into this file. I moved this code - into menubar-x.c where it belongs. I also needed to move the - command builder structure into the file events.h because it is - accessed directly by this accelerator code. What I didn't do, but - which should be done at some point, is to properly abstract this - code using device methods instead of the kludgy way that it - currently hooks into the event code. - - b) Added the lisp variables this-command-properties and - last-command- properties, which should be used to synchronize two - adjacent commands in preference to playing games with the variable - this-command, which is typically what happens. - - c) Added some slightly nasty code to hook into the lisp support - for shifted- motion-key selection. This is actually necessary for - somewhat complicated reasons, which are described in - simple.el. (NB: I think the proper thing would be to have the code - that calls the pre and post command hooks also call out to generic - lisp functions in simple.el, where all built-in stuff could be - added. I will think about this more.) + a) Tried to clean up a little bit the horribly written x-specific + accelerator code that crept into this file. I moved this code + into menubar-x.c where it belongs. I also needed to move the + command builder structure into the file events.h because it is + accessed directly by this accelerator code. What I didn't do, but + which should be done at some point, is to properly abstract this + code using device methods instead of the kludgy way that it + currently hooks into the event code. + + b) Added the lisp variables this-command-properties and + last-command- properties, which should be used to synchronize two + adjacent commands in preference to playing games with the variable + this-command, which is typically what happens. + + c) Added some slightly nasty code to hook into the lisp support + for shifted- motion-key selection. This is actually necessary for + somewhat complicated reasons, which are described in + simple.el. (NB: I think the proper thing would be to have the code + that calls the pre and post command hooks also call out to generic + lisp functions in simple.el, where all built-in stuff could be + added. I will think about this more.) * event-unixoid.c (poll_fds_for_input): - * lread.c (readchar): + * lread.c (readchar): * redisplay-tty.c (tty_clear_frame): * redisplay-x.c (x_get_gc): * signal.c (interrupt_signal): @@ -13185,33 +17485,33 @@ * frame-msw.c: * frame-msw.c (mswindows_size_frame_internal): - Fixed the computation of frame size and position to keep the frame - within the workspace area, rather than within the physical - dimensions of the screen, so that the frame doesn't overlap window - manager decorations, such as the start menu and toolbar, typically - at the bottom of the screen. + Fixed the computation of frame size and position to keep the frame + within the workspace area, rather than within the physical + dimensions of the screen, so that the frame doesn't overlap window + manager decorations, such as the start menu and toolbar, typically + at the bottom of the screen. * frame.c (vars_of_frame): - Changed the default frame title format under MS Windows to consist - of buffername-XEmacs, which is standard under MS Windows. I think - it might be a good idea to change this everywhere because I think - it is superior to the current frame title format, but this is the - kind of change that is likely to cause some people to get annoyed, - so I'm not making it. + Changed the default frame title format under MS Windows to consist + of buffername-XEmacs, which is standard under MS Windows. I think + it might be a good idea to change this everywhere because I think + it is superior to the current frame title format, but this is the + kind of change that is likely to cause some people to get annoyed, + so I'm not making it. * glyphs-eimage.c (png_instantiate): Fixed some compile warnings. * gui-msw.c (mswindows_handle_gui_wm_command): - Fixed compile warnings. + Fixed compile warnings. * gui-x.c: * gui-x.c (strdup_and_add_accel): * gui-x.c (button_item_to_widget_value): * gui-x.h: - Added code to automatically put an accelerator onto the beginning - of menu items that don't have one as is now the standard, and is - described more later. Also fixed things so that the menu item - name can be an evaluated expression, again a new standard. + Added code to automatically put an accelerator onto the beginning + of menu items that don't have one as is now the standard, and is + described more later. Also fixed things so that the menu item + name can be an evaluated expression, again a new standard. * gui.c: * gui.c (gui_item_add_keyval_pair): @@ -13230,9 +17530,9 @@ * line-number.c (buffer_line_number): * lisp.h: * lisp.h (EMACS_INT_MAX): - Added the manifest constant EMACS_INT_MIN corresponding to the - existing constant EMACS_INT_MAX. This is partially to fix compile - warnings under Windows, and partly for cleanliness. + Added the manifest constant EMACS_INT_MIN corresponding to the + existing constant EMACS_INT_MAX. This is partially to fix compile + warnings under Windows, and partly for cleanliness. * menubar-msw.c: * menubar-msw.c (REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIGHT_FLUSH): @@ -13251,15 +17551,15 @@ * menubar-msw.c (mswindows_update_frame_menubars): * menubar-msw.c (mswindows_free_frame_menubars): * menubar-msw.c (mswindows_popup_menu): - Fixed a bug in handling accelerators where an extra character - would be displayed in the menu item. Also generalized the - function displayable_menu_item because it is now used by the - dialog box code as well. And finally, added code in the functions - that create the menubar to extract a list of accelerators for the - top level menubar, which is used in the event code to determine - whether a particular alt-key combination should be used to invoke - a menu item, or should be passed through to access the standard - XEmacs keymap binding for this key combination. + Fixed a bug in handling accelerators where an extra character + would be displayed in the menu item. Also generalized the + function displayable_menu_item because it is now used by the + dialog box code as well. And finally, added code in the functions + that create the menubar to extract a list of accelerators for the + top level menubar, which is used in the event code to determine + whether a particular alt-key combination should be used to invoke + a menu item, or should be passed through to access the standard + XEmacs keymap binding for this key combination. Much needed GCPROing. @@ -13278,10 +17578,10 @@ * menubar-x.c (command_builder_find_menu_accelerator): * menubar-x.c (Faccelerate_menu): * menubar.h: - Moved a whole bunch of code here that was previously in - event-stream.c as described above. There is also code connected - to the new standard of adding an accelerator to the beginning of - menu items that don't have one as described above and below. + Moved a whole bunch of code here that was previously in + event-stream.c as described above. There is also code connected + to the new standard of adding an accelerator to the beginning of + menu items that don't have one as described above and below. * menubar.c: * menubar.c (menu_parse_submenu_keywords): @@ -13291,31 +17591,31 @@ * menubar.c (vars_of_menubar): * menubar.c (complex_vars_of_menubar): - a) Cleaned up a bunch of documentation and improved it. + a) Cleaned up a bunch of documentation and improved it. - b) XEmacs now automatically adds an accelerator onto the beginning - of any menu items that don't have one. I did this because there - will inevitably be some menu items on the main menubar that don't - have accelerators on them because the package that adds that - particular menu item hasn't yet been fixed up to have accelerators - in them and it looked rather strange to have some items with and - some items without accelerators, especially since even in items - without accelerators, you can, at least under windows, still - access the item through an accelerator corresponding to the first - character in the item's name. If people don't like this behavior, - I can add a variable to turn it off optionally, but I'm not sure - this is a good idea because we really do need to have accelerators - on all of the menu items, and if a package doesn't like the - accelerators being put on the first character, then it should put - the accelerators where they belong. - - c) I made a behavior change, which is that the descriptor that - specifies the text of the menu item, which formerly was just a - string, can now also be an evaluated expression. This makes this - descriptor parallel with all of the others, which could also be - evaluated expressions. This also obviates the need for the - keyword :label, which was previously listed in the documentation - as unimplemented, and which was for the same purpose. + b) XEmacs now automatically adds an accelerator onto the beginning + of any menu items that don't have one. I did this because there + will inevitably be some menu items on the main menubar that don't + have accelerators on them because the package that adds that + particular menu item hasn't yet been fixed up to have accelerators + in them and it looked rather strange to have some items with and + some items without accelerators, especially since even in items + without accelerators, you can, at least under windows, still + access the item through an accelerator corresponding to the first + character in the item's name. If people don't like this behavior, + I can add a variable to turn it off optionally, but I'm not sure + this is a good idea because we really do need to have accelerators + on all of the menu items, and if a package doesn't like the + accelerators being put on the first character, then it should put + the accelerators where they belong. + + c) I made a behavior change, which is that the descriptor that + specifies the text of the menu item, which formerly was just a + string, can now also be an evaluated expression. This makes this + descriptor parallel with all of the others, which could also be + evaluated expressions. This also obviates the need for the + keyword :label, which was previously listed in the documentation + as unimplemented, and which was for the same purpose. d) GCPROing. @@ -13324,10 +17624,10 @@ * ntproc.c (sys_spawnve): * ntproc.c (find_child_console): * ntproc.c (sys_kill): - Fixed compile warnings. By the way, this file should really go - away entirely, and this will happen as soon as Kirill makes his - final round of process cleanups, which affect the function - call-process. + Fixed compile warnings. By the way, this file should really go + away entirely, and this will happen as soon as Kirill makes his + final round of process cleanups, which affect the function + call-process. * process-nt.c: * process-nt.c (struct nt_process_data): @@ -13343,17 +17643,17 @@ * process-nt.c (nt_kill_process_by_pid): * process-nt.c (nt_open_network_stream): * process-nt.c (vars_of_process_nt): - Copied over code from Emacs 20.5 to correctly send signals to sub- - processes under Windows 95. Also added code to automatically - create and hide console window when a sub-process is created under - Windows 95, which obviates the need for the separate runemacs.exe - executable, and finally implemented some variables that were - implemented in Emacs 20.5, but previously not in XEmacs. These - include mswindows- start-process-share-console and - mswindows-start-process-inherit-error-mode. (Both of these only - apply to Windows 95.) + Copied over code from Emacs 20.5 to correctly send signals to sub- + processes under Windows 95. Also added code to automatically + create and hide console window when a sub-process is created under + Windows 95, which obviates the need for the separate runemacs.exe + executable, and finally implemented some variables that were + implemented in Emacs 20.5, but previously not in XEmacs. These + include mswindows- start-process-share-console and + mswindows-start-process-inherit-error-mode. (Both of these only + apply to Windows 95.) - * regex.c (regex_compile): Fixed a compile warning. + * regex.c (regex_compile): Fixed a compile warning. * select-msw.c: * select-msw.c (mswindows_own_selection): @@ -13361,20 +17661,20 @@ * select-msw.c (mswindows_disown_selection): * select-msw.c (console_type_create_select_mswindows): * select-msw.c (syms_of_select_mswindows): - Cleaned up the file and implemented the device method - selection_exists_p, which had accidentally been left out. Also - removed four lisp functions that were remnants from before the - time when the selection code was properly device abstracted. - These functions are no longer needed because there are generic - equivalents, and because they were added recently and don't exist - in FSF Emacs, I don't think there's any problem with just deleting - them. + Cleaned up the file and implemented the device method + selection_exists_p, which had accidentally been left out. Also + removed four lisp functions that were remnants from before the + time when the selection code was properly device abstracted. + These functions are no longer needed because there are generic + equivalents, and because they were added recently and don't exist + in FSF Emacs, I don't think there's any problem with just deleting + them. * sysdep.c: * sysdep.c (sys_subshell): - Fixed a compile warning, although in this case there's probably - something wrong with this code, and it ought to be looked into - more thoroughly by somebody who understands it. + Fixed a compile warning, although in this case there's probably + something wrong with this code, and it ought to be looked into + more thoroughly by somebody who understands it. * window.c: * window.c (Fwindow_text_area_height): @@ -13383,13 +17683,13 @@ * window.c (Fwindow_pixel_width): * window.c (debug_print_window): * window.c (syms_of_window): - Added functions window-text-area-height and window-full-width, - which are functions for returning various width and height - characteristics of a window. (One of these functions is necessary - for making the file dialog box work correctly, and the other one - was added for completeness.) Also added a table to the - documentation for window-height which describes the entire scheme - for accessing width and height characteristics of a window. + Added functions window-text-area-height and window-full-width, + which are functions for returning various width and height + characteristics of a window. (One of these functions is necessary + for making the file dialog box work correctly, and the other one + was added for completeness.) Also added a table to the + documentation for window-height which describes the entire scheme + for accessing width and height characteristics of a window. 2000-03-12 Kirill 'Big K' Katsnelson diff --text -u 'xemacs-21.5.6/src/EmacsFrame.c' 'xemacs-21.5.7/src/EmacsFrame.c' Index: ././src/EmacsFrame.c --- ././src/EmacsFrame.c Sun Mar 31 17:27:40 2002 +++ ././src/EmacsFrame.c Fri Jun 21 06:18:20 2002 @@ -29,13 +29,13 @@ #include #include "lisp.h" -#include "device.h" +#include "device-impl.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "toolbar.h" #include "window.h" -#include "console-x.h" +#include "console-x-impl.h" #include "glyphs-x.h" #include "objects-x.h" @@ -131,24 +131,6 @@ { XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, XtRInt, sizeof (int), offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, - { XtNtopToolBarShadowColor, XtCTopToolBarShadowColor, - XtRPixel, sizeof (Pixel), - offset(top_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" }, - { XtNbottomToolBarShadowColor, XtCBottomToolBarShadowColor, - XtRPixel, sizeof (Pixel), - offset (bottom_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" }, - { XtNbackgroundToolBarColor, XtCBackgroundToolBarColor, - XtRPixel, sizeof (Pixel), - offset (background_toolbar_pixel), XtRImmediate, (XtPointer)-1 }, - { XtNforegroundToolBarColor, XtCForegroundToolBarColor, - XtRPixel, sizeof (Pixel), - offset (foreground_toolbar_pixel), XtRImmediate, (XtPointer)-1 }, - { XtNtopToolBarShadowPixmap, XtCTopToolBarShadowPixmap, - XtRPixmap, sizeof (Pixmap), - offset (top_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None }, - { XtNbottomToolBarShadowPixmap, XtCBottomToolBarShadowPixmap, - XtRPixmap, sizeof (Pixmap), - offset (bottom_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None }, { XtNtoolBarShadowThickness, XtCToolBarShadowThickness, XtRDimension, sizeof (Dimension), offset (toolbar_shadow_thickness), XtRImmediate, (XtPointer)2 }, @@ -400,7 +382,6 @@ EmacsFrame cur = (EmacsFrame) cur_widget; EmacsFrame new = (EmacsFrame) new_widget; struct frame *f = new->emacs_frame.frame; - Lisp_Object frame = wrap_frame (f); in_resource_setting++; /* This function does not need to do much. Pretty much everything interesting will get done in the resize method, which will @@ -438,13 +419,13 @@ Fadd_spec_to_specifier (Vscrollbar_width, make_int (new->emacs_frame.scrollbar_width), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.scrollbar_height != new->emacs_frame.scrollbar_height) Fadd_spec_to_specifier (Vscrollbar_height, make_int (new->emacs_frame.scrollbar_height), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); #endif /* HAVE_SCROLLBARS */ #ifdef HAVE_TOOLBARS if (cur->emacs_frame.top_toolbar_height != @@ -452,49 +433,49 @@ Fadd_spec_to_specifier (Vtoolbar_size[TOP_TOOLBAR], make_int (new->emacs_frame.top_toolbar_height), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.bottom_toolbar_height != new->emacs_frame.bottom_toolbar_height) Fadd_spec_to_specifier (Vtoolbar_size[BOTTOM_TOOLBAR], make_int (new->emacs_frame.bottom_toolbar_height), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.left_toolbar_width != new->emacs_frame.left_toolbar_width) Fadd_spec_to_specifier (Vtoolbar_size[LEFT_TOOLBAR], make_int (new->emacs_frame.left_toolbar_width), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.right_toolbar_width != new->emacs_frame.right_toolbar_width) Fadd_spec_to_specifier (Vtoolbar_size[RIGHT_TOOLBAR], make_int (new->emacs_frame.right_toolbar_width), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.top_toolbar_border_width != new->emacs_frame.top_toolbar_border_width) Fadd_spec_to_specifier (Vtoolbar_border_width[TOP_TOOLBAR], make_int (new->emacs_frame.top_toolbar_border_width), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.bottom_toolbar_border_width != new->emacs_frame.bottom_toolbar_border_width) Fadd_spec_to_specifier (Vtoolbar_border_width[BOTTOM_TOOLBAR], make_int (new->emacs_frame.bottom_toolbar_border_width), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.left_toolbar_border_width != new->emacs_frame.left_toolbar_border_width) Fadd_spec_to_specifier (Vtoolbar_border_width[LEFT_TOOLBAR], make_int (new->emacs_frame.left_toolbar_border_width), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); if (cur->emacs_frame.right_toolbar_border_width != new->emacs_frame.right_toolbar_border_width) Fadd_spec_to_specifier (Vtoolbar_border_width[RIGHT_TOOLBAR], make_int (new->emacs_frame.right_toolbar_border_width), - frame, Qnil, Qnil); + wrap_frame (f), Qnil, Qnil); #endif /* HAVE_TOOLBARS */ in_resource_setting--; @@ -583,7 +564,7 @@ XrmValuePtr toVal) { XrmQuark q; - char *lowerName = (char *) alloca (strlen ((char *) fromVal->addr) + 1); + char *lowerName = (char *) ALLOCA (strlen ((char *) fromVal->addr) + 1); XmuCopyISOLatin1Lowered (lowerName, (char *) fromVal->addr); q = XrmStringToQuark (lowerName); diff --text -u 'xemacs-21.5.6/src/EmacsFrameP.h' 'xemacs-21.5.7/src/EmacsFrameP.h' Index: ././src/EmacsFrameP.h --- ././src/EmacsFrameP.h Fri Apr 13 03:23:22 2001 +++ ././src/EmacsFrameP.h Fri Jun 7 22:34:50 2002 @@ -57,12 +57,6 @@ int bottom_toolbar_border_width; /* ... of bottom toolbar */ int left_toolbar_border_width; /* ... of left toolbar */ int right_toolbar_border_width; /* ... of right toolbar */ - Pixel top_toolbar_shadow_pixel; - Pixel bottom_toolbar_shadow_pixel; - Pixel background_toolbar_pixel; - Pixel foreground_toolbar_pixel; - Pixmap top_toolbar_shadow_pixmap; - Pixmap bottom_toolbar_shadow_pixmap; Dimension toolbar_shadow_thickness; unsigned char scrollbar_placement; int interline; /* skips between lines */ diff --text -u 'xemacs-21.5.6/src/ExternalShell.c' 'xemacs-21.5.7/src/ExternalShell.c' Index: ././src/ExternalShell.c --- ././src/ExternalShell.c Fri Apr 13 03:23:23 2001 +++ ././src/ExternalShell.c Sun Jun 23 18:54:40 2002 @@ -611,8 +611,7 @@ hack_event_masks_1 (Display *display, Window w, int this_window_propagate) { Window root, parent, *children; - unsigned int nchildren; - int i; + unsigned int nchildren, i; if (!XQueryTree (display, w, &root, &parent, &children, &nchildren)) return; diff --text -u 'xemacs-21.5.6/src/Makefile.in.in' 'xemacs-21.5.7/src/Makefile.in.in' Index: ././src/Makefile.in.in --- ././src/Makefile.in.in Fri Mar 29 13:46:53 2002 +++ ././src/Makefile.in.in Tue May 28 17:44:44 2002 @@ -307,11 +307,13 @@ ## if they all come out null. objs=\ - abbrev.o alloc.o $(balloon_help_objs) blocktype.o buffer.o bytecode.o\ - callint.o callproc.o casefiddle.o casetab.o chartab.o $(clash_detection_objs)\ - cmdloop.o cmds.o $(coding_system_objs) console.o console-stream.o\ + abbrev.o alloc.o alloca.o \ + $(balloon_help_objs) blocktype.o buffer.o bytecode.o \ + callint.o casefiddle.o casetab.o chartab.o \ + $(clash_detection_objs) cmdloop.o cmds.o $(coding_system_objs) console.o \ + console-stream.o\ data.o $(database_objs) $(debug_objs) device.o dired.o doc.o doprnt.o\ - dynarr.o\ + dynarr.o \ editfns.o elhash.o emacs.o eval.o events.o\ event-stream.o $(event_unixoid_objs) $(extra_objs) extents.o\ faces.o file-coding.o fileio.o $(LOCK_OBJ) filemode.o floatfns.o fns.o \ @@ -600,7 +602,7 @@ ## We have automated tests!! testdir = ${srcdir}/../tests/automated -batch_test_emacs = ${batch} -l ${testdir}/test-harness.el -f batch-test-emacs ${testdir} +batch_test_emacs = ${batch_packages} -l ${testdir}/test-harness.el -f batch-test-emacs ${testdir} .PHONY: check check-temacs check: @@ -794,18 +796,13 @@ ## be used but generate no code. ## Some have it written in assembler in alloca.s. ## Some use the C version in alloca.c (these define C_ALLOCA in config.h). - +## Nowadays we always compile in the C version and use it to avoid stack +## overflow. #ifdef C_ALLOCA -## We could put something in alloca.c to #define free and malloc -## whenever emacs was #defined, but that's not appropriate for all -## users of alloca in Emacs. Check out ../lib-src/getopt.c. */ - -alloca.o : ${srcdir}/alloca.c - $(CC) -c -Dfree=xfree -Dmalloc=xmalloc $(cflags) ${srcdir}/alloca.c #else #ifndef HAVE_ALLOCA -alloca.o : ${srcdir}/alloca.s config.h +allocax.o : ${srcdir}/alloca.s config.h ## $(CPP) is cc -E, which may get confused by filenames ## that do not end in .c. So copy file to a safe name. */ ## cp ${srcdir}/alloca.s allocatem.c @@ -819,7 +816,6 @@ @$(RM) alloca.o ## Xenix, in particular, needs to run assembler via cc. $(CC) -c allocax.s - mv allocax.o alloca.o $(RM) allocax.s allocatem.c #endif /* HAVE_ALLOCA */ #endif /* ! defined (C_ALLOCA) */ diff --text -u /dev/null 'xemacs-21.5.7/src/README.global-renaming' Index: ././src/README.global-renaming --- ././src/README.global-renaming Thu Jan 1 09:00:00 1970 +++ ././src/README.global-renaming Wed Jun 5 21:01:09 2002 @@ -0,0 +1,206 @@ +README.global-renaming + +This file documents the generic scripts that have been used to implement +the recent type renamings, e.g. the "great integral type renaming" and the +"text/char type renaming". More information about these changes can be +found in the Internals manual. + +A sample script to do such renaming is this (used in the great integral +type renaming): + +----------------------------------- cut ------------------------------------ +files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]" +gr Memory_Count Bytecount $files +gr Lstream_Data_Count Bytecount $files +gr Element_Count Elemcount $files +gr Hash_Code Hashcode $files +gr extcount bytecount $files +gr bufpos charbpos $files +gr bytind bytebpos $files +gr memind membpos $files +gr bufbyte intbyte $files +gr Extcount Bytecount $files +gr Bufpos Charbpos $files +gr Bytind Bytebpos $files +gr Memind Membpos $files +gr Bufbyte Intbyte $files +gr EXTCOUNT BYTECOUNT $files +gr BUFPOS CHARBPOS $files +gr BYTIND BYTEBPOS $files +gr MEMIND MEMBPOS $files +gr BUFBYTE INTBYTE $files +gr MEMORY_COUNT BYTECOUNT $files +gr LSTREAM_DATA_COUNT BYTECOUNT $files +gr ELEMENT_COUNT ELEMCOUNT $files +gr HASH_CODE HASHCODE $files +----------------------------------- cut ------------------------------------ + + +`fixtypes.sh' is a Bourne-shell script; it uses 'gr': + + +----------------------------------- cut ------------------------------------ +#!/bin/sh + +# Usage is like this: + +# gr FROM TO FILES ... + +# globally replace FROM with TO in FILES. FROM and TO are regular expressions. +# backup files are stored in the `backup' directory. +from="$1" +to="$2" +shift 2 +echo ${1+"$@"} | xargs global-replace "s/$from/$to/g" +----------------------------------- cut ------------------------------------ + + +`gr' in turn uses a Perl script to do its real work, `global-replace', +which follows: + + +----------------------------------- cut ------------------------------------ +: #-*- Perl -*- + +### global-replace --- modify the contents of a file by a Perl expression + +## Copyright (C) 1999 Martin Buchholz. +## Copyright (C) 2001, 2002 Ben Wing. + +## Authors: Martin Buchholz , Ben Wing +## Maintainer: Ben Wing +## Current Version: 1.2, March 12, 2002 + +# This program 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. +# +# This program 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. + +eval 'exec perl -w -S $0 ${1+"$@"}' + if 0; + +use strict; +use FileHandle; +use Carp; +use Getopt::Long; +use File::Basename; + +(my $myName = $0) =~ s@.*/@@; my $usage=" +Usage: $myName [--help] [--backup-dir=DIR] [--line-mode] [--hunk-mode] + PERLEXPR FILE ... + +Globally modify a file, either line by line or in one big hunk. + +Typical usage is like this: + +[with GNU print, GNU xargs: guaranteed to handle spaces, quotes, etc. + in file names] + +find . -name '*.[ch]' -print0 | xargs -0 $0 's/\bCONST\b/const/g'\n + +[with non-GNU print, xargs] + +find . -name '*.[ch]' -print | xargs $0 's/\bCONST\b/const/g'\n + + +The file is read in, either line by line (with --line-mode specified) +or in one big hunk (with --hunk-mode specified; it's the default), and +the Perl expression is then evalled with \$_ set to the line or hunk of +text, including the terminating newline if there is one. It should +destructively modify the value there, storing the changed result in \$_. + +Files in which any modifications are made are backed up to the directory +specified using --backup-dir, or to `backup.orig' by default. To disable +this, use --backup-dir= with no argument. + +Hunk mode is the default because it is MUCH MUCH faster than line-by-line. +Use line-by-line only when it matters, e.g. you want to do a replacement +only once per line (the default without the `g' argument). Conversely, +when using hunk mode, *ALWAYS* use `g'; otherwise, you will only make one +replacement in the entire file! +"; + +my %options = (); +$Getopt::Long::ignorecase = 0; +&GetOptions ( + \%options, + 'help', 'backup-dir=s', 'line-mode', 'hunk-mode', +); + + +die $usage if $options{"help"} or @ARGV <= 1; +my $code = shift; + +die $usage if grep (-d || ! -w, @ARGV); + +sub SafeOpen { + open ((my $fh = new FileHandle), $_[0]); + confess "Can't open $_[0]: $!" if ! defined $fh; + return $fh; +} + +sub SafeClose { + close $_[0] or confess "Can't close $_[0]: $!"; +} + +sub FileContents { + my $fh = SafeOpen ("< $_[0]"); + my $olddollarslash = $/; + local $/ = undef; + my $contents = <$fh>; + $/ = $olddollarslash; + return $contents; +} + +sub WriteStringToFile { + my $fh = SafeOpen ("> $_[0]"); + binmode $fh; + print $fh $_[1] or confess "$_[0]: $!\n"; + SafeClose $fh; +} + +foreach my $file (@ARGV) { + my $changed_p = 0; + my $new_contents = ""; + if ($options{"line-mode"}) { + my $fh = SafeOpen $file; + while (<$fh>) { + my $save_line = $_; + eval $code; + $changed_p = 1 if $save_line ne $_; + $new_contents .= $_; + } + } else { + my $orig_contents = $_ = FileContents $file; + eval $code; + if ($_ ne $orig_contents) { + $changed_p = 1; + $new_contents = $_; + } + } + + if ($changed_p) { + my $backdir = $options{"backup-dir"}; + $backdir = "backup.orig" if !defined ($backdir); + if ($backdir) { + my ($name, $path, $suffix) = fileparse ($file, ""); + my $backfulldir = $path . $backdir; + my $backfile = "$backfulldir/$name"; + mkdir $backfulldir, 0755 unless -d $backfulldir; + print "modifying $file (original saved in $backfile)\n"; + rename $file, $backfile; + } + WriteStringToFile ($file, $new_contents); + } +} +----------------------------------- cut ------------------------------------ diff --text -u 'xemacs-21.5.6/src/abbrev.c' 'xemacs-21.5.7/src/abbrev.c' Index: ././src/abbrev.c --- ././src/abbrev.c Fri Mar 29 13:46:54 2002 +++ ././src/abbrev.c Wed Jun 5 18:54:52 2002 @@ -76,10 +76,12 @@ Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook; -struct abbrev_match_mapper_closure { +struct abbrev_match_mapper_closure +{ struct buffer *buf; - Lisp_Char_Table *chartab; - Charcount point, maxlen; + Lisp_Object chartab; + Charbpos point; + Charcount maxlen; Lisp_Symbol *found; }; @@ -103,7 +105,7 @@ return 0; } abbrev = symbol_name (sym); - abbrev_length = XSTRING_CHAR_LENGTH (abbrev); + abbrev_length = string_char_length (abbrev); if (abbrev_length > closure->maxlen) { /* This abbrev is too large -- it wouldn't fit. */ @@ -113,7 +115,7 @@ normally want to expand it. OTOH, if the abbrev begins with non-word syntax (e.g. `#if'), it is OK to abbreviate it anywhere. */ if (abbrev_length < closure->maxlen && abbrev_length > 0 - && (WORD_SYNTAX_P (closure->chartab, XSTRING_CHAR (abbrev, 0))) + && (WORD_SYNTAX_P (closure->chartab, string_ichar (abbrev, 0))) && (WORD_SYNTAX_P (closure->chartab, BUF_FETCH_CHAR (closure->buf, closure->point - @@ -123,7 +125,7 @@ } /* Match abbreviation string against buffer text. */ { - Intbyte *ptr = XSTRING_DATA (abbrev); + Ibyte *ptr = XSTRING_DATA (abbrev); Charcount idx; for (idx = 0; idx < abbrev_length; idx++) @@ -131,11 +133,11 @@ if (DOWNCASE (closure->buf, BUF_FETCH_CHAR (closure->buf, closure->point - abbrev_length + idx)) - != DOWNCASE (closure->buf, charptr_emchar (ptr))) + != DOWNCASE (closure->buf, itext_ichar (ptr))) { break; } - INC_CHARPTR (ptr); + INC_IBYTEPTR (ptr); } if (idx == abbrev_length) { @@ -159,7 +161,7 @@ closure.buf = buf; closure.point = BUF_PT (buf); closure.maxlen = closure.point - BUF_BEGV (buf); - closure.chartab = XCHAR_TABLE (buf->mirror_syntax_table); + closure.chartab = buf->mirror_syntax_table; closure.found = 0; map_obarray (obarray, abbrev_match_mapper, &closure); @@ -181,8 +183,8 @@ abbrev_oblookup (struct buffer *buf, Lisp_Object obarray) { Charbpos wordstart, wordend; - Intbyte *word, *p; - Bytecount idx; + Ibyte *word, *p; + Charbpos idx; Lisp_Object lookup; CHECK_VECTOR (obarray); @@ -229,13 +231,13 @@ if (wordend <= wordstart) return 0; - p = word = (Intbyte *) alloca (MAX_EMCHAR_LEN * (wordend - wordstart)); + p = word = (Ibyte *) ALLOCA (MAX_ICHAR_LEN * (wordend - wordstart)); for (idx = wordstart; idx < wordend; idx++) { - Emchar c = BUF_FETCH_CHAR (buf, idx); + Ichar c = BUF_FETCH_CHAR (buf, idx); if (UPPERCASEP (buf, c)) c = DOWNCASE (buf, c); - p += set_charptr_emchar (p, c); + p += set_itext_ichar (p, c); } lookup = oblookup (obarray, word, p - word); if (SYMBOLP (lookup) && !NILP (symbol_value (XSYMBOL (lookup)))) @@ -248,7 +250,7 @@ static int obarray_has_blank_p (Lisp_Object obarray) { - return !ZEROP (oblookup (obarray, (Intbyte *)" ", 1)); + return !ZEROP (oblookup (obarray, (Ibyte *)" ", 1)); } /* Analyze case in the buffer substring, and report it. */ @@ -259,7 +261,7 @@ *lccount = *uccount = 0; while (length--) { - Emchar c = BUF_FETCH_CHAR (buf, pos); + Ichar c = BUF_FETCH_CHAR (buf, pos); if (UPPERCASEP (buf, c)) ++*uccount; else if (LOWERCASEP (buf, c)) @@ -329,7 +331,7 @@ /* OK, we're out of the must-be-fast part. An abbreviation matched. Now find the parameters, insert the expansion, and make it all look pretty. */ - abbrev_length = XSTRING_CHAR_LENGTH (symbol_name (abbrev_symbol)); + abbrev_length = string_char_length (symbol_name (abbrev_symbol)); abbrev_start = point - abbrev_length; expansion = symbol_value (abbrev_symbol); @@ -385,7 +387,7 @@ Charbpos pos = abbrev_start; /* Find the initial. */ while (pos < point - && !WORD_SYNTAX_P (XCHAR_TABLE (buf->mirror_syntax_table), + && !WORD_SYNTAX_P (buf->mirror_syntax_table, BUF_FETCH_CHAR (buf, pos))) pos++; /* Change just that. */ diff --text -u 'xemacs-21.5.6/src/alloc.c' 'xemacs-21.5.7/src/alloc.c' Index: ././src/alloc.c --- ././src/alloc.c Mon Apr 1 12:58:23 2002 +++ ././src/alloc.c Fri Jun 28 23:21:41 2002 @@ -49,10 +49,11 @@ #include "device.h" #include "elhash.h" #include "events.h" -#include "extents.h" -#include "frame.h" +#include "extents-impl.h" +#include "frame-impl.h" #include "glyphs.h" #include "opaque.h" +#include "process.h" #include "redisplay.h" #include "specifier.h" #include "sysfile.h" @@ -70,6 +71,8 @@ EXFUN (Fgarbage_collect, 0); +static void recompute_need_to_garbage_collect (void); + #if 0 /* this is _way_ too slow to be part of the standard debug options */ #if defined(DEBUG_XEMACS) && defined(MULE) #define VERIFY_STRING_CHARS_INTEGRITY @@ -90,8 +93,22 @@ #endif /* Number of bytes of consing done since the last gc */ -EMACS_INT consing_since_gc; -#define INCREMENT_CONS_COUNTER_1(size) (consing_since_gc += (size)) +static EMACS_INT consing_since_gc; +int need_to_garbage_collect; +int need_to_check_c_alloca; +int need_to_signal_post_gc; +int funcall_allocation_flag; +Bytecount __temp_alloca_size__; +Bytecount funcall_alloca_count; + +/* Determine now whether we need to garbage collect or not, to make + Ffuncall() faster */ +#define INCREMENT_CONS_COUNTER_1(size) \ +do \ +{ \ + consing_since_gc += (size); \ + recompute_need_to_garbage_collect (); \ +} while (0) #define debug_allocation_backtrace() \ do { \ @@ -130,6 +147,7 @@ consing_since_gc -= (size); \ if (consing_since_gc < 0) \ consing_since_gc = 0; \ + recompute_need_to_garbage_collect (); \ } while (0) /* Number of bytes of consing since gc before another gc should be done. */ @@ -139,7 +157,8 @@ static EMACS_INT gc_cons_percentage; #ifdef ERROR_CHECK_GC -int always_gc; /* Debugging hack */ +int always_gc; /* Debugging hack; equivalent to + (setq gc-cons-thresold -1) */ #else #define always_gc 0 #endif @@ -157,7 +176,7 @@ /* Nonzero when calling certain hooks or doing other things where a GC would be bad */ -int gc_currently_forbidden; +static int gc_currently_forbidden; /* Hooks. */ Lisp_Object Vpre_gc_hook, Qpre_gc_hook; @@ -244,6 +263,7 @@ to win) than to loop beeping and barfing "Memory exhausted" */ consing_since_gc = gc_cons_threshold + 1; + recompute_need_to_garbage_collect (); release_breathing_space (); /* Flush some histories which might conceivably contain garbalogical @@ -332,20 +352,10 @@ #ifdef ERROR_CHECK_GC -#if SIZEOF_INT == 4 -typedef unsigned int four_byte_t; -#elif SIZEOF_LONG == 4 -typedef unsigned long four_byte_t; -#elif SIZEOF_SHORT == 4 -typedef unsigned short four_byte_t; -#else -What kind of strange-ass system are we running on? -#endif - static void deadbeef_memory (void *ptr, Bytecount size) { - four_byte_t *ptr4 = (four_byte_t *) ptr; + UINT_32_BIT *ptr4 = (UINT_32_BIT *) ptr; Bytecount beefs = size >> 2; /* In practice, size will always be a multiple of four. */ @@ -398,6 +408,10 @@ esp. as the object are not large -- large stuff like buffer text and redisplay structures and allocated separately. */ memset (val, 0, size); + + if (need_to_check_c_alloca) + xemacs_c_alloca (0); + return val; } @@ -918,8 +932,8 @@ } static const struct lrecord_description cons_description[] = { - { XD_LISP_OBJECT, offsetof (Lisp_Cons, car) }, - { XD_LISP_OBJECT, offsetof (Lisp_Cons, cdr) }, + { XD_LISP_OBJECT, offsetof (Lisp_Cons, car_) }, + { XD_LISP_OBJECT, offsetof (Lisp_Cons, cdr_) }, { XD_END } }; @@ -947,8 +961,8 @@ ALLOCATE_FIXED_TYPE (cons, Lisp_Cons, c); set_lheader_implementation (&c->lheader, &lrecord_cons); val = wrap_cons (c); - c->car = car; - c->cdr = cdr; + XSETCAR (val, car); + XSETCDR (val, cdr); return val; } @@ -1456,7 +1470,7 @@ /* Check for valid formal parameter list now, to allow us to use SPECBIND_FAST_UNSAFE() later in funcall_compiled_function(). */ { - EXTERNAL_LIST_LOOP_3 (symbol, arglist, tail) + EXTERNAL_LIST_LOOP_2 (symbol, arglist) { CHECK_SYMBOL (symbol); if (EQ (symbol, Qt) || @@ -1469,6 +1483,47 @@ } f->arglist = arglist; + { + int minargs = 0, maxargs = 0, totalargs = 0; + int optional_p = 0, rest_p = 0, i = 0; + { + LIST_LOOP_2 (arg, arglist) + { + if (EQ (arg, Qand_optional)) + optional_p = 1; + else if (EQ (arg, Qand_rest)) + rest_p = 1; + else + { + if (rest_p) + { + maxargs = MANY; + totalargs++; + break; + } + if (!optional_p) + minargs++; + maxargs++; + totalargs++; + } + } + } + + f->args = xnew_array (Lisp_Object, totalargs); + + { + LIST_LOOP_2 (arg, arglist) + { + if (!EQ (arg, Qand_optional) && !EQ (arg, Qand_rest)) + f->args[i++] = arg; + } + } + + f->max_args = maxargs; + f->min_args = minargs; + f->args_in_array = totalargs; + } + /* `instructions' is a string or a cons (string . int) for a lazy-loaded function. */ if (CONSP (instructions)) @@ -1756,9 +1811,9 @@ /* String blocks contain this many useful bytes. */ #define STRING_CHARS_BLOCK_SIZE \ -((Bytecount) (8192 - MALLOC_OVERHEAD - \ - ((2 * sizeof (struct string_chars_block *)) \ - + sizeof (EMACS_INT)))) + ((Bytecount) (8192 - MALLOC_OVERHEAD - \ + ((2 * sizeof (struct string_chars_block *)) \ + + sizeof (EMACS_INT)))) /* Block header for small strings. */ struct string_chars_block { @@ -1778,8 +1833,7 @@ * (including alignment padding). */ #define STRING_FULLSIZE(size) \ - ALIGN_SIZE (((size) + 1 + sizeof (Lisp_String *)),\ - ALIGNOF (Lisp_String *)) + ALIGN_FOR_TYPE (((size) + 1 + sizeof (Lisp_String *)), Lisp_String *) #define BIG_STRING_FULLSIZE_P(fullsize) ((fullsize) >= STRING_CHARS_BLOCK_SIZE) #define BIG_STRING_SIZE_P(size) (BIG_STRING_FULLSIZE_P (STRING_FULLSIZE(size))) @@ -1811,7 +1865,7 @@ static struct string_chars * allocate_string_chars_struct (Lisp_Object string_it_goes_with, - EMACS_INT fullsize) + Bytecount fullsize) { struct string_chars *s_chars; @@ -1854,7 +1908,7 @@ for (i = 0; i < XSTRING_LENGTH (str); i++) { - if (!BYTE_ASCII_P (XSTRING_BYTE (str, i))) + if (!byte_ascii_p (string_byte (str, i))) break; } @@ -1866,14 +1920,14 @@ #endif /* You do NOT want to be calling this! (And if you do, you must call - XSET_STRING_ASCII_BEGIN() after modifying the string.) Use alloca() + XSET_STRING_ASCII_BEGIN() after modifying the string.) Use ALLOCA () instead and then call make_string() like the rest of the world. */ Lisp_Object make_uninit_string (Bytecount length) { Lisp_String *s; - EMACS_INT fullsize = STRING_FULLSIZE (length); + Bytecount fullsize = STRING_FULLSIZE (length); assert (length >= 0 && fullsize > 0); @@ -1882,12 +1936,12 @@ xzero (*s); set_lheader_implementation (&s->u.lheader, &lrecord_string); - set_string_data (s, BIG_STRING_FULLSIZE_P (fullsize) - ? xnew_array (Intbyte, length + 1) + set_lispstringp_data (s, BIG_STRING_FULLSIZE_P (fullsize) + ? xnew_array (Ibyte, length + 1) : allocate_string_chars_struct (wrap_string (s), fullsize)->chars); - set_string_length (s, length); + set_lispstringp_length (s, length); s->plist = Qnil; set_string_byte (wrap_string (s), length, 0); @@ -1954,7 +2008,7 @@ memmove (XSTRING_DATA (s) + pos + delta, XSTRING_DATA (s) + pos, len); XSET_STRING_DATA - (s, (Intbyte *) xrealloc (XSTRING_DATA (s), + (s, (Ibyte *) xrealloc (XSTRING_DATA (s), XSTRING_LENGTH (s) + delta + 1)); if (delta > 0 && pos >= 0) memmove (XSTRING_DATA (s) + pos + delta, XSTRING_DATA (s) + pos, @@ -1962,9 +2016,9 @@ } else /* String has been demoted from BIG_STRING. */ { - Intbyte *new_data = + Ibyte *new_data = allocate_string_chars_struct (s, newfullsize)->chars; - Intbyte *old_data = XSTRING_DATA (s); + Ibyte *old_data = XSTRING_DATA (s); if (pos >= 0) { @@ -1987,7 +2041,7 @@ constraints). */ if (pos >= 0) { - Intbyte *addroff = pos + XSTRING_DATA (s); + Ibyte *addroff = pos + XSTRING_DATA (s); memmove (addroff + delta, addroff, /* +1 due to zero-termination. */ @@ -1996,10 +2050,10 @@ } else { - Intbyte *old_data = XSTRING_DATA (s); - Intbyte *new_data = + Ibyte *old_data = XSTRING_DATA (s); + Ibyte *new_data = BIG_STRING_FULLSIZE_P (newfullsize) - ? xnew_array (Intbyte, XSTRING_LENGTH (s) + delta + 1) + ? xnew_array (Ibyte, XSTRING_LENGTH (s) + delta + 1) : allocate_string_chars_struct (s, newfullsize)->chars; if (pos >= 0) @@ -2048,12 +2102,12 @@ /* WARNING: If you modify an existing string, you must call CHECK_LISP_WRITEABLE() before and bump_string_modiff() afterwards. */ void -set_string_char (Lisp_Object s, Charcount i, Emchar c) +set_string_char (Lisp_Object s, Charcount i, Ichar c) { - Intbyte newstr[MAX_EMCHAR_LEN]; + Ibyte newstr[MAX_ICHAR_LEN]; Bytecount bytoff = string_index_char_to_byte (s, i); - Bytecount oldlen = charcount_to_bytecount (XSTRING_DATA (s) + bytoff, 1); - Bytecount newlen = set_charptr_emchar (newstr, c); + Bytecount oldlen = itext_ichar_len (XSTRING_DATA (s) + bytoff); + Bytecount newlen = set_itext_ichar (newstr, c); sledgehammer_check_ascii_begin (s); if (oldlen != newlen) @@ -2070,12 +2124,12 @@ /* We've extended ascii_begin, and we have to figure out how much by */ { Bytecount j; - for (j = i + 1; j < XSTRING_LENGTH (s); j++) + for (j = (Bytecount) i + 1; j < XSTRING_LENGTH (s); j++) { - if (!BYTE_ASCII_P (XSTRING_DATA (s)[j])) + if (!byte_ascii_p (XSTRING_DATA (s)[j])) break; } - XSET_STRING_ASCII_BEGIN (s, min (j, MAX_STRING_ASCII_BEGIN)); + XSET_STRING_ASCII_BEGIN (s, min (j, (Bytecount) MAX_STRING_ASCII_BEGIN)); } } sledgehammer_check_ascii_begin (s); @@ -2092,8 +2146,8 @@ CHECK_NATNUM (length); CHECK_CHAR_COERCE_INT (character); { - Intbyte init_str[MAX_EMCHAR_LEN]; - int len = set_charptr_emchar (init_str, XCHAR (character)); + Ibyte init_str[MAX_ICHAR_LEN]; + int len = set_itext_ichar (init_str, XCHAR (character)); Lisp_Object val = make_uninit_string (len * XINT (length)); if (len == 1) @@ -2106,11 +2160,11 @@ else { EMACS_INT i; - Intbyte *ptr = XSTRING_DATA (val); + Ibyte *ptr = XSTRING_DATA (val); for (i = XINT (length); i; i--) { - Intbyte *init_ptr = init_str; + Ibyte *init_ptr = init_str; switch (len) { case 4: *ptr++ = *init_ptr++; @@ -2130,14 +2184,14 @@ */ (int nargs, Lisp_Object *args)) { - Intbyte *storage = alloca_array (Intbyte, nargs * MAX_EMCHAR_LEN); - Intbyte *p = storage; + Ibyte *storage = alloca_array (Ibyte, nargs * MAX_ICHAR_LEN); + Ibyte *p = storage; for (; nargs; nargs--, args++) { Lisp_Object lisp_char = *args; CHECK_CHAR_COERCE_INT (lisp_char); - p += set_charptr_emchar (p, XCHAR (lisp_char)); + p += set_itext_ichar (p, XCHAR (lisp_char)); } return make_string (storage, p - storage); } @@ -2150,11 +2204,11 @@ #ifdef MULE int i; Bytecount length = XSTRING_LENGTH (string); - Intbyte *contents = XSTRING_DATA (string); + Ibyte *contents = XSTRING_DATA (string); for (i = 0; i < length; i++) { - if (!BYTE_ASCII_P (contents[i])) + if (!byte_ascii_p (contents[i])) break; } XSET_STRING_ASCII_BEGIN (string, min (i, MAX_STRING_ASCII_BEGIN)); @@ -2168,7 +2222,7 @@ /* Take some raw memory, which MUST already be in internal format, and package it up into a Lisp string. */ Lisp_Object -make_string (const Intbyte *contents, Bytecount length) +make_string (const Ibyte *contents, Bytecount length) { Lisp_Object val; @@ -2198,17 +2252,17 @@ } Lisp_Object -build_intstring (const Intbyte *str) +build_intstring (const Ibyte *str) { /* Some strlen's crash and burn if passed null. */ - return make_string (str, (str ? qxestrlen (str) : 0)); + return make_string (str, (str ? qxestrlen (str) : (Bytecount) 0)); } Lisp_Object -build_string (const CIntbyte *str) +build_string (const CIbyte *str) { /* Some strlen's crash and burn if passed null. */ - return make_string ((const Intbyte *) str, (str ? strlen (str) : 0)); + return make_string ((const Ibyte *) str, (str ? strlen (str) : 0)); } Lisp_Object @@ -2220,19 +2274,19 @@ } Lisp_Object -build_msg_intstring (const Intbyte *str) +build_msg_intstring (const Ibyte *str) { return build_intstring (GETTEXT (str)); } Lisp_Object -build_msg_string (const CIntbyte *str) +build_msg_string (const CIbyte *str) { return build_string (CGETTEXT (str)); } Lisp_Object -make_string_nocopy (const Intbyte *contents, Bytecount length) +make_string_nocopy (const Ibyte *contents, Bytecount length) { Lisp_String *s; Lisp_Object val; @@ -2247,8 +2301,8 @@ set_lheader_implementation (&s->u.lheader, &lrecord_string); SET_C_READONLY_RECORD_HEADER (&s->u.lheader); s->plist = Qnil; - set_string_data (s, (Intbyte *) contents); - set_string_length (s, length); + set_lispstringp_data (s, (Ibyte *) contents); + set_lispstringp_length (s, length); val = wrap_string (s); init_string_ascii_begin (val); sledgehammer_check_ascii_begin (val); @@ -2976,8 +3030,10 @@ /* Explicitly free a cons cell. */ void -free_cons (Lisp_Cons *ptr) +free_cons (Lisp_Object cons) { + Lisp_Cons *ptr = XCONS (cons); + #ifdef ERROR_CHECK_GC /* If the CAR is not an int, then it will be a pointer, which will always be four-byte aligned. If this cons cell has already been @@ -2985,8 +3041,8 @@ a chain pointer to the next cons on the list, which has cleverly had all its 0's and 1's inverted. This allows for a quick check to make sure we're not freeing something already freed. */ - if (POINTER_TYPE_P (XTYPE (ptr->car))) - ASSERT_VALID_POINTER (XPNTR (ptr->car)); + if (POINTER_TYPE_P (XTYPE (cons_car (ptr)))) + ASSERT_VALID_POINTER (XPNTR (cons_car (ptr))); #endif /* ERROR_CHECK_GC */ #ifndef ALLOC_NO_POOLS @@ -3007,7 +3063,7 @@ for (rest = list; !NILP (rest); rest = next) { next = XCDR (rest); - free_cons (XCONS (rest)); + free_cons (rest); } } @@ -3024,8 +3080,8 @@ for (rest = alist; !NILP (rest); rest = next) { next = XCDR (rest); - free_cons (XCONS (XCAR (rest))); - free_cons (XCONS (rest)); + free_cons (XCAR (rest)); + free_cons (rest); } } @@ -3225,7 +3281,7 @@ memmove (to_s_chars, from_s_chars, fullsize); /* Relocate FROM_S_CHARS's reference */ - set_string_data (string, &(to_s_chars->chars[0])); + set_lispstringp_data (string, &(to_s_chars->chars[0])); from_pos += fullsize; to_pos += fullsize; @@ -3257,11 +3313,11 @@ debug_string_purity_print (Lisp_Object p) { Charcount i; - Charcount s = XSTRING_CHAR_LENGTH (p); + Charcount s = string_char_length (p); stderr_out ("\""); for (i = 0; i < s; i++) { - Emchar ch = XSTRING_CHAR (p, i); + Ichar ch = string_ichar (p, i); if (ch < 32 || ch >= 126) stderr_out ("\\%03o", ch); else if (ch == '\\' || ch == '\"') @@ -3421,6 +3477,7 @@ Flocate_file_clear_hashing (Qt); uncache_home_directory (); zero_out_command_line_status_vars (); + clear_default_devices (); #if defined(LOADHIST) && !(defined(LOADHIST_DUMPED) || \ defined(LOADHIST_BUILTIN)) @@ -3455,20 +3512,10 @@ } -static Lisp_Object -restore_gc_inhibit (Lisp_Object val) -{ - gc_currently_forbidden = XINT (val); - return val; -} - int begin_gc_forbidden (void) { - int speccount = record_unwind_protect (restore_gc_inhibit, - make_int (gc_currently_forbidden)); - gc_currently_forbidden = 1; - return speccount; + return internal_bind_int (&gc_currently_forbidden, 1); } void @@ -3564,7 +3611,7 @@ Lisp_Object device = Fselected_device (Qnil); if (NILP (device)) /* Could happen during startup, eg. if always_gc */ return; - frame = DEVICE_SELECTED_FRAME (XDEVICE (device)); + frame = Fselected_frame (device); if (NILP (frame)) invalid_state ("No frames exist on device", device); f = XFRAME (frame); @@ -3580,8 +3627,13 @@ have infinite GC recursion. */ speccount = begin_gc_forbidden (); + need_to_signal_post_gc = 0; + recompute_funcall_allocation_flag(); + if (!gc_hooks_inhibited) - run_hook_trapping_errors ("Error in pre-gc-hook", Qpre_gc_hook); + run_hook_trapping_problems + ("Error in pre-gc-hook", Qpre_gc_hook, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); /* Now show the GC cursor/message. */ if (!noninteractive) @@ -3610,7 +3662,7 @@ build_msg_string (gc_default_message)); args[1] = build_string ("..."); whole_msg = Fconcat (2, args); - echo_area_message (f, (Intbyte *) 0, whole_msg, 0, -1, + echo_area_message (f, (Ibyte *) 0, whole_msg, 0, -1, Qgarbage_collecting); } } @@ -3692,6 +3744,7 @@ { mark_object (catch->tag); mark_object (catch->val); + mark_object (catch->actual_tag); } } @@ -3721,7 +3774,8 @@ iterate until nothing more gets marked. */ while (finish_marking_weak_hash_tables () > 0 || - finish_marking_weak_lists () > 0) + finish_marking_weak_lists () > 0 || + finish_marking_ephemerons () > 0) ; /* And prune (this needs to be called after everything else has been @@ -3733,6 +3787,9 @@ prune_specifiers (); prune_syntax_tables (); + prune_ephemerons (); + prune_weak_boxes (); + gc_sweep (); consing_since_gc = 0; @@ -3741,6 +3798,7 @@ if (gc_cons_threshold < 10000) gc_cons_threshold = 10000; #endif + recompute_need_to_garbage_collect (); inhibit_non_essential_printing_operations = 0; gc_in_progress = 0; @@ -3749,8 +3807,6 @@ /******* End of garbage collection ********/ - run_hook_trapping_errors ("Error in post-gc-hook", Qpost_gc_hook); - /* Now remove the GC cursor/message */ if (!noninteractive) { @@ -3767,7 +3823,7 @@ build_msg_string (gc_default_message)); args[1] = build_msg_string ("... done"); whole_msg = Fconcat (2, args); - echo_area_message (selected_frame (), (Intbyte *) 0, + echo_area_message (selected_frame (), (Ibyte *) 0, whole_msg, 0, -1, Qgarbage_collecting); } @@ -3783,6 +3839,10 @@ } UNGCPRO; + + need_to_signal_post_gc = 1; + funcall_allocation_flag = 1; + return; } @@ -3955,16 +4015,31 @@ return make_int (total_data_usage ()); } +void +recompute_funcall_allocation_flag (void) +{ + funcall_allocation_flag = + need_to_garbage_collect || + need_to_check_c_alloca || + need_to_signal_post_gc; +} + /* True if it's time to garbage collect now. */ -int -need_to_garbage_collect (void) +static void +recompute_need_to_garbage_collect (void) { if (always_gc) - return 1; - - return (consing_since_gc > gc_cons_threshold && - (100 * consing_since_gc) / total_data_usage () >= - gc_cons_percentage); + need_to_garbage_collect = 1; + else + need_to_garbage_collect = + (consing_since_gc > gc_cons_threshold +#if 0 /* #### implement this better */ + && + (100 * consing_since_gc) / total_data_usage () >= + gc_cons_percentage +#endif /* 0 */ + ); + recompute_funcall_allocation_flag (); } @@ -4169,6 +4244,11 @@ #endif consing_since_gc = 0; + need_to_garbage_collect = always_gc; + need_to_check_c_alloca = 0; + funcall_allocation_flag = 0; + funcall_alloca_count = 0; + #if 1 gc_cons_threshold = 500000; /* XEmacs change */ #else @@ -4294,6 +4374,16 @@ By binding this temporarily to a large number, you can effectively prevent garbage collection during a part of the program. +Normally, you cannot set this value less than 10,000 (if you do, it is +automatically reset during the next garbage collection). However, if +XEmacs was compiled with DEBUG_XEMACS, this does not happen, allowing +you to set this value very low to track down problems with insufficient +GCPRO'ing. If you set this to a negative number, garbage collection will +happen at *EVERY* call to `eval' or `funcall'. This is an extremely +effective way to check GCPRO problems, but be warned that your XEmacs +will be unusable! You almost certainly won't have the patience to wait +long enough to be able to set it back. + See also `consing-since-gc'. */ ); @@ -4346,8 +4436,8 @@ DEFVAR_LISP ("post-gc-hook", &Vpost_gc_hook /* Function or functions to be run just after each garbage collection. Interrupts, garbage collection, and errors are inhibited while this hook -runs, so be extremely careful in what you add here. In particular, avoid -consing, and do not interact with the user. +runs. Each hook is called with one argument which is an alist with +finalization data. */ ); Vpost_gc_hook = Qnil; diff --text -u 'xemacs-21.5.6/src/alloca.c' 'xemacs-21.5.7/src/alloca.c' Index: ././src/alloca.c --- ././src/alloca.c Fri Apr 13 03:23:25 2001 +++ ././src/alloca.c Thu May 23 20:46:19 2002 @@ -26,36 +26,16 @@ /* Authorship: FSF: A long time ago. - Very few changes for XEmacs. + Some cleanups for XEmacs. */ #ifdef HAVE_CONFIG_H #include #endif -/* XEmacs: If compiling with GCC 2, this file is theoretically not needed. - However, alloca() is broken under GCC 2 on many machines: you - cannot put a call to alloca() as part of an argument to a function. - */ -/* If someone has defined alloca as a macro, - there must be some other way alloca is supposed to work. */ -/* XEmacs sometimes uses the C alloca even when a builtin alloca is available, - because it's safer. */ -#if defined (EMACS_WANTS_C_ALLOCA) || (!defined (alloca) && (!defined (__GNUC__) || __GNUC__ < 2)) - #ifdef emacs -#ifdef static -/* actually, only want this if static is defined as "" - -- this is for usg, in which emacs must undefine static - in order to make unexec workable - */ -#ifndef STACK_DIRECTION -you -lose --- must know STACK_DIRECTION at compile-time -#endif /* STACK_DIRECTION undefined */ -#endif /* static */ -#endif /* emacs */ +#include "lisp.h" +#endif /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ @@ -67,48 +47,12 @@ #define ADDRESS_FUNCTION(arg) &(arg) #endif -#ifdef __STDC__ /* XEmacs change */ typedef void *pointer; -#else -typedef char *pointer; -#endif - -/* XEmacs: With ERROR_CHECK_MALLOC defined, there is no xfree -- it's - a macro that does some stuff to try and trap invalid frees, - and then calls xfree_1 to actually do the work. */ - -#ifdef emacs -# ifdef ERROR_CHECK_MALLOC -void xfree_1 (pointer); -# define xfree xfree_1 -# else -void xfree (pointer); -# endif -#endif #ifndef NULL #define NULL 0 #endif -/* Different portions of Emacs need to call different versions of - malloc. The Emacs executable needs alloca to call xmalloc, because - ordinary malloc isn't protected from input signals. On the other - hand, the utilities in lib-src need alloca to call malloc; some of - them are very simple, and don't have an xmalloc routine. - - Non-Emacs programs expect this to call use xmalloc. - - Callers below should use malloc. */ - -#ifdef emacs -#define malloc xmalloc -#endif -#ifndef WIN32_NATIVE -extern pointer malloc (); -#else -extern void *malloc(); -#endif - /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. @@ -161,13 +105,13 @@ It is very important that sizeof(header) agree with malloc alignment chunk size. The following default should work okay. */ -#ifndef ALIGN_SIZE -#define ALIGN_SIZE sizeof(double) +#ifndef ALIGNMENT_SIZE +#define ALIGNMENT_SIZE sizeof(double) #endif typedef union hdr { - char align[ALIGN_SIZE]; /* To force sizeof(header). */ + char align[ALIGNMENT_SIZE]; /* To force sizeof(header). */ struct { union hdr *next; /* For chaining headers. */ @@ -185,12 +129,7 @@ implementations of C, for example under Gould's UTX/32. */ pointer -#ifdef EMACS_WANTS_C_ALLOCA -c_alloca (size) -#else -alloca (size) -#endif - unsigned size; +xemacs_c_alloca (unsigned int size) { auto char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); @@ -212,7 +151,11 @@ { register header *np = hp->h.next; - free ((pointer) hp); /* Collect garbage. */ +#ifdef emacs + xfree (hp); /* Collect garbage. */ +#else + free (hp); /* Collect garbage. */ +#endif hp = np; /* -> next header. */ } @@ -222,13 +165,22 @@ last_alloca_header = hp; /* -> last valid storage. */ } +#ifdef emacs + need_to_check_c_alloca = size > 0 || last_alloca_header; + recompute_funcall_allocation_flag (); +#endif + if (size == 0) return NULL; /* No allocation required. */ /* Allocate combined header + user data storage. */ { +#ifdef emacs + register pointer new = xmalloc (sizeof (header) + size); +#else register pointer new = malloc (sizeof (header) + size); +#endif /* Address of header. */ ((header *) new)->h.next = last_alloca_header; @@ -509,5 +461,3 @@ #endif /* not CRAY2 */ #endif /* CRAY */ - -#endif /* complicated expression at top of file */ diff --text -u 'xemacs-21.5.6/src/backtrace.h' 'xemacs-21.5.7/src/backtrace.h' Index: ././src/backtrace.h --- ././src/backtrace.h Sun Mar 31 17:27:42 2002 +++ ././src/backtrace.h Tue May 28 17:44:44 2002 @@ -1,5 +1,6 @@ /* The lisp stack. Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -35,6 +36,19 @@ #include +#ifdef ERROR_CHECK_CATCH +/* you can use this if you are trying to debug corruption in the + catchlist */ +void check_catchlist_sanity (void); + +/* you can use this if you are trying to debug corruption in the specbind + stack */ +void check_specbind_stack_sanity (void); +#else +#define check_catchlist_sanity() +#define check_specbind_stack_sanity() +#endif + /* These definitions are used in eval.c and alloc.c */ struct backtrace @@ -54,18 +68,24 @@ /* This structure helps implement the `catch' and `throw' control structure. A struct catchtag contains all the information needed to restore the state of the interpreter after a non-local jump. - - Handlers for error conditions (represented by `struct handler' - structures) just point to a catch tag to do the cleanup required - for their jumps. + (No information is stored concerning how to restore the state of + the condition-handler list; this is handled implicitly through + an unwind-protect. unwind-protects are on the specbind stack, + which is reset to its proper value by `throw'. In the process of + that, any intervening bindings are reset and unwind-protects called, + which fixes up the condition-handler list. catchtag structures are chained together in the C calling stack; the `next' member points to the next outer catchtag. A call like (throw TAG VAL) searches for a catchtag whose `tag' - member is TAG, and then unbinds to it. The `val' member is used to - hold VAL while the stack is unwound; `val' is returned as the value - of the catch form. + member is TAG, and then unbinds to it. A value of Vcatch_everything_tag + for the `tag' member of a catchtag is special and means "catch all throws, + regardless of the tag". This is used internally by the C code. The `val' + member is used to hold VAL while the stack is unwound; `val' is returned + as the value of the catch form. The `actual_tag' member holds the value + of TAG as passed to throw, so that it can be retrieved when catches with + Vcatch_everything_tag are set up. All the other members are concerned with restoring the interpreter state. */ @@ -73,6 +93,9 @@ struct catchtag { Lisp_Object tag; + /* Stores the actual tag used in `throw'; the same as TAG, unless + TAG is Vcatch_everything_tag. */ + Lisp_Object actual_tag; Lisp_Object val; struct catchtag *next; struct gcpro *gcpro; @@ -191,6 +214,7 @@ } \ else \ specbind_magic (SB_symbol, SB_newval); \ + check_specbind_stack_sanity (); \ } while (0) /* An even faster, but less safe inline version of specbind(). @@ -203,7 +227,9 @@ Lisp_Object SFU_newval = (value_object); \ Lisp_Symbol *SFU_sym = XSYMBOL (SFU_symbol); \ Lisp_Object SFU_oldval = SFU_sym->value; \ - if (!SYMBOL_VALUE_MAGIC_P (SFU_oldval) || UNBOUNDP (SFU_oldval)) \ + /* Most of the time, will be previously unbound. #### With a bit of \ + rearranging, this could be reduced to only one check. */ \ + if (UNBOUNDP (SFU_oldval) || !SYMBOL_VALUE_MAGIC_P (SFU_oldval)) \ { \ specpdl_ptr->symbol = SFU_symbol; \ specpdl_ptr->old_value = SFU_oldval; \ @@ -215,8 +241,8 @@ } \ else \ specbind_magic (SFU_symbol, SFU_newval); \ + check_specbind_stack_sanity (); \ } while (0) - /* Request enough room for SIZE future entries on special binding stack */ #define SPECPDL_RESERVE(size) do { \ EMACS_INT SR_size = (size); \ @@ -252,6 +278,7 @@ \ sym->value = specpdl_ptr->old_value; \ } \ + check_specbind_stack_sanity (); \ } while (0) /* A slightly faster inline version of unbind_to_1, @@ -274,14 +301,9 @@ \ sym->value = specpdl_ptr->old_value; \ } \ + check_specbind_stack_sanity (); \ } while (0) -#ifdef ERROR_CHECK_STRUCTURES -#define CHECK_SPECBIND_VARIABLE assert (specpdl_ptr->func == 0) -#else -#define CHECK_SPECBIND_VARIABLE DO_NOTHING -#endif - #if 0 /* Unused. It's too hard to guarantee that the current bindings contain only variables. */ @@ -297,7 +319,6 @@ --specpdl_ptr; \ --specpdl_depth_counter; \ \ - CHECK_SPECBIND_VARIABLE; \ sym = XSYMBOL (specpdl_ptr->symbol); \ if (!SYMBOL_VALUE_MAGIC_P (sym->value)) \ sym->value = specpdl_ptr->old_value; \ diff --text -u 'xemacs-21.5.6/src/balloon-x.c' 'xemacs-21.5.7/src/balloon-x.c' Index: ././src/balloon-x.c --- ././src/balloon-x.c Fri Apr 13 03:23:25 2001 +++ ././src/balloon-x.c Fri Jun 21 06:18:21 2002 @@ -24,8 +24,8 @@ #include #include "lisp.h" -#include "device.h" -#include "console-x.h" +#include "device-impl.h" +#include "console-x-impl.h" #include "balloon_help.h" @@ -34,7 +34,7 @@ static unsigned long alloc_color (Display* dpy, const char* colorname, int light) { - Colormap cmap = DEVICE_X_COLORMAP (XDEVICE(Vdefault_x_device)); + Colormap cmap = DEVICE_X_COLORMAP (XDEVICE (get_default_device (Qx))); unsigned long pixel = 0; XColor color; @@ -84,7 +84,7 @@ { Pixel fg, bg, shine, shadow; XFontStruct* font; - Display *dpy = DEVICE_X_DISPLAY (XDEVICE (Vdefault_x_device)); + Display *dpy = DEVICE_X_DISPLAY (XDEVICE (get_default_device (Qx))); fg = alloc_color (dpy, "grey60", 1); bg = alloc_color (dpy, "black", 0); diff --text -u 'xemacs-21.5.6/src/buffer.c' 'xemacs-21.5.7/src/buffer.c' Index: ././src/buffer.c --- ././src/buffer.c Sun Mar 31 17:27:42 2002 +++ ././src/buffer.c Fri Jun 21 06:18:21 2002 @@ -24,12 +24,20 @@ /* Authorship: - FSF: long ago. - JWZ: some changes for Lemacs, long ago. (e.g. separate buffer - list per frame.) - Mly: a few changes for buffer-local vars, 19.8 or 19.9. - Ben Wing: some changes and cleanups for Mule, 19.12. - */ + Based on code from pre-release FSF 19, c. 1991. + Some changes by Jamie Zawinski, c. 1991-1994 (e.g. separate buffer + list per frame, buffer slots). + A few changes for buffer-local vars by Richard Mlynarik for + 19.8 or 19.9, c. 1993. + Many changes by Ben Wing: changes and cleanups for Mule, esp. the + macros in buffer.h and the intial version of the coding-system + conversion macros (in buffer.h) and associated fns. (in this file), + 19.12 (c. 1995); synch. to FSF 19.30 c. 1994; memory usage stats + c. 1996; generated-modeline-string c. 1996 for mousable modeline in + 19.14. + Indirect buffer code by Hrvoje Niksic, c. 1997? + Coding conversion code rewritten by Martin Buchholz, early 2000, + based on design by Ben Wing. */ /* This file contains functions that work with buffer objects. Functions that manipulate a buffer's text, however, are not @@ -72,12 +80,12 @@ #include "chartab.h" #include "casetab.h" #include "commands.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "extents.h" #include "faces.h" #include "file-coding.h" -#include "frame.h" +#include "frame-impl.h" #include "insdel.h" #include "lstream.h" #include "process.h" /* for kill_buffer_processes */ @@ -137,7 +145,7 @@ /* This is the initial (startup) directory, as used for the *scratch* buffer. This is no longer global. Use get_initial_directory() to retrieve it. */ -static Intbyte *initial_directory; +static Ibyte *initial_directory; /* This structure holds the names of symbols whose values may be buffer-local. It is indexed and accessed in the same way as the above. */ @@ -236,6 +244,7 @@ mark_object (buf->extent_info); if (buf->text) mark_object (buf->text->line_number_cache); + mark_buffer_syntax_cache (buf); /* Don't mark normally through the children slot. (Actually, in this case, it doesn't matter.) */ @@ -258,7 +267,7 @@ printing_unreadable_object ("#", XSTRING_DATA (b->name)); } else if (!BUFFER_LIVE_P (b)) - write_c_string ("#", printcharfun); + write_c_string (printcharfun, "#"); else if (escapeflag) write_fmt_string_lisp (printcharfun, "#", 1, b->name); else @@ -558,7 +567,7 @@ b->last_window_start = 1; b->name = name; - if (XSTRING_BYTE (name, 0) != ' ') + if (string_byte (name, 0) != ' ') b->undo_list = Qnil; else b->undo_list = Qt; @@ -568,13 +577,16 @@ /* Put this in the alist of all live buffers. */ push_buffer_alist (name, buf); + note_object_created (buf); init_buffer_markers (b); + init_buffer_syntax_cache (b); b->generated_modeline_string = Fmake_string (make_int (84), make_int (' ')); b->modeline_extent_table = make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); + return buf; } @@ -701,7 +713,7 @@ { REGISTER Lisp_Object gentemp, tem; int count; - Intbyte number[10]; + Ibyte number[10]; CHECK_STRING (name); @@ -1005,7 +1017,7 @@ buf = Fcdr (Fcar (tail)); if (EQ (buf, buffer)) continue; - if (XSTRING_BYTE (XBUFFER (buf)->name, 0) == ' ') + if (string_byte (XBUFFER (buf)->name, 0) == ' ') continue; /* If FRAME has a buffer_predicate, disregard buffers that don't fit the predicate. */ @@ -1102,6 +1114,8 @@ if (!BUFFER_LIVE_P (b)) return Qnil; + check_allowed_operation (OPERATION_DELETE_OBJECT, buf, Qnil); + /* Don't kill the minibuffer now current. */ if (EQ (buf, Vminibuffer_zero)) return Qnil; @@ -1173,7 +1187,7 @@ return Qnil; /* Don't kill the minibuffer now current. */ - if (EQ (buf, XWINDOW (minibuf_window)->buffer)) + if (EQ (buf, XWINDOW_BUFFER (minibuf_window))) return Qnil; /* When we kill a base buffer, kill all its indirect buffers. @@ -1243,7 +1257,9 @@ Freplace_buffer_in_windows (buf, Qnil, Qall); UNGCPRO; +#ifdef USE_C_FONT_LOCK font_lock_buffer_was_killed (b); +#endif /* Delete any auto-save file, if we saved it in this session. */ if (STRINGP (b->auto_save_file_name) @@ -1274,6 +1290,7 @@ } uninit_buffer_markers (b); + uninit_buffer_syntax_cache (b); kill_buffer_local_variables (b); @@ -1294,6 +1311,8 @@ won't be protected from GC. */ nuke_all_buffer_slots (b, Qnil); + note_object_deleted (buf); + unbind_to (speccount); } return Qt; @@ -1721,7 +1740,75 @@ } #endif /* MEMORY_USAGE_STATS */ - + +#if defined (DEBUG_XEMACS) && defined (MULE) + +DEFUN ("buffer-char-byte-conversion-info", Fbuffer_char_byte_converion_info, + 1, 1, 0, /* +Return the current info used for char-byte conversion in BUFFER. +The values returned are in the form of a plist of properties and values. +*/ + (buffer)) +{ + struct buffer *b; + Lisp_Object plist = Qnil; + + CHECK_BUFFER (buffer); /* dead buffers should be allowed, no? */ + b = XBUFFER (buffer); + +#define ADD_INT(field) \ + plist = cons3 (make_int (b->text->field), \ + intern_converting_underscores_to_dashes (#field), plist) +#define ADD_BOOL(field) \ + plist = cons3 (b->text->field ? Qt : Qnil, \ + intern_converting_underscores_to_dashes (#field), plist) + ADD_INT (bufz); + ADD_INT (z); + ADD_INT (mule_bufmin); + ADD_INT (mule_bufmax); + ADD_INT (mule_bytmin); + ADD_INT (mule_bytmax); + ADD_INT (mule_shifter); + ADD_BOOL (mule_three_p); + ADD_BOOL (entirely_one_byte_p); + ADD_INT (num_ascii_chars); + ADD_INT (num_8_bit_fixed_chars); + ADD_INT (num_16_bit_fixed_chars); + { + Lisp_Object pos[16]; + int i; + for (i = 0; i < 16; i++) + pos[i] = make_int (b->text->mule_charbpos_cache[i]); + plist = cons3 (Flist (16, pos), intern ("mule-charbpos-cache"), plist); + for (i = 0; i < 16; i++) + pos[i] = make_int (b->text->mule_bytebpos_cache[i]); + plist = cons3 (Flist (16, pos), intern ("mule-bytebpos-cache"), plist); + } +#undef ADD_INT +#undef ADD_BOOL + + return Fnreverse (plist); +} + +DEFUN ("string-char-byte-conversion-info", Fstring_char_byte_converion_info, 1, 1, 0, /* +Return the current info used for char-byte conversion in STRING. +The values returned are in the form of a plist of properties and values. +*/ + (string)) +{ + Lisp_Object plist = Qnil; + CHECK_STRING (string); + + plist = cons3 (make_int (XSTRING_LENGTH (string)), + intern ("byte-length"), plist); + plist = cons3 (make_int (XSTRING_ASCII_BEGIN (string)), + intern ("ascii-begin"), plist); + + return Fnreverse (plist); +} + +#endif /* defined (DEBUG_XEMACS) && defined (MULE) */ + void @@ -1789,6 +1876,10 @@ #ifdef MEMORY_USAGE_STATS DEFSUBR (Fbuffer_memory_usage); #endif +#if defined (DEBUG_XEMACS) && defined (MULE) + DEFSUBR (Fbuffer_char_byte_converion_info); + DEFSUBR (Fstring_char_byte_converion_info); +#endif DEFERROR (Qprotected_field, "Attempt to modify a protected field", Qinvalid_change); @@ -2671,13 +2762,13 @@ #ifndef WIN32_NATIVE /* Is PWD another name for `.' ? */ static int -directory_is_current_directory (Intbyte *pwd) +directory_is_current_directory (Ibyte *pwd) { struct stat dotstat, pwdstat; return (IS_DIRECTORY_SEP (*pwd) && qxe_stat (pwd, &pwdstat) == 0 - && qxe_stat ((Intbyte *) ".", &dotstat) == 0 + && qxe_stat ((Ibyte *) ".", &dotstat) == 0 && dotstat.st_ino == pwdstat.st_ino && dotstat.st_dev == pwdstat.st_dev); } @@ -2685,8 +2776,8 @@ /* A stand-in for getcwd() #### Fix not to depend on arbitrary size limits */ -Intbyte * -get_initial_directory (Intbyte *pathname, Bytecount size) +Ibyte * +get_initial_directory (Ibyte *pathname, Bytecount size) { if (pathname) { @@ -2702,7 +2793,7 @@ /* This function can GC */ #ifndef WIN32_NATIVE - Intbyte *pwd; + Ibyte *pwd; #endif /* If PWD is accurate, use it instead of calling getcwd. This is faster @@ -2715,7 +2806,7 @@ #endif if ((initial_directory = qxe_allocating_getcwd ()) == NULL) { - Intbyte *errmess; + Ibyte *errmess; GET_STRERROR (errmess, errno); fatal ("`getcwd' failed: %s\n", errmess); } @@ -2728,7 +2819,7 @@ if (! IS_DIRECTORY_SEP (initial_directory[len - 1])) { - XREALLOC_ARRAY (initial_directory, Intbyte, len + 2); + XREALLOC_ARRAY (initial_directory, Ibyte, len + 2); initial_directory[len] = DIRECTORY_SEP; initial_directory[len + 1] = '\0'; } @@ -2736,7 +2827,7 @@ #ifdef WIN32_NATIVE { - Intbyte *newinit = mswindows_canonicalize_filename (initial_directory); + Ibyte *newinit = mswindows_canonicalize_filename (initial_directory); xfree (initial_directory); initial_directory = newinit; } @@ -2747,15 +2838,15 @@ when running subprocesses for the same reason.) */ Extbyte *p; - Extbyte modname[MAX_PATH * MAX_XETCHAR_SIZE]; + Extbyte *modname = mswindows_get_module_file_name (); - if (!qxeGetModuleFileName (NULL, modname, MAX_PATH)) - abort (); - if ((p = xetcsrchr (modname, '\\')) == NULL) - abort (); + assert (modname); + p = xetcsrchr (modname, '\\'); + assert (p); XECOPY_TCHAR (p, '\0'); qxeSetCurrentDirectory (modname); + xfree (modname); } #endif } diff --text -u 'xemacs-21.5.6/src/buffer.h' 'xemacs-21.5.7/src/buffer.h' Index: ././src/buffer.h --- ././src/buffer.h Sun Mar 31 17:27:43 2002 +++ ././src/buffer.h Wed Jun 5 18:54:56 2002 @@ -76,7 +76,7 @@ struct buffer_text { - Intbyte *beg; /* Actual address of buffer contents. */ + Ibyte *beg; /* Actual address of buffer contents. */ Bytebpos gpt; /* Index of gap in buffer. */ Bytebpos z; /* Index of end of buffer. */ Charbpos bufz; /* Equivalent as a Charbpos. */ @@ -103,7 +103,20 @@ Charbpos mule_charbpos_cache[16]; Bytebpos mule_bytebpos_cache[16]; - int entirely_ascii_p; + /* True if all chars fit into one byte; + == (format == FORMAT_8_BIT_FIXED || + (format == FORMAT_DEFAULT && num_ascii_chars == bufz - 1)) + kept around to speed up (slightly?) the byte-char conversion routines. */ + int entirely_one_byte_p; + /* Number of ASCII chars in buffer (0 - 127) */ + Charcount num_ascii_chars; + /* Number of chars in buffer that would fit in an 8-bit-fixed buffer. */ + Charcount num_8_bit_fixed_chars; + /* Number of chars in buffer that would fit in an 16-bit-fixed buffer. */ + Charcount num_16_bit_fixed_chars; + + /* Currently we only handle 8 bit fixed and default */ + Internal_Format format; #endif /* Similar to the above, we keep track of positions for which line @@ -178,9 +191,15 @@ object (done this way for ease in marking / finalizing). */ Lisp_Object extent_info; + /* The buffer's syntax cache. This caches a known region where the + `syntax-table' property is unchanged, for quick lookup in the routines + that scan a buffer looking for a particular syntax (regex routines, + parse-partial-sexp, etc.). */ + struct syntax_cache *syntax_cache; + /* ----------------------------------------------------------------- */ /* All the stuff above this line is the responsibility of insdel.c, - with some help from marker.c and extents.c. + with some help from marker.c, extents.c and syntax.c. All the stuff below this line is the responsibility of buffer.c. */ /* In an indirect buffer, this points to the base buffer. @@ -261,6 +280,12 @@ ) +/* All macros below follow the three golden rules of macros (see text.h), + with the following exception: + + -- 'struct buffer *' arguments can be evaluated more than once. +*/ + /*----------------------------------------------------------------------*/ /* Accessor macros for important positions in a buffer */ /*----------------------------------------------------------------------*/ @@ -272,288 +297,190 @@ the positions. */ /* Beginning of buffer. */ -#define BI_BUF_BEG(buf) ((Bytebpos) 1) +#define BYTE_BUF_BEG(buf) ((Bytebpos) 1) #define BUF_BEG(buf) ((Charbpos) 1) /* Beginning of accessible range of buffer. */ -#define BI_BUF_BEGV(buf) ((buf)->begv + 0) +#define BYTE_BUF_BEGV(buf) ((buf)->begv + 0) #define BUF_BEGV(buf) ((buf)->bufbegv + 0) /* End of accessible range of buffer. */ -#define BI_BUF_ZV(buf) ((buf)->zv + 0) +#define BYTE_BUF_ZV(buf) ((buf)->zv + 0) #define BUF_ZV(buf) ((buf)->bufzv + 0) /* End of buffer. */ -#define BI_BUF_Z(buf) ((buf)->text->z + 0) +#define BYTE_BUF_Z(buf) ((buf)->text->z + 0) #define BUF_Z(buf) ((buf)->text->bufz + 0) /* Point. */ -#define BI_BUF_PT(buf) ((buf)->pt + 0) +#define BYTE_BUF_PT(buf) ((buf)->pt + 0) #define BUF_PT(buf) ((buf)->bufpt + 0) +/* Internal format of buffer. */ +#ifdef MULE +#define BUF_FORMAT(buf) ((buf)->text->format) +#else +#define BUF_FORMAT(buf) FORMAT_DEFAULT +#endif + /*----------------------------------------------------------------------*/ -/* Converting between positions and addresses */ +/* Validating byte positions */ /*----------------------------------------------------------------------*/ -/* Convert the address of a byte in the buffer into a position. */ -INLINE_HEADER Bytebpos BI_BUF_PTR_BYTE_POS (struct buffer *buf, Intbyte *ptr); -INLINE_HEADER Bytebpos -BI_BUF_PTR_BYTE_POS (struct buffer *buf, Intbyte *ptr) -{ - return (ptr - buf->text->beg + 1 - - ((ptr - buf->text->beg + 1) > buf->text->gpt - ? buf->text->gap_size : 0)); -} - -#define BUF_PTR_BYTE_POS(buf, ptr) \ - bytebpos_to_charbpos (buf, BI_BUF_PTR_BYTE_POS (buf, ptr)) - -/* Address of byte at position POS in buffer. */ -INLINE_HEADER Intbyte * BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytebpos pos); -INLINE_HEADER Intbyte * -BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytebpos pos) +/* Address of byte at position POS in buffer, no error checking. */ +DECLARE_INLINE_HEADER ( +Ibyte * +BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (struct buffer *buf, Bytebpos pos) +) { return (buf->text->beg + ((pos >= buf->text->gpt ? (pos + buf->text->gap_size) : pos) - 1)); } -#define BUF_BYTE_ADDRESS(buf, pos) \ - BI_BUF_BYTE_ADDRESS (buf, charbpos_to_bytebpos (buf, pos)) - -/* Address of byte before position POS in buffer. */ -INLINE_HEADER Intbyte * BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytebpos pos); -INLINE_HEADER Intbyte * -BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytebpos pos) -{ - return (buf->text->beg + - ((pos > buf->text->gpt ? (pos + buf->text->gap_size) : pos) - - 2)); -} - -#define BUF_BYTE_ADDRESS_BEFORE(buf, pos) \ - BI_BUF_BYTE_ADDRESS_BEFORE (buf, charbpos_to_bytebpos (buf, pos)) - -/*----------------------------------------------------------------------*/ -/* Converting between byte indices and memory indices */ -/*----------------------------------------------------------------------*/ - -INLINE_HEADER int valid_membpos_p (struct buffer *buf, Membpos x); -INLINE_HEADER int -valid_membpos_p (struct buffer *buf, Membpos x) -{ - return ((x >= 1 && x <= (Membpos) buf->text->gpt) || - (x > (Membpos) (buf->text->gpt + buf->text->gap_size) && - x <= (Membpos) (buf->text->z + buf->text->gap_size))); -} - -INLINE_HEADER Membpos bytebpos_to_membpos (struct buffer *buf, Bytebpos x); -INLINE_HEADER Membpos -bytebpos_to_membpos (struct buffer *buf, Bytebpos x) -{ - return (Membpos) ((x > buf->text->gpt) ? (x + buf->text->gap_size) : x); -} - - -INLINE_HEADER Bytebpos membpos_to_bytebpos (struct buffer *buf, Membpos x); -INLINE_HEADER Bytebpos -membpos_to_bytebpos (struct buffer *buf, Membpos x) +/* Given a byte position, does it point to the beginning of a character? +*/ +#ifdef MULE +DECLARE_INLINE_HEADER ( +int +VALID_BYTEBPOS_P (struct buffer *buf, Bytebpos x) +) { -#ifdef ERROR_CHECK_TEXT - assert (valid_membpos_p (buf, x)); -#endif - return (Bytebpos) ((x > (Membpos) buf->text->gpt) ? - x - buf->text->gap_size : - x); + switch (BUF_FORMAT (buf)) + { + case FORMAT_DEFAULT: + return ibyte_first_byte_p (*BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, x)); + case FORMAT_16_BIT_FIXED: + return ((x - 1) & 1) == 0; + case FORMAT_32_BIT_FIXED: + return ((x - 1) & 3) == 0; + default: + return 1; + } } - -#define membpos_to_charbpos(buf, x) \ - bytebpos_to_charbpos (buf, membpos_to_bytebpos (buf, x)) -#define charbpos_to_membpos(buf, x) \ - bytebpos_to_membpos (buf, charbpos_to_bytebpos (buf, x)) - -/* These macros generalize many standard buffer-position functions to - either a buffer or a string. */ - -/* Converting between Membposs and Bytebposs, for a buffer-or-string. - For strings, this is a no-op. For buffers, this resolves - to the standard membpos<->bytebpos converters. */ - -#define buffer_or_string_bytebpos_to_membpos(obj, ind) \ - (BUFFERP (obj) ? bytebpos_to_membpos (XBUFFER (obj), ind) : (Membpos) ind) - -#define buffer_or_string_membpos_to_bytebpos(obj, ind) \ - (BUFFERP (obj) ? membpos_to_bytebpos (XBUFFER (obj), ind) : (Bytebpos) ind) - -/* Converting between Charbpos's and Bytebposs, for a buffer-or-string. - For strings, this maps to the bytecount<->charcount converters. */ - -#define buffer_or_string_charbpos_to_bytebpos(obj, pos) \ - (BUFFERP (obj) ? charbpos_to_bytebpos (XBUFFER (obj), pos) : \ - (Bytebpos) string_index_char_to_byte (obj, pos)) - -#define buffer_or_string_bytebpos_to_charbpos(obj, ind) \ - (BUFFERP (obj) ? bytebpos_to_charbpos (XBUFFER (obj), ind) : \ - (Charbpos) string_index_byte_to_char (obj, ind)) - -/* Similar for Charbpos's and Membposs. */ - -#define buffer_or_string_charbpos_to_membpos(obj, pos) \ - (BUFFERP (obj) ? charbpos_to_membpos (XBUFFER (obj), pos) : \ - (Membpos) string_index_char_to_byte (obj, pos)) - -#define buffer_or_string_membpos_to_charbpos(obj, ind) \ - (BUFFERP (obj) ? membpos_to_charbpos (XBUFFER (obj), ind) : \ - (Charbpos) string_index_byte_to_char (obj, ind)) - -/************************************************************************/ -/* */ -/* working with buffer-level data */ -/* */ -/************************************************************************/ - -/* - - (A) Working with byte indices: - ------------------------------ - - VALID_BYTEBPOS_P(buf, bi): - Given a byte index, does it point to the beginning of a character? - - ASSERT_VALID_BYTEBPOS_UNSAFE(buf, bi): - If error-checking is enabled, assert that the given byte index - is within range and points to the beginning of a character - or to the end of the buffer. Otherwise, do nothing. - - ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE(buf, bi): - If error-checking is enabled, assert that the given byte index - is within range and satisfies ASSERT_VALID_BYTEBPOS() and also - does not refer to the beginning of the buffer. (i.e. movement - backwards is OK.) Otherwise, do nothing. - - ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE(buf, bi): - If error-checking is enabled, assert that the given byte index - is within range and satisfies ASSERT_VALID_BYTEBPOS() and also - does not refer to the end of the buffer. (i.e. movement - forwards is OK.) Otherwise, do nothing. - - VALIDATE_BYTEBPOS_BACKWARD(buf, bi): - Make sure that the given byte index is pointing to the beginning - of a character. If not, back up until this is the case. Note - that there are not too many places where it is legitimate to do - this sort of thing. It's an error if you're passed an "invalid" - byte index. - - VALIDATE_BYTEBPOS_FORWARD(buf, bi): - Make sure that the given byte index is pointing to the beginning - of a character. If not, move forward until this is the case. - Note that there are not too many places where it is legitimate - to do this sort of thing. It's an error if you're passed an - "invalid" byte index. - - INC_BYTEBPOS(buf, bi): - Given a byte index (assumed to point at the beginning of a - character), modify that value so it points to the beginning - of the next character. - - DEC_BYTEBPOS(buf, bi): - Given a byte index (assumed to point at the beginning of a - character), modify that value so it points to the beginning - of the previous character. Unlike for DEC_CHARPTR(), we can - do all the assert()s because there are sentinels at the - beginning of the gap and the end of the buffer. - - BYTEBPOS_INVALID: - A constant representing an invalid Bytebpos. Valid Bytebposs - can never have this value. - - - (B) Converting between Charbpos's and Bytebposs: - -------------------------------------------- - - charbpos_to_bytebpos(buf, bu): - Given a Charbpos, return the equivalent Bytebpos. - - bytebpos_to_charbpos(buf, bi): - Given a Bytebpos, return the equivalent Charbpos. - - make_charbpos(buf, bi): - Given a Bytebpos, return the equivalent Charbpos as a Lisp Object. - */ - - -/*----------------------------------------------------------------------*/ -/* working with byte indices */ -/*----------------------------------------------------------------------*/ - -#ifdef MULE -# define VALID_BYTEBPOS_P(buf, x) \ - INTBYTE_FIRST_BYTE_P (*BI_BUF_BYTE_ADDRESS (buf, x)) #else # define VALID_BYTEBPOS_P(buf, x) 1 #endif -#ifdef ERROR_CHECK_TEXT +/* If error-checking is enabled, assert that the given char position is + within range. Otherwise, do nothing. +*/ +# define ASSERT_VALID_CHARBPOS_UNSAFE(buf, x) do { \ + text_checking_assert (BUFFER_LIVE_P (buf)); \ + text_checking_assert ((x) >= BUF_BEG (buf) && x <= BUF_Z (buf)); \ +} while (0) + +/* If error-checking is enabled, assert that the given byte position is + within range and points to the beginning of a character or to the end of + the buffer. Otherwise, do nothing. +*/ +# define ASSERT_VALID_BYTEBPOS_UNSAFE(buf, x) do { \ + text_checking_assert (BUFFER_LIVE_P (buf)); \ + text_checking_assert ((x) >= BYTE_BUF_BEG (buf) && x <= BYTE_BUF_Z (buf)); \ + text_checking_assert (VALID_BYTEBPOS_P (buf, x)); \ +} while (0) -# define ASSERT_VALID_BYTEBPOS_UNSAFE(buf, x) do { \ - assert (BUFFER_LIVE_P (buf)); \ - assert ((x) >= BI_BUF_BEG (buf) && x <= BI_BUF_Z (buf)); \ - assert (VALID_BYTEBPOS_P (buf, x)); \ -} while (0) -# define ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE(buf, x) do { \ - assert (BUFFER_LIVE_P (buf)); \ - assert ((x) > BI_BUF_BEG (buf) && x <= BI_BUF_Z (buf)); \ - assert (VALID_BYTEBPOS_P (buf, x)); \ -} while (0) -# define ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE(buf, x) do { \ - assert (BUFFER_LIVE_P (buf)); \ - assert ((x) >= BI_BUF_BEG (buf) && x < BI_BUF_Z (buf)); \ - assert (VALID_BYTEBPOS_P (buf, x)); \ -} while (0) - -#else /* not ERROR_CHECK_TEXT */ -# define ASSERT_VALID_BYTEBPOS_UNSAFE(buf, x) -# define ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE(buf, x) -# define ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE(buf, x) - -#endif /* not ERROR_CHECK_TEXT */ - -/* Note that, although the Mule version will work fine for non-Mule - as well (it should reduce down to nothing), we provide a separate - version to avoid compilation warnings and possible non-optimal - results with stupid compilers. */ +/* If error-checking is enabled, assert that the given byte position is + within range and satisfies ASSERT_VALID_BYTEBPOS() and also does not + refer to the beginning of the buffer. (i.e. movement backwards is OK.) + Otherwise, do nothing. +*/ +# define ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE(buf, x) do { \ + text_checking_assert (BUFFER_LIVE_P (buf)); \ + text_checking_assert ((x) > BYTE_BUF_BEG (buf) && x <= BYTE_BUF_Z (buf)); \ + text_checking_assert (VALID_BYTEBPOS_P (buf, x)); \ +} while (0) + +/* If error-checking is enabled, assert that the given byte position is + within range and satisfies ASSERT_VALID_BYTEBPOS() and also does not + refer to the end of the buffer. (i.e. movement forwards is OK.) + Otherwise, do nothing. +*/ +# define ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE(buf, x) do { \ + text_checking_assert (BUFFER_LIVE_P (buf)); \ + text_checking_assert ((x) >= BYTE_BUF_BEG (buf) && x < BYTE_BUF_Z (buf)); \ + text_checking_assert (VALID_BYTEBPOS_P (buf, x)); \ +} while (0) #ifdef MULE -# define VALIDATE_BYTEBPOS_BACKWARD(buf, x) do { \ - Intbyte *VBB_ptr = BI_BUF_BYTE_ADDRESS (buf, x); \ - while (!INTBYTE_FIRST_BYTE_P (*VBB_ptr)) \ - VBB_ptr--, (x)--; \ +/* Make sure that the given byte position is pointing to the beginning of a + character. If not, back up until this is the case. Note that there are + not too many places where it is legitimate to do this sort of thing. + It's an error if you're passed an "invalid" byte position. +*/ +# define VALIDATE_BYTEBPOS_BACKWARD(buf, x) do { \ + switch (BUF_FORMAT (buf)) \ + { \ + case FORMAT_DEFAULT: \ + { \ + Ibyte *VBB_ptr = BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, x); \ + while (!ibyte_first_byte_p (*VBB_ptr)) \ + VBB_ptr--, (x)--; \ + } \ + break; \ + case FORMAT_16_BIT_FIXED: \ + if (((x - 1) & 1) != 0) \ + x--; \ + break; \ + case FORMAT_32_BIT_FIXED: \ + while (((x - 1) & 3) != 0) \ + x--; \ + break; \ + default: \ + break; \ + } \ } while (0) #else # define VALIDATE_BYTEBPOS_BACKWARD(buf, x) #endif -/* Note that, although the Mule version will work fine for non-Mule - as well (it should reduce down to nothing), we provide a separate - version to avoid compilation warnings and possible non-optimal - results with stupid compilers. */ - #ifdef MULE -# define VALIDATE_BYTEBPOS_FORWARD(buf, x) do { \ - Intbyte *VBF_ptr = BI_BUF_BYTE_ADDRESS (buf, x); \ - while (!INTBYTE_FIRST_BYTE_P (*VBF_ptr)) \ - VBF_ptr++, (x)++; \ +/* Make sure that the given byte position is pointing to the beginning of a + character. If not, move forward until this is the case. Note that + there are not too many places where it is legitimate to do this sort of + thing. It's an error if you're passed an "invalid" byte position. +*/ +# define VALIDATE_BYTEBPOS_FORWARD(buf, x) do { \ + switch (BUF_FORMAT (buf)) \ + { \ + case FORMAT_DEFAULT: \ + { \ + Ibyte *VBF_ptr = BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, x); \ + while (!ibyte_first_byte_p (*VBF_ptr)) \ + VBF_ptr++, (x)++; \ + } \ + break; \ + case FORMAT_16_BIT_FIXED: \ + if (((x - 1) & 1) != 0) \ + x++; \ + break; \ + case FORMAT_32_BIT_FIXED: \ + while (((x - 1) & 3) != 0) \ + x++; \ + break; \ + default: \ + break; \ + } \ } while (0) #else # define VALIDATE_BYTEBPOS_FORWARD(buf, x) #endif -/* Note that in the simplest case (no MULE, no ERROR_CHECK_TEXT), - this crap reduces down to simply (x)++. */ +/*----------------------------------------------------------------------*/ +/* Working with byte positions */ +/*----------------------------------------------------------------------*/ + + +/* Given a byte position (assumed to point at the beginning of a + character), modify that value so it points to the beginning of the next + character. + + Note that in the simplest case (no MULE, no ERROR_CHECK_TEXT), + this crap reduces down to simply (x)++. */ #define INC_BYTEBPOS(buf, x) do \ { \ - ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE (buf, x); \ + ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE (buf, x); \ /* Note that we do the increment first to \ make sure that the pointer in \ VALIDATE_BYTEBPOS_FORWARD() ends up on \ @@ -562,8 +489,14 @@ VALIDATE_BYTEBPOS_FORWARD (buf, x); \ } while (0) -/* Note that in the simplest case (no MULE, no ERROR_CHECK_TEXT), - this crap reduces down to simply (x)--. */ +/* Given a byte position (assumed to point at the beginning of a + character), modify that value so it points to the beginning of the + previous character. Unlike for DEC_IBYTEPTR(), we can do all the + assert()s because there are sentinels at the beginning of the gap and + the end of the buffer. + + Note that in the simplest case (no MULE, no ERROR_CHECK_TEXT), this + crap reduces down to simply (x)--. */ #define DEC_BYTEBPOS(buf, x) do \ { \ @@ -576,33 +509,35 @@ VALIDATE_BYTEBPOS_BACKWARD (buf, x); \ } while (0) -INLINE_HEADER Bytebpos prev_bytebpos (struct buffer *buf, Bytebpos x); -INLINE_HEADER Bytebpos +DECLARE_INLINE_HEADER ( +Bytebpos prev_bytebpos (struct buffer *buf, Bytebpos x) +) { DEC_BYTEBPOS (buf, x); return x; } -INLINE_HEADER Bytebpos next_bytebpos (struct buffer *buf, Bytebpos x); -INLINE_HEADER Bytebpos +DECLARE_INLINE_HEADER ( +Bytebpos next_bytebpos (struct buffer *buf, Bytebpos x) +) { INC_BYTEBPOS (buf, x); return x; } +/* A constant representing an invalid Bytebpos. Valid Bytebposes + can never have this value. */ + #define BYTEBPOS_INVALID ((Bytebpos) -1) /*----------------------------------------------------------------------*/ -/* Converting between buffer positions and byte indices */ +/* Converting between byte and character positions */ /*----------------------------------------------------------------------*/ #ifdef MULE -Bytebpos charbpos_to_bytebpos_func (struct buffer *buf, Charbpos x); -Charbpos bytebpos_to_charbpos_func (struct buffer *buf, Bytebpos x); - /* The basic algorithm we use is to keep track of a known region of characters in each buffer, all of which are of the same width. We keep track of the boundaries of the region in both Charbpos and Bytebpos @@ -665,76 +600,303 @@ worth seeing if anything can be gleaned. */ +Bytebpos charbpos_to_bytebpos_func (struct buffer *buf, Charbpos x); +Charbpos bytebpos_to_charbpos_func (struct buffer *buf, Bytebpos x); extern short three_to_one_table[]; -INLINE_HEADER Bytebpos real_charbpos_to_bytebpos (struct buffer *buf, Charbpos x); -INLINE_HEADER Bytebpos -real_charbpos_to_bytebpos (struct buffer *buf, Charbpos x) -{ - if (buf->text->entirely_ascii_p) - return (Bytebpos) x; - if (x >= buf->text->mule_bufmin && x <= buf->text->mule_bufmax) - return (buf->text->mule_bytmin + +#endif /* MULE */ + +/* Given a Charbpos, return the equivalent Bytebpos. */ + +DECLARE_INLINE_HEADER ( +Bytebpos +charbpos_to_bytebpos (struct buffer *buf, Charbpos x) +) +{ + Bytebpos retval; + ASSERT_VALID_CHARBPOS_UNSAFE (buf, x); +#ifdef MULE + if (buf->text->entirely_one_byte_p) + retval = (Bytebpos) x; + else if (BUF_FORMAT (buf) == FORMAT_16_BIT_FIXED) + retval = (Bytebpos) (x << 1); + else if (BUF_FORMAT (buf) == FORMAT_32_BIT_FIXED) + retval = (Bytebpos) (x << 2); + else if (x >= buf->text->mule_bufmin && x <= buf->text->mule_bufmax) + retval = (buf->text->mule_bytmin + ((x - buf->text->mule_bufmin) << buf->text->mule_shifter) + - (buf->text->mule_three_p ? (x - buf->text->mule_bufmin) : 0)); + (buf->text->mule_three_p ? (x - buf->text->mule_bufmin) : + (Bytebpos) 0)); else - return charbpos_to_bytebpos_func (buf, x); + retval = charbpos_to_bytebpos_func (buf, x); +#else + retval = (Bytebpos) x; +#endif + ASSERT_VALID_BYTEBPOS_UNSAFE (buf, retval); + return retval; } -INLINE_HEADER Charbpos real_bytebpos_to_charbpos (struct buffer *buf, Bytebpos x); -INLINE_HEADER Charbpos -real_bytebpos_to_charbpos (struct buffer *buf, Bytebpos x) -{ - if (buf->text->entirely_ascii_p) - return (Charbpos) x; - if (x >= buf->text->mule_bytmin && x <= buf->text->mule_bytmax) - return (buf->text->mule_bufmin + - ((buf->text->mule_three_p - ? three_to_one_table[x - buf->text->mule_bytmin] - : (x - buf->text->mule_bytmin) >> buf->text->mule_shifter))); +/* Given a Bytebpos, return the equivalent Charbpos. */ + +DECLARE_INLINE_HEADER ( +Charbpos +bytebpos_to_charbpos (struct buffer *buf, Bytebpos x) +) +{ + Charbpos retval; + ASSERT_VALID_BYTEBPOS_UNSAFE (buf, x); +#ifdef MULE + if (buf->text->entirely_one_byte_p) + retval = (Charbpos) x; + else if (BUF_FORMAT (buf) == FORMAT_16_BIT_FIXED) + retval = (Charbpos) (x >> 1); + else if (BUF_FORMAT (buf) == FORMAT_32_BIT_FIXED) + retval = (Charbpos) (x >> 2); + else if (x >= buf->text->mule_bytmin && x <= buf->text->mule_bytmax) + retval = (buf->text->mule_bufmin + + ((buf->text->mule_three_p + ? three_to_one_table[x - buf->text->mule_bytmin] + : (x - buf->text->mule_bytmin) >> buf->text->mule_shifter))); else - return bytebpos_to_charbpos_func (buf, x); + retval = bytebpos_to_charbpos_func (buf, x); +#else + retval = (Charbpos) x; +#endif + ASSERT_VALID_CHARBPOS_UNSAFE (buf, retval); + return retval; } -#else /* not MULE */ +/* Given a Bytebpos, return the equivalent Charbpos as a Lisp Object. */ -# define real_charbpos_to_bytebpos(buf, x) ((Bytebpos) x) -# define real_bytebpos_to_charbpos(buf, x) ((Charbpos) x) +#define make_charbpos(buf, ind) make_int (bytebpos_to_charbpos (buf, ind)) -#endif /* not MULE */ +/*----------------------------------------------------------------------*/ +/* Converting between byte and memory positions */ +/*----------------------------------------------------------------------*/ -#ifdef ERROR_CHECK_TEXT +DECLARE_INLINE_HEADER ( +int +valid_membpos_p (struct buffer *buf, Membpos x) +) +{ + return ((x >= 1 && x <= (Membpos) buf->text->gpt) || + (x > (Membpos) (buf->text->gpt + buf->text->gap_size) && + x <= (Membpos) (buf->text->z + buf->text->gap_size))); +} -Bytebpos charbpos_to_bytebpos (struct buffer *buf, Charbpos x); -Charbpos bytebpos_to_charbpos (struct buffer *buf, Bytebpos x); +DECLARE_INLINE_HEADER ( +Membpos +bytebpos_to_membpos (struct buffer *buf, Bytebpos x) +) +{ + ASSERT_VALID_BYTEBPOS_UNSAFE (buf, x); + return (Membpos) ((x > buf->text->gpt) ? (x + buf->text->gap_size) : x); +} -#else /* not ERROR_CHECK_TEXT */ -#define charbpos_to_bytebpos real_charbpos_to_bytebpos -#define bytebpos_to_charbpos real_bytebpos_to_charbpos +DECLARE_INLINE_HEADER ( +Bytebpos +membpos_to_bytebpos (struct buffer *buf, Membpos x) +) +{ + Bytebpos retval; + text_checking_assert (valid_membpos_p (buf, x)); + retval = (Bytebpos) ((x > (Membpos) buf->text->gpt) ? + x - buf->text->gap_size : + x); + ASSERT_VALID_BYTEBPOS_UNSAFE (buf, retval); + return retval; +} -#endif /* not ERROR_CHECK_TEXT */ +DECLARE_INLINE_HEADER ( +Charbpos +membpos_to_charbpos (struct buffer *buf, Membpos x) +) +{ + return bytebpos_to_charbpos (buf, membpos_to_bytebpos (buf, x)); +} -#define make_charbpos(buf, ind) make_int (bytebpos_to_charbpos (buf, ind)) +DECLARE_INLINE_HEADER ( +Membpos +charbpos_to_membpos (struct buffer *buf, Charbpos x) +) +{ + return bytebpos_to_membpos (buf, charbpos_to_bytebpos (buf, x)); +} + +/*----------------------------------------------------------------------*/ +/* Generalized buffer/string position convertors */ +/*----------------------------------------------------------------------*/ + +/* These macros generalize many standard buffer-position functions to + either a buffer or a string. */ + +/* Converting between Memxpos's and Bytexpos's, for a buffer-or-string. + For strings, this is a no-op. For buffers, this resolves + to the standard membpos<->bytebpos converters. */ + +DECLARE_INLINE_HEADER ( +Memxpos buffer_or_string_bytexpos_to_memxpos (Lisp_Object obj, Bytexpos pos) +) +{ + return (BUFFERP (obj) ? bytebpos_to_membpos (XBUFFER (obj), pos) : + (Memxpos) pos); +} + +DECLARE_INLINE_HEADER ( +Bytexpos buffer_or_string_memxpos_to_bytexpos (Lisp_Object obj, Memxpos pos) +) +{ + return (BUFFERP (obj) ? membpos_to_bytebpos (XBUFFER (obj), pos) : + (Bytexpos) pos); +} + +/* Converting between Charxpos's and Bytexpos's, for a buffer-or-string. + For strings, this maps to the bytecount<->charcount converters. */ + +DECLARE_INLINE_HEADER ( +Bytexpos buffer_or_string_charxpos_to_bytexpos (Lisp_Object obj, Charxpos pos) +) +{ + return (BUFFERP (obj) ? charbpos_to_bytebpos (XBUFFER (obj), pos) : + (Bytexpos) string_index_char_to_byte (obj, pos)); +} + +DECLARE_INLINE_HEADER ( +Charxpos buffer_or_string_bytexpos_to_charxpos (Lisp_Object obj, Bytexpos pos) +) +{ + return (BUFFERP (obj) ? bytebpos_to_charbpos (XBUFFER (obj), pos) : + (Charxpos) string_index_byte_to_char (obj, pos)); +} + +/* Similar for Charxpos's and Memxpos's. */ + +DECLARE_INLINE_HEADER ( +Memxpos buffer_or_string_charxpos_to_memxpos (Lisp_Object obj, Charxpos pos) +) +{ + return (BUFFERP (obj) ? charbpos_to_membpos (XBUFFER (obj), pos) : + (Memxpos) string_index_char_to_byte (obj, pos)); +} + +DECLARE_INLINE_HEADER ( +Charxpos buffer_or_string_memxpos_to_charxpos (Lisp_Object obj, Memxpos pos) +) +{ + return (BUFFERP (obj) ? membpos_to_charbpos (XBUFFER (obj), pos) : + (Charxpos) string_index_byte_to_char (obj, pos)); +} + +DECLARE_INLINE_HEADER ( +Internal_Format buffer_or_other_internal_format (Lisp_Object obj) +) +{ + return BUFFERP (obj) ? BUF_FORMAT (XBUFFER (obj)) : FORMAT_DEFAULT; +} + +/* Return the index to the character before the one at X, + in a buffer or string. */ + +DECLARE_INLINE_HEADER ( +Bytebpos +prev_bytexpos (Lisp_Object obj, Bytebpos x) +) +{ + return BUFFERP (obj) ? prev_bytebpos (XBUFFER (obj), x) : + prev_string_index (obj, x); +} + +/* Return the index to the character after the one at X, + in a buffer or string. */ + +DECLARE_INLINE_HEADER ( +Bytebpos +next_bytexpos (Lisp_Object obj, Bytebpos x) +) +{ + return BUFFERP (obj) ? next_bytebpos (XBUFFER (obj), x) : + next_string_index (obj, x); +} + +/*----------------------------------------------------------------------*/ +/* Converting between positions and addresses */ +/*----------------------------------------------------------------------*/ + +/* Convert the address of a byte in the buffer into a position. */ +DECLARE_INLINE_HEADER ( +Bytebpos +BYTE_BUF_PTR_BYTE_POS (struct buffer *buf, Ibyte *ptr) +) +{ + Bytebpos retval = (ptr - buf->text->beg + 1 + - ((ptr - buf->text->beg + 1) > buf->text->gpt + ? buf->text->gap_size : (Bytebpos) 0)); + ASSERT_VALID_BYTEBPOS_UNSAFE (buf, retval); + return retval; +} + +#define BUF_PTR_BYTE_POS(buf, ptr) \ + bytebpos_to_charbpos (buf, BYTE_BUF_PTR_BYTE_POS (buf, ptr)) + +/* Address of byte at position POS in buffer. */ +DECLARE_INLINE_HEADER ( +Ibyte * +BYTE_BUF_BYTE_ADDRESS (struct buffer *buf, Bytebpos pos) +) +{ + ASSERT_VALID_BYTEBPOS_UNSAFE (buf, pos); + return BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, pos); +} + +#define BUF_BYTE_ADDRESS(buf, pos) \ + BYTE_BUF_BYTE_ADDRESS (buf, charbpos_to_bytebpos (buf, pos)) + +/* Address of byte before position POS in buffer. */ +DECLARE_INLINE_HEADER ( +Ibyte * +BYTE_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytebpos pos) +) +{ + ASSERT_VALID_BYTEBPOS_UNSAFE (buf, pos); + return (buf->text->beg + + ((pos > buf->text->gpt ? (pos + buf->text->gap_size) : pos) + - 2)); +} + +#define BUF_BYTE_ADDRESS_BEFORE(buf, pos) \ + BYTE_BUF_BYTE_ADDRESS_BEFORE (buf, charbpos_to_bytebpos (buf, pos)) /*----------------------------------------------------------------------*/ /* Converting between buffer bytes and Emacs characters */ /*----------------------------------------------------------------------*/ /* The character at position POS in buffer. */ -#define BI_BUF_FETCH_CHAR(buf, pos) \ - charptr_emchar (BI_BUF_BYTE_ADDRESS (buf, pos)) + +#define BYTE_BUF_FETCH_CHAR(buf, pos) \ + itext_ichar_fmt (BYTE_BUF_BYTE_ADDRESS (buf, pos), BUF_FORMAT (buf), \ + wrap_buffer (buf)) #define BUF_FETCH_CHAR(buf, pos) \ - BI_BUF_FETCH_CHAR (buf, charbpos_to_bytebpos (buf, pos)) + BYTE_BUF_FETCH_CHAR (buf, charbpos_to_bytebpos (buf, pos)) + +/* The "raw value" of the character at position POS in buffer. + See ichar_to_raw(). */ + +#define BYTE_BUF_FETCH_CHAR_RAW(buf, pos) \ + itext_ichar_raw_fmt (BYTE_BUF_BYTE_ADDRESS (buf, pos), BUF_FORMAT (buf)) +#define BUF_FETCH_CHAR_RAW(buf, pos) \ + BYTE_BUF_FETCH_CHAR_RAW (buf, charbpos_to_bytebpos (buf, pos)) /* The character at position POS in buffer, as a string. This is - equivalent to set_charptr_emchar (str, BUF_FETCH_CHAR (buf, pos)) + equivalent to set_itext_ichar (str, BUF_FETCH_CHAR (buf, pos)) but is faster for Mule. */ -# define BI_BUF_CHARPTR_COPY_CHAR(buf, pos, str) \ - charptr_copy_char (BI_BUF_BYTE_ADDRESS (buf, pos), str) -#define BUF_CHARPTR_COPY_CHAR(buf, pos, str) \ - BI_BUF_CHARPTR_COPY_CHAR (buf, charbpos_to_bytebpos (buf, pos), str) +# define BYTE_BUF_ITEXT_COPY_ICHAR(buf, pos, str) \ + (BUF_FORMAT (buf) == FORMAT_DEFAULT ? \ + itext_copy_ichar (BYTE_BUF_BYTE_ADDRESS (buf, pos), str) : \ + set_itext_ichar (str, BYTE_BUF_FETCH_CHAR (buf, pos))) +#define BUF_ITEXT_COPY_ICHAR(buf, pos, str) \ + BYTE_BUF_ITEXT_COPY_ICHAR (buf, charbpos_to_bytebpos (buf, pos), str) /************************************************************************/ @@ -748,18 +910,18 @@ /*----------------------------------------------------------------------*/ /* Set beginning of accessible range of buffer. */ -#define SET_BOTH_BUF_BEGV(buf, val, bival) \ +#define SET_BOTH_BUF_BEGV(buf, val, bpval) \ do \ { \ - (buf)->begv = (bival); \ + (buf)->begv = (bpval); \ (buf)->bufbegv = (val); \ } while (0) /* Set end of accessible range of buffer. */ -#define SET_BOTH_BUF_ZV(buf, val, bival) \ +#define SET_BOTH_BUF_ZV(buf, val, bpval) \ do \ { \ - (buf)->zv = (bival); \ + (buf)->zv = (bpval); \ (buf)->bufzv = (val); \ } while (0) @@ -769,11 +931,20 @@ specified. However, point is set in lots and lots of places. So we provide the ability to specify both (for efficiency) or just one. */ -#define BOTH_BUF_SET_PT(buf, val, bival) set_buffer_point (buf, val, bival) -#define BI_BUF_SET_PT(buf, bival) \ - BOTH_BUF_SET_PT (buf, bytebpos_to_charbpos (buf, bival), bival) -#define BUF_SET_PT(buf, value) \ - BOTH_BUF_SET_PT (buf, value, charbpos_to_bytebpos (buf, value)) +#define BOTH_BUF_SET_PT(buf, val, bpval) set_buffer_point (buf, val, bpval) +#define BYTE_BUF_SET_PT(buf, bpval) \ +do \ +{ \ + Bytebpos __bpbsp_bpval = (bpval); \ + BOTH_BUF_SET_PT (buf, bytebpos_to_charbpos (buf, __bpbsp_bpval), \ + __bpbsp_bpval); \ +} while (0) +#define BUF_SET_PT(buf, value) \ +do \ +{ \ + Bytebpos __bsp_val = (value); \ + BOTH_BUF_SET_PT (buf, __bsp_val, charbpos_to_bytebpos (buf, __bsp_val)); \ +} while (0) #if 0 /* FSFmacs */ @@ -792,38 +963,72 @@ /* Is this buffer narrowed? */ #define BUF_NARROWED(buf) \ - ((BI_BUF_BEGV (buf) != BI_BUF_BEG (buf)) || \ - (BI_BUF_ZV (buf) != BI_BUF_Z (buf))) + ((BYTE_BUF_BEGV (buf) != BYTE_BUF_BEG (buf)) || \ + (BYTE_BUF_ZV (buf) != BYTE_BUF_Z (buf))) -/* Modification count. */ +/* Modification count */ #define BUF_MODIFF(buf) ((buf)->text->modiff) -/* Saved modification count. */ +/* Saved modification count */ #define BUF_SAVE_MODIFF(buf) ((buf)->text->save_modiff) /* Face changed. */ #define BUF_FACECHANGE(buf) ((buf)->face_change) -#define POINT_MARKER_P(marker) \ - (XMARKER (marker)->buffer != 0 && \ - EQ (marker, XMARKER (marker)->buffer->point_marker)) +DECLARE_INLINE_HEADER ( +int +POINT_MARKER_P (Lisp_Object marker) +) +{ + return (XMARKER (marker)->buffer != 0 && + EQ (marker, XMARKER (marker)->buffer->point_marker)); +} #define BUF_MARKERS(buf) ((buf)->markers) +#ifdef MULE + +DECLARE_INLINE_HEADER ( +Lisp_Object +BUFFER_CATEGORY_TABLE (struct buffer *buf) +) +{ + return buf ? buf->category_table : Vstandard_category_table; +} + +#endif /* MULE */ + +DECLARE_INLINE_HEADER ( +Lisp_Object +BUFFER_SYNTAX_TABLE (struct buffer *buf) +) +{ + return buf ? buf->syntax_table : Vstandard_syntax_table; +} + +DECLARE_INLINE_HEADER ( +Lisp_Object +BUFFER_MIRROR_SYNTAX_TABLE (struct buffer *buf) +) +{ + return buf ? buf->mirror_syntax_table : + XCHAR_TABLE (Vstandard_syntax_table)->mirror_table; +} + /* WARNING: The new definitions of CEILING_OF() and FLOOR_OF() differ semantically from the old ones (in FSF Emacs and XEmacs 19.11 and before). Conversion is as follows: - OLD_BI_CEILING_OF(n) = NEW_BI_CEILING_OF(n) - 1 - OLD_BI_FLOOR_OF(n) = NEW_BI_FLOOR_OF(n + 1) + OLD_BYTE_CEILING_OF(n) = NEW_BYTE_CEILING_OF(n) - 1 + OLD_BYTE_FLOOR_OF(n) = NEW_BYTE_FLOOR_OF(n + 1) The definitions were changed because the new definitions are more consistent with the way everything else works in XEmacs. */ -/* Properties of CEILING_OF and FLOOR_OF (also apply to BI_ variants): +/* Properties of CEILING_OF and FLOOR_OF (also apply to BYTE_ variants): 1) FLOOR_OF (CEILING_OF (n)) = n CEILING_OF (FLOOR_OF (n)) = n @@ -852,11 +1057,9 @@ while (pos < to) { - Bytebpos ceil; - - ceil = BI_BUF_CEILING_OF (buf, pos); + Bytebpos ceil = BYTE_BUF_CEILING_OF (buf, pos); ceil = min (to, ceil); - process_intbyte_string (BI_BUF_BYTE_ADDRESS (buf, pos), ceil - pos); + process_ibyte_string (BYTE_BUF_BYTE_ADDRESS (buf, pos), ceil - pos); pos = ceil; } } @@ -867,40 +1070,64 @@ */ -/* Return the maximum index in the buffer it is safe to scan forwards +/* Return the maximum position in the buffer it is safe to scan forwards past N to. This is used to prevent buffer scans from running into the gap (e.g. search.c). All characters between N and CEILING_OF(N) are located contiguous in memory. Note that the character *at* CEILING_OF(N) is not contiguous in memory. */ -#define BI_BUF_CEILING_OF(b, n) \ - ((n) < (b)->text->gpt && (b)->text->gpt < BI_BUF_ZV (b) ? \ - (b)->text->gpt : BI_BUF_ZV (b)) +#define BYTE_BUF_CEILING_OF(b, n) \ + ((n) < (b)->text->gpt && (b)->text->gpt < BYTE_BUF_ZV (b) ? \ + (b)->text->gpt : BYTE_BUF_ZV (b)) #define BUF_CEILING_OF(b, n) \ - bytebpos_to_charbpos (b, BI_BUF_CEILING_OF (b, charbpos_to_bytebpos (b, n))) + bytebpos_to_charbpos (b, BYTE_BUF_CEILING_OF (b, charbpos_to_bytebpos (b, n))) -/* Return the minimum index in the buffer it is safe to scan backwards +/* Return the minimum position in the buffer it is safe to scan backwards past N to. All characters between FLOOR_OF(N) and N are located contiguous in memory. Note that the character *at* N may not be contiguous in memory. */ -#define BI_BUF_FLOOR_OF(b, n) \ - (BI_BUF_BEGV (b) < (b)->text->gpt && (b)->text->gpt < (n) ? \ - (b)->text->gpt : BI_BUF_BEGV (b)) +#define BYTE_BUF_FLOOR_OF(b, n) \ + (BYTE_BUF_BEGV (b) < (b)->text->gpt && (b)->text->gpt < (n) ? \ + (b)->text->gpt : BYTE_BUF_BEGV (b)) #define BUF_FLOOR_OF(b, n) \ - bytebpos_to_charbpos (b, BI_BUF_FLOOR_OF (b, charbpos_to_bytebpos (b, n))) + bytebpos_to_charbpos (b, BYTE_BUF_FLOOR_OF (b, charbpos_to_bytebpos (b, n))) -#define BI_BUF_CEILING_OF_IGNORE_ACCESSIBLE(b, n) \ - ((n) < (b)->text->gpt && (b)->text->gpt < BI_BUF_Z (b) ? \ - (b)->text->gpt : BI_BUF_Z (b)) +#define BYTE_BUF_CEILING_OF_IGNORE_ACCESSIBLE(b, n) \ + ((n) < (b)->text->gpt && (b)->text->gpt < BYTE_BUF_Z (b) ? \ + (b)->text->gpt : BYTE_BUF_Z (b)) #define BUF_CEILING_OF_IGNORE_ACCESSIBLE(b, n) \ bytebpos_to_charbpos \ - (b, BI_BUF_CEILING_OF_IGNORE_ACCESSIBLE (b, charbpos_to_bytebpos (b, n))) + (b, BYTE_BUF_CEILING_OF_IGNORE_ACCESSIBLE (b, charbpos_to_bytebpos (b, n))) -#define BI_BUF_FLOOR_OF_IGNORE_ACCESSIBLE(b, n) \ - (BI_BUF_BEG (b) < (b)->text->gpt && (b)->text->gpt < (n) ? \ - (b)->text->gpt : BI_BUF_BEG (b)) +#define BYTE_BUF_FLOOR_OF_IGNORE_ACCESSIBLE(b, n) \ + (BYTE_BUF_BEG (b) < (b)->text->gpt && (b)->text->gpt < (n) ? \ + (b)->text->gpt : BYTE_BUF_BEG (b)) #define BUF_FLOOR_OF_IGNORE_ACCESSIBLE(b, n) \ bytebpos_to_charbpos \ - (b, BI_BUF_FLOOR_OF_IGNORE_ACCESSIBLE (b, charbpos_to_bytebpos (b, n))) + (b, BYTE_BUF_FLOOR_OF_IGNORE_ACCESSIBLE (b, charbpos_to_bytebpos (b, n))) + +/* Iterate over contiguous chunks of text in buffer BUF, starting at POS, + of length LEN. Evaluates POS and LEN only once, but BUF multiply. In + each iteration, store the current chunk into RUNPTR/RUNLEN, which will + be automatically declared (don't declare them yourself). This does not + respect the limits of accessibility (BUF_BEGV/BUF_ZV); if you want these + limits respected, you need to impose them yourself. + + NOTE: This must be surrounded with braces! */ + +#define BUFFER_TEXT_LOOP(buf, pos, len, runptr, runlen) \ +Ibyte *runptr; \ +Bytecount runlen; \ +Bytebpos BTL_pos = (pos); \ +Bytebpos BTL_len = (len); \ +for (runptr = BYTE_BUF_BYTE_ADDRESS (buf, BTL_pos), \ + runlen = BYTE_BUF_CEILING_OF_IGNORE_ACCESSIBLE (buf, BTL_pos) - BTL_pos, \ + runlen = min (BTL_len, runlen); \ + BTL_len > 0; \ + BTL_pos += runlen, \ + BTL_len -= runlen, \ + runptr = BYTE_BUF_BYTE_ADDRESS (buf, BTL_pos), \ + runlen = BYTE_BUF_CEILING_OF_IGNORE_ACCESSIBLE (buf, BTL_pos) - BTL_pos, \ + runlen = min (BTL_len, runlen)) /* This structure marks which slots in a buffer have corresponding default values in Vbuffer_defaults. @@ -927,18 +1154,18 @@ void r_alloc_free (unsigned char **); #define BUFFER_ALLOC(data, size) \ - ((Intbyte *) r_alloc ((unsigned char **) &data, (size) * sizeof(Intbyte))) + ((Ibyte *) r_alloc ((unsigned char **) &data, (size) * sizeof(Ibyte))) #define BUFFER_REALLOC(data, size) \ - ((Intbyte *) r_re_alloc ((unsigned char **) &data, (size) * sizeof(Intbyte))) + ((Ibyte *) r_re_alloc ((unsigned char **) &data, (size) * sizeof(Ibyte))) #define BUFFER_FREE(data) r_alloc_free ((unsigned char **) &(data)) #define R_ALLOC_DECLARE(var,data) r_alloc_declare (&(var), data) #else /* !REL_ALLOC */ #define BUFFER_ALLOC(data,size)\ - (data = xnew_array (Intbyte, size)) + (data = xnew_array (Ibyte, size)) #define BUFFER_REALLOC(data,size)\ - ((Intbyte *) xrealloc (data, (size) * sizeof(Intbyte))) + ((Ibyte *) xrealloc (data, (size) * sizeof(Ibyte))) /* Avoid excess parentheses, or syntax errors may rear their heads. */ #define BUFFER_FREE(data) xfree (data) #define R_ALLOC_DECLARE(var,data) @@ -951,12 +1178,7 @@ /************************************************************************/ /* A "trt" table is a mapping from characters to other characters, - typically used to convert between uppercase and lowercase. For - compatibility reasons, trt tables are currently in the form of - a Lisp string of 256 characters, specifying the conversion for each - of the first 256 Emacs characters (i.e. the 256 Latin-1 characters). - This should be generalized at some point to support conversions for - all of the allowable Mule characters. + typically used to convert between uppercase and lowercase. */ /* The _1 macros are named as such because they assume that you have @@ -964,30 +1186,25 @@ 0 - 255. Bad lossage will happen otherwise. */ #define MAKE_TRT_TABLE() Fmake_char_table (Qgeneric) -INLINE_HEADER Emchar TRT_TABLE_CHAR_1 (Lisp_Object table, Emchar c); -INLINE_HEADER Emchar -TRT_TABLE_CHAR_1 (Lisp_Object table, Emchar ch) +DECLARE_INLINE_HEADER ( +Ichar +TRT_TABLE_OF (Lisp_Object table, Ichar ch) +) { Lisp_Object TRT_char; - TRT_char = get_char_table (ch, XCHAR_TABLE (table)); + TRT_char = get_char_table (ch, table); if (NILP (TRT_char)) return ch; else return XCHAR (TRT_char); } -#define SET_TRT_TABLE_CHAR_1(table, ch1, ch2) \ - Fput_char_table (make_char (ch1), make_char (ch2), table); - -INLINE_HEADER Emchar TRT_TABLE_OF (Lisp_Object trt, Emchar c); -INLINE_HEADER Emchar -TRT_TABLE_OF (Lisp_Object trt, Emchar c) -{ - return TRT_TABLE_CHAR_1 (trt, c); -} +#define SET_TRT_TABLE_OF(table, ch1, ch2) \ + Fput_char_table (make_char (ch1), make_char (ch2), table) -INLINE_HEADER Lisp_Object BUFFER_CASE_TABLE (struct buffer *buf); -INLINE_HEADER Lisp_Object +DECLARE_INLINE_HEADER ( +Lisp_Object BUFFER_CASE_TABLE (struct buffer *buf) +) { return buf ? buf->case_table : Vstandard_case_table; } @@ -1000,18 +1217,20 @@ /* 1 if CH is upper case. */ -INLINE_HEADER int UPPERCASEP (struct buffer *buf, Emchar ch); -INLINE_HEADER int -UPPERCASEP (struct buffer *buf, Emchar ch) +DECLARE_INLINE_HEADER ( +int +UPPERCASEP (struct buffer *buf, Ichar ch) +) { return DOWNCASE_TABLE_OF (buf, ch) != ch; } /* 1 if CH is lower case. */ -INLINE_HEADER int LOWERCASEP (struct buffer *buf, Emchar ch); -INLINE_HEADER int -LOWERCASEP (struct buffer *buf, Emchar ch) +DECLARE_INLINE_HEADER ( +int +LOWERCASEP (struct buffer *buf, Ichar ch) +) { return (UPCASE_TABLE_OF (buf, ch) != ch && DOWNCASE_TABLE_OF (buf, ch) == ch); @@ -1019,18 +1238,20 @@ /* 1 if CH is neither upper nor lower case. */ -INLINE_HEADER int NOCASEP (struct buffer *buf, Emchar ch); -INLINE_HEADER int -NOCASEP (struct buffer *buf, Emchar ch) +DECLARE_INLINE_HEADER ( +int +NOCASEP (struct buffer *buf, Ichar ch) +) { return UPCASE_TABLE_OF (buf, ch) == ch; } /* Upcase a character, or make no change if that cannot be done. */ -INLINE_HEADER Emchar UPCASE (struct buffer *buf, Emchar ch); -INLINE_HEADER Emchar -UPCASE (struct buffer *buf, Emchar ch) +DECLARE_INLINE_HEADER ( +Ichar +UPCASE (struct buffer *buf, Ichar ch) +) { return (DOWNCASE_TABLE_OF (buf, ch) == ch) ? UPCASE_TABLE_OF (buf, ch) : ch; } diff --text -u 'xemacs-21.5.6/src/bytecode.c' 'xemacs-21.5.7/src/bytecode.c' Index: ././src/bytecode.c --- ././src/bytecode.c Mon Apr 1 12:58:26 2002 +++ ././src/bytecode.c Fri Jun 21 06:18:21 2002 @@ -1,7 +1,7 @@ /* Execution of byte code produced by bytecomp.el. Implementation of compiled-function objects. Copyright (C) 1992, 1993 Free Software Foundation, Inc. - Copyright (C) 1995 Ben Wing. + Copyright (C) 1995, 2002 Ben Wing. This file is part of XEmacs. @@ -56,6 +56,7 @@ #include "bytecode.h" #include "opaque.h" #include "syntax.h" +#include "window.h" EXFUN (Ffetch_bytecode, 1); @@ -209,19 +210,12 @@ Bconstant = 0300 }; typedef enum Opcode Opcode; -typedef unsigned char Opbyte; Lisp_Object * execute_rare_opcode (Lisp_Object *stack_ptr, const Opbyte *program_ptr, Opcode opcode); -static Lisp_Object execute_optimized_program (const Opbyte *program, - int stack_depth, - Lisp_Object *constants_data); - -extern Lisp_Object Qand_rest, Qand_optional; - /* Define BYTE_CODE_METER to enable generation of a byte-op usage histogram. This isn't defined in FSF Emacs and isn't defined in XEmacs v19. */ /* #define BYTE_CODE_METER */ @@ -464,74 +458,6 @@ #endif /* !LISP_FLOAT_TYPE */ } -/* Apply compiled-function object FUN to the NARGS evaluated arguments - in ARGS, and return the result of evaluation. */ -Lisp_Object -funcall_compiled_function (Lisp_Object fun, int nargs, Lisp_Object args[]) -{ - /* This function can GC */ - int speccount = specpdl_depth(); - REGISTER int i = 0; - Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun); - int optional = 0; - - if (!OPAQUEP (f->instructions)) - /* Lazily munge the instructions into a more efficient form */ - optimize_compiled_function (fun); - - /* optimize_compiled_function() guaranteed that f->specpdl_depth is - the required space on the specbinding stack for binding the args - and local variables of fun. So just reserve it once. */ - SPECPDL_RESERVE (f->specpdl_depth); - - { - /* Fmake_byte_code() guaranteed that f->arglist is a valid list - containing only non-constant symbols. */ - LIST_LOOP_3 (symbol, f->arglist, tail) - { - if (EQ (symbol, Qand_rest)) - { - tail = XCDR (tail); - symbol = XCAR (tail); - SPECBIND_FAST_UNSAFE (symbol, Flist (nargs - i, &args[i])); - goto run_code; - } - else if (EQ (symbol, Qand_optional)) - optional = 1; - else if (i == nargs && !optional) - goto wrong_number_of_arguments; - else - SPECBIND_FAST_UNSAFE (symbol, i < nargs ? args[i++] : Qnil); - } - } - - if (i < nargs) - goto wrong_number_of_arguments; - - run_code: - - { - Lisp_Object value = - execute_optimized_program ((Opbyte *) XOPAQUE_DATA (f->instructions), - f->stack_depth, - XVECTOR_DATA (f->constants)); - - /* The attempt to optimize this by only unbinding variables failed - because using buffer-local variables as function parameters - leads to specpdl_ptr->func != 0 */ - /* UNBIND_TO_GCPRO_VARIABLES_ONLY (speccount, value); */ - UNBIND_TO_GCPRO (speccount, value); - return value; - } - - wrong_number_of_arguments: - /* The actual printed compiled_function object is incomprehensible. - Check the backtrace to see if we can get a more meaningful symbol. */ - if (EQ (fun, indirect_function (*backtrace_list->function, 0))) - fun = *backtrace_list->function; - return Fsignal (Qwrong_number_of_arguments, list2 (fun, make_int (nargs))); -} - /* Read next uint8 from the instruction stream. */ #define READ_UINT_1 ((unsigned int) (unsigned char) *program_ptr++) @@ -593,7 +519,7 @@ real benchmarking and profiling work -- martin */ -static Lisp_Object +Lisp_Object execute_optimized_program (const Opbyte *program, int stack_depth, Lisp_Object *constants_data) @@ -717,6 +643,10 @@ specpdl_depth_counter++; symbol_ptr->value = new_value; + +#ifdef ERROR_CHECK_CATCH + check_specbind_stack_sanity (); +#endif } else specbind_magic (symbol, new_value); @@ -1242,13 +1172,13 @@ case Bsave_restriction: record_unwind_protect (save_restriction_restore, - save_restriction_save ()); + save_restriction_save (current_buffer)); break; case Bcatch: { Lisp_Object arg = POP; - TOP = internal_catch (TOP, Feval, arg, 0); + TOP = internal_catch (TOP, Feval, arg, 0, 0); break; } @@ -1481,7 +1411,7 @@ DOESNT_RETURN -invalid_byte_code (const CIntbyte *reason, Lisp_Object frob) +invalid_byte_code (const CIbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_byte_code, reason, frob); } @@ -1510,8 +1440,8 @@ /* Get next character from Lisp instructions string. */ #define READ_INSTRUCTION_CHAR(lvalue) do { \ - (lvalue) = charptr_emchar (ptr); \ - INC_CHARPTR (ptr); \ + (lvalue) = itext_ichar (ptr); \ + INC_IBYTEPTR (ptr); \ *icounts_ptr++ = program_ptr - program; \ if (lvalue > UCHAR_MAX) \ invalid_byte_code \ @@ -1617,8 +1547,8 @@ Opbyte *program_ptr = program; - const Intbyte *ptr = XSTRING_DATA (instructions); - const Intbyte * const end = ptr + instructions_length; + const Ibyte *ptr = XSTRING_DATA (instructions); + const Ibyte * const end = ptr + instructions_length; *varbind_count = 0; @@ -1873,7 +1803,7 @@ if (STRINGP (f->instructions)) { - /* XSTRING_LENGTH() is more efficient than XSTRING_CHAR_LENGTH(), + /* XSTRING_LENGTH() is more efficient than string_char_length(), which would be slightly more `proper' */ program = alloca_array (Opbyte, 1 + 2 * XSTRING_LENGTH (f->instructions)); optimize_byte_code (f->instructions, f->constants, @@ -1901,7 +1831,7 @@ struct gcpro gcpro1, gcpro2; GCPRO2 (obj, printcharfun); - write_c_string (print_readably ? "#[" : "#", printcharfun); + write_c_string (printcharfun, print_readably ? "]" : ">"); } @@ -1962,6 +1892,7 @@ mark_compiled_function (Lisp_Object obj) { Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (obj); + int i; mark_object (f->instructions); mark_object (f->arglist); @@ -1969,6 +1900,9 @@ #ifdef COMPILED_FUNCTION_ANNOTATION_HACK mark_object (f->annotated); #endif + for (i = 0; i < f->args_in_array; i++) + mark_object (f->args[i]); + /* tail-recurse on constants */ return f->constants; } @@ -2001,7 +1935,20 @@ internal_hash (f->constants, depth + 1)); } +static const struct lrecord_description lo_description_1[] = { + { XD_LISP_OBJECT, 0 }, + { XD_END } +}; + +static const struct struct_description lo_description = { + sizeof (Lisp_Object), + lo_description_1 +}; + static const struct lrecord_description compiled_function_description[] = { + { XD_INT, offsetof (Lisp_Compiled_Function, args_in_array) }, + { XD_STRUCT_PTR, offsetof (Lisp_Compiled_Function, args), + XD_INDIRECT (0, 0), &lo_description }, { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, instructions) }, { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, constants) }, { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, arglist) }, @@ -2048,9 +1995,9 @@ /* Invert action performed by optimize_byte_code() */ Lisp_Opaque *opaque = XOPAQUE (f->instructions); - Intbyte * const buffer = - alloca_array (Intbyte, OPAQUE_SIZE (opaque) * MAX_EMCHAR_LEN); - Intbyte *bp = buffer; + Ibyte * const buffer = + alloca_array (Ibyte, OPAQUE_SIZE (opaque) * MAX_ICHAR_LEN); + Ibyte *bp = buffer; const Opbyte * const program = (const Opbyte *) OPAQUE_DATA (opaque); const Opbyte *program_ptr = program; @@ -2059,7 +2006,7 @@ while (program_ptr < program_end) { Opcode opcode = (Opcode) READ_UINT_1; - bp += set_charptr_emchar (bp, opcode); + bp += set_itext_ichar (bp, opcode); switch (opcode) { case Bvarref+7: @@ -2068,8 +2015,8 @@ case Bcall+7: case Bunbind+7: case Bconstant2: - bp += set_charptr_emchar (bp, READ_UINT_1); - bp += set_charptr_emchar (bp, READ_UINT_1); + bp += set_itext_ichar (bp, READ_UINT_1); + bp += set_itext_ichar (bp, READ_UINT_1); break; case Bvarref+6: @@ -2080,7 +2027,7 @@ case BlistN: case BconcatN: case BinsertN: - bp += set_charptr_emchar (bp, READ_UINT_1); + bp += set_itext_ichar (bp, READ_UINT_1); break; case Bgoto: @@ -2094,8 +2041,8 @@ Opbyte *buf2p = buf2; /* Convert back to program-relative address */ WRITE_INT16 (jump + (program_ptr - 2 - program), buf2p); - bp += set_charptr_emchar (bp, buf2[0]); - bp += set_charptr_emchar (bp, buf2[1]); + bp += set_itext_ichar (bp, buf2[0]); + bp += set_itext_ichar (bp, buf2[1]); break; } @@ -2104,7 +2051,7 @@ case BRgotoifnonnil: case BRgotoifnilelsepop: case BRgotoifnonnilelsepop: - bp += set_charptr_emchar (bp, READ_INT_1 + 127); + bp += set_itext_ichar (bp, READ_INT_1 + 127); break; default: @@ -2279,8 +2226,7 @@ #ifdef COMPILED_FUNCTION_ANNOTATION_HACK -/* Remove the `xx' if you wish to restore this feature */ -xxDEFUN ("compiled-function-annotation", Fcompiled_function_annotation, 1, 1, 0, /* +DEFUN ("compiled-function-annotation", Fcompiled_function_annotation, 1, 1, 0, /* Return the annotation of the compiled-function object FUNCTION, or nil. The annotation is a piece of information indicating where this compiled-function object came from. Generally this will be diff --text -u 'xemacs-21.5.6/src/bytecode.h' 'xemacs-21.5.7/src/bytecode.h' Index: ././src/bytecode.h --- ././src/bytecode.h Fri Mar 29 13:46:59 2002 +++ ././src/bytecode.h Sun Apr 14 21:42:14 2002 @@ -1,5 +1,6 @@ /* Definitions for bytecode interpretation and compiled-function objects. Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -61,6 +62,18 @@ Lisp_Object instructions; Lisp_Object constants; Lisp_Object arglist; + /* For speed, we unroll arglist into an array of argument symbols, so we + don't have to process arglist every time we make a function call. */ + Lisp_Object *args; + /* Minimum and maximum number of arguments. If MAX_ARGS == MANY, the + function was declared with &rest, and (args_in_array - 1) indicates + how many arguments there are before the &rest argument. (We could + munge the max_non_rest_args into max_args by using a negative number, + but that interferes with pdump marking. We don't want to use a flag + to indicate &rest because that would add an extra check in the + simplest case.) */ + int min_args, max_args; + int args_in_array; /* This uses the minimal number of conses; see accessors in data.c. */ Lisp_Object doc_and_interactive; #ifdef COMPILED_FUNCTION_ANNOTATION_HACK @@ -84,9 +97,12 @@ void set_compiled_function_documentation (Lisp_Compiled_Function *f, Lisp_Object new_doc); -Lisp_Object funcall_compiled_function (Lisp_Object fun, - int nargs, Lisp_Object args[]); void optimize_compiled_function (Lisp_Object compiled_function); + +typedef unsigned char Opbyte; +Lisp_Object execute_optimized_program (const Opbyte *program, + int stack_depth, + Lisp_Object *constants_data); DECLARE_LRECORD (compiled_function, Lisp_Compiled_Function); #define XCOMPILED_FUNCTION(x) XRECORD (x, compiled_function, \ diff --text -u 'xemacs-21.5.6/src/callint.c' 'xemacs-21.5.7/src/callint.c' Index: ././src/callint.c --- ././src/callint.c Fri Mar 29 13:46:59 2002 +++ ././src/callint.c Fri Jun 21 06:18:21 2002 @@ -35,7 +35,7 @@ #include "commands.h" #include "events.h" #include "insdel.h" -#include "window.h" +#include "window-impl.h" /* WINDOW_MINI_P */ extern int num_input_chars; @@ -237,12 +237,8 @@ quotify_args (Lisp_Object expr) { Lisp_Object tail; - Lisp_Cons *ptr; - for (tail = expr; CONSP (tail); tail = ptr->cdr) - { - ptr = XCONS (tail); - ptr->car = Fquote_maybe (ptr->car); - } + EXTERNAL_LIST_LOOP (tail, expr) + XSETCAR (tail, Fquote_maybe (XCAR (tail))); return expr; } @@ -262,7 +258,7 @@ } static Lisp_Object -callint_prompt (const Intbyte *prompt_start, Bytecount prompt_length, +callint_prompt (const Ibyte *prompt_start, Bytecount prompt_length, const Lisp_Object *args, int nargs) { Lisp_Object s = make_string (prompt_start, prompt_length); @@ -390,7 +386,7 @@ goto lose; } - /* FSFmacs makes an alloca() copy of prompt_data here. + /* FSFmacs makes an ALLOCA () copy of prompt_data here. We're more intelligent about this and just reset prompt_data as necessary. */ /* If either specs or prompt_data is set to a string, use it. */ @@ -649,7 +645,7 @@ prompts with "Set key C-x C-f to command: "instead of printing event objects in there. */ -#define PROMPT() callint_prompt ((const Intbyte *) prompt_start, prompt_length, visargs, argnum) +#define PROMPT() callint_prompt ((const Ibyte *) prompt_start, prompt_length, visargs, argnum) switch (prompt_data[prompt_index]) { case 'a': /* Symbol defined as a function */ @@ -948,10 +944,10 @@ case '+': default: { - signal_ferror (Qsyntax_error, - "Invalid `interactive' control letter \"%c\" (#o%03o).", - prompt_data[prompt_index], - prompt_data[prompt_index]); + signal_ferror + (Qsyntax_error, + "Invalid `interactive' control letter \"%c\" (#o%03o).", + prompt_data[prompt_index], prompt_data[prompt_index]); } } #undef PROMPT diff --text -u 'xemacs-21.5.6/src/callproc.c' 'xemacs-21.5.7/src/callproc.c' Index: ././src/callproc.c --- ././src/callproc.c Sun Mar 31 17:27:45 2002 +++ ././src/callproc.c Tue May 28 17:44:45 2002 @@ -1,1044 +0,0 @@ -/* Old synchronous subprocess invocation for XEmacs. - Copyright (C) 1985, 86, 87, 88, 93, 94, 95 Free Software Foundation, Inc. - Copyright (C) 2000, 2001, 2002 Ben Wing. - -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 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. */ - -/* Synched up with: Mule 2.0, FSF 19.30. */ -/* Partly sync'ed with 19.36.4 */ - - -/* #### This ENTIRE file is only used in batch mode. (Well, almost; - certainly the main call-process stuff is only used in batch mode.) - - We only need two things to get rid of both this and ntproc.c: - - -- my `stderr-proc' ws, which adds support for a separate stderr - in asynch. subprocesses. (it's a feature in `old-call-process-internal'.) - -- a noninteractive event loop that supports processes. -*/ - -#include -#include "lisp.h" - -#include "buffer.h" -#include "commands.h" -#include "insdel.h" -#include "lstream.h" -#include "process.h" -#include "sysdep.h" -#include "window.h" -#include "file-coding.h" - -#include "systime.h" -#include "sysproc.h" -#include "sysfile.h" /* Always include after sysproc.h #### Why? This - rule is not followed elsewhere in XEmacs, without - apparent problems */ -#include "syssignal.h" /* Always include before systty.h #### Why? This - rule is not followed elsewhere in XEmacs, without - apparent problems */ -#include "systty.h" -#include "sysdir.h" - -#ifdef WIN32_NATIVE -#include "syswindows.h" -#endif - -#ifdef WIN32_NATIVE -/* When we are starting external processes we need to know whether they - take binary input (no conversion) or text input (\n is converted to - \r\n). Similarly for output: if newlines are written as \r\n then it's - text process output, otherwise it's binary. */ -Lisp_Object Vbinary_process_input; -Lisp_Object Vbinary_process_output; -#endif /* WIN32_NATIVE */ - -Lisp_Object Vshell_file_name; - -/* The environment to pass to all subprocesses when they are started. - This is in the semi-bogus format of ("VAR=VAL" "VAR2=VAL2" ... ) - */ -Lisp_Object Vprocess_environment; - -/* True iff we are about to fork off a synchronous process or if we - are waiting for it. */ -volatile int synch_process_alive; - -/* Nonzero => this is a string explaining death of synchronous subprocess. */ -const char *synch_process_death; - -/* If synch_process_death is zero, - this is exit code of synchronous subprocess. */ -int synch_process_retcode; - -/* Clean up when exiting Fcall_process_internal. - On Windows, delete the temporary file on any kind of termination. - On Unix, kill the process and any children on termination by signal. */ - -/* Nonzero if this is termination due to exit. */ -static int call_process_exited; - -/* Make sure egetenv() not called too soon */ -int env_initted; - -Lisp_Object Vlisp_EXEC_SUFFIXES; - -static Lisp_Object -call_process_kill (Lisp_Object fdpid) -{ - Lisp_Object fd = Fcar (fdpid); - Lisp_Object pid = Fcdr (fdpid); - - if (!NILP (fd)) - retry_close (XINT (fd)); - - if (!NILP (pid)) - EMACS_KILLPG (XINT (pid), SIGKILL); - - synch_process_alive = 0; - return Qnil; -} - -static Lisp_Object -call_process_cleanup (Lisp_Object fdpid) -{ - int fd = XINT (Fcar (fdpid)); - int pid = XINT (Fcdr (fdpid)); - - if (!call_process_exited && - EMACS_KILLPG (pid, SIGINT) == 0) - { - int speccount = specpdl_depth (); - - record_unwind_protect (call_process_kill, fdpid); - /* #### "c-G" -- need non-consing Single-key-description */ - message ("Waiting for process to die...(type C-g again to kill it instantly)"); - -#ifdef WIN32_NATIVE - { - HANDLE pHandle = OpenProcess (PROCESS_ALL_ACCESS, 0, pid); - if (pHandle == NULL) - warn_when_safe (Qprocess, Qnotice, - "cannot open process (PID %d) for cleanup", pid); - else - wait_for_termination (pHandle); - } -#else - wait_for_termination (pid); -#endif - - /* "Discard" the unwind protect. */ - XCAR (fdpid) = Qnil; - XCDR (fdpid) = Qnil; - unbind_to (speccount); - - message ("Waiting for process to die... done"); - } - synch_process_alive = 0; - retry_close (fd); - return Qnil; -} - -DEFUN ("old-call-process-internal", Fold_call_process_internal, 1, MANY, 0, /* -Call PROGRAM synchronously in separate process, with coding-system specified. -Arguments are - (PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS). -The program's input comes from file INFILE (nil means `/dev/null'). -Insert output in BUFFER before point; t means current buffer; - nil for BUFFER means discard it; 0 means discard and don't wait. -BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, -REAL-BUFFER says what to do with standard output, as above, -while STDERR-FILE says what to do with standard error in the child. -STDERR-FILE may be nil (discard standard error output), -t (mix it with ordinary output), or a file name string. - -Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted. -Remaining arguments are strings passed as command arguments to PROGRAM. - -If BUFFER is 0, `call-process' returns immediately with value nil. -Otherwise it waits for PROGRAM to terminate and returns a numeric exit status - or a signal description string. -If you quit, the process is killed with SIGINT, or SIGKILL if you - quit again. -*/ - (int nargs, Lisp_Object *args)) -{ - /* This function can GC */ - Lisp_Object infile, buffer, current_dir, display, path; - int fd[2]; - int filefd; -#ifdef WIN32_NATIVE - HANDLE pHandle; -#endif - int pid; - char buf[16384]; - char *bufptr = buf; - int bufsize = 16384; - int speccount = specpdl_depth (); - struct gcpro gcpro1, gcpro2, gcpro3; - Intbyte **new_argv = alloca_array (Intbyte *, max (2, nargs - 2)); - - /* File to use for stderr in the child. - t means use same as standard output. */ - Lisp_Object error_file; - - CHECK_STRING (args[0]); - - error_file = Qt; - -#if defined (NO_SUBPROCESSES) - /* Without asynchronous processes we cannot have BUFFER == 0. */ - if (nargs >= 3 && !INTP (args[2])) - signal_error (Qunimplemented, "Operating system cannot handle asynchronous subprocesses", Qunbound); -#endif /* NO_SUBPROCESSES */ - - /* Do all filename munging before building new_argv because GC in - * Lisp code called by various filename-hacking routines might - * relocate strings */ - locate_file (Vexec_path, args[0], Vlisp_EXEC_SUFFIXES, &path, X_OK); - - /* Make sure that the child will be able to chdir to the current - buffer's current directory, or its unhandled equivalent. [[ We - can't just have the child check for an error when it does the - chdir, since it's in a vfork. ]] -- not any more, we don't use - vfork. -ben - - Note: These calls are spread out to insure that the return values - of the calls (which may be newly-created strings) are properly - GC-protected. */ - { - struct gcpro ngcpro1, ngcpro2; - NGCPRO2 (current_dir, path); /* Caller gcprotects args[] */ - current_dir = current_buffer->directory; - /* If the current dir has no terminating slash, we'll get undesirable - results, so put the slash back. */ - current_dir = Ffile_name_as_directory (current_dir); - current_dir = Funhandled_file_name_directory (current_dir); - current_dir = expand_and_dir_to_file (current_dir, Qnil); - -#if 0 - /* This is in FSF, but it breaks everything in the presence of - ange-ftp-visited files, so away with it. */ - if (NILP (Ffile_accessible_directory_p (current_dir))) - signal_error (Qprocess_error, "Setting current directory", - current_buffer->directory); -#endif /* 0 */ - NUNGCPRO; - } - - GCPRO2 (current_dir, path); - - if (nargs >= 2 && ! NILP (args[1])) - { - struct gcpro ngcpro1; - NGCPRO1 (current_buffer->directory); - infile = Fexpand_file_name (args[1], current_buffer->directory); - NUNGCPRO; - CHECK_STRING (infile); - } - else - infile = build_string (NULL_DEVICE); - - UNGCPRO; - - GCPRO3 (infile, current_dir, path); /* Fexpand_file_name might trash it */ - - if (nargs >= 3) - { - buffer = args[2]; - - /* If BUFFER is a list, its meaning is - (BUFFER-FOR-STDOUT FILE-FOR-STDERR). */ - if (CONSP (buffer)) - { - if (CONSP (XCDR (buffer))) - { - Lisp_Object file_for_stderr = XCAR (XCDR (buffer)); - - if (NILP (file_for_stderr) || EQ (Qt, file_for_stderr)) - error_file = file_for_stderr; - else - error_file = Fexpand_file_name (file_for_stderr, Qnil); - } - - buffer = XCAR (buffer); - } - - if (!(EQ (buffer, Qnil) - || EQ (buffer, Qt) - || ZEROP (buffer))) - { - Lisp_Object spec_buffer = buffer; - buffer = Fget_buffer (buffer); - /* Mention the buffer name for a better error message. */ - if (NILP (buffer)) - CHECK_BUFFER (spec_buffer); - CHECK_BUFFER (buffer); - } - } - else - buffer = Qnil; - - UNGCPRO; - - display = ((nargs >= 4) ? args[3] : Qnil); - - /* From here we assume we won't GC (unless an error is signaled). */ - { - REGISTER int i; - for (i = 4; i < nargs; i++) - { - CHECK_STRING (args[i]); - new_argv[i - 3] = XSTRING_DATA (args[i]); - } - } - new_argv[max(nargs - 3,1)] = 0; - - if (NILP (path)) - signal_error (Qprocess_error, "Searching for program", - Fcons (args[0], Qnil)); - new_argv[0] = XSTRING_DATA (path); - - filefd = qxe_open (XSTRING_DATA (infile), O_RDONLY | OPEN_BINARY, 0); - if (filefd < 0) - report_process_error ("Opening process input file", infile); - - if (INTP (buffer)) - { - fd[1] = qxe_open ((Intbyte *) NULL_DEVICE, O_WRONLY | OPEN_BINARY, 0); - fd[0] = -1; - } - else - { -#ifdef WIN32_NATIVE - pipe_will_die_soon (fd); -#else - pipe (fd); -#endif -#if 0 - /* Replaced by close_process_descs */ - set_exclusive_use (fd[0]); -#endif - } - - { - REGISTER int fd1 = fd[1]; - int fd_error = fd1; - - /* Record that we're about to create a synchronous process. */ - synch_process_alive = 1; - - /* These vars record information from process termination. - Clear them now before process can possibly terminate, - to avoid timing error if process terminates soon. */ - synch_process_death = 0; - synch_process_retcode = 0; - - if (NILP (error_file)) - fd_error = qxe_open ((Intbyte *) NULL_DEVICE, O_WRONLY | OPEN_BINARY); - else if (STRINGP (error_file)) - { - fd_error = qxe_open (XSTRING_DATA (error_file), -#ifdef WIN32_NATIVE - O_WRONLY | O_TRUNC | O_CREAT | O_TEXT, - S_IREAD | S_IWRITE -#else /* not WIN32_NATIVE */ - O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY, - CREAT_MODE -#endif /* not WIN32_NATIVE */ - ); - } - - if (fd_error < 0) - { - int save_errno = errno; - retry_close (filefd); - retry_close (fd[0]); - if (fd1 >= 0) - retry_close (fd1); - errno = save_errno; - report_process_error ("Cannot open", Fcons (error_file, Qnil)); - } - -#ifdef WIN32_NATIVE - pid = child_setup (filefd, fd1, fd_error, new_argv, current_dir); - if (!INTP (buffer)) - { - /* OpenProcess() as soon after child_setup as possible. It's too - late once the process terminated. */ - pHandle = OpenProcess (PROCESS_ALL_ACCESS, 0, pid); -#if 0 - if (pHandle == NULL) - { - /* #### seems to cause crash in unbind_to_1(...) below. APA */ - warn_when_safe (Qprocess, Qnotice, - "cannot open process to wait for"); - } -#endif - } - /* Close STDERR into the parent process. We no longer need it. */ - if (fd_error >= 0) - retry_close (fd_error); -#else /* not WIN32_NATIVE */ - pid = fork (); - - if (pid == 0) - { - if (fd[0] >= 0) - retry_close (fd[0]); - /* This is necessary because some shells may attempt to - access the current controlling terminal and will hang - if they are run in the background, as will be the case - when XEmacs is started in the background. Martin - Buchholz observed this problem running a subprocess - that used zsh to call gzip to uncompress an info - file. */ - disconnect_controlling_terminal (); - child_setup (filefd, fd1, fd_error, new_argv, current_dir); - } - if (fd_error >= 0) - retry_close (fd_error); - -#endif /* not WIN32_NATIVE */ - - /* Close most of our fd's, but not fd[0] - since we will use that to read input from. */ - retry_close (filefd); - if (fd1 >= 0) - retry_close (fd1); - } - -#ifndef WIN32_NATIVE - if (pid < 0) - { - int save_errno = errno; - if (fd[0] >= 0) - retry_close (fd[0]); - errno = save_errno; - report_process_error ("Doing fork", Qunbound); - } -#endif - - if (INTP (buffer)) - { - if (fd[0] >= 0) - retry_close (fd[0]); -#if defined (NO_SUBPROCESSES) - /* If Emacs has been built with asynchronous subprocess support, - we don't need to do this, I think because it will then have - the facilities for handling SIGCHLD. */ - wait_without_blocking (); -#endif /* NO_SUBPROCESSES */ - return Qnil; - } - - { - int nread; - int total_read = 0; - Lisp_Object instream; - struct gcpro ngcpro1; - - /* Enable sending signal if user quits below. */ - call_process_exited = 0; - - record_unwind_protect (call_process_cleanup, - Fcons (make_int (fd[0]), make_int (pid))); - - /* FSFmacs calls Fset_buffer() here. We don't have to because - we can insert into buffers other than the current one. */ - if (EQ (buffer, Qt)) - buffer = wrap_buffer (current_buffer); - instream = make_filedesc_input_stream (fd[0], 0, -1, LSTR_ALLOW_QUIT); - instream = - make_coding_input_stream - (XLSTREAM (instream), - get_coding_system_for_text_file (Vcoding_system_for_read, 1), - CODING_DECODE, 0); - Lstream_set_character_mode (XLSTREAM (instream)); - NGCPRO1 (instream); - while (1) - { - QUIT; - /* Repeatedly read until we've filled as much as possible - of the buffer size we have. But don't read - less than 1024--save that for the next bufferfull. */ - - nread = 0; - while (nread < bufsize - 1024) - { - Bytecount this_read - = Lstream_read (XLSTREAM (instream), bufptr + nread, - bufsize - nread); - - if (this_read < 0) - goto give_up; - - if (this_read == 0) - goto give_up_1; - - nread += this_read; - } - - give_up_1: - - /* Now NREAD is the total amount of data in the buffer. */ - if (nread == 0) - break; - -#if 0 - /* [[check Vbinary_process_output]] */ -#endif - - total_read += nread; - - if (!NILP (buffer)) - buffer_insert_raw_string (XBUFFER (buffer), (Intbyte *) bufptr, - nread); - - /* Make the buffer bigger as we continue to read more data, - but not past 64k. */ - if (bufsize < 64 * 1024 && total_read > 32 * bufsize) - { - bufsize *= 2; - bufptr = (char *) alloca (bufsize); - } - - if (!NILP (display) && INTERACTIVE) - { - redisplay (); - } - } - give_up: - Lstream_close (XLSTREAM (instream)); - NUNGCPRO; - - QUIT; - /* Wait for it to terminate, unless it already has. */ -#ifdef WIN32_NATIVE - wait_for_termination (pHandle); -#else - wait_for_termination (pid); -#endif - - /* Don't kill any children that the subprocess may have left behind - when exiting. */ - call_process_exited = 1; - unbind_to (speccount); - - if (synch_process_death) - return build_msg_string (synch_process_death); - return make_int (synch_process_retcode); - } -} - - - -/* Move the file descriptor FD so that its number is not less than MIN. * - The original file descriptor remains open. */ -static int -relocate_fd (int fd, int min) -{ - if (fd >= min) - return fd; - else - { - int newfd = dup (fd); - if (newfd == -1) - { - Intbyte *errmess; - GET_STRERROR (errmess, errno); - stderr_out ("Error while setting up child: %s\n", errmess); - _exit (1); - } - return relocate_fd (newfd, min); - } -} - -/* This is the last thing run in a newly forked inferior - either synchronous or asynchronous. - Copy descriptors IN, OUT and ERR - as descriptors STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO. - Initialize inferior's priority, pgrp, connected dir and environment. - then exec another program based on new_argv. - - XEmacs: We've removed the SET_PGRP argument because it's already - done by the callers of child_setup. - - CURRENT_DIR is an elisp string giving the path of the current - directory the subprocess should have. Since we can't really signal - a decent error from within the child (not quite correct in - XEmacs?), this should be verified as an executable directory by the - parent. */ - -#ifdef WIN32_NATIVE -int -#else -void -#endif -child_setup (int in, int out, int err, Intbyte **new_argv, - Lisp_Object current_dir) -{ - Intbyte **env; - Intbyte *pwd; -#ifdef WIN32_NATIVE - int cpid; - HANDLE handles[4]; -#endif /* WIN32_NATIVE */ - -#ifdef SET_EMACS_PRIORITY - if (emacs_priority != 0) - nice (- emacs_priority); -#endif - - /* Under Windows, we are not in a child process at all, so we should - not close handles inherited from the parent -- we are the parent - and doing so will screw up all manner of things! Similarly, most - of the rest of the cleanup done in this function is not done - under Windows. - - #### This entire child_setup() function is an utter and complete - piece of shit. I would rewrite it, at the very least splitting - out the Windows and non-Windows stuff into two completely - different functions; but instead I'm trying to make it go away - entirely, using the Lisp definition in process.el. What's left - is to fix up the routines in event-msw.c (and in event-Xt.c and - event-tty.c) to allow for stream devices to be handled correctly. - There isn't much to do, in fact, and I'll fix it shortly. That - way, the Lisp definition can be used non-interactively too. */ -#if !defined (NO_SUBPROCESSES) && !defined (WIN32_NATIVE) - /* Close Emacs's descriptors that this process should not have. */ - close_process_descs (); -#endif /* not NO_SUBPROCESSES */ -#ifndef WIN32_NATIVE - close_load_descs (); -#endif - - /* [[Note that use of alloca is always safe here. It's obvious for systems - that do not have true vfork or that have true (stack) alloca. - If using vfork and C_ALLOCA it is safe because that changes - the superior's static variables as if the superior had done alloca - and will be cleaned up in the usual way.]] -- irrelevant because - XEmacs does not use vfork. */ - { - REGISTER Bytecount i; - - i = XSTRING_LENGTH (current_dir); - pwd = alloca_array (Intbyte, i + 6); - memcpy (pwd, "PWD=", 4); - memcpy (pwd + 4, XSTRING_DATA (current_dir), i); - i += 4; - if (!IS_DIRECTORY_SEP (pwd[i - 1])) - pwd[i++] = DIRECTORY_SEP; - pwd[i] = 0; - - /* [[We can't signal an Elisp error here; we're in a vfork. Since - the callers check the current directory before forking, this - should only return an error if the directory's permissions - are changed between the check and this chdir, but we should - at least check.]] -- irrelevant because XEmacs does not use vfork. */ - if (qxe_chdir (pwd + 4) < 0) - { - /* Don't report the chdir error, or ange-ftp.el doesn't work. */ - /* (FSFmacs does _exit (errno) here.) */ - pwd = 0; - } - else - { - /* Strip trailing "/". Cretinous *[]&@$#^%@#$% Un*x */ - /* leave "//" (from FSF) */ - while (i > 6 && IS_DIRECTORY_SEP (pwd[i - 1])) - pwd[--i] = 0; - } - } - - /* Set `env' to a vector of the strings in Vprocess_environment. */ - /* + 2 to include PWD and terminating 0. */ - env = alloca_array (Intbyte *, XINT (Flength (Vprocess_environment)) + 2); - { - REGISTER Lisp_Object tail; - Intbyte **new_env = env; - - /* If we have a PWD envvar and we know the real current directory, - pass one down, but with corrected value. */ - if (pwd && egetenv ("PWD")) - *new_env++ = pwd; - - /* Copy the Vprocess_environment strings into new_env. */ - for (tail = Vprocess_environment; - CONSP (tail) && STRINGP (XCAR (tail)); - tail = XCDR (tail)) - { - Intbyte **ep = env; - Intbyte *envvar = XSTRING_DATA (XCAR (tail)); - - /* See if envvar duplicates any string already in the env. - If so, don't put it in. - When an env var has multiple definitions, - we keep the definition that comes first in process-environment. */ - for (; ep != new_env; ep++) - { - Intbyte *p = *ep, *q = envvar; - while (1) - { - if (*q == 0) - /* The string is malformed; might as well drop it. */ - goto duplicate; - if (*q != *p) - break; - if (*q == '=') - goto duplicate; - p++, q++; - } - } - if (pwd && !qxestrncmp ((Intbyte *) "PWD=", envvar, 4)) - { - *new_env++ = pwd; - pwd = 0; - } - else - *new_env++ = envvar; - - duplicate: ; - } - - *new_env = 0; - } - -#ifdef WIN32_NATIVE - prepare_standard_handles (in, out, err, handles); - /* #### junk! But all this win32 code will die soon. */ - set_process_dir ((char *) XSTRING_DATA (current_dir)); -#else /* not WIN32_NATIVE */ - /* Make sure that in, out, and err are not actually already in - descriptors zero, one, or two; this could happen if Emacs is - started with its standard in, out, or error closed, as might - happen under X. */ - in = relocate_fd (in, 3); - out = relocate_fd (out, 3); - err = relocate_fd (err, 3); - - /* Set the standard input/output channels of the new process. */ - retry_close (STDIN_FILENO); - retry_close (STDOUT_FILENO); - retry_close (STDERR_FILENO); - - dup2 (in, STDIN_FILENO); - dup2 (out, STDOUT_FILENO); - dup2 (err, STDERR_FILENO); - - retry_close (in); - retry_close (out); - retry_close (err); - - /* I can't think of any reason why child processes need any more - than the standard 3 file descriptors. It would be cleaner to - close just the ones that need to be, but the following brute - force approach is certainly effective, and not too slow. */ - { - int fd; - for (fd=3; fd<=64; fd++) - retry_close (fd); - } -#endif /* not WIN32_NATIVE */ - -#ifdef vipc - something missing here; -#endif /* vipc */ - -#ifdef WIN32_NATIVE - /* Spawn the child. (See ntproc.c:Spawnve). */ - /* #### junk! arguments not converted. But all this win32 code - will die soon. */ - cpid = spawnve_will_die_soon (_P_NOWAIT, new_argv[0], - (const char* const*)new_argv, - (const char* const*)env); - if (cpid == -1) - /* An error occurred while trying to spawn the process. */ - report_process_error ("Spawning child process", Qunbound); - reset_standard_handles (in, out, err, handles); - return cpid; -#else /* not WIN32_NATIVE */ - /* we've wrapped execve; it translates its arguments */ - qxe_execve (new_argv[0], new_argv, env); - - stdout_out ("Can't exec program %s\n", new_argv[0]); - _exit (1); -#endif /* not WIN32_NATIVE */ -} - -static int -getenv_internal (const Intbyte *var, - Bytecount varlen, - Intbyte **value, - Bytecount *valuelen) -{ - Lisp_Object scan; - - assert (env_initted); - - for (scan = Vprocess_environment; CONSP (scan); scan = XCDR (scan)) - { - Lisp_Object entry = XCAR (scan); - - if (STRINGP (entry) - && XSTRING_LENGTH (entry) > varlen - && XSTRING_BYTE (entry, varlen) == '=' -#ifdef WIN32_NATIVE - /* NT environment variables are case insensitive. */ - && ! memicmp (XSTRING_DATA (entry), var, varlen) -#else /* not WIN32_NATIVE */ - && ! memcmp (XSTRING_DATA (entry), var, varlen) -#endif /* not WIN32_NATIVE */ - ) - { - *value = XSTRING_DATA (entry) + (varlen + 1); - *valuelen = XSTRING_LENGTH (entry) - (varlen + 1); - return 1; - } - } - - return 0; -} - -static void -putenv_internal (const Intbyte *var, - Bytecount varlen, - const Intbyte *value, - Bytecount valuelen) -{ - Lisp_Object scan; - - assert (env_initted); - - for (scan = Vprocess_environment; CONSP (scan); scan = XCDR (scan)) - { - Lisp_Object entry = XCAR (scan); - - if (STRINGP (entry) - && XSTRING_LENGTH (entry) > varlen - && XSTRING_BYTE (entry, varlen) == '=' -#ifdef WIN32_NATIVE - /* NT environment variables are case insensitive. */ - && ! memicmp (XSTRING_DATA (entry), var, varlen) -#else /* not WIN32_NATIVE */ - && ! memcmp (XSTRING_DATA (entry), var, varlen) -#endif /* not WIN32_NATIVE */ - ) - { - XCAR (scan) = concat3 (make_string (var, varlen), - build_string ("="), - make_string (value, valuelen)); - return; - } - } - - Vprocess_environment = Fcons (concat3 (make_string (var, varlen), - build_string ("="), - make_string (value, valuelen)), - Vprocess_environment); -} - -/* NOTE: - - FSF has this as a Lisp function, as follows. Generally moving things - out of C and into Lisp is a good idea, but in this case the Lisp - function is used so early in the startup sequence that it would be ugly - to rearrange the early dumped code to accommodate this. - -(defun getenv (variable) - "Get the value of environment variable VARIABLE. -VARIABLE should be a string. Value is nil if VARIABLE is undefined in -the environment. Otherwise, value is a string. - -This function consults the variable `process-environment' -for its value." - (interactive (list (read-envvar-name "Get environment variable: " t))) - (let ((value (getenv-internal variable))) - (when (interactive-p) - (message "%s" (if value value "Not set"))) - value)) -*/ - -DEFUN ("getenv", Fgetenv, 1, 2, "sEnvironment variable: \np", /* -Return the value of environment variable VAR, as a string. -VAR is a string, the name of the variable. -When invoked interactively, prints the value in the echo area. -*/ - (var, interactivep)) -{ - Intbyte *value; - Bytecount valuelen; - Lisp_Object v = Qnil; - struct gcpro gcpro1; - - CHECK_STRING (var); - GCPRO1 (v); - if (getenv_internal (XSTRING_DATA (var), XSTRING_LENGTH (var), - &value, &valuelen)) - v = make_string (value, valuelen); - if (!NILP (interactivep)) - { - if (NILP (v)) - message ("%s not defined in environment", XSTRING_DATA (var)); - else - /* #### Should use Fprin1_to_string or Fprin1 to handle string - containing quotes correctly. */ - message ("\"%s\"", value); - } - RETURN_UNGCPRO (v); -} - -/* A version of getenv that consults Vprocess_environment, easily - callable from C. - - (At init time, Vprocess_environment is initialized from the - environment, stored in the global variable environ. [Note that - at startup time, `environ' should be the same as the envp parameter - passed to main(); however, later calls to putenv() may change - `environ', making the envp parameter inaccurate.] Calls to getenv() - and putenv() consult and modify `environ'. However, once - Vprocess_environment is initted, XEmacs C code should *NEVER* call - getenv() or putenv() directly, because (1) Lisp code that modifies - the environment only modifies Vprocess_environment, not `environ'; - and (2) Vprocess_environment is in internal format but `environ' - is in some external format, and getenv()/putenv() are not Mule- - encapsulated. - - WARNING: This value points into Lisp string data and thus will become - invalid after a GC. */ - -Intbyte * -egetenv (const CIntbyte *var) -{ - /* This cannot GC -- 7-28-00 ben */ - Intbyte *value; - Bytecount valuelen; - - if (getenv_internal ((const Intbyte *) var, strlen (var), &value, &valuelen)) - return value; - else - return 0; -} - -void -eputenv (const CIntbyte *var, const CIntbyte *value) -{ - putenv_internal ((Intbyte *) var, strlen (var), (Intbyte *) value, - strlen (value)); -} - - -void -init_callproc (void) -{ - /* This function can GC */ - - { - /* jwz: always initialize Vprocess_environment, so that egetenv() - works in temacs. */ - char **envp; - Vprocess_environment = Qnil; - for (envp = environ; envp && *envp; envp++) - Vprocess_environment = - Fcons (build_ext_string (*envp, Qnative), Vprocess_environment); - /* This gets set back to 0 in disksave_object_finalization() */ - env_initted = 1; - } - - { - /* Initialize shell-file-name from environment variables or best guess. */ -#ifdef WIN32_NATIVE - const Intbyte *shell = egetenv ("SHELL"); - if (!shell) shell = egetenv ("COMSPEC"); - /* Should never happen! */ - if (!shell) shell = - (Intbyte *) (GetVersion () & 0x80000000 ? "command" : "cmd"); -#else /* not WIN32_NATIVE */ - const Intbyte *shell = egetenv ("SHELL"); - if (!shell) shell = (Intbyte *) "/bin/sh"; -#endif - -#if 0 /* defined (WIN32_NATIVE) */ - /* BAD BAD BAD. We do not wanting to be passing an XEmacs-created - SHELL var down to some inferior Cygwin process, which might get - screwed up. - - There are a few broken apps (eterm/term.el, eterm/tshell.el, - os-utils/terminal.el, texinfo/tex-mode.el) where this will - cause problems. Those broken apps don't look at - shell-file-name, instead just at explicit-shell-file-name, - ESHELL and SHELL. They are apparently attempting to borrow - what `M-x shell' uses, but that latter also looks at - shell-file-name. What we want is for all of these apps to look - at shell-file-name, so that the user can change the value of - shell-file-name and everything will work out hunky-dorey. - */ - - if (!egetenv ("SHELL")) - { - Intbyte *faux_var = alloca_array (Intbyte, 7 + qxestrlen (shell)); - qxesprintf (faux_var, "SHELL=%s", shell); - Vprocess_environment = Fcons (build_intstring (faux_var), - Vprocess_environment); - } -#endif /* 0 */ - - Vshell_file_name = build_intstring (shell); - } -} - -void -syms_of_callproc (void) -{ - DEFSUBR (Fold_call_process_internal); - DEFSUBR (Fgetenv); -} - -void -vars_of_callproc (void) -{ - /* This function can GC */ -#ifdef WIN32_NATIVE - /* Will die as soon as callproc.c dies */ - DEFVAR_LISP ("binary-process-input", &Vbinary_process_input /* -*If non-nil then new subprocesses are assumed to take binary input. -*/ ); - Vbinary_process_input = Qnil; - - DEFVAR_LISP ("binary-process-output", &Vbinary_process_output /* -*If non-nil then new subprocesses are assumed to produce binary output. -*/ ); - Vbinary_process_output = Qnil; -#endif /* WIN32_NATIVE */ - - DEFVAR_LISP ("shell-file-name", &Vshell_file_name /* -*File name to load inferior shells from. -Initialized from the SHELL environment variable. -*/ ); - - DEFVAR_LISP ("process-environment", &Vprocess_environment /* -List of environment variables for subprocesses to inherit. -Each element should be a string of the form ENVVARNAME=VALUE. -The environment which Emacs inherits is placed in this variable -when Emacs starts. -*/ ); - - Vlisp_EXEC_SUFFIXES = build_string (EXEC_SUFFIXES); - staticpro (&Vlisp_EXEC_SUFFIXES); -} diff --text -u 'xemacs-21.5.6/src/casefiddle.c' 'xemacs-21.5.7/src/casefiddle.c' Index: ././src/casefiddle.c --- ././src/casefiddle.c Wed Mar 13 17:52:33 2002 +++ ././src/casefiddle.c Wed Jun 5 18:55:00 2002 @@ -1,5 +1,6 @@ /* XEmacs case conversion functions. Copyright (C) 1985, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -39,7 +40,7 @@ if (CHAR_OR_CHAR_INTP (string_or_char)) { - Emchar c; + Ichar c; CHECK_CHAR_COERCE_INT (string_or_char); c = XCHAR (string_or_char); c = (flag == CASE_DOWN) ? DOWNCASE (buf, c) : UPCASE (buf, c); @@ -48,17 +49,18 @@ if (STRINGP (string_or_char)) { - Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); - Intbyte *storage = - alloca_array (Intbyte, XSTRING_LENGTH (string_or_char) * MAX_EMCHAR_LEN); - Intbyte *newp = storage; - Intbyte *oldp = XSTRING_DATA (string_or_char); - Intbyte *endp = oldp + XSTRING_LENGTH (string_or_char); + Lisp_Object syntax_table = buf->mirror_syntax_table; + Ibyte *storage = + alloca_array (Ibyte, XSTRING_LENGTH (string_or_char) * + MAX_ICHAR_LEN); + Ibyte *newp = storage; + Ibyte *oldp = XSTRING_DATA (string_or_char); + Ibyte *endp = oldp + XSTRING_LENGTH (string_or_char); int wordp = 0, wordp_prev; while (oldp < endp) { - Emchar c = charptr_emchar (oldp); + Ichar c = itext_ichar (oldp); switch (flag) { case CASE_UP: @@ -82,8 +84,8 @@ break; } - newp += set_charptr_emchar (newp, c); - INC_CHARPTR (oldp); + newp += set_itext_ichar (newp, c); + INC_IBYTEPTR (oldp); } return make_string (storage, newp - storage); @@ -156,7 +158,7 @@ { /* This function can GC */ Charbpos pos, s, e; - Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); + Lisp_Object syntax_table = buf->mirror_syntax_table; int mccount; int wordp = 0, wordp_prev; @@ -171,8 +173,8 @@ for (pos = s; pos < e; pos++) { - Emchar oldc = BUF_FETCH_CHAR (buf, pos); - Emchar c = oldc; + Ichar oldc = BUF_FETCH_CHAR (buf, pos); + Ichar c = oldc; switch (flag) { diff --text -u 'xemacs-21.5.6/src/casetab.c' 'xemacs-21.5.7/src/casetab.c' Index: ././src/casetab.c --- ././src/casetab.c Sun Mar 31 17:27:46 2002 +++ ././src/casetab.c Wed Jun 5 18:55:00 2002 @@ -24,24 +24,39 @@ was rewritten to use junky FSF char tables. Meanwhile I rewrote it to use more logical char tables. --ben */ -/* Written by Howard Gayle. See some mythical and not-in-the-Emacs- - distribution file chartab.c for details. */ +/* Written by Howard Gayle. */ /* Modified for Mule by Ben Wing. */ -/* #### Someone (Yoshiki?) wrote the following comment, which I don't - understand. +/* The four tables in a case table are downcase, upcase, canon, and eqv. + Each is a char-table. Their workings are rather non-obvious. - Case tables consist of four char-tables. These are for downcase, - upcase, canonical and equivalent respectively. + (1) `downcase' is the only obvious table: Map a character to its + lowercase equivalent. - The entries are like this: - - downcase: a -> a, A -> a. - upcase: a -> A, A -> a. (The latter is for NOCASEP.) - canon: a -> a, A -> a. - eqv: a -> A, A -> a. -*/ + (2) `upcase' does *NOT* map a character to its uppercase equivalent, + despite its name. Rather, it maps lowercase characters to their + uppercase equivalent, and uppercase characters to *ANYTHING BUT* their + uppercase equivalent (currently, their lowercase equivalent), and + characters without case to themselves. It is used to determine if a + character "has no case" (no uppercase or lowercase mapping). #### This + is way bogus. Just use the obvious implementation of uppercase mapping + and of NOCASE_P. + + (3) `canon' maps each character to a "canonical" lowercase, such that if + two different uppercase characters map to the same lowercase character, + or vice versa, both characters will have the same entry in the canon + table. + + (4) `equiv' lists the "equivalence classes" defined by `canon'. Imagine + that all characters are divided into groups having the same `canon' + entry; these groups are called "equivalence classes" and `equiv' lists + them by linking the characters in each equivalence class together in a + circular list. + + `canon' is used when doing case-insensitive comparisons. `equiv' is + used in the Boyer-Moore search code. + */ #include #include "lisp.h" @@ -53,10 +68,9 @@ Lisp_Object Qcase_tablep, Qdowncase, Qupcase; Lisp_Object Vstandard_case_table; -static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse); Lisp_Object case_table_char (Lisp_Object ch, Lisp_Object table); -#define STRING256_P(obj) ((STRINGP (obj) && XSTRING_CHAR_LENGTH (obj) == 256)) +#define STRING256_P(obj) ((STRINGP (obj) && string_char_length (obj) == 256)) static Lisp_Object mark_case_table (Lisp_Object obj) @@ -75,8 +89,12 @@ { Lisp_Case_Table *ct = XCASE_TABLE (obj); if (print_readably) - printing_unreadable_object ("#header.uid); - write_fmt_string (printcharfun, "#", ct->header.uid); + printing_unreadable_object ("#", ct->header.uid); + write_fmt_string_lisp + (printcharfun, "#", ct->header.uid); } static const struct lrecord_description case_table_description [] = { @@ -92,19 +110,36 @@ 0, 0, case_table_description, Lisp_Case_Table); static Lisp_Object -allocate_case_table (void) +allocate_case_table (int init_tables) { Lisp_Case_Table *ct = alloc_lcrecord_type (Lisp_Case_Table, &lrecord_case_table); - SET_CASE_TABLE_DOWNCASE (ct, Qnil); - SET_CASE_TABLE_UPCASE (ct, Qnil); - SET_CASE_TABLE_CANON (ct, Qnil); - SET_CASE_TABLE_EQV (ct, Qnil); - + if (init_tables) + { + SET_CASE_TABLE_DOWNCASE (ct, MAKE_TRT_TABLE ()); + SET_CASE_TABLE_UPCASE (ct, MAKE_TRT_TABLE ()); + SET_CASE_TABLE_CANON (ct, MAKE_TRT_TABLE ()); + SET_CASE_TABLE_EQV (ct, MAKE_TRT_TABLE ()); + } + else + { + SET_CASE_TABLE_DOWNCASE (ct, Qnil); + SET_CASE_TABLE_UPCASE (ct, Qnil); + SET_CASE_TABLE_CANON (ct, Qnil); + SET_CASE_TABLE_EQV (ct, Qnil); + } return wrap_case_table (ct); } +DEFUN ("make-case-table", Fmake_case_table, 0, 0, 0, /* +Create a new, empty case table. +*/ + ()) +{ + return allocate_case_table (1); +} + DEFUN ("case-table-p", Fcase_table_p, 1, 1, 0, /* Return t if OBJECT is a case table. See `set-case-table' for more information on these data structures. @@ -152,7 +187,7 @@ case_table_char (Lisp_Object ch, Lisp_Object table) { Lisp_Object ct_char; - ct_char = get_char_table (XCHAR (ch), XCHAR_TABLE (table)); + ct_char = get_char_table (XCHAR (ch), table); if (NILP (ct_char)) return ch; else @@ -162,7 +197,7 @@ DEFUN ("get-case-table", Fget_case_table, 3, 3, 0, /* Return CHAR-CASE version of CHARACTER in CASE-TABLE. -CHAR-CASE is either downcase or upcase. +CHAR-CASE is either `downcase' or `upcase'. */ (char_case, character, case_table)) { @@ -181,7 +216,7 @@ DEFUN ("put-case-table", Fput_case_table, 4, 4, 0, /* Set CHAR-CASE version of CHARACTER to be VALUE in CASE-TABLE. -CHAR-CASE is either downcase or upcase. +CHAR-CASE is either `downcase' or `upcase'. See also `put-case-table-pair'. */ (char_case, character, value, case_table)) @@ -192,25 +227,19 @@ if (EQ (char_case, Qdowncase)) { Fput_char_table (character, value, XCASE_TABLE_DOWNCASE (case_table)); - /* This one is not at all intuitive. */ + /* This one is not at all intuitive. See comment at top of file. */ Fput_char_table (character, value, XCASE_TABLE_UPCASE (case_table)); - Fput_char_table (character, value, XCASE_TABLE_CANON (case_table)); - Fput_char_table (value, value, XCASE_TABLE_CANON (case_table)); - Fput_char_table (value, character, XCASE_TABLE_EQV (case_table)); - Fput_char_table (character, value, XCASE_TABLE_EQV (case_table)); } else if (EQ (char_case, Qupcase)) { Fput_char_table (character, value, XCASE_TABLE_UPCASE (case_table)); - Fput_char_table (character, character, XCASE_TABLE_DOWNCASE (case_table)); - Fput_char_table (character, character, XCASE_TABLE_CANON (case_table)); - Fput_char_table (value, character, XCASE_TABLE_CANON (case_table)); - Fput_char_table (value, character, XCASE_TABLE_EQV (case_table)); - Fput_char_table (character, value, XCASE_TABLE_EQV (case_table)); + Fput_char_table (character, character, + XCASE_TABLE_DOWNCASE (case_table)); } else - invalid_constant ("Char case must be downcase or upcase", char_case); + invalid_constant ("CHAR-CASE must be downcase or upcase", char_case); + XCASE_TABLE (case_table)->dirty = 1; return Qnil; } @@ -229,10 +258,7 @@ Fput_char_table (uc, lc, XCASE_TABLE_DOWNCASE (case_table)); Fput_char_table (lc, uc, XCASE_TABLE_UPCASE (case_table)); - Fput_char_table (lc, lc, XCASE_TABLE_CANON (case_table)); - Fput_char_table (uc, lc, XCASE_TABLE_CANON (case_table)); - Fput_char_table (uc, lc, XCASE_TABLE_EQV (case_table)); - Fput_char_table (lc, uc, XCASE_TABLE_EQV (case_table)); + XCASE_TABLE (case_table)->dirty = 1; return Qnil; } @@ -244,7 +270,7 @@ Lisp_Object new_obj; CHECK_CASE_TABLE (case_table); - new_obj = allocate_case_table (); + new_obj = allocate_case_table (0); XSET_CASE_TABLE_DOWNCASE (new_obj, Fcopy_char_table (XCASE_TABLE_DOWNCASE (case_table))); XSET_CASE_TABLE_UPCASE @@ -256,6 +282,74 @@ return new_obj; } +static int +compute_canon_mapper (struct chartab_range *range, + Lisp_Object table, Lisp_Object val, void *arg) +{ + Lisp_Object casetab = VOID_TO_LISP (arg); + if (range->type == CHARTAB_RANGE_CHAR) + SET_TRT_TABLE_OF (XCASE_TABLE_CANON (casetab), range->ch, + TRT_TABLE_OF (XCASE_TABLE_DOWNCASE (casetab), + TRT_TABLE_OF (XCASE_TABLE_UPCASE (casetab), + XCHAR (val)))); + + return 0; +} + +static int +initialize_identity_mapper (struct chartab_range *range, + Lisp_Object table, Lisp_Object val, void *arg) +{ + Lisp_Object trt = VOID_TO_LISP (arg); + if (range->type == CHARTAB_RANGE_CHAR) + SET_TRT_TABLE_OF (trt, range->ch, range->ch); + + return 0; +} + +static int +compute_up_or_eqv_mapper (struct chartab_range *range, + Lisp_Object table, Lisp_Object val, void *arg) +{ + Lisp_Object inverse = VOID_TO_LISP (arg); + Ichar toch = XCHAR (val); + + if (range->type == CHARTAB_RANGE_CHAR && range->ch != toch) + { + Ichar c = TRT_TABLE_OF (inverse, toch); + SET_TRT_TABLE_OF (inverse, toch, range->ch); + SET_TRT_TABLE_OF (inverse, range->ch, c); + } + + return 0; +} + +/* Recomputing the canonical and equivalency tables from scratch is a + lengthy process, and doing them incrementally is extremely difficult or + perhaps impossible -- and certainly not worth it. To avoid lots of + excessive recomputation when lots of stuff is incrementally added, we + just store a dirty flag and then recompute when a value from the canon + or eqv tables is actually needed. */ + +void +recompute_case_table (Lisp_Object casetab) +{ + struct chartab_range range; + + range.type = CHARTAB_RANGE_ALL; + /* Turn off dirty flag first so we don't get infinite recursion when + retrieving the values below! */ + XCASE_TABLE (casetab)->dirty = 0; + map_char_table (XCASE_TABLE_DOWNCASE (casetab), &range, + compute_canon_mapper, LISP_TO_VOID (casetab)); + map_char_table (XCASE_TABLE_CANON (casetab), &range, + initialize_identity_mapper, + LISP_TO_VOID (XCASE_TABLE_EQV (casetab))); + map_char_table (XCASE_TABLE_CANON (casetab), &range, + compute_up_or_eqv_mapper, + LISP_TO_VOID (XCASE_TABLE_EQV (casetab))); +} + DEFUN ("current-case-table", Fcurrent_case_table, 0, 1, 0, /* Return the case table of BUFFER, which defaults to the current buffer. */ @@ -275,42 +369,13 @@ return Vstandard_case_table; } -static Lisp_Object set_case_table (Lisp_Object table, int standard); - -DEFUN ("set-case-table", Fset_case_table, 1, 1, 0, /* -Select CASE-TABLE as the new case table for the current buffer. -A case table is a case-table object or list - (DOWNCASE UPCASE CANONICALIZE EQUIVALENCES) - where each element is either nil or a string of length 256. -The latter is provided for backward-compatibility. -DOWNCASE maps each character to its lower-case equivalent. -UPCASE maps each character to its upper-case equivalent; - if lower and upper case characters are in 1-1 correspondence, - you may use nil and the upcase table will be deduced from DOWNCASE. -CANONICALIZE maps each character to a canonical equivalent; - any two characters that are related by case-conversion have the same - canonical equivalent character; it may be nil, in which case it is - deduced from DOWNCASE and UPCASE. -EQUIVALENCES is a map that cyclicly permutes each equivalence class - (of characters with the same canonical equivalent); it may be nil, - in which case it is deduced from CANONICALIZE. - -See also `get-case-table', `put-case-table' and `put-case-table-pair'. -*/ - (case_table)) -{ - /* This function can GC */ - return set_case_table (case_table, 0); -} - -DEFUN ("set-standard-case-table", Fset_standard_case_table, 1, 1, 0, /* -Select CASE-TABLE as the new standard case table for new buffers. -See `set-case-table' for more info on case tables. -*/ - (case_table)) +static void +convert_old_style_syntax_string (Lisp_Object table, Lisp_Object string) { - /* This function can GC */ - return set_case_table (case_table, 1); + Ichar i; + + for (i = 0; i < 256; i++) + SET_TRT_TABLE_OF (table, i, string_ichar (string, i)); } static Lisp_Object @@ -318,7 +383,7 @@ { /* This function can GC */ struct buffer *buf = - standard ? XBUFFER(Vbuffer_defaults) : current_buffer; + standard ? XBUFFER (Vbuffer_defaults) : current_buffer; check_case_table (table); @@ -333,109 +398,92 @@ { /* For backward compatibility. */ Lisp_Object down, up, canon, eqv, tail = table; - Lisp_Object temp; - int i; + Lisp_Object casetab = + standard ? Vstandard_case_table : buf->case_table; + struct chartab_range range; + + range.type = CHARTAB_RANGE_ALL; + + Freset_char_table (XCASE_TABLE_DOWNCASE (casetab)); + Freset_char_table (XCASE_TABLE_UPCASE (casetab)); + Freset_char_table (XCASE_TABLE_CANON (casetab)); + Freset_char_table (XCASE_TABLE_EQV (casetab)); down = XCAR (tail); tail = XCDR (tail); up = XCAR (tail); tail = XCDR (tail); canon = XCAR (tail); tail = XCDR (tail); eqv = XCAR (tail); - temp = down; - down = MAKE_TRT_TABLE (); - for (i = 0; i < 256; i++) - SET_TRT_TABLE_CHAR_1 (down, i, XSTRING_CHAR (temp, i)); - + convert_old_style_syntax_string (XCASE_TABLE_DOWNCASE (casetab), down); + if (NILP (up)) { - up = MAKE_TRT_TABLE (); - compute_trt_inverse (down, up); + map_char_table (XCASE_TABLE_DOWNCASE (casetab), &range, + initialize_identity_mapper, + LISP_TO_VOID (XCASE_TABLE_UPCASE (casetab))); + map_char_table (XCASE_TABLE_DOWNCASE (casetab), &range, + compute_up_or_eqv_mapper, + LISP_TO_VOID (XCASE_TABLE_UPCASE (casetab))); } else - { - temp = up; - up = MAKE_TRT_TABLE (); - for (i = 0; i < 256; i++) - SET_TRT_TABLE_CHAR_1 (up, i, XSTRING_CHAR (temp, i)); - } - if (NILP (canon)) - { - canon = MAKE_TRT_TABLE (); + convert_old_style_syntax_string (XCASE_TABLE_UPCASE (casetab), up); - /* Set up the CANON table; for each character, - this sequence of upcasing and downcasing ought to - get the "preferred" lowercase equivalent. */ - for (i = 0; i < 256; i++) - SET_TRT_TABLE_CHAR_1 (canon, i, - TRT_TABLE_CHAR_1 - (down, - TRT_TABLE_CHAR_1 - (up, - TRT_TABLE_CHAR_1 (down, i)))); - } + if (NILP (canon)) + map_char_table (XCASE_TABLE_DOWNCASE (casetab), &range, + compute_canon_mapper, LISP_TO_VOID (casetab)); else - { - temp = canon; - canon = MAKE_TRT_TABLE (); - for (i = 0; i < 256; i++) - SET_TRT_TABLE_CHAR_1 (canon, i, XSTRING_CHAR (temp, i)); - } + convert_old_style_syntax_string (XCASE_TABLE_CANON (casetab), canon); if (NILP (eqv)) { - eqv = MAKE_TRT_TABLE (); - compute_trt_inverse (canon, eqv); + map_char_table (XCASE_TABLE_CANON (casetab), &range, + initialize_identity_mapper, + LISP_TO_VOID (XCASE_TABLE_EQV (casetab))); + map_char_table (XCASE_TABLE_CANON (casetab), &range, + compute_up_or_eqv_mapper, + LISP_TO_VOID (XCASE_TABLE_EQV (casetab))); } else - { - temp = eqv; - eqv = MAKE_TRT_TABLE (); - for (i = 0; i < 256; i++) - SET_TRT_TABLE_CHAR_1 (eqv, i, XSTRING_CHAR (temp, i)); - } - - if (standard) - { - XSET_CASE_TABLE_DOWNCASE (Vstandard_case_table, down); - XSET_CASE_TABLE_UPCASE (Vstandard_case_table, up); - XSET_CASE_TABLE_CANON (Vstandard_case_table, canon); - XSET_CASE_TABLE_EQV (Vstandard_case_table, eqv); - } - - buf->case_table = allocate_case_table (); - XSET_CASE_TABLE_DOWNCASE (buf->case_table, down); - XSET_CASE_TABLE_UPCASE (buf->case_table, up); - XSET_CASE_TABLE_CANON (buf->case_table, canon); - XSET_CASE_TABLE_EQV (buf->case_table, eqv); + convert_old_style_syntax_string (XCASE_TABLE_CANON (casetab), eqv); } return buf->case_table; } - -/* Given a translate table TRT, store the inverse mapping into INVERSE. - Since TRT is not one-to-one, INVERSE is not a simple mapping. - Instead, it divides the space of characters into equivalence classes. - All characters in a given class form one circular list, chained through - the elements of INVERSE. */ -static void -compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse) +DEFUN ("set-case-table", Fset_case_table, 1, 1, 0, /* +Select CASE-TABLE as the new case table for the current buffer. +A case table is a case-table object or list + (DOWNCASE UPCASE CANONICALIZE EQUIVALENCES) + where each element is either nil or a string of length 256. +The latter is provided for backward-compatibility. +DOWNCASE maps each character to its lower-case equivalent. +UPCASE maps each character to its upper-case equivalent; + if lower and upper case characters are in 1-1 correspondence, + you may use nil and the upcase table will be deduced from DOWNCASE. +CANONICALIZE maps each character to a canonical equivalent; + any two characters that are related by case-conversion have the same + canonical equivalent character; it may be nil, in which case it is + deduced from DOWNCASE and UPCASE. +EQUIVALENCES is a map that cyclicly permutes each equivalence class + (of characters with the same canonical equivalent); it may be nil, + in which case it is deduced from CANONICALIZE. + +See also `get-case-table', `put-case-table' and `put-case-table-pair'. +*/ + (case_table)) { - Charcount i = 0400; - Emchar c, q; + /* This function can GC */ + return set_case_table (case_table, 0); +} - while (--i) - SET_TRT_TABLE_CHAR_1 (inverse, i, (Emchar) i); - i = 0400; - while (--i) - { - if ((q = TRT_TABLE_CHAR_1 (trt, i)) != (Emchar) i) - { - c = TRT_TABLE_CHAR_1 (inverse, q); - SET_TRT_TABLE_CHAR_1 (inverse, q, (Emchar) i); - SET_TRT_TABLE_CHAR_1 (inverse, i, c); - } - } +DEFUN ("set-standard-case-table", Fset_standard_case_table, 1, 1, 0, /* +Select CASE-TABLE as the new standard case table for new buffers. +See `set-case-table' for more info on case tables. +*/ + (case_table)) +{ + /* This function can GC */ + return set_case_table (case_table, 1); } @@ -448,6 +496,7 @@ DEFSYMBOL (Qdowncase); DEFSYMBOL (Qupcase); + DEFSUBR (Fmake_case_table); DEFSUBR (Fcase_table_p); DEFSUBR (Fget_case_table); DEFSUBR (Fput_case_table); @@ -462,35 +511,28 @@ void complex_vars_of_casetab (void) { - REGISTER Emchar i; - Lisp_Object tem; + REGISTER Ichar i; staticpro (&Vstandard_case_table); - Vstandard_case_table = allocate_case_table (); + Vstandard_case_table = allocate_case_table (1); - tem = MAKE_TRT_TABLE (); - XSET_CASE_TABLE_DOWNCASE (Vstandard_case_table, tem); - XSET_CASE_TABLE_CANON (Vstandard_case_table, tem); - - /* Under Mule, can't do set_string_char() until Vcharset_control_1 - and Vcharset_ascii are initialized. */ for (i = 0; i < 256; i++) { unsigned char lowered = tolower (i); - SET_TRT_TABLE_CHAR_1 (tem, i, lowered); + SET_TRT_TABLE_OF (XCASE_TABLE_DOWNCASE (Vstandard_case_table), i, + lowered); } - tem = MAKE_TRT_TABLE (); - XSET_CASE_TABLE_UPCASE (Vstandard_case_table, tem); - XSET_CASE_TABLE_EQV (Vstandard_case_table, tem); - for (i = 0; i < 256; i++) { unsigned char flipped = (isupper (i) ? tolower (i) : (islower (i) ? toupper (i) : i)); - SET_TRT_TABLE_CHAR_1 (tem, i, flipped); + SET_TRT_TABLE_OF (XCASE_TABLE_UPCASE (Vstandard_case_table), i, + flipped); } + + recompute_case_table (Vstandard_case_table); } diff --text -u 'xemacs-21.5.6/src/casetab.h' 'xemacs-21.5.7/src/casetab.h' Index: ././src/casetab.h --- ././src/casetab.h Fri Mar 29 13:47:01 2002 +++ ././src/casetab.h Sun May 5 20:30:50 2002 @@ -1,5 +1,6 @@ /* XEmacs routines to deal with case tables. Copyright (C) 2000 Yoshiki Hayashi. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. XEmacs is free software; you can redistribute it and/or modify it @@ -29,6 +30,7 @@ Lisp_Object upcase_table; Lisp_Object case_canon_table; Lisp_Object case_eqv_table; + int dirty; }; typedef struct Lisp_Case_Table Lisp_Case_Table; @@ -39,14 +41,34 @@ #define CHECK_CASE_TABLE(x) CHECK_RECORD (x, case_table) #define CONCHECK_CASE_TABLE(x) CONCHECK_RECORD (x, case_table) +void recompute_case_table (Lisp_Object casetab); + +DECLARE_INLINE_HEADER ( +Lisp_Case_Table * +XCASE_TABLE_UPDATE (Lisp_Object table) +) +{ + Lisp_Case_Table *ct = XCASE_TABLE (table); + /* If the table is dirty (changes have been made without ancillary + structures updated), recompute first. */ + if (ct->dirty) + recompute_case_table (table); + return ct; +} + #define CASE_TABLE_DOWNCASE(ct) ((ct)->downcase_table) #define CASE_TABLE_UPCASE(ct) ((ct)->upcase_table) #define CASE_TABLE_CANON(ct) ((ct)->case_canon_table) #define CASE_TABLE_EQV(ct) ((ct)->case_eqv_table) #define XCASE_TABLE_DOWNCASE(ct) (XCASE_TABLE (ct)->downcase_table) #define XCASE_TABLE_UPCASE(ct) (XCASE_TABLE (ct)->upcase_table) -#define XCASE_TABLE_CANON(ct) (XCASE_TABLE (ct)->case_canon_table) -#define XCASE_TABLE_EQV(ct) (XCASE_TABLE (ct)->case_eqv_table) +/* Only do automatic updating for canon and eqv, which are the two that are + automatically computed and that are not up to date. These are not + normally used by the simple case routines. canon is used by + compare-buffer-substrings when case-insensitive and by the regex + routines, and eqv is used only by the Boyer-Moore search routines. */ +#define XCASE_TABLE_CANON(ct) (XCASE_TABLE_UPDATE (ct)->case_canon_table) +#define XCASE_TABLE_EQV(ct) (XCASE_TABLE_UPDATE (ct)->case_eqv_table) #define SET_CASE_TABLE_DOWNCASE(ct, p) ((ct)->downcase_table = p) #define SET_CASE_TABLE_UPCASE(ct, p) ((ct)->upcase_table = p) diff --text -u 'xemacs-21.5.6/src/charset.h' 'xemacs-21.5.7/src/charset.h' Index: ././src/charset.h --- ././src/charset.h Sun Mar 31 17:27:47 2002 +++ ././src/charset.h Wed Jun 5 18:55:01 2002 @@ -40,18 +40,20 @@ #define Vcharset_ascii Qnil -#define CHAR_CHARSET(ch) Vcharset_ascii -#define CHAR_LEADING_BYTE(ch) LEADING_BYTE_ASCII +#define ichar_charset(ch) Vcharset_ascii +#define ichar_leading_byte(ch) LEADING_BYTE_ASCII +#define ichar_len(ch) 1 +#define ichar_len_fmt(ch, fmt) 1 #define LEADING_BYTE_ASCII 0x80 #define NUM_LEADING_BYTES 1 #define MIN_LEADING_BYTE 0x80 #define CHARSETP(cs) 1 -#define CHARSET_BY_LEADING_BYTE(lb) Vcharset_ascii +#define charset_by_leading_byte(lb) Vcharset_ascii #define XCHARSET_LEADING_BYTE(cs) LEADING_BYTE_ASCII #define XCHARSET_GRAPHIC(cs) -1 #define XCHARSET_COLUMNS(cs) 1 #define XCHARSET_DIMENSION(cs) 1 -#define BREAKUP_CHAR(ch, charset, byte1, byte2) do { \ +#define BREAKUP_ICHAR(ch, charset, byte1, byte2) do { \ (charset) = Vcharset_ascii; \ (byte1) = (ch); \ (byte2) = 0; \ @@ -151,13 +153,14 @@ /* Is this leading byte for a private charset? */ -#define LEADING_BYTE_PRIVATE_P(lb) ((lb) >= MIN_LEADING_BYTE_PRIVATE_1) +#define leading_byte_private_p(lb) ((lb) >= MIN_LEADING_BYTE_PRIVATE_1) /* Is this a prefix for a private leading byte? */ -INLINE_HEADER int LEADING_BYTE_PREFIX_P (Intbyte lb); -INLINE_HEADER int -LEADING_BYTE_PREFIX_P (Intbyte lb) +DECLARE_INLINE_HEADER ( +int +leading_byte_prefix_p (Ibyte lb) +) { return (lb == PRE_LEADING_BYTE_PRIVATE_1 || lb == PRE_LEADING_BYTE_PRIVATE_2); @@ -166,7 +169,7 @@ /* Given a private leading byte, return the leading byte prefix stored in a string. */ -#define PRIVATE_LEADING_BYTE_PREFIX(lb) \ +#define private_leading_byte_prefix(lb) \ ((unsigned int) (lb) < MIN_LEADING_BYTE_PRIVATE_2 ? \ PRE_LEADING_BYTE_PRIVATE_1 : \ PRE_LEADING_BYTE_PRIVATE_2) @@ -225,7 +228,7 @@ unsigned char unicode_table_loaded; /* Final byte of this character set in ISO2022 designating escape sequence */ - Intbyte final; + Ibyte final; /* Number of bytes (1 - 4) required in the internal representation for characters in this character set. This is *not* the @@ -276,7 +279,7 @@ /* Leading byte and id have been regrouped. -- OG */ #define CHARSET_ID(cs) ((cs)->id) -#define CHARSET_LEADING_BYTE(cs) ((Intbyte) CHARSET_ID (cs)) +#define CHARSET_LEADING_BYTE(cs) ((Ibyte) CHARSET_ID (cs)) #define CHARSET_NAME(cs) ((cs)->name) #define CHARSET_SHORT_NAME(cs) ((cs)->short_name) #define CHARSET_LONG_NAME(cs) ((cs)->long_name) @@ -297,7 +300,7 @@ #define CHARSET_FROM_UNICODE_LEVELS(cs) ((cs)->from_unicode_levels) -#define CHARSET_PRIVATE_P(cs) LEADING_BYTE_PRIVATE_P (CHARSET_LEADING_BYTE (cs)) +#define CHARSET_PRIVATE_P(cs) leading_byte_private_p (CHARSET_LEADING_BYTE (cs)) #define XCHARSET_ID(cs) CHARSET_ID (XCHARSET (cs)) #define XCHARSET_NAME(cs) CHARSET_NAME (XCHARSET (cs)) @@ -332,13 +335,14 @@ /* Table of charsets indexed by type/final-byte/direction. */ Lisp_Object charset_by_attributes[4][128][2]; - Intbyte next_allocated_1_byte_leading_byte; - Intbyte next_allocated_2_byte_leading_byte; + Ibyte next_allocated_1_byte_leading_byte; + Ibyte next_allocated_2_byte_leading_byte; }; -INLINE_HEADER Lisp_Object CHARSET_BY_LEADING_BYTE (int lb); -INLINE_HEADER Lisp_Object -CHARSET_BY_LEADING_BYTE (int lb) +DECLARE_INLINE_HEADER ( +Lisp_Object +charset_by_leading_byte (int lb) +) { extern struct charset_lookup *chlook; @@ -351,10 +355,10 @@ return chlook->charset_by_leading_byte[lb - MIN_LEADING_BYTE]; } -INLINE_HEADER Lisp_Object -CHARSET_BY_ATTRIBUTES (int type, int final, int dir); -INLINE_HEADER Lisp_Object -CHARSET_BY_ATTRIBUTES (int type, int final, int dir) +DECLARE_INLINE_HEADER ( +Lisp_Object +charset_by_attributes (int type, int final, int dir) +) { extern struct charset_lookup *chlook; @@ -372,15 +376,15 @@ /* The bit fields of character are divided into 3 parts: FIELD1(5bits):FIELD2(7bits):FIELD3(7bits) */ -#define CHAR_FIELD1_MASK (0x1F << 14) -#define CHAR_FIELD2_MASK (0x7F << 7) -#define CHAR_FIELD3_MASK 0x7F +#define ICHAR_FIELD1_MASK (0x1F << 14) +#define ICHAR_FIELD2_MASK (0x7F << 7) +#define ICHAR_FIELD3_MASK 0x7F /* Macros to access each field of a character code of C. */ -#define CHAR_FIELD1(c) (((c) & CHAR_FIELD1_MASK) >> 14) -#define CHAR_FIELD2(c) (((c) & CHAR_FIELD2_MASK) >> 7) -#define CHAR_FIELD3(c) ((c) & CHAR_FIELD3_MASK) +#define ichar_field1(c) (((c) & ICHAR_FIELD1_MASK) >> 14) +#define ichar_field2(c) (((c) & ICHAR_FIELD2_MASK) >> 7) +#define ichar_field3(c) ((c) & ICHAR_FIELD3_MASK) /* Field 1, if non-zero, usually holds a leading byte for a dimension-2 charset. Field 2, if non-zero, usually holds a leading @@ -396,32 +400,32 @@ /* Minimum and maximum allowed values for the fields. */ -#define MIN_CHAR_FIELD2_OFFICIAL \ +#define MIN_ICHAR_FIELD2_OFFICIAL \ (MIN_LEADING_BYTE_OFFICIAL_1 - FIELD2_TO_OFFICIAL_LEADING_BYTE) -#define MAX_CHAR_FIELD2_OFFICIAL \ +#define MAX_ICHAR_FIELD2_OFFICIAL \ (MAX_LEADING_BYTE_OFFICIAL_1 - FIELD2_TO_OFFICIAL_LEADING_BYTE) -#define MIN_CHAR_FIELD1_OFFICIAL \ +#define MIN_ICHAR_FIELD1_OFFICIAL \ (MIN_LEADING_BYTE_OFFICIAL_2 - FIELD1_TO_OFFICIAL_LEADING_BYTE) -#define MAX_CHAR_FIELD1_OFFICIAL \ +#define MAX_ICHAR_FIELD1_OFFICIAL \ (MAX_LEADING_BYTE_OFFICIAL_2 - FIELD1_TO_OFFICIAL_LEADING_BYTE) -#define MIN_CHAR_FIELD2_PRIVATE \ +#define MIN_ICHAR_FIELD2_PRIVATE \ (MIN_LEADING_BYTE_PRIVATE_1 - FIELD2_TO_PRIVATE_LEADING_BYTE) -#define MAX_CHAR_FIELD2_PRIVATE \ +#define MAX_ICHAR_FIELD2_PRIVATE \ (MAX_LEADING_BYTE_PRIVATE_1 - FIELD2_TO_PRIVATE_LEADING_BYTE) -#define MIN_CHAR_FIELD1_PRIVATE \ +#define MIN_ICHAR_FIELD1_PRIVATE \ (MIN_LEADING_BYTE_PRIVATE_2 - FIELD1_TO_PRIVATE_LEADING_BYTE) -#define MAX_CHAR_FIELD1_PRIVATE \ +#define MAX_ICHAR_FIELD1_PRIVATE \ (MAX_LEADING_BYTE_PRIVATE_2 - FIELD1_TO_PRIVATE_LEADING_BYTE) /* Minimum character code of each character. */ -#define MIN_CHAR_OFFICIAL_TYPE9N (MIN_CHAR_FIELD2_OFFICIAL << 7) -#define MIN_CHAR_PRIVATE_TYPE9N (MIN_CHAR_FIELD2_PRIVATE << 7) -#define MIN_CHAR_OFFICIAL_TYPE9NX9N (MIN_CHAR_FIELD1_OFFICIAL << 14) -#define MIN_CHAR_PRIVATE_TYPE9NX9N (MIN_CHAR_FIELD1_PRIVATE << 14) +#define MIN_CHAR_OFFICIAL_TYPE9N (MIN_ICHAR_FIELD2_OFFICIAL << 7) +#define MIN_CHAR_PRIVATE_TYPE9N (MIN_ICHAR_FIELD2_PRIVATE << 7) +#define MIN_CHAR_OFFICIAL_TYPE9NX9N (MIN_ICHAR_FIELD1_OFFICIAL << 14) +#define MIN_CHAR_PRIVATE_TYPE9NX9N (MIN_ICHAR_FIELD1_PRIVATE << 14) #define MIN_CHAR_COMPOSITION (0x1F << 14) /* Leading byte of a character. @@ -431,20 +435,21 @@ FIELD2_TO_PRIVATE_LEADING_BYTE are the same. */ -INLINE_HEADER Intbyte CHAR_LEADING_BYTE (Emchar c); -INLINE_HEADER Intbyte -CHAR_LEADING_BYTE (Emchar c) +DECLARE_INLINE_HEADER ( +Ibyte +ichar_leading_byte (Ichar c) +) { - if (CHAR_ASCII_P (c)) + if (ichar_ascii_p (c)) return LEADING_BYTE_ASCII; else if (c < 0xA0) return LEADING_BYTE_CONTROL_1; else if (c < MIN_CHAR_OFFICIAL_TYPE9NX9N) - return CHAR_FIELD2 (c) + FIELD2_TO_OFFICIAL_LEADING_BYTE; + return ichar_field2 (c) + FIELD2_TO_OFFICIAL_LEADING_BYTE; else if (c < MIN_CHAR_PRIVATE_TYPE9NX9N) - return CHAR_FIELD1 (c) + FIELD1_TO_OFFICIAL_LEADING_BYTE; + return ichar_field1 (c) + FIELD1_TO_OFFICIAL_LEADING_BYTE; else if (c < MIN_CHAR_COMPOSITION) - return CHAR_FIELD1 (c) + FIELD1_TO_PRIVATE_LEADING_BYTE; + return ichar_field1 (c) + FIELD1_TO_PRIVATE_LEADING_BYTE; else { #ifdef ENABLE_COMPOSITE_CHARS @@ -456,7 +461,50 @@ } } -#define CHAR_CHARSET(c) CHARSET_BY_LEADING_BYTE (CHAR_LEADING_BYTE (c)) +DECLARE_INLINE_HEADER ( +Bytecount +ichar_len (Ichar c) +) +{ + if (ichar_ascii_p (c)) + return 1; + else if (c < MIN_CHAR_OFFICIAL_TYPE9NX9N) + return 2; + else if (c < MIN_CHAR_PRIVATE_TYPE9NX9N) + return 3; /* dimension-2 official or dimension-1 private */ + else if (c < MIN_CHAR_COMPOSITION) + return 4; + else + { +#ifdef ENABLE_COMPOSITE_CHARS +#error Not yet implemented +#else + abort(); + return 0; +#endif /* ENABLE_COMPOSITE_CHARS */ + } +} + +DECLARE_INLINE_HEADER ( +Bytecount +ichar_len_fmt (Ichar c, Internal_Format fmt) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return ichar_len (c); + case FORMAT_16_BIT_FIXED: + return 2; + case FORMAT_32_BIT_FIXED: + return 4; + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return 1; + } +} + +#define ichar_charset(c) charset_by_leading_byte (ichar_leading_byte (c)) /* Return a character whose charset is CHARSET and position-codes are C1 and C2. TYPE9N character ignores C2. (For typical charsets, i.e. not @@ -468,72 +516,63 @@ FIELD2_TO_PRIVATE_LEADING_BYTE are the same. */ -INLINE_HEADER Emchar MAKE_CHAR_1 (Lisp_Object charset, int c1, int c2); -INLINE_HEADER Emchar -MAKE_CHAR_1 (Lisp_Object charset, int c1, int c2) +DECLARE_INLINE_HEADER ( +Ichar +make_ichar (Lisp_Object charset, int c1, int c2) +) { + Ichar retval; if (EQ (charset, Vcharset_ascii)) - return c1; + retval = c1; else if (EQ (charset, Vcharset_control_1)) - return c1 | 0x80; + retval = c1 | 0x80; #ifdef ENABLE_COMPOSITE_CHARS else if (EQ (charset, Vcharset_composite)) - return (0x1F << 14) | ((c1) << 7) | (c2); + retval = (0x1F << 14) | ((c1) << 7) | (c2); #endif else if (XCHARSET_DIMENSION (charset) == 1) - return ((XCHARSET_LEADING_BYTE (charset) - - FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7) | (c1); + retval = ((XCHARSET_LEADING_BYTE (charset) - + FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7) | (c1); else if (!XCHARSET_PRIVATE_P (charset)) - return ((XCHARSET_LEADING_BYTE (charset) - - FIELD1_TO_OFFICIAL_LEADING_BYTE) << 14) | ((c1) << 7) | (c2); + retval = ((XCHARSET_LEADING_BYTE (charset) - + FIELD1_TO_OFFICIAL_LEADING_BYTE) << 14) | ((c1) << 7) | (c2); else - return ((XCHARSET_LEADING_BYTE (charset) - - FIELD1_TO_PRIVATE_LEADING_BYTE) << 14) | ((c1) << 7) | (c2); -} - -#ifdef ERROR_CHECK_TEXT -INLINE_HEADER Emchar MAKE_CHAR (Lisp_Object charset, int c1, int c2); -INLINE_HEADER Emchar -MAKE_CHAR (Lisp_Object charset, int c1, int c2) -{ - Emchar retval = MAKE_CHAR_1 (charset, c1, c2); - assert (valid_char_p (retval)); + retval = ((XCHARSET_LEADING_BYTE (charset) - + FIELD1_TO_PRIVATE_LEADING_BYTE) << 14) | ((c1) << 7) | (c2); + text_checking_assert (valid_ichar_p (retval)); return retval; } -#else -#define MAKE_CHAR(charset, c1, c2) MAKE_CHAR_1 (charset, c1, c2) -#endif -/* BREAKUP_CHAR_1_UNSAFE assumes that the charset has already been +/* BREAKUP_ICHAR_1_UNSAFE assumes that the charset has already been calculated, and just computes c1 and c2. - BREAKUP_CHAR also computes and stores the charset. */ + BREAKUP_ICHAR also computes and stores the charset. */ -#define BREAKUP_CHAR_1_UNSAFE(c, charset, c1, c2) \ +#define BREAKUP_ICHAR_1_UNSAFE(c, charset, c1, c2) \ XCHARSET_DIMENSION (charset) == 1 \ - ? ((c1) = CHAR_FIELD3 (c), (c2) = 0) \ - : ((c1) = CHAR_FIELD2 (c), \ - (c2) = CHAR_FIELD3 (c)) - -INLINE_HEADER void breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, - int *c2); -INLINE_HEADER void -breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) -{ - text_checking_assert (valid_char_p (c)); - *charset = CHAR_CHARSET (c); - BREAKUP_CHAR_1_UNSAFE (c, *charset, *c1, *c2); + ? ((c1) = ichar_field3 (c), (c2) = 0) \ + : ((c1) = ichar_field2 (c), \ + (c2) = ichar_field3 (c)) + +DECLARE_INLINE_HEADER ( +void +breakup_ichar_1 (Ichar c, Lisp_Object *charset, int *c1, int *c2) +) +{ + text_checking_assert (valid_ichar_p (c)); + *charset = ichar_charset (c); + BREAKUP_ICHAR_1_UNSAFE (c, *charset, *c1, *c2); } -/* BREAKUP_CHAR separates an Emchar into its components. The charset of +/* BREAKUP_ICHAR separates an Ichar into its components. The charset of character C is set to CHARSET, and the position-codes of C are set to C1 and C2. C2 of TYPE9N character is 0. */ -#define BREAKUP_CHAR(c, charset, c1, c2) \ - breakup_char_1 (c, &(charset), &(c1), &(c2)) +#define BREAKUP_ICHAR(c, charset, c1, c2) \ + breakup_ichar_1 (c, &(charset), &(c1), &(c2)) void get_charset_limits (Lisp_Object charset, int *low, int *high); -int char_to_unicode (Emchar chr); +int ichar_to_unicode (Ichar chr); #endif /* MULE */ diff --text -u 'xemacs-21.5.6/src/chartab.c' 'xemacs-21.5.7/src/chartab.c' Index: ././src/chartab.c --- ././src/chartab.c Mon Apr 1 12:58:27 2002 +++ ././src/chartab.c Wed Jun 5 18:55:01 2002 @@ -57,6 +57,10 @@ Lisp_Object Vword_combining_categories, Vword_separating_categories; #endif /* MULE */ +static int check_valid_char_table_value (Lisp_Object value, + enum char_table_type type, + Error_Behavior errb); + /* A char table maps from ranges of characters to values. @@ -126,7 +130,7 @@ { Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj); - return internal_array_hash (cte->level2, 96, depth); + return internal_array_hash (cte->level2, 96, depth + 1); } static const struct lrecord_description char_table_entry_description[] = { @@ -218,159 +222,122 @@ } static void -print_chartab_range (Emchar first, Emchar last, Lisp_Object val, - Lisp_Object printcharfun) +decode_char_table_range (Lisp_Object range, struct chartab_range *outrange) { - if (first != last) - write_fmt_string_lisp (printcharfun, " (%s %s)", 2, - make_char (first), make_char (last)); + if (EQ (range, Qt)) + outrange->type = CHARTAB_RANGE_ALL; + else if (CHAR_OR_CHAR_INTP (range)) + { + outrange->type = CHARTAB_RANGE_CHAR; + outrange->ch = XCHAR_OR_CHAR_INT (range); + } +#ifndef MULE else - write_fmt_string_lisp (printcharfun, " %s ", 1, make_char (first)); - print_internal (val, printcharfun, 1); -} - -#ifdef MULE - -static void -print_chartab_charset_row (Lisp_Object charset, - int row, - Lisp_Char_Table_Entry *cte, - Lisp_Object printcharfun) -{ - int i; - Lisp_Object cat = Qunbound; - int first = -1; - - for (i = 32; i < 128; i++) + sferror ("Range must be t or a character", range); +#else /* MULE */ + else if (VECTORP (range)) { - Lisp_Object pam = cte->level2[i - 32]; - - if (first == -1) - { - first = i; - cat = pam; - continue; - } - - if (!EQ (cat, pam)) + Lisp_Vector *vec = XVECTOR (range); + Lisp_Object *elts = vector_data (vec); + if (vector_length (vec) != 2) + sferror ("Length of charset row vector must be 2", + range); + outrange->type = CHARTAB_RANGE_ROW; + outrange->charset = Fget_charset (elts[0]); + CHECK_INT (elts[1]); + outrange->row = XINT (elts[1]); + switch (XCHARSET_TYPE (outrange->charset)) { - if (row == -1) - print_chartab_range (MAKE_CHAR (charset, first, 0), - MAKE_CHAR (charset, i - 1, 0), - cat, printcharfun); - else - print_chartab_range (MAKE_CHAR (charset, row, first), - MAKE_CHAR (charset, row, i - 1), - cat, printcharfun); - first = -1; - i--; + case CHARSET_TYPE_94: + case CHARSET_TYPE_96: + sferror ("Charset in row vector must be multi-byte", + outrange->charset); + case CHARSET_TYPE_94X94: + check_int_range (outrange->row, 33, 126); + break; + case CHARSET_TYPE_96X96: + check_int_range (outrange->row, 32, 127); + break; + default: + abort (); } } - - if (first != -1) + else { - if (row == -1) - print_chartab_range (MAKE_CHAR (charset, first, 0), - MAKE_CHAR (charset, i - 1, 0), - cat, printcharfun); - else - print_chartab_range (MAKE_CHAR (charset, row, first), - MAKE_CHAR (charset, row, i - 1), - cat, printcharfun); + if (!CHARSETP (range) && !SYMBOLP (range)) + sferror + ("Char table range must be t, charset, char, or vector", range); + outrange->type = CHARTAB_RANGE_CHARSET; + outrange->charset = Fget_charset (range); } +#endif /* MULE */ } -static void -print_chartab_two_byte_charset (Lisp_Object charset, - Lisp_Char_Table_Entry *cte, - Lisp_Object printcharfun) +static Lisp_Object +encode_char_table_range (struct chartab_range *range) { - int i; - - for (i = 32; i < 128; i++) + switch (range->type) { - Lisp_Object jen = cte->level2[i - 32]; + case CHARTAB_RANGE_ALL: + return Qt; + +#ifdef MULE + case CHARTAB_RANGE_CHARSET: + return XCHARSET_NAME (Fget_charset (range->charset)); - if (!CHAR_TABLE_ENTRYP (jen)) - { - write_fmt_string_lisp (printcharfun, " [%s %d] %s", - 3, XCHARSET_NAME (charset), - make_int (i), jen); - } - else - print_chartab_charset_row (charset, i, XCHAR_TABLE_ENTRY (jen), - printcharfun); + case CHARTAB_RANGE_ROW: + return vector2 (XCHARSET_NAME (Fget_charset (range->charset)), + make_int (range->row)); +#endif + case CHARTAB_RANGE_CHAR: + return make_char (range->ch); + default: + abort (); } + return Qnil; /* not reached */ } -#endif /* MULE */ +struct ptemap +{ + Lisp_Object printcharfun; + int first; +}; + +static int +print_table_entry (struct chartab_range *range, Lisp_Object table, + Lisp_Object val, void *arg) +{ + struct ptemap *a = (struct ptemap *) arg; + struct gcpro gcpro1; + Lisp_Object lisprange; + if (!a->first) + write_c_string (a->printcharfun, " "); + a->first = 0; + lisprange = encode_char_table_range (range); + GCPRO1 (lisprange); + write_fmt_string_lisp (a->printcharfun, "%s %s", 2, lisprange, val); + UNGCPRO; + return 0; +} static void print_char_table (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) { Lisp_Char_Table *ct = XCHAR_TABLE (obj); + struct chartab_range range; + struct ptemap arg; + + range.type = CHARTAB_RANGE_ALL; + arg.printcharfun = printcharfun; + arg.first = 1; write_fmt_string_lisp (printcharfun, "#s(char-table type %s data (", 1, char_table_type_to_symbol (ct->type)); + map_char_table (obj, &range, print_table_entry, &arg); + write_c_string (printcharfun, "))"); - /* Now write out the ASCII/Control-1 stuff. */ - { - int i; - int first = -1; - Lisp_Object val = Qunbound; - - for (i = 0; i < NUM_ASCII_CHARS; i++) - { - if (first == -1) - { - first = i; - val = ct->ascii[i]; - continue; - } - - if (!EQ (ct->ascii[i], val)) - { - print_chartab_range (first, i - 1, val, printcharfun); - first = -1; - i--; - } - } - - if (first != -1) - print_chartab_range (first, i - 1, val, printcharfun); - } - -#ifdef MULE - { - int i; - - for (i = MIN_LEADING_BYTE; i < MIN_LEADING_BYTE + NUM_LEADING_BYTES; - i++) - { - Lisp_Object ann = ct->level1[i - MIN_LEADING_BYTE]; - Lisp_Object charset = CHARSET_BY_LEADING_BYTE (i); - - if (!CHARSETP (charset) || i == LEADING_BYTE_ASCII - || i == LEADING_BYTE_CONTROL_1) - continue; - if (!CHAR_TABLE_ENTRYP (ann)) - { - write_fmt_string_lisp (printcharfun, " %s %s", 2, - XCHARSET_NAME (charset), ann); - } - else - { - Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (ann); - if (XCHARSET_DIMENSION (charset) == 1) - print_chartab_charset_row (charset, -1, cte, printcharfun); - else - print_chartab_two_byte_charset (charset, cte, printcharfun); - } - } - } -#endif /* MULE */ - - write_c_string ("))", printcharfun); + /* #### need to print and read the default; but that will allow the + default to be modified, which we don't (yet) support -- but FSF does */ } static int @@ -393,7 +360,7 @@ return 0; #endif /* MULE */ - return 1; + return internal_equal (ct1->default_, ct2->default_, depth + 1); } static Hashcode @@ -401,12 +368,13 @@ { Lisp_Char_Table *ct = XCHAR_TABLE (obj); Hashcode hashval = internal_array_hash (ct->ascii, NUM_ASCII_CHARS, - depth); + depth + 1); #ifdef MULE hashval = HASH2 (hashval, - internal_array_hash (ct->level1, NUM_LEADING_BYTES, depth)); + internal_array_hash (ct->level1, NUM_LEADING_BYTES, + depth + 1)); #endif /* MULE */ - return hashval; + return HASH2 (hashval, internal_hash (ct->default_, depth + 1)); } static const struct lrecord_description char_table_description[] = { @@ -474,6 +442,15 @@ } void +set_char_table_default (Lisp_Object table, Lisp_Object value) +{ + Lisp_Char_Table *ct = XCHAR_TABLE (table); + ct->default_ = value; + if (ct->type == CHAR_TABLE_TYPE_SYNTAX) + update_syntax_table (table); +} + +static void fill_char_table (Lisp_Char_Table *ct, Lisp_Object value) { int i; @@ -486,7 +463,7 @@ #endif /* MULE */ if (ct->type == CHAR_TABLE_TYPE_SYNTAX) - update_syntax_table (ct); + update_syntax_table (wrap_char_table (ct)); } DEFUN ("reset-char-table", Freset_char_table, 1, 1, 0, /* @@ -495,6 +472,7 @@ (char_table)) { Lisp_Char_Table *ct; + Lisp_Object def; CHECK_CHAR_TABLE (char_table); ct = XCHAR_TABLE (char_table); @@ -502,24 +480,31 @@ switch (ct->type) { case CHAR_TABLE_TYPE_CHAR: - fill_char_table (ct, make_char (0)); + def = make_char (0); break; case CHAR_TABLE_TYPE_DISPLAY: case CHAR_TABLE_TYPE_GENERIC: #ifdef MULE case CHAR_TABLE_TYPE_CATEGORY: #endif /* MULE */ - fill_char_table (ct, Qnil); + def = Qnil; break; case CHAR_TABLE_TYPE_SYNTAX: - fill_char_table (ct, make_int (Sinherit)); + def = make_int (Sinherit); break; default: abort (); + def = Qnil; + break; } + /* Avoid doubly updating the syntax table by setting the default ourselves, + since set_char_table_default() also updates. */ + ct->default_ = def; + fill_char_table (ct, Qunbound); + return Qnil; } @@ -552,7 +537,7 @@ To create a char table, use `make-char-table'. To modify a char table, use `put-char-table' or `remove-char-table'. To retrieve the value for a particular character, use `get-char-table'. -See also `map-char-table', `clear-char-table', `copy-char-table', +See also `map-char-table', `reset-char-table', `copy-char-table', `char-table-p', `valid-char-table-type-p', `char-table-type-list', `valid-char-table-value-p', and `check-char-table-value'. @@ -590,9 +575,10 @@ ct->type = ty; if (ty == CHAR_TABLE_TYPE_SYNTAX) { + /* Qgeneric not Qsyntax because a syntax table has a mirror table + and we don't want infinite recursion */ ct->mirror_table = Fmake_char_table (Qgeneric); - fill_char_table (XCHAR_TABLE (ct->mirror_table), - make_int (Spunct)); + set_char_table_default (ct->mirror_table, make_int (Spunct)); } else ct->mirror_table = Qnil; @@ -700,70 +686,18 @@ return obj; } -static void -decode_char_table_range (Lisp_Object range, struct chartab_range *outrange) -{ - if (EQ (range, Qt)) - outrange->type = CHARTAB_RANGE_ALL; - else if (CHAR_OR_CHAR_INTP (range)) - { - outrange->type = CHARTAB_RANGE_CHAR; - outrange->ch = XCHAR_OR_CHAR_INT (range); - } -#ifndef MULE - else - sferror ("Range must be t or a character", range); -#else /* MULE */ - else if (VECTORP (range)) - { - Lisp_Vector *vec = XVECTOR (range); - Lisp_Object *elts = vector_data (vec); - if (vector_length (vec) != 2) - sferror ("Length of charset row vector must be 2", - range); - outrange->type = CHARTAB_RANGE_ROW; - outrange->charset = Fget_charset (elts[0]); - CHECK_INT (elts[1]); - outrange->row = XINT (elts[1]); - switch (XCHARSET_TYPE (outrange->charset)) - { - case CHARSET_TYPE_94: - case CHARSET_TYPE_96: - sferror ("Charset in row vector must be multi-byte", - outrange->charset); - case CHARSET_TYPE_94X94: - check_int_range (outrange->row, 33, 126); - break; - case CHARSET_TYPE_96X96: - check_int_range (outrange->row, 32, 127); - break; - default: - abort (); - } - } - else - { - if (!CHARSETP (range) && !SYMBOLP (range)) - sferror - ("Char table range must be t, charset, char, or vector", range); - outrange->type = CHARTAB_RANGE_CHARSET; - outrange->charset = Fget_charset (range); - } -#endif /* MULE */ -} - #ifdef MULE -/* called from CHAR_TABLE_VALUE(). */ +/* called from get_char_table(). */ Lisp_Object get_non_ascii_char_table_value (Lisp_Char_Table *ct, int leading_byte, - Emchar c) + Ichar c) { Lisp_Object val; - Lisp_Object charset = CHARSET_BY_LEADING_BYTE (leading_byte); + Lisp_Object charset = charset_by_leading_byte (leading_byte); int byte1, byte2; - BREAKUP_CHAR_1_UNSAFE (c, charset, byte1, byte2); + BREAKUP_ICHAR_1_UNSAFE (c, charset, byte1, byte2); val = ct->level1[leading_byte - MIN_LEADING_BYTE]; if (CHAR_TABLE_ENTRYP (val)) { @@ -783,46 +717,31 @@ #endif /* MULE */ -Lisp_Object -get_char_table (Emchar ch, Lisp_Char_Table *ct) +DEFUN ("char-table-default", Fchar_table_default, 1, 1, 0, /* +Return the default value for CHAR-TABLE. When an entry for a character +does not exist, the default is returned. +*/ + (char_table)) { -#ifdef MULE - { - Lisp_Object charset; - int byte1, byte2; - Lisp_Object val; - - BREAKUP_CHAR (ch, charset, byte1, byte2); - - if (EQ (charset, Vcharset_ascii)) - val = ct->ascii[byte1]; - else if (EQ (charset, Vcharset_control_1)) - val = ct->ascii[byte1 + 128]; - else - { - int lb = XCHARSET_LEADING_BYTE (charset) - MIN_LEADING_BYTE; - val = ct->level1[lb]; - if (CHAR_TABLE_ENTRYP (val)) - { - Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (val); - val = cte->level2[byte1 - 32]; - if (CHAR_TABLE_ENTRYP (val)) - { - cte = XCHAR_TABLE_ENTRY (val); - assert (byte2 >= 32); - val = cte->level2[byte2 - 32]; - assert (!CHAR_TABLE_ENTRYP (val)); - } - } - } - - return val; - } -#else /* not MULE */ - return ct->ascii[(unsigned char)ch]; -#endif /* not MULE */ + CHECK_CHAR_TABLE (char_table); + return XCHAR_TABLE (char_table)->default_; } +DEFUN ("set-char-table-default", Fset_char_table_default, 2, 2, 0, /* +Set the default value for CHAR-TABLE to DEFAULT. +Currently, the default value for syntax tables cannot be changed. +(This policy might change in the future.) +*/ + (char_table, default_)) +{ + CHECK_CHAR_TABLE (char_table); + if (XCHAR_TABLE_TYPE (char_table) == CHAR_TABLE_TYPE_SYNTAX) + invalid_change ("Can't change default for syntax tables", char_table); + check_valid_char_table_value (default_, XCHAR_TABLE_TYPE (char_table), + ERROR_ME); + set_char_table_default (char_table, default_); + return Qnil; +} DEFUN ("get-char-table", Fget_char_table, 2, 2, 0, /* Find value for CHARACTER in CHAR-TABLE. @@ -832,93 +751,103 @@ CHECK_CHAR_TABLE (char_table); CHECK_CHAR_COERCE_INT (character); - return get_char_table (XCHAR (character), XCHAR_TABLE (char_table)); + return get_char_table (XCHAR (character), char_table); } -DEFUN ("get-range-char-table", Fget_range_char_table, 2, 3, 0, /* -Find value for a range in CHAR-TABLE. -If there is more than one value, return MULTI (defaults to nil). -*/ - (range, char_table, multi)) +static int +copy_mapper (struct chartab_range *range, Lisp_Object table, + Lisp_Object val, void *arg) { - Lisp_Char_Table *ct; - struct chartab_range rainj; + put_char_table (VOID_TO_LISP (arg), range, val); + return 0; +} - if (CHAR_OR_CHAR_INTP (range)) - return Fget_char_table (range, char_table); - CHECK_CHAR_TABLE (char_table); - ct = XCHAR_TABLE (char_table); +void +copy_char_table_range (Lisp_Object from, Lisp_Object to, + struct chartab_range *range) +{ + map_char_table (from, range, copy_mapper, LISP_TO_VOID (to)); +} - decode_char_table_range (range, &rainj); - switch (rainj.type) +Lisp_Object +get_range_char_table (struct chartab_range *range, Lisp_Object table, + Lisp_Object multi) +{ + Lisp_Char_Table *ct = XCHAR_TABLE (table); + Lisp_Object retval = Qnil; + + switch (range->type) { + case CHARTAB_RANGE_CHAR: + return get_char_table (range->ch, table); + case CHARTAB_RANGE_ALL: { int i; - Lisp_Object first = ct->ascii[0]; + retval = ct->ascii[0]; for (i = 1; i < NUM_ASCII_CHARS; i++) - if (!EQ (first, ct->ascii[i])) + if (!EQ (retval, ct->ascii[i])) return multi; #ifdef MULE for (i = MIN_LEADING_BYTE; i < MIN_LEADING_BYTE + NUM_LEADING_BYTES; i++) { - if (!CHARSETP (CHARSET_BY_LEADING_BYTE (i)) + if (!CHARSETP (charset_by_leading_byte (i)) || i == LEADING_BYTE_ASCII || i == LEADING_BYTE_CONTROL_1) continue; - if (!EQ (first, ct->level1[i - MIN_LEADING_BYTE])) + if (!EQ (retval, ct->level1[i - MIN_LEADING_BYTE])) return multi; } #endif /* MULE */ - return first; + break; } #ifdef MULE case CHARTAB_RANGE_CHARSET: - if (EQ (rainj.charset, Vcharset_ascii)) + if (EQ (range->charset, Vcharset_ascii)) { int i; - Lisp_Object first = ct->ascii[0]; + retval = ct->ascii[0]; for (i = 1; i < 128; i++) - if (!EQ (first, ct->ascii[i])) + if (!EQ (retval, ct->ascii[i])) return multi; - return first; + break; } - if (EQ (rainj.charset, Vcharset_control_1)) + if (EQ (range->charset, Vcharset_control_1)) { int i; - Lisp_Object first = ct->ascii[128]; + retval = ct->ascii[128]; for (i = 129; i < 160; i++) - if (!EQ (first, ct->ascii[i])) + if (!EQ (retval, ct->ascii[i])) return multi; - return first; + break; } { - Lisp_Object val = ct->level1[XCHARSET_LEADING_BYTE (rainj.charset) - - MIN_LEADING_BYTE]; - if (CHAR_TABLE_ENTRYP (val)) + retval = ct->level1[XCHARSET_LEADING_BYTE (range->charset) - + MIN_LEADING_BYTE]; + if (CHAR_TABLE_ENTRYP (retval)) return multi; - return val; + break; } case CHARTAB_RANGE_ROW: { - Lisp_Object val = ct->level1[XCHARSET_LEADING_BYTE (rainj.charset) - - MIN_LEADING_BYTE]; - if (!CHAR_TABLE_ENTRYP (val)) - return val; - val = XCHAR_TABLE_ENTRY (val)->level2[rainj.row - 32]; - if (CHAR_TABLE_ENTRYP (val)) + retval = ct->level1[XCHARSET_LEADING_BYTE (range->charset) - + MIN_LEADING_BYTE]; + if (!CHAR_TABLE_ENTRYP (retval)) + break; + retval = XCHAR_TABLE_ENTRY (retval)->level2[range->row - 32]; + if (CHAR_TABLE_ENTRYP (retval)) return multi; - return val; + break; } #endif /* not MULE */ @@ -926,9 +855,27 @@ abort (); } - return Qnil; /* not (usually) reached */ + if (UNBOUNDP (retval)) + return ct->default_; + return retval; } +DEFUN ("get-range-char-table", Fget_range_char_table, 2, 3, 0, /* +Find value for a range in CHAR-TABLE. +If there is more than one value, return MULTI (defaults to nil). +*/ + (range, char_table, multi)) +{ + struct chartab_range rainj; + + if (CHAR_OR_CHAR_INTP (range)) + return Fget_char_table (range, char_table); + CHECK_CHAR_TABLE (char_table); + + decode_char_table_range (range, &rainj); + return get_range_char_table (&rainj, char_table, multi); +} + static int check_valid_char_table_value (Lisp_Object value, enum char_table_type type, Error_Behavior errb) @@ -1024,12 +971,14 @@ return Qnil; } -/* Assign VAL to all characters in RANGE in char table CT. */ +/* Assign VAL to all characters in RANGE in char table TABLE. */ void -put_char_table (Lisp_Char_Table *ct, struct chartab_range *range, +put_char_table (Lisp_Object table, struct chartab_range *range, Lisp_Object val) { + Lisp_Char_Table *ct = XCHAR_TABLE (table); + switch (range->type) { case CHARTAB_RANGE_ALL: @@ -1077,7 +1026,7 @@ Lisp_Object charset; int byte1, byte2; - BREAKUP_CHAR (range->ch, charset, byte1, byte2); + BREAKUP_ICHAR (range->ch, charset, byte1, byte2); if (EQ (charset, Vcharset_ascii)) ct->ascii[byte1] = val; else if (EQ (charset, Vcharset_control_1)) @@ -1115,7 +1064,7 @@ } if (ct->type == CHAR_TABLE_TYPE_SYNTAX) - update_syntax_table (ct); + update_syntax_table (wrap_char_table (ct)); } DEFUN ("put-char-table", Fput_char_table, 3, 3, 0, /* @@ -1143,38 +1092,78 @@ check_valid_char_table_value (value, ct->type, ERROR_ME); decode_char_table_range (range, &rainj); value = canonicalize_char_table_value (value, ct->type); - put_char_table (ct, &rainj, value); + put_char_table (char_table, &rainj, value); + return Qnil; +} + +DEFUN ("remove-char-table", Fremove_char_table, 2, 2, 0, /* +Remove any value from chars in RANGE in CHAR-TABLE. + +RANGE specifies one or more characters to be affected and should be +one of the following: + +-- t (all characters are affected) +-- A charset (only allowed when Mule support is present) +-- A vector of two elements: a two-octet charset and a row number + (only allowed when Mule support is present) +-- A single character + +With the values removed, the default value will be returned. +*/ + (range, char_table)) +{ + struct chartab_range rainj; + + CHECK_CHAR_TABLE (char_table); + decode_char_table_range (range, &rainj); + put_char_table (char_table, &rainj, Qunbound); return Qnil; } /* Map FN over the ASCII chars in CT. */ static int -map_over_charset_ascii (Lisp_Char_Table *ct, - int (*fn) (struct chartab_range *range, - Lisp_Object val, void *arg), - void *arg) +map_over_charset_ascii_1 (Lisp_Char_Table *ct, + int start, int stop, + int (*fn) (struct chartab_range *range, + Lisp_Object table, Lisp_Object val, + void *arg), + void *arg) { struct chartab_range rainj; int i, retval; - int start = 0; -#ifdef MULE - int stop = 128; -#else - int stop = 256; -#endif rainj.type = CHARTAB_RANGE_CHAR; - for (i = start, retval = 0; i < stop && retval == 0; i++) + for (i = start, retval = 0; i <= stop && retval == 0; i++) { - rainj.ch = (Emchar) i; - retval = (fn) (&rainj, ct->ascii[i], arg); + rainj.ch = (Ichar) i; + if (!UNBOUNDP (ct->ascii[i])) + retval = (fn) (&rainj, wrap_char_table (ct), ct->ascii[i], arg); } return retval; } + +/* Map FN over the ASCII chars in CT. */ + +static int +map_over_charset_ascii (Lisp_Char_Table *ct, + int (*fn) (struct chartab_range *range, + Lisp_Object table, Lisp_Object val, + void *arg), + void *arg) +{ + return map_over_charset_ascii_1 (ct, 0, +#ifdef MULE + 127, +#else + 255, +#endif + fn, arg); +} + #ifdef MULE /* Map FN over the Control-1 chars in CT. */ @@ -1182,23 +1171,11 @@ static int map_over_charset_control_1 (Lisp_Char_Table *ct, int (*fn) (struct chartab_range *range, - Lisp_Object val, void *arg), + Lisp_Object table, Lisp_Object val, + void *arg), void *arg) { - struct chartab_range rainj; - int i, retval; - int start = 128; - int stop = start + 32; - - rainj.type = CHARTAB_RANGE_CHAR; - - for (i = start, retval = 0; i < stop && retval == 0; i++) - { - rainj.ch = (Emchar) (i); - retval = (fn) (&rainj, ct->ascii[i], arg); - } - - return retval; + return map_over_charset_ascii_1 (ct, 128, 159, fn, arg); } /* Map FN over the row ROW of two-byte charset CHARSET. @@ -1206,39 +1183,45 @@ CTE specifies the char table entry for CHARSET. */ static int -map_over_charset_row (Lisp_Char_Table_Entry *cte, +map_over_charset_row (Lisp_Char_Table *ct, + Lisp_Char_Table_Entry *cte, Lisp_Object charset, int row, int (*fn) (struct chartab_range *range, - Lisp_Object val, void *arg), + Lisp_Object table, Lisp_Object val, + void *arg), void *arg) { Lisp_Object val = cte->level2[row - 32]; - if (!CHAR_TABLE_ENTRYP (val)) + if (UNBOUNDP (val)) + return 0; + else if (!CHAR_TABLE_ENTRYP (val)) { struct chartab_range rainj; - + rainj.type = CHARTAB_RANGE_ROW; rainj.charset = charset; rainj.row = row; - return (fn) (&rainj, val, arg); + return (fn) (&rainj, wrap_char_table (ct), val, arg); } else { struct chartab_range rainj; int i, retval; - int charset94_p = (XCHARSET_CHARS (charset) == 94); - int start = charset94_p ? 33 : 32; - int stop = charset94_p ? 127 : 128; + int start, stop; + + get_charset_limits (charset, &start, &stop); cte = XCHAR_TABLE_ENTRY (val); rainj.type = CHARTAB_RANGE_CHAR; - for (i = start, retval = 0; i < stop && retval == 0; i++) + for (i = start, retval = 0; i <= stop && retval == 0; i++) { - rainj.ch = MAKE_CHAR (charset, row, i); - retval = (fn) (&rainj, cte->level2[i - 32], arg); + rainj.ch = make_ichar (charset, row, i); + if (!UNBOUNDP (cte->level2[i - 32])) + retval = (fn) (&rainj, wrap_char_table (ct), cte->level2[i - 32], + arg); } return retval; } @@ -1248,48 +1231,51 @@ static int map_over_other_charset (Lisp_Char_Table *ct, int lb, int (*fn) (struct chartab_range *range, - Lisp_Object val, void *arg), + Lisp_Object table, Lisp_Object val, + void *arg), void *arg) { Lisp_Object val = ct->level1[lb - MIN_LEADING_BYTE]; - Lisp_Object charset = CHARSET_BY_LEADING_BYTE (lb); + Lisp_Object charset = charset_by_leading_byte (lb); if (!CHARSETP (charset) || lb == LEADING_BYTE_ASCII || lb == LEADING_BYTE_CONTROL_1) return 0; + if (UNBOUNDP (val)) + return 0; if (!CHAR_TABLE_ENTRYP (val)) { struct chartab_range rainj; rainj.type = CHARTAB_RANGE_CHARSET; rainj.charset = charset; - return (fn) (&rainj, val, arg); + return (fn) (&rainj, wrap_char_table (ct), val, arg); } - { Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (val); - int charset94_p = (XCHARSET_CHARS (charset) == 94); - int start = charset94_p ? 33 : 32; - int stop = charset94_p ? 127 : 128; + int start, stop; int i, retval; + get_charset_limits (charset, &start, &stop); if (XCHARSET_DIMENSION (charset) == 1) { struct chartab_range rainj; rainj.type = CHARTAB_RANGE_CHAR; - for (i = start, retval = 0; i < stop && retval == 0; i++) + for (i = start, retval = 0; i <= stop && retval == 0; i++) { - rainj.ch = MAKE_CHAR (charset, i, 0); - retval = (fn) (&rainj, cte->level2[i - 32], arg); + rainj.ch = make_ichar (charset, i, 0); + if (!UNBOUNDP (cte->level2[i - 32])) + retval = (fn) (&rainj, wrap_char_table (ct), cte->level2[i - 32], + arg); } } else { - for (i = start, retval = 0; i < stop && retval == 0; i++) - retval = map_over_charset_row (cte, charset, i, fn, arg); + for (i = start, retval = 0; i <= stop && retval == 0; i++) + retval = map_over_charset_row (ct, cte, charset, i, fn, arg); } return retval; @@ -1300,15 +1286,20 @@ /* Map FN (with client data ARG) over range RANGE in char table CT. Mapping stops the first time FN returns non-zero, and that value - becomes the return value of map_char_table(). */ + becomes the return value of map_char_table(). + + #### This mapping code is way ugly. The FSF version, in contrast, + is short and sweet, and much more recursive. There should be some way + of cleaning this up. */ int -map_char_table (Lisp_Char_Table *ct, +map_char_table (Lisp_Object table, struct chartab_range *range, int (*fn) (struct chartab_range *range, - Lisp_Object val, void *arg), + Lisp_Object table, Lisp_Object val, void *arg), void *arg) { + Lisp_Char_Table *ct = XCHAR_TABLE (table); switch (range->type) { case CHARTAB_RANGE_ALL: @@ -1347,31 +1338,38 @@ { Lisp_Object val = ct->level1[XCHARSET_LEADING_BYTE (range->charset) - MIN_LEADING_BYTE]; - if (!CHAR_TABLE_ENTRYP (val)) + + if (CHAR_TABLE_ENTRYP (val)) + return map_over_charset_row (ct, XCHAR_TABLE_ENTRY (val), + range->charset, range->row, fn, arg); + else if (!UNBOUNDP (val)) { struct chartab_range rainj; rainj.type = CHARTAB_RANGE_ROW; rainj.charset = range->charset; rainj.row = range->row; - return (fn) (&rainj, val, arg); + return (fn) (&rainj, table, val, arg); } else - return map_over_charset_row (XCHAR_TABLE_ENTRY (val), - range->charset, range->row, - fn, arg); + return 0; } #endif /* MULE */ case CHARTAB_RANGE_CHAR: { - Emchar ch = range->ch; - Lisp_Object val = CHAR_TABLE_VALUE_UNSAFE (ct, ch); + Ichar ch = range->ch; + Lisp_Object val = get_char_table (ch, table); struct chartab_range rainj; - rainj.type = CHARTAB_RANGE_CHAR; - rainj.ch = ch; - return (fn) (&rainj, val, arg); + if (!UNBOUNDP (val)) + { + rainj.type = CHARTAB_RANGE_CHAR; + rainj.ch = ch; + return (fn) (&rainj, table, val, arg); + } + else + return 0; } default: @@ -1389,36 +1387,13 @@ static int slow_map_char_table_fun (struct chartab_range *range, - Lisp_Object val, void *arg) + Lisp_Object table, Lisp_Object val, void *arg) { - Lisp_Object ranjarg = Qnil; struct slow_map_char_table_arg *closure = (struct slow_map_char_table_arg *) arg; - switch (range->type) - { - case CHARTAB_RANGE_ALL: - ranjarg = Qt; - break; - -#ifdef MULE - case CHARTAB_RANGE_CHARSET: - ranjarg = XCHARSET_NAME (range->charset); - break; - - case CHARTAB_RANGE_ROW: - ranjarg = vector2 (XCHARSET_NAME (range->charset), - make_int (range->row)); - break; -#endif /* MULE */ - case CHARTAB_RANGE_CHAR: - ranjarg = make_char (range->ch); - break; - default: - abort (); - } - - closure->retval = call2 (closure->function, ranjarg, val); + closure->retval = call2 (closure->function, encode_char_table_range (range), + val); return !NILP (closure->retval); } @@ -1432,20 +1407,18 @@ */ (function, char_table, range)) { - Lisp_Char_Table *ct; struct slow_map_char_table_arg slarg; struct gcpro gcpro1, gcpro2; struct chartab_range rainj; CHECK_CHAR_TABLE (char_table); - ct = XCHAR_TABLE (char_table); if (NILP (range)) range = Qt; decode_char_table_range (range, &rainj); slarg.function = function; slarg.retval = Qnil; GCPRO2 (slarg.function, slarg.retval); - map_char_table (ct, &rainj, slow_map_char_table_fun, &slarg); + map_char_table (char_table, &rainj, slow_map_char_table_fun, &slarg); UNGCPRO; return slarg.retval; @@ -1466,6 +1439,8 @@ return 1; } +/* #### Document the print/read format; esp. what's this cons element? */ + static int chartab_data_validate (Lisp_Object keyword, Lisp_Object value, Error_Behavior errb) @@ -1530,9 +1505,9 @@ { if (CHAR_OR_CHAR_INTP (XCAR (range))) { - Emchar first = XCHAR_OR_CHAR_INT (Fcar (range)); - Emchar last = XCHAR_OR_CHAR_INT (Fcar (Fcdr (range))); - Emchar i; + Ichar first = XCHAR_OR_CHAR_INT (Fcar (range)); + Ichar last = XCHAR_OR_CHAR_INT (Fcar (Fcdr (range))); + Ichar i; for (i = first; i <= last; i++) Fput_char_table (make_char (i), val, chartab); @@ -1596,15 +1571,13 @@ } int -check_category_char (Emchar ch, Lisp_Object table, +check_category_char (Ichar ch, Lisp_Object table, int designator, int not_p) { REGISTER Lisp_Object temp; - Lisp_Char_Table *ctbl; if (NILP (Fcategory_table_p (table))) wtaerror ("Expected category table", table); - ctbl = XCHAR_TABLE (table); - temp = get_char_table (ch, ctbl); + temp = get_char_table (ch, table); if (NILP (temp)) return not_p; @@ -1622,7 +1595,7 @@ (position, designator, buffer, category_table)) { Lisp_Object ctbl; - Emchar ch; + Ichar ch; int des; struct buffer *buf = decode_buffer (buffer, 0); @@ -1642,7 +1615,7 @@ (character, designator, category_table)) { Lisp_Object ctbl; - Emchar ch; + Ichar ch; int des; CHECK_CATEGORY_DESIGNATOR (designator); @@ -1720,8 +1693,7 @@ #define CATEGORYP(x) \ (CHARP (x) && XCHAR (x) >= 0x20 && XCHAR (x) <= 0x7E) -#define CATEGORY_SET(c) \ - (get_char_table(c, XCHAR_TABLE(current_buffer->category_table))) +#define CATEGORY_SET(c) get_char_table (c, current_buffer->category_table) /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. The faster version of `!NILP (Faref (category_set, category))'. */ @@ -1733,9 +1705,8 @@ Use the macro WORD_BOUNDARY_P instead of calling this function directly. */ -int word_boundary_p (Emchar c1, Emchar c2); int -word_boundary_p (Emchar c1, Emchar c2) +word_boundary_p (Ichar c1, Ichar c2) { Lisp_Object category_set1, category_set2; Lisp_Object tail; @@ -1748,7 +1719,7 @@ c2 = cmpchar_component (c2, 0, 1); #endif - if (EQ (CHAR_CHARSET (c1), CHAR_CHARSET (c2))) + if (EQ (ichar_charset (c1), ichar_charset (c2))) { tail = Vword_separating_categories; default_result = 0; @@ -1766,15 +1737,15 @@ if (NILP (category_set2)) return default_result; - for (; CONSP (tail); tail = XCONS (tail)->cdr) + for (; CONSP (tail); tail = XCDR (tail)) { - Lisp_Object elt = XCONS(tail)->car; + Lisp_Object elt = XCAR (tail); if (CONSP (elt) - && CATEGORYP (XCONS (elt)->car) - && CATEGORYP (XCONS (elt)->cdr) - && CATEGORY_MEMBER (XCHAR (XCONS (elt)->car), category_set1) - && CATEGORY_MEMBER (XCHAR (XCONS (elt)->cdr), category_set2)) + && CATEGORYP (XCAR (elt)) + && CATEGORYP (XCDR (elt)) + && CATEGORY_MEMBER (XCHAR (XCAR (elt)), category_set1) + && CATEGORY_MEMBER (XCHAR (XCDR (elt)), category_set2)) return !default_result; } return default_result; @@ -1802,6 +1773,8 @@ DEFSUBR (Fchar_table_type_list); DEFSUBR (Fvalid_char_table_type_p); DEFSUBR (Fchar_table_type); + DEFSUBR (Fchar_table_default); + DEFSUBR (Fset_char_table_default); DEFSUBR (Freset_char_table); DEFSUBR (Fmake_char_table); DEFSUBR (Fcopy_char_table); @@ -1810,6 +1783,7 @@ DEFSUBR (Fvalid_char_table_value_p); DEFSUBR (Fcheck_valid_char_table_value); DEFSUBR (Fput_char_table); + DEFSUBR (Fremove_char_table); DEFSUBR (Fmap_char_table); #ifdef MULE diff --text -u 'xemacs-21.5.6/src/chartab.h' 'xemacs-21.5.7/src/chartab.h' Index: ././src/chartab.h --- ././src/chartab.h Fri Mar 29 13:47:02 2002 +++ ././src/chartab.h Wed Jun 5 18:55:02 2002 @@ -83,7 +83,7 @@ struct lcrecord_header header; Lisp_Object ascii[NUM_ASCII_CHARS]; - Lisp_Object default_; /* #### not yet implemented */ + Lisp_Object default_; Lisp_Object parent; /* #### not yet implemented */ #ifdef MULE @@ -134,37 +134,36 @@ #define CHAR_TABLE_TYPE(ct) ((ct)->type) #define XCHAR_TABLE_TYPE(ct) CHAR_TABLE_TYPE (XCHAR_TABLE (ct)) -#ifdef MULE - Lisp_Object get_non_ascii_char_table_value (Lisp_Char_Table *ct, int leading_byte, - Emchar c); + Ichar c); -INLINE_HEADER Lisp_Object -CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (Lisp_Char_Table *ct, Emchar ch); -INLINE_HEADER Lisp_Object -CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (Lisp_Char_Table *ct, Emchar ch) +DECLARE_INLINE_HEADER ( +Lisp_Object +get_char_table (Ichar ch, Lisp_Object table) +) { - unsigned char lb = CHAR_LEADING_BYTE (ch); - if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE])) - return (ct)->level1[lb - MIN_LEADING_BYTE]; + Lisp_Object retval; + Lisp_Char_Table *ct = XCHAR_TABLE (table); +#ifdef MULE + if (ch < NUM_ASCII_CHARS) + retval = ct->ascii[ch]; else - return get_non_ascii_char_table_value (ct, lb, ch); -} - -#define CHAR_TABLE_VALUE_UNSAFE(ct, ch) \ - ((ch) < NUM_ASCII_CHARS \ - ? (ct)->ascii[ch] \ - : CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (ct, ch)) - + { + unsigned char lb = ichar_leading_byte (ch); + if (!CHAR_TABLE_ENTRYP (ct->level1[lb - MIN_LEADING_BYTE])) + retval = ct->level1[lb - MIN_LEADING_BYTE]; + else + retval = get_non_ascii_char_table_value (ct, lb, ch); + } #else /* not MULE */ - -#define CHAR_TABLE_VALUE_UNSAFE(ct, ch) ((ct)->ascii[(unsigned char) (ch)]) - + retval = ct->ascii[(unsigned char) ch]; #endif /* not MULE */ - -#define XCHAR_TABLE_VALUE_UNSAFE(ct, ch) \ - CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (ct), ch) + if (!UNBOUNDP (retval)) + return retval; + else + return ct->default_; +} enum chartab_range_type { @@ -179,21 +178,26 @@ struct chartab_range { enum chartab_range_type type; - Emchar ch; + Ichar ch; Lisp_Object charset; int row; }; -void fill_char_table (Lisp_Char_Table *ct, Lisp_Object value); -void put_char_table (Lisp_Char_Table *ct, struct chartab_range *range, +void set_char_table_default (Lisp_Object table, Lisp_Object value); +void put_char_table (Lisp_Object table, struct chartab_range *range, Lisp_Object val); -Lisp_Object get_char_table (Emchar, Lisp_Char_Table *); -int map_char_table (Lisp_Char_Table *ct, +int map_char_table (Lisp_Object table, struct chartab_range *range, int (*fn) (struct chartab_range *range, + Lisp_Object table, Lisp_Object val, void *arg), void *arg); void prune_syntax_tables (void); +Lisp_Object get_range_char_table (struct chartab_range *range, + Lisp_Object table, Lisp_Object multi); +void copy_char_table_range (Lisp_Object from, Lisp_Object to, + struct chartab_range *range); +int word_boundary_p (Ichar c1, Ichar c2); EXFUN (Fcopy_char_table, 1); EXFUN (Fmake_char_table, 1); @@ -205,8 +209,8 @@ #ifdef MULE -int check_category_char(Emchar ch, Lisp_Object ctbl, - int designator, int not_p); +int check_category_char (Ichar ch, Lisp_Object ctbl, int designator, + int not_p); extern Lisp_Object Vstandard_category_table; diff --text -u 'xemacs-21.5.6/src/cm.c' 'xemacs-21.5.7/src/cm.c' Index: ././src/cm.c --- ././src/cm.c Sun Mar 31 17:27:48 2002 +++ ././src/cm.c Fri Jun 21 06:18:21 2002 @@ -31,7 +31,7 @@ #include "lstream.h" #include "redisplay.h" -#include "console-tty.h" +#include "console-tty-impl.h" #define EXPENSIVE 2000 diff --text -u 'xemacs-21.5.6/src/cmdloop.c' 'xemacs-21.5.7/src/cmdloop.c' Index: ././src/cmdloop.c --- ././src/cmdloop.c Sun Mar 31 17:27:48 2002 +++ ././src/cmdloop.c Fri Jun 21 06:18:22 2002 @@ -1,6 +1,6 @@ /* Editor command loop. Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 2001 Ben Wing. + Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -32,12 +32,17 @@ #include "lisp.h" #include "buffer.h" +#include "console-impl.h" #include "device.h" #include "commands.h" #include "frame.h" #include "events.h" #include "window.h" +#ifdef HAVE_MS_WINDOWS +#include "console-msw.h" +#endif + /* Current depth in recursive edits. */ Fixnum command_loop_level; @@ -285,7 +290,7 @@ Otherwise, this function will return normally when all command- line arguments have been processed, the user's initialization file has been read in, and the first frame has been created. */ - internal_catch (Qtop_level, top_level_1, Qnil, 0); + internal_catch (Qtop_level, top_level_1, Qnil, 0, 0); /* If an error occurred during startup and the initial console wasn't created, then die now (the error was already printed out @@ -305,7 +310,7 @@ MARK_MODELINE_CHANGED; /* Now invoke the command loop. It never returns; however, a throw to 'top-level will place us at the end of this loop. */ - internal_catch (Qtop_level, command_loop_2, Qnil, 0); + internal_catch (Qtop_level, command_loop_2, Qnil, 0, 0); /* #### wrong with selected-console? */ /* We don't actually call clear_echo_area() here, partially at least because that runs Lisp code and it may be unsafe @@ -359,16 +364,15 @@ MARK_MODELINE_CHANGED; record_unwind_protect (recursive_edit_unwind, - ((current_buffer - != XBUFFER (XWINDOW (Fselected_window - (Qnil))->buffer)) + current_buffer + != XWINDOW_XBUFFER (Fselected_window (Qnil)) ? Fcurrent_buffer () - : Qnil)); + : Qnil); specbind (Qstandard_output, Qt); specbind (Qstandard_input, Qt); - val = internal_catch (Qexit, command_loop_2, Qnil, 0); + val = internal_catch (Qexit, command_loop_2, Qnil, 0, 0); if (EQ (val, Qt)) /* Turn abort-recursive-edit into a quit. */ @@ -436,7 +440,7 @@ Fcommand_loop_1 (); else internal_catch (Qtop_level, - cold_load_command_loop, Qnil, 0); + cold_load_command_loop, Qnil, 0, 0); goto loop; return Qnil; } @@ -546,9 +550,9 @@ Lisp_Object selected_window = Fselected_window (Qnil); if (!NILP (selected_window) && - (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)) + XWINDOW_XBUFFER (selected_window) != current_buffer) { - set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); + set_buffer_internal (XWINDOW_XBUFFER (selected_window)); } } @@ -570,18 +574,11 @@ int count = begin_dont_check_for_quit (); Fsit_for (make_int (2), Qnil); clear_echo_area (selected_frame (), Qnil, 0); + Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ unbind_to (count); } Fnext_event (event, Qnil); - /* If ^G was typed while emacs was reading input from the user, then - Fnext_event() will have read it as a normal event and - next_event_internal() will have set Vquit_flag. We reset this - so that the ^G is treated as just another key. This is strange, - but it is what emacs 18 did. - - Do not call check_quit() here. */ - Vquit_flag = Qnil; Fdispatch_event (event); if (!was_locked) diff --text -u 'xemacs-21.5.6/src/cmds.c' 'xemacs-21.5.7/src/cmds.c' Index: ././src/cmds.c --- ././src/cmds.c Fri Mar 29 13:47:02 2002 +++ ././src/cmds.c Fri Jun 21 06:18:22 2002 @@ -1,5 +1,6 @@ /* Simple built-in editing commands. Copyright (C) 1985, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -24,6 +25,7 @@ #include "lisp.h" #include "commands.h" #include "buffer.h" +#include "extents.h" #include "syntax.h" #include "insdel.h" @@ -317,7 +319,7 @@ return Fdelete_char (make_int (- n), killp); } -static void internal_self_insert (Emchar ch, int noautofill); +static void internal_self_insert (Ichar ch, int noautofill); DEFUN ("self-insert-command", Fself_insert_command, 1, 1, "*p", /* Insert the character you type. @@ -327,7 +329,7 @@ (count)) { /* This function can GC */ - Emchar ch; + Ichar ch; Lisp_Object c; EMACS_INT n; @@ -363,19 +365,19 @@ A value of 2 means this did things that call for an undo boundary. */ static void -internal_self_insert (Emchar c1, int noautofill) +internal_self_insert (Ichar c1, int noautofill) { /* This function can GC */ /* int hairy = 0; -- unused */ REGISTER enum syntaxcode synt; - REGISTER Emchar c2; + REGISTER Ichar c2; Lisp_Object overwrite; - Lisp_Char_Table *syntax_table; + Lisp_Object syntax_table; struct buffer *buf = current_buffer; int tab_width; overwrite = buf->overwrite_mode; - syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); + syntax_table = buf->mirror_syntax_table; #if 0 /* No, this is very bad, it makes undo *always* undo a character at a time @@ -440,7 +442,7 @@ } } if ((CHAR_TABLEP (Vauto_fill_chars) - ? !NILP (XCHAR_TABLE_VALUE_UNSAFE (Vauto_fill_chars, c1)) + ? !NILP (get_char_table (c1, Vauto_fill_chars)) : (c1 == ' ' || c1 == '\n')) && !noautofill && !NILP (buf->auto_fill_function)) diff --text -u 'xemacs-21.5.6/src/config.h.in' 'xemacs-21.5.7/src/config.h.in' Index: ././src/config.h.in --- ././src/config.h.in Sun Mar 31 17:27:49 2002 +++ ././src/config.h.in Fri Jun 21 06:18:22 2002 @@ -41,7 +41,7 @@ config.h.in with #undef, it is easy to make this file serve as config.h under Windows NT. Options that are set by the user are specified in the file config.inc.samp, which is included by xemacs.mak -(the makefile) and used to set command-line options to the +\(the makefile) and used to set command-line options to the compiler. The sorts of options that relate to the system and not to the user and which are normally auto-determined by configure are set in windowsnt.h. @@ -255,7 +255,34 @@ #undef HAVE_SYS_WAIT_H #undef HAVE_LIBINTL_H #undef HAVE_X11_XLOCALE_H + +/* About __STDC__: Different compilers differ wrt __STDC__. Sunpro C + defines it, but its value is 0 unless we disable non-ANSI extensions. + VC++ doesn't define it at all unless we disable non-ANSI extensions. + But these compilers are all ANSI-compliant. So don't go testing + __STDC__ anywhere except in code that runs only on known + compilers. --ben + + Jamie wrote the following: + + [[ The ANSI standard says that defining __STDC__ to a non-zero value + means that the compiler conforms to that standard. The standard + requires certain header files and library functions to be present. + Therefore, if your compiler defines __STDC__ to non-0 but does not have + ANSI headers and the ANSI library routines, then your compiler is + buggy. Conversely, an ANSI-conforming environment (which has both the + ANSI headers and library routines, i.e., stdlib.h and `memmove') does + not necessarily define the STDC_HEADERS flag. Lucid Emacs requires an + ANSI compiler. Therefore, there is no need to consult the abominable + STDC_HEADERS flag. -- jwz ]] + + In reality, we should not be testing STDC_HEADERS at all except + possibly in code we're purposely keeping in close sync with FSF code. + STDC_HEADERS should be defined on *ALL* compilers. +*/ + #undef STDC_HEADERS + #undef TIME_WITH_SYS_TIME #undef WORDS_BIGENDIAN @@ -586,6 +613,14 @@ */ #undef QUICK_BUILD +/* If true, run the compiler with many files at once rather than one at a + time. May speed up compilation time with some compilers, particularly + if the entire compilation happens in a single process -- the process can + cache the results of processing include files. This definitely helps + with VC++ (although it doesn't use Makefile.in.in) but not with GCC, + which runs many processes per file to compile. */ +#undef BATCH_COMPILER_RUNS + /* If defined, use unions instead of ints. A few systems (DEC Alpha) seem to require this, probably because something with the int definitions isn't right with 64-bit systems. */ @@ -624,6 +659,8 @@ #define XLIB_ILLEGAL_ACCESS 1 #endif +#define XEMACS_WANTS_C_ALLOCA + /* alloca twiddling. Because we might be #including alloca.h here, feature test macros such as _XOPEN_SOURCE must be defined above. */ @@ -649,8 +686,12 @@ /* AIX requires this before any "real" code in the translation unit. */ #pragma alloca #elif ! defined (alloca) +#ifdef C_ALLOCA +#define alloca xemacs_c_alloca +#else void *alloca (); -#endif +#endif /* C_ALLOCA */ +#endif /* !defined (alloca) */ #endif /* C code */ /* The configuration script may define `opsysfile' to be the name of @@ -694,21 +735,25 @@ #define SYSTEM_MALLOC #endif -/* Use the relocating allocator for buffer space? */ -#undef REL_ALLOC - /* Define the return type of signal handlers if the s/xxx.h file did not already do so. */ #define RETSIGTYPE void +#ifndef XCDECL +#define XCDECL +#endif + /* SIGTYPE is the macro we actually use. */ #ifndef SIGTYPE -#define SIGTYPE RETSIGTYPE +#define SIGTYPE RETSIGTYPE XCDECL #define SIGRETURN return #endif #ifndef WIN32_NO_CONFIGURE /* Defined in xemacs.mak or s/windowsnt.h: */ +/* Use the relocating allocator for buffer space? */ +#undef REL_ALLOC + /* Define DYNODUMP if it is necessary to properly dump on this system. Currently this is only Solaris 2.x, for x < 6. */ #undef DYNODUMP @@ -940,6 +985,11 @@ #undef PDUMP #endif /* WIN32_NO_CONFIGURE */ + +/* For the moment, we go ahead and keep this, since it's used in mouse.el. + #### font-lock does its own version using parse-partial-sexp. We should + merge the two. */ +#define USE_C_FONT_LOCK #if defined (WIN32_NATIVE) || defined (CYGWIN) # define HAVE_WIN32_CODING_SYSTEMS diff --text -u /dev/null 'xemacs-21.5.7/src/console-gtk-impl.h' Index: ././src/console-gtk-impl.h --- ././src/console-gtk-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/console-gtk-impl.h Fri Jun 21 06:18:22 2002 @@ -0,0 +1,199 @@ +/* Define X specific console, device, and frame object for XEmacs. + Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. + Copyright (C) 2002 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + + +/* Authorship: + + Ultimately based on FSF, then later on JWZ work for Lemacs. + Rewritten over time by Ben Wing and Chuck Thompson (original + multi-device work by Chuck Thompson). + */ + +#ifndef INCLUDED_console_gtk_impl_h_ +#define INCLUDED_console_gtk_impl_h_ + +#ifdef HAVE_GTK + +#include "console-impl.h" +#include "console-gtk.h" + +#define GDK_DRAWABLE(x) (GdkDrawable *) (x) +#define GET_GTK_WIDGET_WINDOW(x) (GTK_WIDGET (x)->window) +#define GET_GTK_WIDGET_PARENT(x) (GTK_WIDGET (x)->parent) + +DECLARE_CONSOLE_TYPE (gtk); + +struct gtk_device +{ + /* Gtk application info. */ + GtkWidget *gtk_app_shell; + + /* Cache of GC's for frame's on this device. */ + struct gc_cache *gc_cache; + + /* Selected visual, depth and colormap for this device */ + GdkVisual *visual; + int depth; + GdkColormap *device_cmap; + + /* Used by x_bevel_modeline in redisplay-x.c */ + GdkBitmap *gray_pixmap; + + /* frame that holds the WM_COMMAND property; there should be exactly + one of these per device. */ + Lisp_Object WM_COMMAND_frame; + + /* The following items are all used exclusively in event-gtk.c. */ + int MetaMask, HyperMask, SuperMask, AltMask, ModeMask; + guint lock_interpretation; + + void *x_modifier_keymap; /* Really an (XModifierKeymap *)*/ + + guint *x_keysym_map; + int x_keysym_map_min_code; + int x_keysym_map_max_code; + int x_keysym_map_keysyms_per_code; + Lisp_Object x_keysym_map_hashtable; + + /* #### It's not clear that there is much distinction anymore + between mouse_timestamp and global_mouse_timestamp, now that + Emacs doesn't see most (all?) events not destined for it. */ + + /* The timestamp of the last button or key event used by emacs itself. + This is used for asserting selections and input focus. */ + guint32 mouse_timestamp; + + /* This is the timestamp the last button or key event whether it was + dispatched to emacs or widgets. */ + guint32 global_mouse_timestamp; + + /* This is the last known timestamp received from the server. It is + maintained by x_event_to_emacs_event and used to patch bogus + WM_TAKE_FOCUS messages sent by Mwm. */ + guint32 last_server_timestamp; + + GdkAtom atom_WM_PROTOCOLS; + GdkAtom atom_WM_TAKE_FOCUS; + GdkAtom atom_WM_STATE; + +#if 0 + /* #### BILL!!! */ + /* stuff for sticky modifiers: */ + unsigned int need_to_add_mask, down_mask; + KeyCode last_downkey; + guint32 release_time; +#endif +}; + +#define DEVICE_GTK_DATA(d) DEVICE_TYPE_DATA (d, gtk) + +#define DEVICE_GTK_VISUAL(d) (DEVICE_GTK_DATA (d)->visual) +#define DEVICE_GTK_DEPTH(d) (DEVICE_GTK_DATA (d)->depth) +#define DEVICE_GTK_COLORMAP(d) (DEVICE_GTK_DATA (d)->device_cmap) +#define DEVICE_GTK_APP_SHELL(d) (DEVICE_GTK_DATA (d)->gtk_app_shell) +#define DEVICE_GTK_GC_CACHE(d) (DEVICE_GTK_DATA (d)->gc_cache) +#define DEVICE_GTK_GRAY_PIXMAP(d) (DEVICE_GTK_DATA (d)->gray_pixmap) +#define DEVICE_GTK_WM_COMMAND_FRAME(d) (DEVICE_GTK_DATA (d)->WM_COMMAND_frame) +#define DEVICE_GTK_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->mouse_timestamp) +#define DEVICE_GTK_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->global_mouse_timestamp) +#define DEVICE_GTK_LAST_SERVER_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->last_server_timestamp) + +/* The maximum number of widgets that can be displayed above the text + area at one time. Currently no more than 3 will ever actually be + displayed (menubar, psheet, debugger panel). */ +#define MAX_CONCURRENT_TOP_WIDGETS 8 + +struct gtk_frame +{ + /* The widget of this frame. */ + GtkWidget *widget; /* This is really a GtkWindow */ + + /* The layout manager */ + GtkWidget *container; /* actually a GtkVBox. */ + + /* The widget of the menubar */ + GtkWidget *menubar_widget; + + /* The widget of the edit portion of this frame; this is a GtkDrawingArea, + and the window of this widget is what the redisplay code draws on. */ + GtkWidget *edit_widget; + + /* Lists the widgets above the text area, in the proper order. */ + GtkWidget *top_widgets[MAX_CONCURRENT_TOP_WIDGETS]; + int num_top_widgets; + + /* Our container widget as a Lisp_Object */ + Lisp_Object lisp_visible_widgets[10]; + + /*************************** Miscellaneous **************************/ + + /* The icon pixmaps; these are Lisp_Image_Instance objects, or Qnil. */ + Lisp_Object icon_pixmap; + Lisp_Object icon_pixmap_mask; + + /* geometry string that ought to be freed. */ + char *geom_free_me_please; + + /* 1 if the frame is completely visible on the display, 0 otherwise. + if 0 the frame may have been iconified or may be totally + or partially hidden by another X window */ + unsigned int totally_visible_p :1; + + /* Is it visible at all? */ + unsigned int visible_p :1; + + /* Are we a top-level frame? This means that our shell is a + TopLevelShell, and we should do certain things to interact with + the window manager. */ + unsigned int top_level_frame_p :1; + + /* Are we iconfied right now? */ + unsigned int iconified_p :1; + +}; + +#define FRAME_GTK_DATA(f) FRAME_TYPE_DATA (f, gtk) + +#define FRAME_GTK_SHELL_WIDGET(f) (FRAME_GTK_DATA (f)->widget) +#define FRAME_GTK_CONTAINER_WIDGET(f) (FRAME_GTK_DATA (f)->container) +#define FRAME_GTK_MENUBAR_WIDGET(f) (FRAME_GTK_DATA (f)->menubar_widget) +#define FRAME_GTK_TEXT_WIDGET(f) (FRAME_GTK_DATA (f)->edit_widget) +#define FRAME_GTK_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->top_widgets) +#define FRAME_GTK_NUM_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->num_top_widgets) +#define FRAME_GTK_ICONIFIED_P(f) (FRAME_GTK_DATA (f)->iconfigied_p) + +#define FRAME_GTK_LISP_WIDGETS(f) (FRAME_GTK_DATA (f)->lisp_visible_widgets) +#define FRAME_GTK_ICON_PIXMAP(f) (FRAME_GTK_DATA (f)->icon_pixmap) +#define FRAME_GTK_ICON_PIXMAP_MASK(f) (FRAME_GTK_DATA (f)->icon_pixmap_mask) + +#define FRAME_GTK_GEOM_FREE_ME_PLEASE(f) (FRAME_GTK_DATA (f)->geom_free_me_please) + +#define FRAME_GTK_TOTALLY_VISIBLE_P(f) (FRAME_GTK_DATA (f)->totally_visible_p) +#define FRAME_GTK_VISIBLE_P(f) (FRAME_GTK_DATA (f)->visible_p) +#define FRAME_GTK_TOP_LEVEL_FRAME_P(f) (FRAME_GTK_DATA (f)->top_level_frame_p) + +extern struct console_type *gtk_console_type; + +#endif /* HAVE_GTK */ +#endif /* INCLUDED_console_gtk_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/console-gtk.c' 'xemacs-21.5.7/src/console-gtk.c' Index: ././src/console-gtk.c --- ././src/console-gtk.c Fri May 25 20:26:53 2001 +++ ././src/console-gtk.c Fri Jun 21 06:18:22 2002 @@ -29,9 +29,10 @@ #include #include "lisp.h" -#include "console-gtk.h" #include "process.h" /* canonicalize_host_name */ #include "redisplay.h" /* for display_arg */ + +#include "console-gtk-impl.h" DEFINE_CONSOLE_TYPE (gtk); diff --text -u 'xemacs-21.5.6/src/console-gtk.h' 'xemacs-21.5.7/src/console-gtk.h' Index: ././src/console-gtk.h --- ././src/console-gtk.h Sat Mar 16 19:39:15 2002 +++ ././src/console-gtk.h Fri Jun 21 06:18:23 2002 @@ -1,6 +1,7 @@ /* Define X specific console, device, and frame object for XEmacs. Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -37,169 +38,11 @@ #include "console.h" #include -#define GDK_DRAWABLE(x) (GdkDrawable *) (x) -#define GET_GTK_WIDGET_WINDOW(x) (GTK_WIDGET (x)->window) -#define GET_GTK_WIDGET_PARENT(x) (GTK_WIDGET (x)->parent) - -DECLARE_CONSOLE_TYPE (gtk); - -struct gtk_device -{ - /* Gtk application info. */ - GtkWidget *gtk_app_shell; - - /* Cache of GC's for frame's on this device. */ - struct gc_cache *gc_cache; - - /* Selected visual, depth and colormap for this device */ - GdkVisual *visual; - int depth; - GdkColormap *device_cmap; - - /* Used by x_bevel_modeline in redisplay-x.c */ - GdkBitmap *gray_pixmap; - - /* frame that holds the WM_COMMAND property; there should be exactly - one of these per device. */ - Lisp_Object WM_COMMAND_frame; - - /* The following items are all used exclusively in event-gtk.c. */ - int MetaMask, HyperMask, SuperMask, AltMask, ModeMask; - guint lock_interpretation; - - void *x_modifier_keymap; /* Really an (XModifierKeymap *)*/ - - guint *x_keysym_map; - int x_keysym_map_min_code; - int x_keysym_map_max_code; - int x_keysym_map_keysyms_per_code; - Lisp_Object x_keysym_map_hashtable; - - /* #### It's not clear that there is much distinction anymore - between mouse_timestamp and global_mouse_timestamp, now that - Emacs doesn't see most (all?) events not destined for it. */ - - /* The timestamp of the last button or key event used by emacs itself. - This is used for asserting selections and input focus. */ - guint32 mouse_timestamp; - - /* This is the timestamp the last button or key event whether it was - dispatched to emacs or widgets. */ - guint32 global_mouse_timestamp; - - /* This is the last known timestamp received from the server. It is - maintained by x_event_to_emacs_event and used to patch bogus - WM_TAKE_FOCUS messages sent by Mwm. */ - guint32 last_server_timestamp; - - GdkAtom atom_WM_PROTOCOLS; - GdkAtom atom_WM_TAKE_FOCUS; - GdkAtom atom_WM_STATE; - -#if 0 - /* #### BILL!!! */ - /* stuff for sticky modifiers: */ - unsigned int need_to_add_mask, down_mask; - KeyCode last_downkey; - guint32 release_time; -#endif -}; - -#define DEVICE_GTK_DATA(d) DEVICE_TYPE_DATA (d, gtk) - -#define DEVICE_GTK_VISUAL(d) (DEVICE_GTK_DATA (d)->visual) -#define DEVICE_GTK_DEPTH(d) (DEVICE_GTK_DATA (d)->depth) -#define DEVICE_GTK_COLORMAP(d) (DEVICE_GTK_DATA (d)->device_cmap) -#define DEVICE_GTK_APP_SHELL(d) (DEVICE_GTK_DATA (d)->gtk_app_shell) -#define DEVICE_GTK_GC_CACHE(d) (DEVICE_GTK_DATA (d)->gc_cache) -#define DEVICE_GTK_GRAY_PIXMAP(d) (DEVICE_GTK_DATA (d)->gray_pixmap) -#define DEVICE_GTK_WM_COMMAND_FRAME(d) (DEVICE_GTK_DATA (d)->WM_COMMAND_frame) -#define DEVICE_GTK_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->mouse_timestamp) -#define DEVICE_GTK_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->global_mouse_timestamp) -#define DEVICE_GTK_LAST_SERVER_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->last_server_timestamp) - -/* The maximum number of widgets that can be displayed above the text - area at one time. Currently no more than 3 will ever actually be - displayed (menubar, psheet, debugger panel). */ -#define MAX_CONCURRENT_TOP_WIDGETS 8 - -struct gtk_frame -{ - /* The widget of this frame. */ - GtkWidget *widget; /* This is really a GtkWindow */ - - /* The layout manager */ - GtkWidget *container; /* actually a GtkVBox. */ - - /* The widget of the menubar */ - GtkWidget *menubar_widget; - - /* The widget of the edit portion of this frame; this is a GtkDrawingArea, - and the window of this widget is what the redisplay code draws on. */ - GtkWidget *edit_widget; - - /* Lists the widgets above the text area, in the proper order. */ - GtkWidget *top_widgets[MAX_CONCURRENT_TOP_WIDGETS]; - int num_top_widgets; - - /* Our container widget as a Lisp_Object */ - Lisp_Object lisp_visible_widgets[10]; - - /*************************** Miscellaneous **************************/ - - /* The icon pixmaps; these are Lisp_Image_Instance objects, or Qnil. */ - Lisp_Object icon_pixmap; - Lisp_Object icon_pixmap_mask; - - /* geometry string that ought to be freed. */ - char *geom_free_me_please; - - /* 1 if the frame is completely visible on the display, 0 otherwise. - if 0 the frame may have been iconified or may be totally - or partially hidden by another X window */ - unsigned int totally_visible_p :1; - - /* Is it visible at all? */ - unsigned int visible_p :1; - - /* Are we a top-level frame? This means that our shell is a - TopLevelShell, and we should do certain things to interact with - the window manager. */ - unsigned int top_level_frame_p :1; - - /* Are we iconfied right now? */ - unsigned int iconified_p :1; - -}; - -#define FRAME_GTK_DATA(f) FRAME_TYPE_DATA (f, gtk) - -#define FRAME_GTK_SHELL_WIDGET(f) (FRAME_GTK_DATA (f)->widget) -#define FRAME_GTK_CONTAINER_WIDGET(f) (FRAME_GTK_DATA (f)->container) -#define FRAME_GTK_MENUBAR_WIDGET(f) (FRAME_GTK_DATA (f)->menubar_widget) -#define FRAME_GTK_TEXT_WIDGET(f) (FRAME_GTK_DATA (f)->edit_widget) -#define FRAME_GTK_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->top_widgets) -#define FRAME_GTK_NUM_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->num_top_widgets) -#define FRAME_GTK_ICONIFIED_P(f) (FRAME_GTK_DATA (f)->iconfigied_p) - -#define FRAME_GTK_LISP_WIDGETS(f) (FRAME_GTK_DATA (f)->lisp_visible_widgets) -#define FRAME_GTK_ICON_PIXMAP(f) (FRAME_GTK_DATA (f)->icon_pixmap) -#define FRAME_GTK_ICON_PIXMAP_MASK(f) (FRAME_GTK_DATA (f)->icon_pixmap_mask) - -#define FRAME_GTK_GEOM_FREE_ME_PLEASE(f) (FRAME_GTK_DATA (f)->geom_free_me_please) - -#define FRAME_GTK_TOTALLY_VISIBLE_P(f) (FRAME_GTK_DATA (f)->totally_visible_p) -#define FRAME_GTK_VISIBLE_P(f) (FRAME_GTK_DATA (f)->visible_p) -#define FRAME_GTK_TOP_LEVEL_FRAME_P(f) (FRAME_GTK_DATA (f)->top_level_frame_p) - /* Variables associated with the X display frame this emacs is using. */ extern Lisp_Object Vx_gc_pointer_shape; extern Lisp_Object Vx_scrollbar_pointer_shape; -extern struct console_type *gtk_console_type; -extern Lisp_Object Vdefault_gtk_device; - /* Number of pixels below each line. */ extern int gtk_interline_space; @@ -218,7 +61,7 @@ void gtk_redraw_exposed_area (struct frame *f, int x, int y, int width, int height); void gtk_output_string (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, int xoffset, + Ichar_dynarr *buf, int xpos, int xoffset, int start_pixpos, int width, face_index findex, int cursor, int cursor_start, int cursor_width, int cursor_height); diff --text -u /dev/null 'xemacs-21.5.7/src/console-impl.h' Index: ././src/console-impl.h --- ././src/console-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/console-impl.h Fri Jun 21 06:18:23 2002 @@ -0,0 +1,564 @@ +/* Define console object for XEmacs. + Copyright (C) 1996, 2002 Ben Wing + +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 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. */ + +/* Synched up with: Not in FSF. */ + +/* Written by Ben Wing. */ + +#ifndef INCLUDED_console_impl_h_ +#define INCLUDED_console_impl_h_ + +#include "console.h" + +extern const struct struct_description cted_description; +extern const struct struct_description console_methods_description; + + +/* + * Constants returned by device_implementation_flags_method + */ + +/* Set when device uses pixel-based geometry */ +#define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L + +/* Indicates that the device is a printer */ +#define XDEVIMPF_IS_A_PRINTER 0x00000002L + +/* Do not automatically redisplay this device */ +#define XDEVIMPF_NO_AUTO_REDISPLAY 0x00000004L + +/* Do not delete the device when last frame's gone */ +#define XDEVIMPF_FRAMELESS_OK 0x00000008L + +/* Do not preempt resiaply of frame or device once it starts */ +#define XDEVIMPF_DONT_PREEMPT_REDISPLAY 0x00000010L + +struct console_methods +{ + const char *name; /* Used by print_console, print_device, print_frame */ + Lisp_Object symbol; + Lisp_Object predicate_symbol; + unsigned int flags; /* Read-only implementation flags, set once upon + console type creation. INITIALIZE_CONSOLE_TYPE sets + this member to 0. */ + + /* console methods */ + void (*init_console_method) (struct console *, Lisp_Object props); + void (*mark_console_method) (struct console *); + int (*initially_selected_for_input_method) (struct console *); + void (*delete_console_method) (struct console *); + Lisp_Object (*semi_canonicalize_console_connection_method) + (Lisp_Object connection, Error_Behavior errb); + Lisp_Object (*semi_canonicalize_device_connection_method) + (Lisp_Object connection, Error_Behavior errb); + Lisp_Object (*canonicalize_console_connection_method) + (Lisp_Object connection, Error_Behavior errb); + Lisp_Object (*canonicalize_device_connection_method) + (Lisp_Object connection, Error_Behavior errb); + Lisp_Object (*device_to_console_connection_method) + (Lisp_Object connection, Error_Behavior errb); + + /* device methods */ + void (*init_device_method) (struct device *, Lisp_Object props); + void (*finish_init_device_method) (struct device *, Lisp_Object props); + void (*delete_device_method) (struct device *); + void (*mark_device_method) (struct device *); + void (*asynch_device_change_method) (void); + Lisp_Object (*device_system_metrics_method) (struct device *, + enum device_metrics); + Lisp_Object (*own_selection_method)(Lisp_Object selection_name, + Lisp_Object selection_value, + Lisp_Object how_to_add, + Lisp_Object selection_type, + int owned_p); + void (*disown_selection_method)(Lisp_Object selection_name, + Lisp_Object timeval); + Lisp_Object (*get_foreign_selection_method) (Lisp_Object selection_symbol, + Lisp_Object target_type); + Lisp_Object (*selection_exists_p_method)(Lisp_Object selection_name, + Lisp_Object selection_type); + Lisp_Object (*available_selection_types_method)(Lisp_Object selection_name); + Lisp_Object (*register_selection_data_type_method)(Lisp_Object type_name); + Lisp_Object (*selection_data_type_name_method)(Lisp_Object type); + + /* frame methods */ + Lisp_Object *device_specific_frame_props; + void (*init_frame_1_method) (struct frame *, Lisp_Object properties, + int frame_name_is_defaulted); + void (*init_frame_2_method) (struct frame *, Lisp_Object properties); + void (*init_frame_3_method) (struct frame *); + void (*after_init_frame_method) (struct frame *, int first_on_device, + int first_on_console); + void (*mark_frame_method) (struct frame *); + void (*delete_frame_method) (struct frame *); + void (*focus_on_frame_method) (struct frame *); + void (*raise_frame_method) (struct frame *); + void (*lower_frame_method) (struct frame *); + void (*enable_frame_method) (struct frame *); + void (*disable_frame_method) (struct frame *); + int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame, + int *x, int *y); + void (*set_mouse_position_method) (struct window *w, int x, int y); + void (*make_frame_visible_method) (struct frame *f); + void (*make_frame_invisible_method) (struct frame *f); + void (*iconify_frame_method) (struct frame *f); + Lisp_Object (*frame_property_method) (struct frame *f, Lisp_Object prop); + int (*internal_frame_property_p_method) (struct frame *f, + Lisp_Object prop); + Lisp_Object (*frame_properties_method) (struct frame *f); + void (*set_frame_properties_method) (struct frame *f, Lisp_Object plist); + void (*set_frame_size_method) (struct frame *f, int width, int height); + void (*set_frame_position_method) (struct frame *f, int xoff, int yoff); + int (*frame_visible_p_method) (struct frame *f); + int (*frame_totally_visible_p_method) (struct frame *f); + int (*frame_iconified_p_method) (struct frame *f); + void (*set_title_from_ibyte_method) (struct frame *f, Ibyte *title); + void (*set_icon_name_from_ibyte_method) (struct frame *f, Ibyte *title); + void (*set_frame_pointer_method) (struct frame *f); + void (*set_frame_icon_method) (struct frame *f); + void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event); + Lisp_Object (*get_frame_parent_method) (struct frame *f); + void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name); + int (*frame_size_fixed_p_method) (struct frame *f); + void (*eject_page_method) (struct frame *f); + + /* redisplay methods */ + int (*left_margin_width_method) (struct window *); + int (*right_margin_width_method) (struct window *); + int (*text_width_method) (struct frame *f, struct face_cachel *cachel, + const Ichar *str, Charcount len); + void (*output_display_block_method) (struct window *, struct display_line *, + int, int, int, int, int, int, int); + int (*divider_height_method) (void); + int (*eol_cursor_width_method) (void); + void (*output_vertical_divider_method) (struct window *, int); + void (*clear_to_window_end_method) (struct window *, int, int); + void (*clear_region_method) (Lisp_Object, struct device*, struct frame*, face_index, + int, int, int, int, + Lisp_Object, Lisp_Object, Lisp_Object); + void (*clear_frame_method) (struct frame *); + void (*window_output_begin_method) (struct window *); + void (*frame_output_begin_method) (struct frame *); + void (*window_output_end_method) (struct window *); + void (*frame_output_end_method) (struct frame *); + int (*flash_method) (struct device *); + void (*ring_bell_method) (struct device *, int volume, int pitch, + int duration); + void (*frame_redraw_cursor_method) (struct frame *f); + void (*set_final_cursor_coords_method) (struct frame *, int, int); + void (*bevel_area_method) (struct window *, face_index, int, int, int, int, int, + int, enum edge_style); + void (*output_pixmap_method) (struct window *w, Lisp_Object image_instance, + struct display_box *db, struct display_glyph_area *dga, + face_index findex, int cursor_start, int cursor_width, + int cursor_height, int offset_bitmap); + void (*output_string_method) (struct window *w, struct display_line *dl, + Ichar_dynarr *buf, int xpos, int xoffset, + int start_pixpos, int width, face_index findex, + int cursor, int cursor_start, int cursor_width, + int cursor_height); + + /* color methods */ + int (*initialize_color_instance_method) (Lisp_Color_Instance *, + Lisp_Object name, + Lisp_Object device, + Error_Behavior errb); + void (*mark_color_instance_method) (Lisp_Color_Instance *); + void (*print_color_instance_method) (Lisp_Color_Instance *, + Lisp_Object printcharfun, + int escapeflag); + void (*finalize_color_instance_method) (Lisp_Color_Instance *); + int (*color_instance_equal_method) (Lisp_Color_Instance *, + Lisp_Color_Instance *, + int depth); + Hashcode (*color_instance_hash_method) (Lisp_Color_Instance *, + int depth); + Lisp_Object (*color_instance_rgb_components_method) (Lisp_Color_Instance *); + int (*valid_color_name_p_method) (struct device *, Lisp_Object color); + + /* font methods */ + int (*initialize_font_instance_method) (Lisp_Font_Instance *, + Lisp_Object name, + Lisp_Object device, + Error_Behavior errb); + void (*mark_font_instance_method) (Lisp_Font_Instance *); + void (*print_font_instance_method) (Lisp_Font_Instance *, + Lisp_Object printcharfun, + int escapeflag); + void (*finalize_font_instance_method) (Lisp_Font_Instance *); + Lisp_Object (*font_instance_truename_method) (Lisp_Font_Instance *, + Error_Behavior errb); + Lisp_Object (*font_instance_properties_method) (Lisp_Font_Instance *); + Lisp_Object (*list_fonts_method) (Lisp_Object pattern, + Lisp_Object device); + Lisp_Object (*find_charset_font_method) (Lisp_Object device, + Lisp_Object font, + Lisp_Object charset, + int stage); + int (*font_spec_matches_charset_method) (struct device *d, + Lisp_Object charset, + const Ibyte *nonreloc, + Lisp_Object reloc, + Bytecount offset, + Bytecount length, + int stage); + + /* image methods */ + void (*mark_image_instance_method) (Lisp_Image_Instance *); + void (*print_image_instance_method) (Lisp_Image_Instance *, + Lisp_Object printcharfun, + int escapeflag); + void (*finalize_image_instance_method) (Lisp_Image_Instance *); + void (*unmap_subwindow_method) (Lisp_Image_Instance *); + void (*map_subwindow_method) (Lisp_Image_Instance *, int x, int y, + struct display_glyph_area* dga); + void (*resize_subwindow_method) (Lisp_Image_Instance *, int w, int h); + void (*redisplay_subwindow_method) (Lisp_Image_Instance *); + void (*redisplay_widget_method) (Lisp_Image_Instance *); + /* Maybe this should be a specifier. Unfortunately specifiers don't + allow us to represent things at the toolkit level, which is what + is required here. */ + int (*widget_border_width_method) (void); + int (*widget_spacing_method) (Lisp_Image_Instance *); + int (*image_instance_equal_method) (Lisp_Image_Instance *, + Lisp_Image_Instance *, + int depth); + Hashcode (*image_instance_hash_method) (Lisp_Image_Instance *, + int depth); + void (*init_image_instance_from_eimage_method) (Lisp_Image_Instance *ii, + int width, int height, + int slices, + unsigned char *eimage, + int dest_mask, + Lisp_Object instantiator, + Lisp_Object domain); + Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method); + int (*colorize_image_instance_method) (Lisp_Object image_instance, + Lisp_Object fg, Lisp_Object bg); + void (*widget_query_string_geometry_method) (Lisp_Object string, + Lisp_Object face, + int* width, int* height, + Lisp_Object domain); + Lisp_Object image_conversion_list; + +#ifdef HAVE_TOOLBARS + /* toolbar methods */ + void (*output_frame_toolbars_method) (struct frame *); + void (*initialize_frame_toolbars_method) (struct frame *); + void (*free_frame_toolbars_method) (struct frame *); + void (*output_toolbar_button_method) (struct frame *, Lisp_Object); + void (*redraw_frame_toolbars_method) (struct frame *); + void (*redraw_exposed_toolbars_method) (struct frame *f, int x, int y, + int width, int height); +#endif + +#ifdef HAVE_SCROLLBARS + /* scrollbar methods */ + int (*inhibit_scrollbar_slider_size_change_method) (void); + void (*free_scrollbar_instance_method) (struct scrollbar_instance *); + void (*release_scrollbar_instance_method) (struct scrollbar_instance *); + void (*create_scrollbar_instance_method) (struct frame *, int, + struct scrollbar_instance *); + void (*update_scrollbar_instance_values_method) (struct window *, + struct scrollbar_instance *, + int, int, int, int, int, + int, int, int, int, int); + void (*update_scrollbar_instance_status_method) (struct window *, int, int, + struct + scrollbar_instance *); + void (*scrollbar_pointer_changed_in_window_method) (struct window *w); +#ifdef MEMORY_USAGE_STATS + int (*compute_scrollbar_instance_usage_method) (struct device *, + struct scrollbar_instance *, + struct overhead_stats *); +#endif +#endif /* HAVE_SCROLLBARS */ + +#ifdef HAVE_MENUBARS + /* menubar methods */ + void (*update_frame_menubars_method) (struct frame *); + void (*free_frame_menubars_method) (struct frame *); +#endif + +#ifdef HAVE_DIALOGS + /* dialog methods */ + Lisp_Object (*make_dialog_box_internal_method) (struct frame *, + Lisp_Object type, + Lisp_Object keys); +#endif +}; + +#define CONMETH_TYPE(meths) ((meths)->symbol) +#define CONMETH_IMPL_FLAG(meths, f) ((meths)->flags & (f)) + +#define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name) +#define CONSOLE_TYPE(c) ((c)->conmeths->symbol) +#define CONSOLE_IMPL_FLAG(c, f) CONMETH_IMPL_FLAG ((c)->conmeths, (f)) + +/******** Accessing / calling a console method *********/ + +#define HAS_CONTYPE_METH_P(meth, m) ((meth)->m##_method) +#define CONTYPE_METH(meth, m, args) (((meth)->m##_method) args) + +/* Call a void-returning console method, if it exists */ +#define MAYBE_CONTYPE_METH(meth, m, args) do { \ + struct console_methods *maybe_contype_meth_meth = (meth); \ + if (HAS_CONTYPE_METH_P (maybe_contype_meth_meth, m)) \ + CONTYPE_METH (maybe_contype_meth_meth, m, args); \ +} while (0) + +/* Call a console method, if it exists; otherwise return + the specified value - meth is multiply evaluated. */ +#define CONTYPE_METH_OR_GIVEN(meth, m, args, given) \ + (HAS_CONTYPE_METH_P (meth, m) ? \ + CONTYPE_METH (meth, m, args) : (given)) + +/* Call an int-returning console method, if it exists; otherwise + return 0 */ +#define MAYBE_INT_CONTYPE_METH(meth, m, args) \ + CONTYPE_METH_OR_GIVEN (meth, m, args, 0) + +/* Call an Lisp-Object-returning console method, if it exists; + otherwise return Qnil */ +#define MAYBE_LISP_CONTYPE_METH(meth, m, args) \ + CONTYPE_METH_OR_GIVEN (meth, m, args, Qnil) + +/******** Same functions, operating on a console instead of a + struct console_methods ********/ + +#define HAS_CONMETH_P(c, m) HAS_CONTYPE_METH_P ((c)->conmeths, m) +#define CONMETH(c, m, args) CONTYPE_METH ((c)->conmeths, m, args) +#define MAYBE_CONMETH(c, m, args) MAYBE_CONTYPE_METH ((c)->conmeths, m, args) +#define CONMETH_OR_GIVEN(c, m, args, given) \ + CONTYPE_METH_OR_GIVEN((c)->conmeths, m, args, given) +#define MAYBE_INT_CONMETH(c, m, args) \ + MAYBE_INT_CONTYPE_METH ((c)->conmeths, m, args) +#define MAYBE_LISP_CONMETH(c, m, args) \ + MAYBE_LISP_CONTYPE_METH ((c)->conmeths, m, args) + +/******** Defining new console types ********/ + +typedef struct console_type_entry console_type_entry; +struct console_type_entry +{ + Lisp_Object symbol; + struct console_methods *meths; +}; + +#define DECLARE_CONSOLE_TYPE(type) \ +extern struct console_methods * type##_console_methods + +#define DEFINE_CONSOLE_TYPE(type) \ +struct console_methods * type##_console_methods + +#define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \ + type##_console_methods = xnew_and_zero (struct console_methods); \ + type##_console_methods->name = obj_name; \ + type##_console_methods->symbol = Q##type; \ + defsymbol_nodump (&type##_console_methods->predicate_symbol, pred_sym); \ + add_entry_to_console_type_list (Q##type, type##_console_methods); \ + type##_console_methods->image_conversion_list = Qnil; \ + staticpro_nodump (&type##_console_methods->image_conversion_list); \ + dump_add_root_struct_ptr (&type##_console_methods, &console_methods_description); \ +} while (0) + +#define REINITIALIZE_CONSOLE_TYPE(type) do { \ + staticpro_nodump (&type##_console_methods->predicate_symbol); \ + staticpro_nodump (&type##_console_methods->image_conversion_list); \ +} while (0) + + +/* Declare that console-type TYPE has method M; used in + initialization routines */ +#define CONSOLE_HAS_METHOD(type, m) \ + (type##_console_methods->m##_method = type##_##m) + +/* Declare that console-type TYPE inherits method M + implementation from console-type FROMTYPE */ +#define CONSOLE_INHERITS_METHOD(type, fromtype, m) \ + (type##_console_methods->m##_method = fromtype##_##m) + +/* Define console type implementation flags */ +#define CONSOLE_IMPLEMENTATION_FLAGS(type, flg) \ + (type##_console_methods->flags = flg) + +struct console +{ + struct lcrecord_header header; + + /* Description of this console's methods. */ + struct console_methods *conmeths; + + /* A structure of auxiliary data specific to the console type. + struct x_console is used for X window frames; defined in console-x.h + struct tty_console is used to TTY's; defined in console-tty.h */ + void *console_data; + + /* Character that causes a quit. Normally C-g. + #### Should be possible for this not to be ASCII. (Currently works + under Windows.) */ + Ichar quit_char; + + /* ----- begin partially-completed console localization of + event loop ---- */ + + int local_var_flags; + +#define MARKED_SLOT(x) Lisp_Object x +#include "conslots.h" + + /* Where to store the next keystroke of the macro. + Index into con->kbd_macro_builder. */ + int kbd_macro_ptr; + + /* The finalized section of the macro starts at kbd_macro_buffer and + ends before this. This is not the same as kbd_macro_pointer, because + we advance this to kbd_macro_pointer when a key's command is complete. + This way, the keystrokes for "end-kbd-macro" are not included in the + macro. */ + int kbd_macro_end; + + /* ----- end partially-completed console localization of event loop ---- */ + + unsigned int input_enabled :1; +}; + +/* Redefine basic properties more efficiently */ + +#undef CONSOLE_LIVE_P +#define CONSOLE_LIVE_P(con) (!EQ (CONSOLE_TYPE (con), Qdead)) +#undef CONSOLE_DEVICE_LIST +#define CONSOLE_DEVICE_LIST(con) ((con)->device_list) + +#define CONSOLE_TYPE_P(con, type) EQ (CONSOLE_TYPE (con), Q##type) + +#ifdef ERROR_CHECK_TYPES +DECLARE_INLINE_HEADER ( +struct console * +error_check_console_type (struct console *con, Lisp_Object sym) +) +{ + assert (EQ (CONSOLE_TYPE (con), sym)); + return con; +} +# define CONSOLE_TYPE_DATA(con, type) \ + (*(struct type##_console **) \ + &(error_check_console_type (con, Q##type))->console_data) +#else +# define CONSOLE_TYPE_DATA(con, type) \ + (*(struct type##_console **) &((con)->console_data)) +#endif + +#define CHECK_CONSOLE_TYPE(x, type) do { \ + CHECK_CONSOLE (x); \ + if (! CONSOLE_TYPE_P (XCONSOLE (x), type)) \ + dead_wrong_type_argument \ + (type##_console_methods->predicate_symbol, x); \ +} while (0) +#define CONCHECK_CONSOLE_TYPE(x, type) do { \ + CONCHECK_CONSOLE (x); \ + if (!(CONSOLEP (x) && \ + CONSOLE_TYPE_P (XCONSOLE (x), type))) \ + x = wrong_type_argument \ + (type##_console_methods->predicate_symbol, x); \ +} while (0) + +/* #### These should be in the console-*.h files but there are + too many places where the abstraction is broken. Need to + fix. */ + +#ifdef HAVE_GTK +#define CONSOLE_TYPESYM_GTK_P(typesym) EQ (typesym, Qgtk) +#else +#define CONSOLE_TYPESYM_GTK_P(typesym) 0 +#endif + +#ifdef HAVE_X_WINDOWS +#define CONSOLE_TYPESYM_X_P(typesym) EQ (typesym, Qx) +#else +#define CONSOLE_TYPESYM_X_P(typesym) 0 +#endif +#ifdef HAVE_TTY +#define CONSOLE_TYPESYM_TTY_P(typesym) EQ (typesym, Qtty) +#else +#define CONSOLE_TYPESYM_TTY_P(typesym) 0 +#endif +#ifdef HAVE_MS_WINDOWS +#define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) EQ (typesym, Qmswindows) +#else +#define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) 0 +#endif +#define CONSOLE_TYPESYM_STREAM_P(typesym) EQ (typesym, Qstream) + +#define CONSOLE_TYPESYM_WIN_P(typesym) \ + (CONSOLE_TYPESYM_GTK_P (typesym) || CONSOLE_TYPESYM_X_P (typesym) || CONSOLE_TYPESYM_MSWINDOWS_P (typesym)) + +#define CONSOLE_X_P(con) CONSOLE_TYPESYM_X_P (CONSOLE_TYPE (con)) +#define CHECK_X_CONSOLE(z) CHECK_CONSOLE_TYPE (z, x) +#define CONCHECK_X_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, x) + +#define CONSOLE_GTK_P(con) CONSOLE_TYPESYM_GTK_P (CONSOLE_TYPE (con)) +#define CHECK_GTK_CONSOLE(z) CHECK_CONSOLE_TYPE (z, gtk) +#define CONCHECK_GTK_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, gtk) + +#define CONSOLE_TTY_P(con) CONSOLE_TYPESYM_TTY_P (CONSOLE_TYPE (con)) +#define CHECK_TTY_CONSOLE(z) CHECK_CONSOLE_TYPE (z, tty) +#define CONCHECK_TTY_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, tty) + +#define CONSOLE_MSWINDOWS_P(con) CONSOLE_TYPESYM_MSWINDOWS_P (CONSOLE_TYPE (con)) +#define CHECK_MSWINDOWS_CONSOLE(z) CHECK_CONSOLE_TYPE (z, mswindows) +#define CONCHECK_MSWINDOWS_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, mswindows) + +#define CONSOLE_STREAM_P(con) CONSOLE_TYPESYM_STREAM_P (CONSOLE_TYPE (con)) +#define CHECK_STREAM_CONSOLE(z) CHECK_CONSOLE_TYPE (z, stream) +#define CONCHECK_STREAM_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, stream) + +#define CONSOLE_WIN_P(con) CONSOLE_TYPESYM_WIN_P (CONSOLE_TYPE (con)) + +/* This structure marks which slots in a console have corresponding + default values in console_defaults. + Each such slot has a nonzero value in this structure. + The value has only one nonzero bit. + + When a console has its own local value for a slot, + the bit for that slot (found in the same slot in this structure) + is turned on in the console's local_var_flags slot. + + If a slot in this structure is zero, then even though there may + be a DEFVAR_CONSOLE_LOCAL for the slot, there is no default value for it; + and the corresponding slot in console_defaults is not used. */ + +extern struct console console_local_flags; + +#define CONSOLE_NAME(con) ((con)->name) +#define CONSOLE_CONNECTION(con) ((con)->connection) +#define CONSOLE_CANON_CONNECTION(con) ((con)->canon_connection) +#define CONSOLE_FUNCTION_KEY_MAP(con) ((con)->function_key_map) +#define CONSOLE_SELECTED_DEVICE(con) ((con)->selected_device) +#define CONSOLE_SELECTED_FRAME(con) \ + DEVICE_SELECTED_FRAME (XDEVICE ((con)->selected_device)) +#define CONSOLE_LAST_NONMINIBUF_FRAME(con) NON_LVALUE ((con)->last_nonminibuf_frame) +#define CONSOLE_QUIT_CHAR(con) ((con)->quit_char) + +DECLARE_CONSOLE_TYPE (dead); + +extern console_type_entry_dynarr *the_console_type_entry_dynarr; + +#endif /* INCLUDED_console_impl_h_ */ diff --text -u /dev/null 'xemacs-21.5.7/src/console-msw-impl.h' Index: ././src/console-msw-impl.h --- ././src/console-msw-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/console-msw-impl.h Fri Jun 21 06:18:23 2002 @@ -0,0 +1,287 @@ +/* Define mswindows-specific console, device, and frame object for XEmacs. + Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. + Copyright (C) 2001, 2002 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +/* This file essentially Mule-ized (except perhaps some Unicode splitting). + 5-2000. */ + +/* Authorship: + + Ultimately based on FSF, then later on JWZ work for Lemacs. + Rewritten over time by Ben Wing and Chuck Thompson. + Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. + */ + +#ifndef INCLUDED_console_msw_impl_h_ +#define INCLUDED_console_msw_impl_h_ + +#include "console-impl.h" +#include "console-msw.h" + +/* + * Consoles + */ + +DECLARE_CONSOLE_TYPE (mswindows); + +struct mswindows_console +{ + int infd, outfd; +}; + +DECLARE_CONSOLE_TYPE (msprinter); + +/* + * Printer settings, aka devmode + */ + +typedef struct Lisp_Devmode +{ + struct lcrecord_header header; + + /* Pointer to the DEVMODE structure */ + DEVMODEW *devmode; + + /* Full printer name. It can be longer than devmode->dmDeviceName + can accommodate, so need to keep it separately */ + Lisp_Object printer_name; + + /* Printer device this object is currently selected in, or Qnil + if not selected */ + Lisp_Object device; + +} Lisp_Devmode; + +#define DEVMODE_SIZE(dm) ((dm)->dmSize + (dm)->dmDriverExtra) +#define XDEVMODE_SIZE(x) ((x)->devmode ? DEVMODE_SIZE((x)->devmode) : 0) + +/* + * Devices + */ + +struct mswindows_device +{ + Lisp_Object fontlist; /* List of (STRING . FIXED-P), device fonts */ + HDC hcdc; /* Compatible DC */ + DWORD update_tick; /* Used when device is modified through + Windows messages, see WM_DISPLAYCHANGE + in event-msw.c */ +}; + +#define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows) +#define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist) +#define DEVICE_MSWINDOWS_HCDC(d) (DEVICE_MSWINDOWS_DATA (d)->hcdc) +#define DEVICE_MSWINDOWS_UPDATE_TICK(d) (DEVICE_MSWINDOWS_DATA (d)->update_tick) + +struct msprinter_device +{ + HDC hdc, hcdc; /* Printer and the comp. DCs */ + HANDLE hprinter; + Lisp_Object name; + Lisp_Object devmode; + Lisp_Object fontlist; +}; + +#define DEVICE_MSPRINTER_DATA(d) DEVICE_TYPE_DATA (d, msprinter) +#define DEVICE_MSPRINTER_HDC(d) (DEVICE_MSPRINTER_DATA (d)->hdc) +#define DEVICE_MSPRINTER_HCDC(d) (DEVICE_MSPRINTER_DATA (d)->hcdc) +#define DEVICE_MSPRINTER_HPRINTER(d) (DEVICE_MSPRINTER_DATA (d)->hprinter) +#define DEVICE_MSPRINTER_FONTLIST(d) (DEVICE_MSPRINTER_DATA (d)->fontlist) +#define DEVICE_MSPRINTER_NAME(d) (DEVICE_MSPRINTER_DATA (d)->name) +#define DEVICE_MSPRINTER_DEVMODE(d) (DEVICE_MSPRINTER_DATA (d)->devmode) + +#define CONSOLE_TYPESYM_MSPRINTER_P(typesym) EQ (typesym, Qmsprinter) +#define DEVICE_MSPRINTER_P(dev) CONSOLE_TYPESYM_MSPRINTER_P (DEVICE_TYPE (dev)) +#define CHECK_MSPRINTER_DEVICE(z) CHECK_DEVICE_TYPE (z, msprinter) +#define CONCHECK_MSPRINTER_DEVICE(z) CONCHECK_DEVICE_TYPE (z, msprinter) + +/* Common checks */ + +#define DEVICE_MSGDI_P(dev) (DEVICE_MSWINDOWS_P(dev) || DEVICE_MSPRINTER_P(dev)) +#define CHECK_MSGDI_DEVICE(d) \ + do { \ + CHECK_DEVICE (d); \ + if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \ + dead_wrong_type_argument \ + (list3 (Qor, Qmswindows, Qmsprinter), d); \ + } while (0) +#define CONCHECK_MSGDI_DEVICE(d) \ + do { \ + CHECK_DEVICE (d); \ + if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \ + wrong_type_argument \ + (list3 (Qor, Qmswindows, Qmsprinter), d); \ + } while (0) + +/* + * Frames + */ + +struct mswindows_frame +{ + /* win32 window handle */ + HWND hwnd; + + /* DC for this win32 window */ + HDC hdc; + + /* Used with DeferWindowPos */ + HDWP hdwp; + + /* Time of last click event, for button 2 emul */ + DWORD last_click_time; + + /* Mods of last click event */ + DWORD last_click_mods; + + /* Coordinates of last click event, screen-relative */ + POINTS last_click_point; +#ifdef HAVE_TOOLBARS + /* Toolbar hash table. See toolbar-msw.c */ + Lisp_Object toolbar_hash_table; + unsigned int toolbar_checksum[4]; +#endif + + /* Menu hash table. See menubar-msw.c */ + Lisp_Object menu_hash_table; + + /* Menu checksum. See menubar-msw.c */ + unsigned int menu_checksum; + + /* Widget glyphs attached to this frame. See glyphs-msw.c */ + Lisp_Object widget_hash_table1, widget_hash_table2, widget_hash_table3; + + /* Frame title hash value. See frame-msw.c */ + unsigned int title_checksum; + + /* Real character width and height of the frame. + FRAME_{HEIGHT,WIDTH} do not work for pixel geometry! */ + int charheight, charwidth; + +#ifdef MULE + int cursor_x; + int cursor_y; + face_index cursor_findex; +#endif + + /* Misc flags */ + int button2_need_lbutton : 1; + int button2_need_rbutton : 1; + int button2_is_down : 1; + int ignore_next_lbutton_up : 1; + int ignore_next_rbutton_up : 1; + int sizing : 1; + int paint_pending : 1; /* Whether a WM_PAINT magic event has been queued */ + int popup : 1; /* frame is a popup frame */ + + /* Geometry, in characters, as specified by proplist during frame + creation. Members are set to -1 for unspecified */ + XEMACS_RECT_WH *target_rect; +}; + +#define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows) + +#define FRAME_MSWINDOWS_HANDLE(f) (FRAME_MSWINDOWS_DATA (f)->hwnd) +#define FRAME_MSWINDOWS_DC(f) (FRAME_MSWINDOWS_DATA (f)->hdc) +#define FRAME_MSWINDOWS_MENU_HASH_TABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hash_table) +#define FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f) \ + (FRAME_MSWINDOWS_DATA (f)->toolbar_hash_table) +#define FRAME_MSWINDOWS_WIDGET_HASH_TABLE1(f) \ + (FRAME_MSWINDOWS_DATA (f)->widget_hash_table1) +#define FRAME_MSWINDOWS_WIDGET_HASH_TABLE2(f) \ + (FRAME_MSWINDOWS_DATA (f)->widget_hash_table2) +#define FRAME_MSWINDOWS_WIDGET_HASH_TABLE3(f) \ + (FRAME_MSWINDOWS_DATA (f)->widget_hash_table3) +#define FRAME_MSWINDOWS_TOOLBAR_CHECKSUM(f,pos) \ + (FRAME_MSWINDOWS_DATA (f)->toolbar_checksum[pos]) +#define FRAME_MSWINDOWS_MENU_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->menu_checksum) +#define FRAME_MSWINDOWS_TITLE_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->title_checksum) +#define FRAME_MSWINDOWS_CHARWIDTH(f) (FRAME_MSWINDOWS_DATA (f)->charwidth) +#define FRAME_MSWINDOWS_CHARHEIGHT(f) (FRAME_MSWINDOWS_DATA (f)->charheight) +#define FRAME_MSWINDOWS_TARGET_RECT(f) (FRAME_MSWINDOWS_DATA (f)->target_rect) + +#define FRAME_MSWINDOWS_POPUP(f) (FRAME_MSWINDOWS_DATA (f)->popup) + +#ifdef MULE +# define FRAME_MSWINDOWS_CURSOR_X(f) (FRAME_MSWINDOWS_DATA (f)->cursor_x) +# define FRAME_MSWINDOWS_CURSOR_Y(f) (FRAME_MSWINDOWS_DATA (f)->cursor_y) +# define FRAME_MSWINDOWS_CURSOR_FINDEX(f) (FRAME_MSWINDOWS_DATA (f)->cursor_findex) +#endif + +/* Frame check and validation macros */ +#define FRAME_MSWINDOWS_P(frm) CONSOLE_TYPESYM_MSWINDOWS_P (FRAME_TYPE (frm)) +#define CHECK_MSWINDOWS_FRAME(z) CHECK_FRAME_TYPE (z, mswindows) +#define CONCHECK_MSWINDOWS_FRAME(z) CONCHECK_FRAME_TYPE (z, mswindows) + +/* win32 window LONG indices */ +#define XWL_FRAMEOBJ 0 +#define XWL_COUNT 1 /* Number of LONGs that we use */ +#define MSWINDOWS_WINDOW_EXTRA_BYTES (XWL_COUNT * 4) + +/* + * Printer frame, aka printer job + */ + +struct msprinter_frame +{ + int left_margin, top_margin, /* All in twips */ + right_margin, bottom_margin; + int charheight, charwidth; /* As per proplist or -1 if not given */ + int pix_left, pix_top; /* Calculated in init_frame_*, VP offset */ + int job_started : 1; + int page_started : 1; +}; + +#define FRAME_MSPRINTER_DATA(f) FRAME_TYPE_DATA (f, msprinter) +#define FRAME_MSPRINTER_LEFT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->left_margin) +#define FRAME_MSPRINTER_RIGHT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->top_margin) +#define FRAME_MSPRINTER_TOP_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->right_margin) +#define FRAME_MSPRINTER_BOTTOM_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->bottom_margin) +#define FRAME_MSPRINTER_JOB_STARTED(f) (FRAME_MSPRINTER_DATA (f)->job_started) +#define FRAME_MSPRINTER_PAGE_STARTED(f) (FRAME_MSPRINTER_DATA (f)->page_started) +#define FRAME_MSPRINTER_CHARWIDTH(f) (FRAME_MSPRINTER_DATA (f)->charwidth) +#define FRAME_MSPRINTER_CHARHEIGHT(f) (FRAME_MSPRINTER_DATA (f)->charheight) +#define FRAME_MSPRINTER_PIXLEFT(f) (FRAME_MSPRINTER_DATA (f)->pix_left) +#define FRAME_MSPRINTER_PIXTOP(f) (FRAME_MSPRINTER_DATA (f)->pix_top) + +/* + * Events + */ + +/* win32 messages / magic event types */ +#define EVENT_MSWINDOWS_MAGIC_TYPE(e) \ + ((e)->event.magic.underlying_mswindows_event) +#define XM_BUMPQUEUE (WM_USER + 101) +#define XM_MAPFRAME (WM_USER + 102) +#define XM_UNMAPFRAME (WM_USER + 103) + +struct mswindows_dialog_id +{ + struct lcrecord_header header; + + Lisp_Object frame; + Lisp_Object callbacks; + HWND hwnd; +}; + +#endif /* INCLUDED_console_msw_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/console-msw.c' 'xemacs-21.5.7/src/console-msw.c' Index: ././src/console-msw.c --- ././src/console-msw.c Sun Mar 31 17:27:49 2002 +++ ././src/console-msw.c Fri Jun 21 06:18:23 2002 @@ -32,7 +32,7 @@ #include #include "lisp.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "events.h" #include "opaque.h" @@ -92,7 +92,7 @@ GetConsoleHwnd (void) { HWND hwndFound; - Intbyte newtitleint[200]; + Ibyte newtitleint[200]; Extbyte *newtitle; Extbyte *oldtitle; int numchars; @@ -234,7 +234,7 @@ int mswindows_message_outputted; int -mswindows_output_console_string (const Intbyte *ptr, Bytecount len) +mswindows_output_console_string (const Ibyte *ptr, Bytecount len) { DWORD num_written; @@ -270,11 +270,11 @@ (XSTRING_DATA (char_or_string), XSTRING_LENGTH (char_or_string)); else { - Intbyte str[MAX_EMCHAR_LEN]; + Ibyte str[MAX_ICHAR_LEN]; Bytecount len; CHECK_CHAR_COERCE_INT (char_or_string); - len = set_charptr_emchar (str, XCHAR (char_or_string)); + len = set_itext_ichar (str, XCHAR (char_or_string)); write_string_to_mswindows_debugging_output (str, len); } @@ -282,7 +282,7 @@ } void -write_string_to_mswindows_debugging_output (Intbyte *str, Bytecount len) +write_string_to_mswindows_debugging_output (Ibyte *str, Bytecount len) { const Extbyte *extptr; if (initialized && !inhibit_non_essential_printing_operations) @@ -338,8 +338,8 @@ return (CONSP (obj) && CONSP (XCDR (obj))) ? XCONS (XCDR (obj)) : 0; } -Intbyte *DSTRING (Lisp_Object obj); -Intbyte * +Ibyte *DSTRING (Lisp_Object obj); +Ibyte * DSTRING (Lisp_Object obj) { return STRINGP (obj) ? XSTRING_DATA (obj) : NULL; @@ -359,8 +359,8 @@ return SYMBOLP (obj) ? XSYMBOL (obj) : NULL; } -Intbyte *DSYMNAME (Lisp_Object obj); -Intbyte * +Ibyte *DSYMNAME (Lisp_Object obj); +Ibyte * DSYMNAME (Lisp_Object obj) { return SYMBOLP (obj) ? XSTRING_DATA (XSYMBOL (obj)->name) : NULL; diff --text -u 'xemacs-21.5.6/src/console-msw.h' 'xemacs-21.5.7/src/console-msw.h' Index: ././src/console-msw.h --- ././src/console-msw.h Fri Mar 29 13:47:03 2002 +++ ././src/console-msw.h Fri Jun 21 06:18:23 2002 @@ -1,7 +1,7 @@ /* Define mswindows-specific console, device, and frame object for XEmacs. Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -49,38 +49,10 @@ #define XEMACS_CONTROL_CLASS "XEmacsControl" /* - * Consoles - */ - -DECLARE_CONSOLE_TYPE (mswindows); - -struct mswindows_console -{ - int infd, outfd; -}; - -DECLARE_CONSOLE_TYPE (msprinter); - -/* * Printer settings, aka devmode */ -typedef struct Lisp_Devmode -{ - struct lcrecord_header header; - - /* Pointer to the DEVMODE structure */ - DEVMODEW *devmode; - - /* Full printer name. It can be longer than devmode->dmDeviceName - can accommodate, so need to keep it separately */ - Lisp_Object printer_name; - - /* Printer device this object is currently selected in, or Qnil - if not selected */ - Lisp_Object device; - -} Lisp_Devmode; +typedef struct Lisp_Devmode Lisp_Devmode; DECLARE_LRECORD (devmode, Lisp_Devmode); @@ -90,72 +62,15 @@ #define CHECK_DEVMODE(x) CHECK_RECORD (x, devmode) #define CONCHECK_DEVMODE(x) CONCHECK_RECORD (x, devmode) -#define DEVMODE_SIZE(dm) ((dm)->dmSize + (dm)->dmDriverExtra) -#define XDEVMODE_SIZE(x) ((x)->devmode ? DEVMODE_SIZE((x)->devmode) : 0) - /* * Devices */ #define MSW_FONTSIZE (LF_FACESIZE * 4 + 12) -struct mswindows_device -{ - Lisp_Object fontlist; /* List of strings, device fonts */ - HDC hcdc; /* Compatible DC */ - DWORD update_tick; /* Used when device is modified through - Windows messages, see WM_DISPLAYCHANGE - in event-msw.c */ -}; - -#define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows) -#define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist) -#define DEVICE_MSWINDOWS_HCDC(d) (DEVICE_MSWINDOWS_DATA (d)->hcdc) -#define DEVICE_MSWINDOWS_UPDATE_TICK(d) (DEVICE_MSWINDOWS_DATA (d)->update_tick) - -struct msprinter_device -{ - HDC hdc, hcdc; /* Printer and the comp. DCs */ - HANDLE hprinter; - Lisp_Object name; - Lisp_Object devmode; - Lisp_Object fontlist; -}; - -#define DEVICE_MSPRINTER_DATA(d) DEVICE_TYPE_DATA (d, msprinter) -#define DEVICE_MSPRINTER_HDC(d) (DEVICE_MSPRINTER_DATA (d)->hdc) -#define DEVICE_MSPRINTER_HCDC(d) (DEVICE_MSPRINTER_DATA (d)->hcdc) -#define DEVICE_MSPRINTER_HPRINTER(d) (DEVICE_MSPRINTER_DATA (d)->hprinter) -#define DEVICE_MSPRINTER_FONTLIST(d) (DEVICE_MSPRINTER_DATA (d)->fontlist) -#define DEVICE_MSPRINTER_NAME(d) (DEVICE_MSPRINTER_DATA (d)->name) -#define DEVICE_MSPRINTER_DEVMODE(d) (DEVICE_MSPRINTER_DATA (d)->devmode) - -#define CONSOLE_TYPESYM_MSPRINTER_P(typesym) EQ (typesym, Qmsprinter) -#define DEVICE_MSPRINTER_P(dev) CONSOLE_TYPESYM_MSPRINTER_P (DEVICE_TYPE (dev)) -#define CHECK_MSPRINTER_DEVICE(z) CHECK_DEVICE_TYPE (z, msprinter) -#define CONCHECK_MSPRINTER_DEVICE(z) CONCHECK_DEVICE_TYPE (z, msprinter) - /* Printer functions in frame-msw.c */ void msprinter_start_page (struct frame *f); -/* Common checks */ - -#define DEVICE_MSGDI_P(dev) (DEVICE_MSWINDOWS_P(dev) || DEVICE_MSPRINTER_P(dev)) -#define CHECK_MSGDI_DEVICE(d) \ - do { \ - CHECK_DEVICE (d); \ - if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \ - dead_wrong_type_argument \ - (list3 (Qor, Qmswindows, Qmsprinter), d); \ - } while (0) -#define CONCHECK_MSGDI_DEVICE(d) \ - do { \ - CHECK_DEVICE (d); \ - if (!(DEVICEP (d) && DEVICE_MSGDI_P(XDEVICE(d)))) \ - wrong_type_argument \ - (list3 (Qor, Qmswindows, Qmsprinter), d); \ - } while (0) - /* * Frames */ @@ -167,145 +82,6 @@ int height; } XEMACS_RECT_WH; -struct mswindows_frame -{ - /* win32 window handle */ - HWND hwnd; - - /* DC for this win32 window */ - HDC hdc; - - /* Used with DeferWindowPos */ - HDWP hdwp; - - /* Time of last click event, for button 2 emul */ - DWORD last_click_time; - - /* Mods of last click event */ - DWORD last_click_mods; - - /* Coordinates of last click event, screen-relative */ - POINTS last_click_point; -#ifdef HAVE_TOOLBARS - /* Toolbar hash table. See toolbar-msw.c */ - Lisp_Object toolbar_hash_table; - unsigned int toolbar_checksum[4]; -#endif - - /* Menu hash table. See menubar-msw.c */ - Lisp_Object menu_hash_table; - - /* Menu checksum. See menubar-msw.c */ - unsigned int menu_checksum; - - /* Widget glyphs attached to this frame. See glyphs-msw.c */ - Lisp_Object widget_hash_table1, widget_hash_table2, widget_hash_table3; - - /* Frame title hash value. See frame-msw.c */ - unsigned int title_checksum; - - /* Real character width and height of the frame. - FRAME_{HEIGHT,WIDTH} do not work for pixel geometry! */ - int charheight, charwidth; - -#ifdef MULE - int cursor_x; - int cursor_y; - face_index cursor_findex; -#endif - - /* Misc flags */ - int button2_need_lbutton : 1; - int button2_need_rbutton : 1; - int button2_is_down : 1; - int ignore_next_lbutton_up : 1; - int ignore_next_rbutton_up : 1; - int sizing : 1; - int paint_pending : 1; /* Whether a WM_PAINT magic event has been queued */ - int popup : 1; /* frame is a popup frame */ - - /* Geometry, in characters, as specified by proplist during frame - creation. Members are set to -1 for unspecified */ - XEMACS_RECT_WH *target_rect; -}; - -#define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows) - -#define FRAME_MSWINDOWS_HANDLE(f) (FRAME_MSWINDOWS_DATA (f)->hwnd) -#define FRAME_MSWINDOWS_DC(f) (FRAME_MSWINDOWS_DATA (f)->hdc) -#define FRAME_MSWINDOWS_MENU_HASH_TABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hash_table) -#define FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f) \ - (FRAME_MSWINDOWS_DATA (f)->toolbar_hash_table) -#define FRAME_MSWINDOWS_WIDGET_HASH_TABLE1(f) \ - (FRAME_MSWINDOWS_DATA (f)->widget_hash_table1) -#define FRAME_MSWINDOWS_WIDGET_HASH_TABLE2(f) \ - (FRAME_MSWINDOWS_DATA (f)->widget_hash_table2) -#define FRAME_MSWINDOWS_WIDGET_HASH_TABLE3(f) \ - (FRAME_MSWINDOWS_DATA (f)->widget_hash_table3) -#define FRAME_MSWINDOWS_TOOLBAR_CHECKSUM(f,pos) \ - (FRAME_MSWINDOWS_DATA (f)->toolbar_checksum[pos]) -#define FRAME_MSWINDOWS_MENU_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->menu_checksum) -#define FRAME_MSWINDOWS_TITLE_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->title_checksum) -#define FRAME_MSWINDOWS_CHARWIDTH(f) (FRAME_MSWINDOWS_DATA (f)->charwidth) -#define FRAME_MSWINDOWS_CHARHEIGHT(f) (FRAME_MSWINDOWS_DATA (f)->charheight) -#define FRAME_MSWINDOWS_TARGET_RECT(f) (FRAME_MSWINDOWS_DATA (f)->target_rect) - -#define FRAME_MSWINDOWS_POPUP(f) (FRAME_MSWINDOWS_DATA (f)->popup) - -#ifdef MULE -# define FRAME_MSWINDOWS_CURSOR_X(f) (FRAME_MSWINDOWS_DATA (f)->cursor_x) -# define FRAME_MSWINDOWS_CURSOR_Y(f) (FRAME_MSWINDOWS_DATA (f)->cursor_y) -# define FRAME_MSWINDOWS_CURSOR_FINDEX(f) (FRAME_MSWINDOWS_DATA (f)->cursor_findex) -#endif - -/* Frame check and validation macros */ -#define FRAME_MSWINDOWS_P(frm) CONSOLE_TYPESYM_MSWINDOWS_P (FRAME_TYPE (frm)) -#define CHECK_MSWINDOWS_FRAME(z) CHECK_FRAME_TYPE (z, mswindows) -#define CONCHECK_MSWINDOWS_FRAME(z) CONCHECK_FRAME_TYPE (z, mswindows) - -/* win32 window LONG indices */ -#define XWL_FRAMEOBJ 0 -#define XWL_COUNT 1 /* Number of LONGs that we use */ -#define MSWINDOWS_WINDOW_EXTRA_BYTES (XWL_COUNT * 4) - -/* - * Printer frame, aka printer job - */ - -struct msprinter_frame -{ - int left_margin, top_margin, /* All in twips */ - right_margin, bottom_margin; - int charheight, charwidth; /* As per proplist or -1 if not given */ - int pix_left, pix_top; /* Calculated in init_frame_*, VP offset */ - int job_started : 1; - int page_started : 1; -}; - -#define FRAME_MSPRINTER_DATA(f) FRAME_TYPE_DATA (f, msprinter) -#define FRAME_MSPRINTER_LEFT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->left_margin) -#define FRAME_MSPRINTER_RIGHT_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->top_margin) -#define FRAME_MSPRINTER_TOP_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->right_margin) -#define FRAME_MSPRINTER_BOTTOM_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->bottom_margin) -#define FRAME_MSPRINTER_JOB_STARTED(f) (FRAME_MSPRINTER_DATA (f)->job_started) -#define FRAME_MSPRINTER_PAGE_STARTED(f) (FRAME_MSPRINTER_DATA (f)->page_started) -#define FRAME_MSPRINTER_CHARWIDTH(f) (FRAME_MSPRINTER_DATA (f)->charwidth) -#define FRAME_MSPRINTER_CHARHEIGHT(f) (FRAME_MSPRINTER_DATA (f)->charheight) -#define FRAME_MSPRINTER_PIXLEFT(f) (FRAME_MSPRINTER_DATA (f)->pix_left) -#define FRAME_MSPRINTER_PIXTOP(f) (FRAME_MSPRINTER_DATA (f)->pix_top) - -/* - * Events - */ - -/* win32 messages / magic event types */ -#define EVENT_MSWINDOWS_MAGIC_TYPE(e) \ - ((e)->event.magic.underlying_mswindows_event) -#define XM_BUMPQUEUE (WM_USER + 101) -#define XM_MAPFRAME (WM_USER + 102) -#define XM_UNMAPFRAME (WM_USER + 103) - - /* * Random globals */ @@ -341,20 +117,16 @@ Lisp_Object object); Lisp_Object mswindows_cancel_dispatch_event (Lisp_Event *event); Lisp_Object mswindows_pump_outstanding_events (void); -Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun) +Lisp_Object mswindows_protect_modal_loop (const char *error_string, + Lisp_Object (*bfun) (Lisp_Object barg), - Lisp_Object barg); + Lisp_Object barg, int flags); void mswindows_unmodalize_signal_maybe (void); -COLORREF mswindows_string_to_color (const Intbyte *name); -USID emacs_mswindows_create_stream_pair (void *inhandle, void *outhandle, - Lisp_Object *instream, - Lisp_Object *outstream, - int flags); -USID emacs_mswindows_delete_stream_pair (Lisp_Object instream, - Lisp_Object outstream); +COLORREF mswindows_string_to_color (const Ibyte *name); #ifdef HAVE_WIN32_PROCESSES +HANDLE get_nt_process_handle_only_first_time (Lisp_Process *p); HANDLE get_nt_process_handle (Lisp_Process *p); #endif @@ -367,9 +139,11 @@ Lisp_Object mswindows_enumerate_fonts (HDC hdc); -int mswindows_char_is_accelerator (struct frame *f, Emchar ch); +#ifdef HAVE_MENUBARS +int mswindows_char_is_accelerator (struct frame *f, Ichar ch); Lisp_Object mswindows_translate_menu_or_dialog_item (Lisp_Object item, - Emchar *accel); + Ichar *accel); +#endif #ifdef HAVE_TOOLBARS Lisp_Object mswindows_get_toolbar_button_text (struct frame *f, @@ -399,19 +173,31 @@ Lisp_Object mswindows_find_frame (HWND hwnd); +/* Defined in console-msw.c */ +EXFUN (Fmswindows_message_box, 3); +extern int mswindows_message_outputted; +void mswindows_hide_console (void); +int mswindows_output_console_string (const Ibyte *ptr, Bytecount len); +void write_string_to_mswindows_debugging_output (Ibyte *str, Bytecount len); + + #ifdef MULE Lisp_Object mswindows_get_code_page_charset (int code_page); void mswindows_start_ime_composition (struct frame *f); #endif /* MULE */ -struct mswindows_dialog_id -{ - struct lcrecord_header header; +/* Defined in intl-win32.c */ +EXFUN (Fmswindows_set_current_locale, 1); +EXFUN (Fmswindows_current_locale, 0); +EXFUN (Fmswindows_user_default_locale, 0); +EXFUN (Fmswindows_system_default_locale, 0); +EXFUN (Fmswindows_locale_code_page, 1); +EXFUN (Fmswindows_supported_locales, 0); +EXFUN (Fmswindows_charset_code_page, 1); +EXFUN (Fmswindows_charset_registry, 1); +EXFUN (Fmswindows_set_charset_code_page, 2); - Lisp_Object frame; - Lisp_Object callbacks; - HWND hwnd; -}; +struct mswindows_dialog_id; DECLARE_LRECORD (mswindows_dialog_id, struct mswindows_dialog_id); #define XMSWINDOWS_DIALOG_ID(x) XRECORD (x, mswindows_dialog_id, struct mswindows_dialog_id) diff --text -u /dev/null 'xemacs-21.5.7/src/console-stream-impl.h' Index: ././src/console-stream-impl.h --- ././src/console-stream-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/console-stream-impl.h Fri Jun 21 06:18:23 2002 @@ -0,0 +1,44 @@ +/* Define stream specific console, device, and frame object for XEmacs. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995 Free Software Foundation, Inc. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +/* Written by Ben Wing. */ + +#ifndef INCLUDED_console_stream_impl_h_ +#define INCLUDED_console_stream_impl_h_ + +#include "console-impl.h" +#include "console-stream.h" + +DECLARE_CONSOLE_TYPE (stream); + +struct stream_console +{ + FILE *in; + FILE *out; + FILE *err; + int needs_newline; +}; + +#define CONSOLE_STREAM_DATA(con) CONSOLE_TYPE_DATA (con, stream) + +#endif /* INCLUDED_console_stream_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/console-stream.c' 'xemacs-21.5.7/src/console-stream.c' Index: ././src/console-stream.c --- ././src/console-stream.c Sun Mar 31 17:27:50 2002 +++ ././src/console-stream.c Fri Jun 21 06:18:23 2002 @@ -28,14 +28,14 @@ #include #include "lisp.h" -#include "device.h" +#include "device-impl.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "redisplay.h" #include "sysdep.h" #include "window.h" -#include "console-stream.h" +#include "console-stream-impl.h" #include "console-tty.h" #include "sysfile.h" @@ -178,7 +178,7 @@ static int stream_text_width (struct frame *f, struct face_cachel *cachel, - const Emchar *str, Charcount len) + const Ichar *str, Charcount len) { return len; } @@ -217,9 +217,9 @@ static void stream_clear_region (Lisp_Object window, struct device* d, struct frame * f, - face_index findex, int x, int y, - int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, - Lisp_Object background_pixmap) + face_index findex, int x, int y, + int width, int height, Lisp_Object fcolor, + Lisp_Object bcolor, Lisp_Object background_pixmap) { } @@ -233,8 +233,14 @@ stream_ring_bell (struct device *d, int volume, int pitch, int duration) { struct console *c = XCONSOLE (DEVICE_CONSOLE (d)); - fputc (07, CONSOLE_STREAM_DATA (c)->out); - fflush (CONSOLE_STREAM_DATA (c)->out); + /* Don't output ^G when not a TTY -- in particular, under MS Windows, ^G + is interpreted as bell by the console, but not when running under + VC++. Probably this would be the same under Unix. */ + if (isatty (fileno (CONSOLE_STREAM_DATA (c)->out))) + { + fputc (07, CONSOLE_STREAM_DATA (c)->out); + fflush (CONSOLE_STREAM_DATA (c)->out); + } } diff --text -u 'xemacs-21.5.6/src/console-stream.h' 'xemacs-21.5.7/src/console-stream.h' Index: ././src/console-stream.h --- ././src/console-stream.h Fri May 25 20:26:53 2001 +++ ././src/console-stream.h Fri Jun 21 06:18:24 2002 @@ -28,26 +28,14 @@ #include "console.h" -DECLARE_CONSOLE_TYPE (stream); - -struct stream_console -{ - FILE *in; - FILE *out; - FILE *err; - int needs_newline; -}; - -#define CONSOLE_STREAM_DATA(con) CONSOLE_TYPE_DATA (con, stream) - extern Lisp_Object Vterminal_console, Vterminal_frame, Vterminal_device; -Lisp_Object stream_semi_canonicalize_console_connection(Lisp_Object, +Lisp_Object stream_semi_canonicalize_console_connection (Lisp_Object, + Error_Behavior); +Lisp_Object stream_canonicalize_console_connection (Lisp_Object, + Error_Behavior); +Lisp_Object stream_semi_canonicalize_device_connection (Lisp_Object, Error_Behavior); -Lisp_Object stream_canonicalize_console_connection(Lisp_Object, +Lisp_Object stream_canonicalize_device_connection (Lisp_Object, Error_Behavior); -Lisp_Object stream_semi_canonicalize_device_connection(Lisp_Object, - Error_Behavior); -Lisp_Object stream_canonicalize_device_connection(Lisp_Object, - Error_Behavior); #endif /* INCLUDED_console_stream_h_ */ diff --text -u /dev/null 'xemacs-21.5.7/src/console-tty-impl.h' Index: ././src/console-tty-impl.h --- ././src/console-tty-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/console-tty-impl.h Fri Jun 21 06:18:24 2002 @@ -0,0 +1,245 @@ +/* Define TTY specific console, device, and frame object for XEmacs. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1996 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +/* Written by Chuck Thompson and Ben Wing. */ + +/* NOTE: Currently each TTY console can have only one device. + Therefore, all stuff for both input and output is lumped into + the console structure. If it ever becomes meaningful to + have more than one device on a TTY console, the output stuff + will have to get separated out. */ + +#ifndef INCLUDED_console_tty_impl_h_ +#define INCLUDED_console_tty_impl_h_ + +#include "console-impl.h" +#include "console-tty.h" + +DECLARE_CONSOLE_TYPE (tty); + +struct tty_console +{ + int infd, outfd; + Lisp_Object instream, outstream; + Lisp_Object terminal_type; + Lisp_Object controlling_process; + char *term_entry_buffer; + + /* Physical location of cursor on this console. */ + int cursor_x; + int cursor_y; + + /* The real location of the cursor. The above physical location may + be ahead of where we really are. */ + int real_cursor_x; + int real_cursor_y; + + int final_cursor_x; + int final_cursor_y; + + int height; + int width; + + /* The count of frame number. */ + int frame_count; + + /* flags indicating presence, absence or value of various features */ + struct + { + unsigned int must_write_spaces :1; /* terminal inserts nulls, not + spaces to fill whitespace on + screen */ + unsigned int insert_mode_motion :1; /* cursor movement commands + work while in insert mode */ + unsigned int standout_motion :1; /* cursor movement is graceful + in standout or underline mode */ + unsigned int memory_above_frame :1; /* display retained above screen */ + unsigned int memory_below_frame :1; /* display retained below screen */ + unsigned int meta_key :2; /* 0 == mask off top bit; + 1 == top bit is meta; + 2 == top bit is useful as + character info */ + unsigned int flow_control :1; /* Nonzero means use ^S/^Q as + cretinous flow control. */ + int standout_width; /* # of spaces printed when + change to standout mode */ + int underline_width; /* # of spaces printed when + change to underline mode */ + } flags; + + /* cursor motion entries - each entry is commented with the terminfo + and the termcap entry */ + struct + { + /* local cursor movement */ + const char *up; /* cuu1, up */ + const char *down; /* cud1, do */ + const char *left; /* cub1, le */ + const char *right; /* cuf1, nd */ + const char *home; /* home, ho */ + const char *low_left; /* ll, ll */ + const char *car_return; /* cr, cr */ + + /* parameterized local cursor movement */ + const char *multi_up; /* cuu, UP */ + const char *multi_down; /* cud, DO */ + const char *multi_left; /* cub, LE */ + const char *multi_right; /* cuf, RI */ + + /* absolute cursor motion */ + const char *abs; /* cup, cm */ + const char *hor_abs; /* hpa, ch */ + const char *ver_abs; /* vpa, cv */ + + /* scrolling */ + const char *scroll_forw; /* ind, sf */ + const char *scroll_back; /* ri, sr */ + const char *multi_scroll_forw; /* indn, SF */ + const char *multi_scroll_back; /* rin, SR */ + const char *set_scroll_region; /* csr, cs */ + } cm; + + /* screen editing entries - each entry is commented with the + terminfo and the termcap entry */ + struct + { + /* adding to the screen */ + const char *ins_line; /* il1, al */ + const char *multi_ins_line; /* il, AL */ + const char *repeat; /* rep, rp */ + const char *begin_ins_mode; /* smir, im */ + const char *end_ins_mode; /* rmir, ei */ + const char *ins_char; /* ich1, ic */ + const char *multi_ins_char; /* ich, IC */ + const char *insert_pad; /* ip, ip */ + + /* deleting from the screen */ + const char *clr_frame; /* clear, cl */ + const char *clr_from_cursor; /* ed, cd */ + const char *clr_to_eol; /* el, ce */ + const char *del_line; /* dl1, dl */ + const char *multi_del_line; /* dl, DL */ + const char *del_char; /* dch1, dc */ + const char *multi_del_char; /* dch, DC */ + const char *begin_del_mode; /* smdc, dm */ + const char *end_del_mode; /* rmdc, ed */ + const char *erase_at_cursor; /* ech, ec */ + } se; + + /* screen display entries - each entry is commented with the + terminfo and termcap entry */ + struct + { + const char *begin_standout; /* smso, so */ + const char *end_standout; /* rmso, se */ + const char *begin_underline; /* smul, us */ + const char *end_underline; /* rmul, ue */ + const char *begin_alternate; /* smacs, as */ + const char *end_alternate; /* rmacs, ae */ + + const char *turn_on_reverse; /* rev, mr */ + const char *turn_on_blinking; /* blink, mb */ + const char *turn_on_bold; /* bold, md */ + const char *turn_on_dim; /* dim, mh */ + const char *turn_off_attributes; /* sgr0, me */ + + const char *visual_bell; /* flash, vb */ + const char *audio_bell; /* bel, bl */ + + const char *cursor_visible; /* cvvis, vs */ + const char *cursor_normal; /* cnorm, ve */ + const char *init_motion; /* smcup, ti */ + const char *end_motion; /* rmcup, te */ + const char *keypad_on; /* smkx, ks */ + const char *keypad_off; /* rmkx, ke */ + + const char *orig_pair; /* op, op */ + } sd; + + /* costs of various operations */ + struct + { + int cm_up; + int cm_down; + int cm_left; + int cm_right; + int cm_home; + int cm_low_left; + int cm_car_return; + int cm_abs; + int cm_hor_abs; + int cm_ver_abs; + } cost; + + /* The initial tty mode bits */ + struct emacs_tty old_tty; + + /* Is this TTY our controlling terminal? */ + unsigned int controlling_terminal :1; + unsigned int is_stdio :1; +}; + +#define CONSOLE_TTY_DATA(c) CONSOLE_TYPE_DATA (c, tty) +#define CONSOLE_TTY_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->cursor_x) +#define CONSOLE_TTY_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->cursor_y) +#define CONSOLE_TTY_REAL_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->real_cursor_x) +#define CONSOLE_TTY_REAL_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->real_cursor_y) +#define CONSOLE_TTY_FINAL_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->final_cursor_x) +#define CONSOLE_TTY_FINAL_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->final_cursor_y) + +#define TTY_CM(c) (CONSOLE_TTY_DATA (c)->cm) +#define TTY_SE(c) (CONSOLE_TTY_DATA (c)->se) +#define TTY_SD(c) (CONSOLE_TTY_DATA (c)->sd) +#define TTY_FLAGS(c) (CONSOLE_TTY_DATA (c)->flags) +#define TTY_COST(c) (CONSOLE_TTY_DATA (c)->cost) + +#define TTY_INC_CURSOR_X(c, n) do { \ + int TICX_n = (n); \ + assert (CONSOLE_TTY_CURSOR_X (c) == CONSOLE_TTY_REAL_CURSOR_X (c)); \ + CONSOLE_TTY_CURSOR_X (c) += TICX_n; \ + CONSOLE_TTY_REAL_CURSOR_X (c) += TICX_n; \ +} while (0) + +#define TTY_INC_CURSOR_Y(c, n) do { \ + int TICY_n = (n); \ + CONSOLE_TTY_CURSOR_Y (c) += TICY_n; \ + CONSOLE_TTY_REAL_CURSOR_Y (c) += TICY_n; \ +} while (0) + +struct tty_device +{ +#ifdef HAVE_TERMIOS + speed_t ospeed; /* Output speed (from sg_ospeed) */ +#else + short ospeed; /* Output speed (from sg_ospeed) */ +#endif +}; + +#define DEVICE_TTY_DATA(d) DEVICE_TYPE_DATA (d, tty) + +/* termcap requires this to be global */ +#ifndef HAVE_TERMIOS +extern short ospeed; /* Output speed (from sg_ospeed) */ +#endif + +#endif /* INCLUDED_console_tty_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/console-tty.c' 'xemacs-21.5.7/src/console-tty.c' Index: ././src/console-tty.c --- ././src/console-tty.c Wed Apr 3 19:47:48 2002 +++ ././src/console-tty.c Fri Jun 21 06:18:24 2002 @@ -27,15 +27,18 @@ #include #include "lisp.h" -#include "console-tty.h" +#include "console-tty-impl.h" #include "console-stream.h" + #include "faces.h" +#include "file-coding.h" #include "frame.h" -#include "lstream.h" #include "glyphs.h" +#include "lstream.h" +#include "process.h" + #include "sysdep.h" #include "sysfile.h" -#include "file-coding.h" DEFINE_CONSOLE_TYPE (tty); DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing); @@ -77,7 +80,7 @@ CHECK_STRING (terminal_type); else { - Intbyte *temp_type = egetenv ("TERM"); + Ibyte *temp_type = egetenv ("TERM"); if (!temp_type) { @@ -117,9 +120,9 @@ tty_con->instream = make_coding_input_stream (XLSTREAM (tty_con->instream), get_coding_system_for_text_file (Qkeyboard, 0), - CODING_DECODE, CODE_FL_READ_ONE_BYTE_AT_A_TIME); + CODING_DECODE, + LSTREAM_FL_READ_ONE_BYTE_AT_A_TIME); Lstream_set_buffering (XLSTREAM (tty_con->instream), LSTREAM_UNBUFFERED, 0); - Lstream_set_character_mode (XLSTREAM (tty_con->instream)); tty_con->outstream = make_filedesc_output_stream (tty_con->outfd, 0, -1, 0); tty_con->outstream = make_coding_output_stream (XLSTREAM (tty_con->outstream), @@ -143,7 +146,7 @@ would have two controlling TTY's, which is not allowed). */ EMACS_GET_TTY_PROCESS_GROUP (tty_con->infd, &tty_pg); - cfd = qxe_open ((Intbyte *) "/dev/tty", O_RDWR, 0); + cfd = qxe_open ((Ibyte *) "/dev/tty", O_RDWR, 0); EMACS_GET_TTY_PROCESS_GROUP (cfd, &controlling_tty_pg); retry_close (cfd); if (tty_pg == controlling_tty_pg) diff --text -u 'xemacs-21.5.6/src/console-tty.h' 'xemacs-21.5.7/src/console-tty.h' Index: ././src/console-tty.h --- ././src/console-tty.h Fri May 25 20:26:53 2001 +++ ././src/console-tty.h Fri Jun 21 06:18:24 2002 @@ -33,215 +33,7 @@ #define INCLUDED_console_tty_h_ #include "console.h" -#include "syssignal.h" /* Always include before systty.h */ #include "systty.h" - -DECLARE_CONSOLE_TYPE (tty); - -struct tty_console -{ - int infd, outfd; - Lisp_Object instream, outstream; - Lisp_Object terminal_type; - Lisp_Object controlling_process; - char *term_entry_buffer; - - /* Physical location of cursor on this console. */ - int cursor_x; - int cursor_y; - - /* The real location of the cursor. The above physical location may - be ahead of where we really are. */ - int real_cursor_x; - int real_cursor_y; - - int final_cursor_x; - int final_cursor_y; - - int height; - int width; - - /* The count of frame number. */ - int frame_count; - - /* flags indicating presence, absence or value of various features */ - struct - { - unsigned int must_write_spaces :1; /* terminal inserts nulls, not - spaces to fill whitespace on - screen */ - unsigned int insert_mode_motion :1; /* cursor movement commands - work while in insert mode */ - unsigned int standout_motion :1; /* cursor movement is graceful - in standout or underline mode */ - unsigned int memory_above_frame :1; /* display retained above screen */ - unsigned int memory_below_frame :1; /* display retained below screen */ - unsigned int meta_key :2; /* 0 == mask off top bit; - 1 == top bit is meta; - 2 == top bit is useful as - character info */ - unsigned int flow_control :1; /* Nonzero means use ^S/^Q as - cretinous flow control. */ - int standout_width; /* # of spaces printed when - change to standout mode */ - int underline_width; /* # of spaces printed when - change to underline mode */ - } flags; - - /* cursor motion entries - each entry is commented with the terminfo - and the termcap entry */ - struct - { - /* local cursor movement */ - const char *up; /* cuu1, up */ - const char *down; /* cud1, do */ - const char *left; /* cub1, le */ - const char *right; /* cuf1, nd */ - const char *home; /* home, ho */ - const char *low_left; /* ll, ll */ - const char *car_return; /* cr, cr */ - - /* parameterized local cursor movement */ - const char *multi_up; /* cuu, UP */ - const char *multi_down; /* cud, DO */ - const char *multi_left; /* cub, LE */ - const char *multi_right; /* cuf, RI */ - - /* absolute cursor motion */ - const char *abs; /* cup, cm */ - const char *hor_abs; /* hpa, ch */ - const char *ver_abs; /* vpa, cv */ - - /* scrolling */ - const char *scroll_forw; /* ind, sf */ - const char *scroll_back; /* ri, sr */ - const char *multi_scroll_forw; /* indn, SF */ - const char *multi_scroll_back; /* rin, SR */ - const char *set_scroll_region; /* csr, cs */ - } cm; - - /* screen editing entries - each entry is commented with the - terminfo and the termcap entry */ - struct - { - /* adding to the screen */ - const char *ins_line; /* il1, al */ - const char *multi_ins_line; /* il, AL */ - const char *repeat; /* rep, rp */ - const char *begin_ins_mode; /* smir, im */ - const char *end_ins_mode; /* rmir, ei */ - const char *ins_char; /* ich1, ic */ - const char *multi_ins_char; /* ich, IC */ - const char *insert_pad; /* ip, ip */ - - /* deleting from the screen */ - const char *clr_frame; /* clear, cl */ - const char *clr_from_cursor; /* ed, cd */ - const char *clr_to_eol; /* el, ce */ - const char *del_line; /* dl1, dl */ - const char *multi_del_line; /* dl, DL */ - const char *del_char; /* dch1, dc */ - const char *multi_del_char; /* dch, DC */ - const char *begin_del_mode; /* smdc, dm */ - const char *end_del_mode; /* rmdc, ed */ - const char *erase_at_cursor; /* ech, ec */ - } se; - - /* screen display entries - each entry is commented with the - terminfo and termcap entry */ - struct - { - const char *begin_standout; /* smso, so */ - const char *end_standout; /* rmso, se */ - const char *begin_underline; /* smul, us */ - const char *end_underline; /* rmul, ue */ - const char *begin_alternate; /* smacs, as */ - const char *end_alternate; /* rmacs, ae */ - - const char *turn_on_reverse; /* rev, mr */ - const char *turn_on_blinking; /* blink, mb */ - const char *turn_on_bold; /* bold, md */ - const char *turn_on_dim; /* dim, mh */ - const char *turn_off_attributes; /* sgr0, me */ - - const char *visual_bell; /* flash, vb */ - const char *audio_bell; /* bel, bl */ - - const char *cursor_visible; /* cvvis, vs */ - const char *cursor_normal; /* cnorm, ve */ - const char *init_motion; /* smcup, ti */ - const char *end_motion; /* rmcup, te */ - const char *keypad_on; /* smkx, ks */ - const char *keypad_off; /* rmkx, ke */ - - const char *orig_pair; /* op, op */ - } sd; - - /* costs of various operations */ - struct - { - int cm_up; - int cm_down; - int cm_left; - int cm_right; - int cm_home; - int cm_low_left; - int cm_car_return; - int cm_abs; - int cm_hor_abs; - int cm_ver_abs; - } cost; - - /* The initial tty mode bits */ - struct emacs_tty old_tty; - - /* Is this TTY our controlling terminal? */ - unsigned int controlling_terminal :1; - unsigned int is_stdio :1; -}; - -#define CONSOLE_TTY_DATA(c) CONSOLE_TYPE_DATA (c, tty) -#define CONSOLE_TTY_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->cursor_x) -#define CONSOLE_TTY_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->cursor_y) -#define CONSOLE_TTY_REAL_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->real_cursor_x) -#define CONSOLE_TTY_REAL_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->real_cursor_y) -#define CONSOLE_TTY_FINAL_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->final_cursor_x) -#define CONSOLE_TTY_FINAL_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->final_cursor_y) - -#define TTY_CM(c) (CONSOLE_TTY_DATA (c)->cm) -#define TTY_SE(c) (CONSOLE_TTY_DATA (c)->se) -#define TTY_SD(c) (CONSOLE_TTY_DATA (c)->sd) -#define TTY_FLAGS(c) (CONSOLE_TTY_DATA (c)->flags) -#define TTY_COST(c) (CONSOLE_TTY_DATA (c)->cost) - -#define TTY_INC_CURSOR_X(c, n) do { \ - int TICX_n = (n); \ - assert (CONSOLE_TTY_CURSOR_X (c) == CONSOLE_TTY_REAL_CURSOR_X (c)); \ - CONSOLE_TTY_CURSOR_X (c) += TICX_n; \ - CONSOLE_TTY_REAL_CURSOR_X (c) += TICX_n; \ -} while (0) - -#define TTY_INC_CURSOR_Y(c, n) do { \ - int TICY_n = (n); \ - CONSOLE_TTY_CURSOR_Y (c) += TICY_n; \ - CONSOLE_TTY_REAL_CURSOR_Y (c) += TICY_n; \ -} while (0) - -struct tty_device -{ -#ifdef HAVE_TERMIOS - speed_t ospeed; /* Output speed (from sg_ospeed) */ -#else - short ospeed; /* Output speed (from sg_ospeed) */ -#endif -}; - -#define DEVICE_TTY_DATA(d) DEVICE_TYPE_DATA (d, tty) - -/* termcap requires this to be global */ -#ifndef HAVE_TERMIOS -extern short ospeed; /* Output speed (from sg_ospeed) */ -#endif extern FILE *termscript; diff --text -u /dev/null 'xemacs-21.5.7/src/console-x-impl.h' Index: ././src/console-x-impl.h --- ././src/console-x-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/console-x-impl.h Fri Jun 21 06:18:24 2002 @@ -0,0 +1,341 @@ +/* Define X specific console, device, and frame object for XEmacs. + Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. + Copyright (C) 1996, 2002 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + + +/* Authorship: + + Ultimately based on FSF, then later on JWZ work for Lemacs. + Rewritten over time by Ben Wing and Chuck Thompson (original + multi-device work by Chuck Thompson). + */ + +#ifndef INCLUDED_console_x_impl_h_ +#define INCLUDED_console_x_impl_h_ + +#ifdef HAVE_X_WINDOWS + +#include "console-impl.h" +#include "console-x.h" + +DECLARE_CONSOLE_TYPE (x); + +struct x_device +{ + /* The X connection of this device. */ + Display *display; + + /* Set by x_IO_error_handler(). */ + int being_deleted; + + /* Xt application info. */ + Widget Xt_app_shell; + + /* Cache of GC's for frames on this device. */ + struct gc_cache *gc_cache; + + /* Selected visual, depth and colormap for this device */ + Visual *visual; + int depth; + Colormap device_cmap; + + /* Used by x_bevel_modeline in redisplay-x.c */ + Pixmap gray_pixmap; + + /* Atoms associated with this device. */ + /* allocated in Xatoms_of_device_x */ + Atom Xatom_WM_PROTOCOLS; + Atom Xatom_WM_DELETE_WINDOW; + Atom Xatom_WM_SAVE_YOURSELF; + Atom Xatom_WM_TAKE_FOCUS; + Atom Xatom_WM_STATE; + + /* allocated in Xatoms_of_select_x */ + Atom Xatom_CLIPBOARD; + Atom Xatom_TIMESTAMP; + Atom Xatom_TEXT; + Atom Xatom_DELETE; + Atom Xatom_MULTIPLE; + Atom Xatom_INCR; + Atom Xatom_EMACS_TMP; + Atom Xatom_TARGETS; + Atom Xatom_NULL; + Atom Xatom_ATOM_PAIR; + Atom Xatom_COMPOUND_TEXT; + + /* allocated in Xatoms_of_objects_x */ + Atom Xatom_FOUNDRY; + Atom Xatom_FAMILY_NAME; + Atom Xatom_WEIGHT_NAME; + Atom Xatom_SLANT; + Atom Xatom_SETWIDTH_NAME; + Atom Xatom_ADD_STYLE_NAME; + Atom Xatom_PIXEL_SIZE; + Atom Xatom_POINT_SIZE; + Atom Xatom_RESOLUTION_X; + Atom Xatom_RESOLUTION_Y; + Atom Xatom_SPACING; + Atom Xatom_AVERAGE_WIDTH; + Atom Xatom_CHARSET_REGISTRY; + Atom Xatom_CHARSET_ENCODING; + + /* The following items are all used exclusively in event-Xt.c. */ + int MetaMask, HyperMask, SuperMask, AltMask, ModeMask; + KeySym lock_interpretation; + + XModifierKeymap *x_modifier_keymap; + + KeySym *x_keysym_map; + int x_keysym_map_min_code; + int x_keysym_map_max_code; + int x_keysym_map_keysyms_per_code; + Lisp_Object x_keysym_map_hash_table; + + /* frame that holds the WM_COMMAND property; there should be exactly + one of these per device. */ + Lisp_Object WM_COMMAND_frame; + + /* #### It's not clear that there is much distinction anymore + between mouse_timestamp and global_mouse_timestamp, now that + Emacs doesn't see most (all?) events not destined for it. */ + + /* The timestamp of the last button or key event used by emacs itself. + This is used for asserting selections and input focus. */ + Time mouse_timestamp; + + /* This is the timestamp the last button or key event whether it was + dispatched to emacs or widgets. */ + Time global_mouse_timestamp; + + /* This is the last known timestamp received from the server. It is + maintained by x_event_to_emacs_event and used to patch bogus + WM_TAKE_FOCUS messages sent by Mwm. */ + Time last_server_timestamp; + + /* Used by Xlib to preserve information across calls to + XLookupString(), to implement compose processing. + + According to The X Window System, p. 467, "The creation of + XComposeStatus structures is implementation dependent; + a portable program must pass NULL for this argument." + But this means that a portable program cannot implement + compose processing! WTF? + + So we just set it to all zeros. */ + + /* No X Server ever used this, AFAIK -- mrb */ + /* XComposeStatus x_compose_status; */ + +#ifdef HAVE_XIM + XIM xim; + XIMStyles *xim_styles; +#endif /* HAVE_XIM */ + + /* stuff for sticky modifiers: */ + + unsigned int need_to_add_mask, down_mask; + KeyCode last_downkey; + Time release_time; + Time modifier_release_time; +}; + +#define DEVICE_X_DATA(d) DEVICE_TYPE_DATA (d, x) + +#define FRAME_X_DISPLAY(f) (DEVICE_X_DISPLAY (XDEVICE (f->device))) +#define DEVICE_X_DISPLAY(d) (DEVICE_X_DATA (d)->display) +#define DEVICE_X_BEING_DELETED(d) (DEVICE_X_DATA (d)->being_deleted) +#define DEVICE_X_VISUAL(d) (DEVICE_X_DATA (d)->visual) +#define DEVICE_X_DEPTH(d) (DEVICE_X_DATA (d)->depth) +#define DEVICE_X_COLORMAP(d) (DEVICE_X_DATA (d)->device_cmap) +#define DEVICE_XT_APP_SHELL(d) (DEVICE_X_DATA (d)->Xt_app_shell) +#define DEVICE_X_GC_CACHE(d) (DEVICE_X_DATA (d)->gc_cache) +#define DEVICE_X_GRAY_PIXMAP(d) (DEVICE_X_DATA (d)->gray_pixmap) +#define DEVICE_X_WM_COMMAND_FRAME(d) (DEVICE_X_DATA (d)->WM_COMMAND_frame) +#define DEVICE_X_MOUSE_TIMESTAMP(d) (DEVICE_X_DATA (d)->mouse_timestamp) +#define DEVICE_X_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_X_DATA (d)->global_mouse_timestamp) +#define DEVICE_X_LAST_SERVER_TIMESTAMP(d) (DEVICE_X_DATA (d)->last_server_timestamp) +#define DEVICE_X_KEYSYM_MAP_HASH_TABLE(d) (DEVICE_X_DATA (d)->x_keysym_map_hash_table) +/* #define DEVICE_X_X_COMPOSE_STATUS(d) (DEVICE_X_DATA (d)->x_compose_status) */ +#ifdef HAVE_XIM +#define DEVICE_X_XIM(d) (DEVICE_X_DATA (d)->xim) +#define DEVICE_X_XIM_STYLES(d) (DEVICE_X_DATA (d)->xim_styles) +#define DEVICE_X_FONTSET(d) (DEVICE_X_DATA (d)->fontset) +#endif /* HAVE_XIM */ + +/* allocated in Xatoms_of_device_x */ +#define DEVICE_XATOM_WM_PROTOCOLS(d) (DEVICE_X_DATA (d)->Xatom_WM_PROTOCOLS) +#define DEVICE_XATOM_WM_DELETE_WINDOW(d) (DEVICE_X_DATA (d)->Xatom_WM_DELETE_WINDOW) +#define DEVICE_XATOM_WM_SAVE_YOURSELF(d) (DEVICE_X_DATA (d)->Xatom_WM_SAVE_YOURSELF) +#define DEVICE_XATOM_WM_TAKE_FOCUS(d) (DEVICE_X_DATA (d)->Xatom_WM_TAKE_FOCUS) +#define DEVICE_XATOM_WM_STATE(d) (DEVICE_X_DATA (d)->Xatom_WM_STATE) + +/* allocated in Xatoms_of_select_x */ +#define DEVICE_XATOM_CLIPBOARD(d) (DEVICE_X_DATA (d)->Xatom_CLIPBOARD) +#define DEVICE_XATOM_TIMESTAMP(d) (DEVICE_X_DATA (d)->Xatom_TIMESTAMP) +#define DEVICE_XATOM_TEXT(d) (DEVICE_X_DATA (d)->Xatom_TEXT) +#define DEVICE_XATOM_DELETE(d) (DEVICE_X_DATA (d)->Xatom_DELETE) +#define DEVICE_XATOM_MULTIPLE(d) (DEVICE_X_DATA (d)->Xatom_MULTIPLE) +#define DEVICE_XATOM_INCR(d) (DEVICE_X_DATA (d)->Xatom_INCR) +#define DEVICE_XATOM_EMACS_TMP(d) (DEVICE_X_DATA (d)->Xatom_EMACS_TMP) +#define DEVICE_XATOM_TARGETS(d) (DEVICE_X_DATA (d)->Xatom_TARGETS) +#define DEVICE_XATOM_NULL(d) (DEVICE_X_DATA (d)->Xatom_NULL) +#define DEVICE_XATOM_ATOM_PAIR(d) (DEVICE_X_DATA (d)->Xatom_ATOM_PAIR) +#define DEVICE_XATOM_COMPOUND_TEXT(d) (DEVICE_X_DATA (d)->Xatom_COMPOUND_TEXT) + +/* allocated in Xatoms_of_objects_x */ +#define DEVICE_XATOM_FOUNDRY(d) (DEVICE_X_DATA (d)->Xatom_FOUNDRY) +#define DEVICE_XATOM_FAMILY_NAME(d) (DEVICE_X_DATA (d)->Xatom_FAMILY_NAME) +#define DEVICE_XATOM_WEIGHT_NAME(d) (DEVICE_X_DATA (d)->Xatom_WEIGHT_NAME) +#define DEVICE_XATOM_SLANT(d) (DEVICE_X_DATA (d)->Xatom_SLANT) +#define DEVICE_XATOM_SETWIDTH_NAME(d) (DEVICE_X_DATA (d)->Xatom_SETWIDTH_NAME) +#define DEVICE_XATOM_ADD_STYLE_NAME(d) (DEVICE_X_DATA (d)->Xatom_ADD_STYLE_NAME) +#define DEVICE_XATOM_PIXEL_SIZE(d) (DEVICE_X_DATA (d)->Xatom_PIXEL_SIZE) +#define DEVICE_XATOM_POINT_SIZE(d) (DEVICE_X_DATA (d)->Xatom_POINT_SIZE) +#define DEVICE_XATOM_RESOLUTION_X(d) (DEVICE_X_DATA (d)->Xatom_RESOLUTION_X) +#define DEVICE_XATOM_RESOLUTION_Y(d) (DEVICE_X_DATA (d)->Xatom_RESOLUTION_Y) +#define DEVICE_XATOM_SPACING(d) (DEVICE_X_DATA (d)->Xatom_SPACING) +#define DEVICE_XATOM_AVERAGE_WIDTH(d) (DEVICE_X_DATA (d)->Xatom_AVERAGE_WIDTH) +#define DEVICE_XATOM_CHARSET_REGISTRY(d) (DEVICE_X_DATA (d)->Xatom_CHARSET_REGISTRY) +#define DEVICE_XATOM_CHARSET_ENCODING(d) (DEVICE_X_DATA (d)->Xatom_CHARSET_ENCODING) + +/* The maximum number of widgets that can be displayed above the text + area at one time. Currently no more than 3 will ever actually be + displayed (menubar, psheet, debugger panel). */ +#define MAX_CONCURRENT_TOP_WIDGETS 8 + +struct x_frame +{ + /* The widget of this frame. This is an EmacsShell or an + ExternalShell. */ + Widget widget; + + /* The parent of the EmacsFrame, the menubar, and the scrollbars. + This is an EmacsManager. */ + Widget container; + + /* The widget of the menubar, of whatever widget class it happens to be. */ + Widget menubar_widget; + + /* The widget of the edit portion of this frame; this is an EmacsFrame, + and the window of this widget is what the redisplay code draws on. */ + Widget edit_widget; + + /* Lists the widgets above the text area, in the proper order. + Used by the EmacsManager. */ + Widget top_widgets[MAX_CONCURRENT_TOP_WIDGETS]; + int num_top_widgets; + + /*************************** Miscellaneous **************************/ + + /* The icon pixmaps; these are Lisp_Image_Instance objects, or Qnil. */ + Lisp_Object icon_pixmap; + Lisp_Object icon_pixmap_mask; + +#ifdef HAVE_TOOLBARS + int old_toolbar_size[4]; + + /* We don't provide a mechanism for changing these after they are + initialized so we might as well keep pointers to them and avoid + lots of expensive calls to gc_cache_lookup. */ + GC toolbar_top_shadow_gc; + GC toolbar_bottom_shadow_gc; + GC toolbar_blank_background_gc; + GC toolbar_pixmap_background_gc; +#endif /* HAVE_TOOLBARS */ + + /* geometry string that ought to be freed. */ + char *geom_free_me_please; + +#ifdef HAVE_XIM + XPoint xic_spot; /* Spot Location cache */ +#ifdef XIM_XLIB + XIC xic; + /* Could get these at any time by asking xic, but... */ + XIMStyle xic_style; /* XIM Style cache */ +#endif /* XIM_XLIB */ +#endif /* HAVE_XIM */ + + /* 1 if the frame is completely visible on the display, 0 otherwise. + if 0 the frame may have been iconified or may be totally + or partially hidden by another X window */ + unsigned int totally_visible_p :1; + + /* NB: Both of the following flags are derivable from the 'shell' + field above, but it's easier if we also have them separately here. */ + + /* Are we a top-level frame? This means that our shell is a + TopLevelShell, and we should do certain things to interact with + the window manager. */ + unsigned int top_level_frame_p :1; + +#ifdef EXTERNAL_WIDGET + /* Are we using somebody else's window for our shell window? This + means that our shell is an ExternalShell. If this flag is set, then + `top_level_frame_p' will never be set. */ + unsigned int external_window_p :1; +#endif /* EXTERNAL_WIDGET */ +}; + +#define FRAME_X_DATA(f) FRAME_TYPE_DATA (f, x) + +#define FRAME_X_SHELL_WIDGET(f) (FRAME_X_DATA (f)->widget) +#define FRAME_X_CONTAINER_WIDGET(f) (FRAME_X_DATA (f)->container) +#define FRAME_X_MENUBAR_WIDGET(f) (FRAME_X_DATA (f)->menubar_widget) +#define FRAME_X_TEXT_WIDGET(f) (FRAME_X_DATA (f)->edit_widget) +#define FRAME_X_TOP_WIDGETS(f) (FRAME_X_DATA (f)->top_widgets) +#define FRAME_X_NUM_TOP_WIDGETS(f) (FRAME_X_DATA (f)->num_top_widgets) + +#define FRAME_X_ICON_PIXMAP(f) (FRAME_X_DATA (f)->icon_pixmap) +#define FRAME_X_ICON_PIXMAP_MASK(f) (FRAME_X_DATA (f)->icon_pixmap_mask) + +#ifdef HAVE_TOOLBARS +#define FRAME_X_OLD_TOOLBAR_SIZE(f, pos) (FRAME_X_DATA (f)->old_toolbar_size[pos]) + +#define FRAME_X_TOOLBAR_TOP_SHADOW_GC(f) (FRAME_X_DATA (f)->toolbar_top_shadow_gc) +#define FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC(f) (FRAME_X_DATA (f)->toolbar_bottom_shadow_gc) +#define FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC(f) (FRAME_X_DATA (f)->toolbar_blank_background_gc) +#define FRAME_X_TOOLBAR_PIXMAP_BACKGROUND_GC(f) (FRAME_X_DATA (f)->toolbar_pixmap_background_gc) +#endif /* HAVE_TOOLBARS */ + +#define FRAME_X_GEOM_FREE_ME_PLEASE(f) (FRAME_X_DATA (f)->geom_free_me_please) + +#define FRAME_X_TOTALLY_VISIBLE_P(f) (FRAME_X_DATA (f)->totally_visible_p) +#define FRAME_X_TOP_LEVEL_FRAME_P(f) (FRAME_X_DATA (f)->top_level_frame_p) + +#ifdef EXTERNAL_WIDGET +#define FRAME_X_EXTERNAL_WINDOW_P(f) (FRAME_X_DATA (f)->external_window_p) +#endif + +#ifdef HAVE_XIM +#define FRAME_X_XIC_SPOT(f) (FRAME_X_DATA (f)->xic_spot) +#ifdef XIM_XLIB +#define FRAME_X_XIC(f) (FRAME_X_DATA (f)->xic) +#define FRAME_X_XIC_STYLE(f) (FRAME_X_DATA (f)->xic_style) +#endif /* XIM_XLIB */ +#endif /* HAVE_XIM */ + +extern struct console_type *x_console_type; + +#endif /* HAVE_X_WINDOWS */ + +#endif /* INCLUDED_console_x_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/console-x.c' 'xemacs-21.5.7/src/console-x.c' Index: ././src/console-x.c --- ././src/console-x.c Fri Mar 29 13:47:05 2002 +++ ././src/console-x.c Fri Jun 21 06:18:24 2002 @@ -30,11 +30,12 @@ #include #include "lisp.h" -#include "console-x.h" #include "buffer.h" #include "process.h" /* canonicalize_host_name */ #include "redisplay.h" /* for display_arg */ +#include "console-x-impl.h" + DEFINE_CONSOLE_TYPE (x); static int @@ -48,21 +49,21 @@ split_up_display_spec (Lisp_Object display, int *hostname_length, int *display_length, int *screen_length) { - Intbyte *beg = XSTRING_DATA (display); - Intbyte *end = beg + XSTRING_LENGTH (display); - Intbyte *p = end; + Ibyte *beg = XSTRING_DATA (display); + Ibyte *end = beg + XSTRING_LENGTH (display); + Ibyte *p = end; while (p > beg) { - DEC_CHARPTR (p); - if (charptr_emchar (p) == ':') + DEC_IBYTEPTR (p); + if (itext_ichar (p) == ':') { *hostname_length = p - beg; while (p < end - 1) { - INC_CHARPTR (p); - if (charptr_emchar (p) == '.') + INC_IBYTEPTR (p); + if (itext_ichar (p) == '.') { *display_length = p - beg - *hostname_length; *screen_length = end - p; @@ -193,20 +194,20 @@ connection = x_device_to_console_connection (connection, errb); /* Check for a couple of standard special cases */ - if (XSTRING_CHAR (connection, 0) == ':') + if (string_ichar (connection, 0) == ':') connection = concat2 (build_string ("localhost"), connection); else { /* connection =~ s/^unix:/localhost:/; */ - const Intbyte *p = XSTRING_DATA (connection); - const Intbyte *end = XSTRING_DATA (connection) + XSTRING_LENGTH (connection); + const Ibyte *p = XSTRING_DATA (connection); + const Ibyte *end = XSTRING_DATA (connection) + XSTRING_LENGTH (connection); int i; for (i = 0; i < (int) sizeof ("unix:") - 1; i++) { - if (p == end || charptr_emchar (p) != "unix:"[i]) + if (p == end || itext_ichar (p) != "unix:"[i]) goto ok; - INC_CHARPTR (p); + INC_IBYTEPTR (p); } connection = concat2 (build_string ("localhost:"), diff --text -u 'xemacs-21.5.6/src/console-x.h' 'xemacs-21.5.7/src/console-x.h' Index: ././src/console-x.h --- ././src/console-x.h Fri Mar 29 13:47:05 2002 +++ ././src/console-x.h Fri Jun 21 06:18:24 2002 @@ -53,186 +53,6 @@ # define XPointer char * #endif -DECLARE_CONSOLE_TYPE (x); - -struct x_device -{ - /* The X connection of this device. */ - Display *display; - - /* Set by x_IO_error_handler(). */ - int being_deleted; - - /* Xt application info. */ - Widget Xt_app_shell; - - /* Cache of GC's for frames on this device. */ - struct gc_cache *gc_cache; - - /* Selected visual, depth and colormap for this device */ - Visual *visual; - int depth; - Colormap device_cmap; - - /* Used by x_bevel_modeline in redisplay-x.c */ - Pixmap gray_pixmap; - - /* Atoms associated with this device. */ - /* allocated in Xatoms_of_device_x */ - Atom Xatom_WM_PROTOCOLS; - Atom Xatom_WM_DELETE_WINDOW; - Atom Xatom_WM_SAVE_YOURSELF; - Atom Xatom_WM_TAKE_FOCUS; - Atom Xatom_WM_STATE; - - /* allocated in Xatoms_of_select_x */ - Atom Xatom_CLIPBOARD; - Atom Xatom_TIMESTAMP; - Atom Xatom_TEXT; - Atom Xatom_DELETE; - Atom Xatom_MULTIPLE; - Atom Xatom_INCR; - Atom Xatom_EMACS_TMP; - Atom Xatom_TARGETS; - Atom Xatom_NULL; - Atom Xatom_ATOM_PAIR; - Atom Xatom_COMPOUND_TEXT; - - /* allocated in Xatoms_of_objects_x */ - Atom Xatom_FOUNDRY; - Atom Xatom_FAMILY_NAME; - Atom Xatom_WEIGHT_NAME; - Atom Xatom_SLANT; - Atom Xatom_SETWIDTH_NAME; - Atom Xatom_ADD_STYLE_NAME; - Atom Xatom_PIXEL_SIZE; - Atom Xatom_POINT_SIZE; - Atom Xatom_RESOLUTION_X; - Atom Xatom_RESOLUTION_Y; - Atom Xatom_SPACING; - Atom Xatom_AVERAGE_WIDTH; - Atom Xatom_CHARSET_REGISTRY; - Atom Xatom_CHARSET_ENCODING; - - /* The following items are all used exclusively in event-Xt.c. */ - int MetaMask, HyperMask, SuperMask, AltMask, ModeMask; - KeySym lock_interpretation; - - XModifierKeymap *x_modifier_keymap; - - KeySym *x_keysym_map; - int x_keysym_map_min_code; - int x_keysym_map_max_code; - int x_keysym_map_keysyms_per_code; - Lisp_Object x_keysym_map_hash_table; - - /* frame that holds the WM_COMMAND property; there should be exactly - one of these per device. */ - Lisp_Object WM_COMMAND_frame; - - /* #### It's not clear that there is much distinction anymore - between mouse_timestamp and global_mouse_timestamp, now that - Emacs doesn't see most (all?) events not destined for it. */ - - /* The timestamp of the last button or key event used by emacs itself. - This is used for asserting selections and input focus. */ - Time mouse_timestamp; - - /* This is the timestamp the last button or key event whether it was - dispatched to emacs or widgets. */ - Time global_mouse_timestamp; - - /* This is the last known timestamp received from the server. It is - maintained by x_event_to_emacs_event and used to patch bogus - WM_TAKE_FOCUS messages sent by Mwm. */ - Time last_server_timestamp; - - /* Used by Xlib to preserve information across calls to - XLookupString(), to implement compose processing. - - According to The X Window System, p. 467, "The creation of - XComposeStatus structures is implementation dependent; - a portable program must pass NULL for this argument." - But this means that a portable program cannot implement - compose processing! WTF? - - So we just set it to all zeros. */ - - /* No X Server ever used this, AFAIK -- mrb */ - /* XComposeStatus x_compose_status; */ - -#ifdef HAVE_XIM - XIM xim; - XIMStyles *xim_styles; -#endif /* HAVE_XIM */ - - /* stuff for sticky modifiers: */ - - unsigned int need_to_add_mask, down_mask; - KeyCode last_downkey; - Time release_time; - Time modifier_release_time; -}; - -#define DEVICE_X_DATA(d) DEVICE_TYPE_DATA (d, x) - -#define FRAME_X_DISPLAY(f) (DEVICE_X_DISPLAY (XDEVICE (f->device))) -#define DEVICE_X_DISPLAY(d) (DEVICE_X_DATA (d)->display) -#define DEVICE_X_BEING_DELETED(d) (DEVICE_X_DATA (d)->being_deleted) -#define DEVICE_X_VISUAL(d) (DEVICE_X_DATA (d)->visual) -#define DEVICE_X_DEPTH(d) (DEVICE_X_DATA (d)->depth) -#define DEVICE_X_COLORMAP(d) (DEVICE_X_DATA (d)->device_cmap) -#define DEVICE_XT_APP_SHELL(d) (DEVICE_X_DATA (d)->Xt_app_shell) -#define DEVICE_X_GC_CACHE(d) (DEVICE_X_DATA (d)->gc_cache) -#define DEVICE_X_GRAY_PIXMAP(d) (DEVICE_X_DATA (d)->gray_pixmap) -#define DEVICE_X_WM_COMMAND_FRAME(d) (DEVICE_X_DATA (d)->WM_COMMAND_frame) -#define DEVICE_X_MOUSE_TIMESTAMP(d) (DEVICE_X_DATA (d)->mouse_timestamp) -#define DEVICE_X_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_X_DATA (d)->global_mouse_timestamp) -#define DEVICE_X_LAST_SERVER_TIMESTAMP(d) (DEVICE_X_DATA (d)->last_server_timestamp) -#define DEVICE_X_KEYSYM_MAP_HASH_TABLE(d) (DEVICE_X_DATA (d)->x_keysym_map_hash_table) -/* #define DEVICE_X_X_COMPOSE_STATUS(d) (DEVICE_X_DATA (d)->x_compose_status) */ -#ifdef HAVE_XIM -#define DEVICE_X_XIM(d) (DEVICE_X_DATA (d)->xim) -#define DEVICE_X_XIM_STYLES(d) (DEVICE_X_DATA (d)->xim_styles) -#define DEVICE_X_FONTSET(d) (DEVICE_X_DATA (d)->fontset) -#endif /* HAVE_XIM */ - -/* allocated in Xatoms_of_device_x */ -#define DEVICE_XATOM_WM_PROTOCOLS(d) (DEVICE_X_DATA (d)->Xatom_WM_PROTOCOLS) -#define DEVICE_XATOM_WM_DELETE_WINDOW(d) (DEVICE_X_DATA (d)->Xatom_WM_DELETE_WINDOW) -#define DEVICE_XATOM_WM_SAVE_YOURSELF(d) (DEVICE_X_DATA (d)->Xatom_WM_SAVE_YOURSELF) -#define DEVICE_XATOM_WM_TAKE_FOCUS(d) (DEVICE_X_DATA (d)->Xatom_WM_TAKE_FOCUS) -#define DEVICE_XATOM_WM_STATE(d) (DEVICE_X_DATA (d)->Xatom_WM_STATE) - -/* allocated in Xatoms_of_select_x */ -#define DEVICE_XATOM_CLIPBOARD(d) (DEVICE_X_DATA (d)->Xatom_CLIPBOARD) -#define DEVICE_XATOM_TIMESTAMP(d) (DEVICE_X_DATA (d)->Xatom_TIMESTAMP) -#define DEVICE_XATOM_TEXT(d) (DEVICE_X_DATA (d)->Xatom_TEXT) -#define DEVICE_XATOM_DELETE(d) (DEVICE_X_DATA (d)->Xatom_DELETE) -#define DEVICE_XATOM_MULTIPLE(d) (DEVICE_X_DATA (d)->Xatom_MULTIPLE) -#define DEVICE_XATOM_INCR(d) (DEVICE_X_DATA (d)->Xatom_INCR) -#define DEVICE_XATOM_EMACS_TMP(d) (DEVICE_X_DATA (d)->Xatom_EMACS_TMP) -#define DEVICE_XATOM_TARGETS(d) (DEVICE_X_DATA (d)->Xatom_TARGETS) -#define DEVICE_XATOM_NULL(d) (DEVICE_X_DATA (d)->Xatom_NULL) -#define DEVICE_XATOM_ATOM_PAIR(d) (DEVICE_X_DATA (d)->Xatom_ATOM_PAIR) -#define DEVICE_XATOM_COMPOUND_TEXT(d) (DEVICE_X_DATA (d)->Xatom_COMPOUND_TEXT) - -/* allocated in Xatoms_of_objects_x */ -#define DEVICE_XATOM_FOUNDRY(d) (DEVICE_X_DATA (d)->Xatom_FOUNDRY) -#define DEVICE_XATOM_FAMILY_NAME(d) (DEVICE_X_DATA (d)->Xatom_FAMILY_NAME) -#define DEVICE_XATOM_WEIGHT_NAME(d) (DEVICE_X_DATA (d)->Xatom_WEIGHT_NAME) -#define DEVICE_XATOM_SLANT(d) (DEVICE_X_DATA (d)->Xatom_SLANT) -#define DEVICE_XATOM_SETWIDTH_NAME(d) (DEVICE_X_DATA (d)->Xatom_SETWIDTH_NAME) -#define DEVICE_XATOM_ADD_STYLE_NAME(d) (DEVICE_X_DATA (d)->Xatom_ADD_STYLE_NAME) -#define DEVICE_XATOM_PIXEL_SIZE(d) (DEVICE_X_DATA (d)->Xatom_PIXEL_SIZE) -#define DEVICE_XATOM_POINT_SIZE(d) (DEVICE_X_DATA (d)->Xatom_POINT_SIZE) -#define DEVICE_XATOM_RESOLUTION_X(d) (DEVICE_X_DATA (d)->Xatom_RESOLUTION_X) -#define DEVICE_XATOM_RESOLUTION_Y(d) (DEVICE_X_DATA (d)->Xatom_RESOLUTION_Y) -#define DEVICE_XATOM_SPACING(d) (DEVICE_X_DATA (d)->Xatom_SPACING) -#define DEVICE_XATOM_AVERAGE_WIDTH(d) (DEVICE_X_DATA (d)->Xatom_AVERAGE_WIDTH) -#define DEVICE_XATOM_CHARSET_REGISTRY(d) (DEVICE_X_DATA (d)->Xatom_CHARSET_REGISTRY) -#define DEVICE_XATOM_CHARSET_ENCODING(d) (DEVICE_X_DATA (d)->Xatom_CHARSET_ENCODING) - #define Xt_SET_VALUE(widget, resource, value) do { \ Arg al; \ XtSetArg (al, resource, value); \ @@ -245,122 +65,6 @@ XtGetValues (widget, &al, 1); \ } while (0) -/* The maximum number of widgets that can be displayed above the text - area at one time. Currently no more than 3 will ever actually be - displayed (menubar, psheet, debugger panel). */ -#define MAX_CONCURRENT_TOP_WIDGETS 8 - -struct x_frame -{ - /* The widget of this frame. This is an EmacsShell or an - ExternalShell. */ - Widget widget; - - /* The parent of the EmacsFrame, the menubar, and the scrollbars. - This is an EmacsManager. */ - Widget container; - - /* The widget of the menubar, of whatever widget class it happens to be. */ - Widget menubar_widget; - - /* The widget of the edit portion of this frame; this is an EmacsFrame, - and the window of this widget is what the redisplay code draws on. */ - Widget edit_widget; - - /* Lists the widgets above the text area, in the proper order. - Used by the EmacsManager. */ - Widget top_widgets[MAX_CONCURRENT_TOP_WIDGETS]; - int num_top_widgets; - - /*************************** Miscellaneous **************************/ - - /* The icon pixmaps; these are Lisp_Image_Instance objects, or Qnil. */ - Lisp_Object icon_pixmap; - Lisp_Object icon_pixmap_mask; - -#ifdef HAVE_TOOLBARS - int old_toolbar_size[4]; - - /* We don't provide a mechanism for changing these after they are - initialized so we might as well keep pointers to them and avoid - lots of expensive calls to gc_cache_lookup. */ - GC toolbar_top_shadow_gc; - GC toolbar_bottom_shadow_gc; - GC toolbar_blank_background_gc; - GC toolbar_pixmap_background_gc; -#endif /* HAVE_TOOLBARS */ - - /* geometry string that ought to be freed. */ - char *geom_free_me_please; - -#ifdef HAVE_XIM - XPoint xic_spot; /* Spot Location cache */ -#ifdef XIM_XLIB - XIC xic; - /* Could get these at any time by asking xic, but... */ - XIMStyle xic_style; /* XIM Style cache */ -#endif /* XIM_XLIB */ -#endif /* HAVE_XIM */ - - /* 1 if the frame is completely visible on the display, 0 otherwise. - if 0 the frame may have been iconified or may be totally - or partially hidden by another X window */ - unsigned int totally_visible_p :1; - - /* NB: Both of the following flags are derivable from the 'shell' - field above, but it's easier if we also have them separately here. */ - - /* Are we a top-level frame? This means that our shell is a - TopLevelShell, and we should do certain things to interact with - the window manager. */ - unsigned int top_level_frame_p :1; - -#ifdef EXTERNAL_WIDGET - /* Are we using somebody else's window for our shell window? This - means that our shell is an ExternalShell. If this flag is set, then - `top_level_frame_p' will never be set. */ - unsigned int external_window_p :1; -#endif /* EXTERNAL_WIDGET */ -}; - -#define FRAME_X_DATA(f) FRAME_TYPE_DATA (f, x) - -#define FRAME_X_SHELL_WIDGET(f) (FRAME_X_DATA (f)->widget) -#define FRAME_X_CONTAINER_WIDGET(f) (FRAME_X_DATA (f)->container) -#define FRAME_X_MENUBAR_WIDGET(f) (FRAME_X_DATA (f)->menubar_widget) -#define FRAME_X_TEXT_WIDGET(f) (FRAME_X_DATA (f)->edit_widget) -#define FRAME_X_TOP_WIDGETS(f) (FRAME_X_DATA (f)->top_widgets) -#define FRAME_X_NUM_TOP_WIDGETS(f) (FRAME_X_DATA (f)->num_top_widgets) - -#define FRAME_X_ICON_PIXMAP(f) (FRAME_X_DATA (f)->icon_pixmap) -#define FRAME_X_ICON_PIXMAP_MASK(f) (FRAME_X_DATA (f)->icon_pixmap_mask) - -#ifdef HAVE_TOOLBARS -#define FRAME_X_OLD_TOOLBAR_SIZE(f, pos) (FRAME_X_DATA (f)->old_toolbar_size[pos]) - -#define FRAME_X_TOOLBAR_TOP_SHADOW_GC(f) (FRAME_X_DATA (f)->toolbar_top_shadow_gc) -#define FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC(f) (FRAME_X_DATA (f)->toolbar_bottom_shadow_gc) -#define FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC(f) (FRAME_X_DATA (f)->toolbar_blank_background_gc) -#define FRAME_X_TOOLBAR_PIXMAP_BACKGROUND_GC(f) (FRAME_X_DATA (f)->toolbar_pixmap_background_gc) -#endif /* HAVE_TOOLBARS */ - -#define FRAME_X_GEOM_FREE_ME_PLEASE(f) (FRAME_X_DATA (f)->geom_free_me_please) - -#define FRAME_X_TOTALLY_VISIBLE_P(f) (FRAME_X_DATA (f)->totally_visible_p) -#define FRAME_X_TOP_LEVEL_FRAME_P(f) (FRAME_X_DATA (f)->top_level_frame_p) - -#ifdef EXTERNAL_WIDGET -#define FRAME_X_EXTERNAL_WINDOW_P(f) (FRAME_X_DATA (f)->external_window_p) -#endif - -#ifdef HAVE_XIM -#define FRAME_X_XIC_SPOT(f) (FRAME_X_DATA (f)->xic_spot) -#ifdef XIM_XLIB -#define FRAME_X_XIC(f) (FRAME_X_DATA (f)->xic) -#define FRAME_X_XIC_STYLE(f) (FRAME_X_DATA (f)->xic_style) -#endif /* XIM_XLIB */ -#endif /* HAVE_XIM */ - /* Variables associated with the X display frame this emacs is using. */ extern XtAppContext Xt_app_con; @@ -368,9 +72,6 @@ extern Lisp_Object Vx_scrollbar_pointer_shape; extern Lisp_Object Qx_error; -extern struct console_type *x_console_type; -extern Lisp_Object Vdefault_x_device; - /* Number of pixels below each line. */ extern int x_interline_space; /* #### implement me */ @@ -406,7 +107,7 @@ void x_redraw_exposed_area (struct frame *f, int x, int y, int width, int height); void x_output_string (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, int xoffset, + Ichar_dynarr *buf, int xpos, int xoffset, int start_pixpos, int width, face_index findex, int cursor, int cursor_start, int cursor_width, int cursor_height); diff --text -u 'xemacs-21.5.6/src/console.c' 'xemacs-21.5.7/src/console.c' Index: ././src/console.c --- ././src/console.c Sun Mar 31 17:27:50 2002 +++ ././src/console.c Fri Jun 21 06:18:24 2002 @@ -21,20 +21,26 @@ /* Synched up with: Not in FSF. */ -/* Written by Ben Wing. */ +/* Written by Ben Wing, late 1995?. + suspend-console, set-input-mode, and related stuff largely based on + existing code. +*/ #include #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "console-impl.h" +#include "device-impl.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "redisplay.h" #include "sysdep.h" #include "window.h" -#include "console-tty.h" +#ifdef HAVE_TTY +#include "console-tty-impl.h" +#endif Lisp_Object Vconsole_list, Vselected_console; @@ -217,6 +223,18 @@ return CDFW_CONSOLE (object); } +int +console_live_p (struct console *c) +{ + return CONSOLE_LIVE_P (c); +} + +Lisp_Object +console_device_list (struct console *c) +{ + return CONSOLE_DEVICE_LIST (c); +} + DEFUN ("selected-console", Fselected_console, 0, 0, 0, /* Return the console which is currently active. @@ -488,6 +506,7 @@ /* Do it this way so that the console list is in order of creation */ Vconsole_list = nconc2 (Vconsole_list, Fcons (console, Qnil)); + note_object_created (console); if (CONMETH_OR_GIVEN (con, initially_selected_for_input, (con), 0)) event_stream_select_console (con); @@ -553,7 +572,7 @@ { Lisp_Object console; - VOID_TO_LISP (console, closure); + console = VOID_TO_LISP (closure); if (FRAME_MINIBUF_ONLY_P (XFRAME (frame))) return 0; if (EQ (console, FRAME_CONSOLE (XFRAME (frame)))) @@ -603,6 +622,10 @@ return; console = wrap_console (con); + + if (!force) + check_allowed_operation (OPERATION_DELETE_OBJECT, console, Qnil); + GCPRO1 (console); if (!called_from_kill_emacs) @@ -726,6 +749,7 @@ them. */ nuke_all_console_slots (con, Qnil); con->conmeths = dead_console_methods; + note_object_deleted (console); UNGCPRO; } diff --text -u 'xemacs-21.5.6/src/console.h' 'xemacs-21.5.7/src/console.h' Index: ././src/console.h --- ././src/console.h Sun Mar 31 17:27:51 2002 +++ ././src/console.h Sun Jun 23 02:14:45 2002 @@ -1,5 +1,5 @@ /* Define console object for XEmacs. - Copyright (C) 1996 Ben Wing + Copyright (C) 1996, 2002 Ben Wing This file is part of XEmacs. @@ -60,411 +60,7 @@ DM_show_sounds, DM_slow_device, DM_security }; -extern const struct struct_description cted_description; -extern const struct struct_description console_methods_description; - - -/* - * Constants returned by device_implementation_flags_method - */ - -/* Set when device uses pixel-based geometry */ -#define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L - -/* Indicates that the device is a printer */ -#define XDEVIMPF_IS_A_PRINTER 0x00000002L - -/* Do not automatically redisplay this device */ -#define XDEVIMPF_NO_AUTO_REDISPLAY 0x00000004L - -/* Do not delete the device when last frame's gone */ -#define XDEVIMPF_FRAMELESS_OK 0x00000008L - -/* Do not preempt resiaply of frame or device once it starts */ -#define XDEVIMPF_DONT_PREEMPT_REDISPLAY 0x00000010L - -struct console_methods -{ - const char *name; /* Used by print_console, print_device, print_frame */ - Lisp_Object symbol; - Lisp_Object predicate_symbol; - unsigned int flags; /* Read-only implementation flags, set once upon - console type creation. INITIALIZE_CONSOLE_TYPE sets - this member to 0. */ - - /* console methods */ - void (*init_console_method) (struct console *, Lisp_Object props); - void (*mark_console_method) (struct console *); - int (*initially_selected_for_input_method) (struct console *); - void (*delete_console_method) (struct console *); - Lisp_Object (*semi_canonicalize_console_connection_method) - (Lisp_Object connection, Error_Behavior errb); - Lisp_Object (*semi_canonicalize_device_connection_method) - (Lisp_Object connection, Error_Behavior errb); - Lisp_Object (*canonicalize_console_connection_method) - (Lisp_Object connection, Error_Behavior errb); - Lisp_Object (*canonicalize_device_connection_method) - (Lisp_Object connection, Error_Behavior errb); - Lisp_Object (*device_to_console_connection_method) - (Lisp_Object connection, Error_Behavior errb); - - /* device methods */ - void (*init_device_method) (struct device *, Lisp_Object props); - void (*finish_init_device_method) (struct device *, Lisp_Object props); - void (*delete_device_method) (struct device *); - void (*mark_device_method) (struct device *); - void (*asynch_device_change_method) (void); - Lisp_Object (*device_system_metrics_method) (struct device *, - enum device_metrics); - Lisp_Object (*own_selection_method)(Lisp_Object selection_name, - Lisp_Object selection_value, - Lisp_Object how_to_add, - Lisp_Object selection_type, - int owned_p); - void (*disown_selection_method)(Lisp_Object selection_name, - Lisp_Object timeval); - Lisp_Object (*get_foreign_selection_method) (Lisp_Object selection_symbol, - Lisp_Object target_type); - Lisp_Object (*selection_exists_p_method)(Lisp_Object selection_name, - Lisp_Object selection_type); - Lisp_Object (*available_selection_types_method)(Lisp_Object selection_name); - Lisp_Object (*register_selection_data_type_method)(Lisp_Object type_name); - Lisp_Object (*selection_data_type_name_method)(Lisp_Object type); - - /* frame methods */ - Lisp_Object *device_specific_frame_props; - void (*init_frame_1_method) (struct frame *, Lisp_Object properties, - int frame_name_is_defaulted); - void (*init_frame_2_method) (struct frame *, Lisp_Object properties); - void (*init_frame_3_method) (struct frame *); - void (*after_init_frame_method) (struct frame *, int first_on_device, - int first_on_console); - void (*mark_frame_method) (struct frame *); - void (*delete_frame_method) (struct frame *); - void (*focus_on_frame_method) (struct frame *); - void (*raise_frame_method) (struct frame *); - void (*lower_frame_method) (struct frame *); - void (*enable_frame_method) (struct frame *); - void (*disable_frame_method) (struct frame *); - int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame, - int *x, int *y); - void (*set_mouse_position_method) (struct window *w, int x, int y); - void (*make_frame_visible_method) (struct frame *f); - void (*make_frame_invisible_method) (struct frame *f); - void (*iconify_frame_method) (struct frame *f); - Lisp_Object (*frame_property_method) (struct frame *f, Lisp_Object prop); - int (*internal_frame_property_p_method) (struct frame *f, - Lisp_Object prop); - Lisp_Object (*frame_properties_method) (struct frame *f); - void (*set_frame_properties_method) (struct frame *f, Lisp_Object plist); - void (*set_frame_size_method) (struct frame *f, int width, int height); - void (*set_frame_position_method) (struct frame *f, int xoff, int yoff); - int (*frame_visible_p_method) (struct frame *f); - int (*frame_totally_visible_p_method) (struct frame *f); - int (*frame_iconified_p_method) (struct frame *f); - void (*set_title_from_intbyte_method) (struct frame *f, Intbyte *title); - void (*set_icon_name_from_intbyte_method) (struct frame *f, Intbyte *title); - void (*set_frame_pointer_method) (struct frame *f); - void (*set_frame_icon_method) (struct frame *f); - void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event); - Lisp_Object (*get_frame_parent_method) (struct frame *f); - void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name); - int (*frame_size_fixed_p_method) (struct frame *f); - void (*eject_page_method) (struct frame *f); - - /* redisplay methods */ - int (*left_margin_width_method) (struct window *); - int (*right_margin_width_method) (struct window *); - int (*text_width_method) (struct frame *f, struct face_cachel *cachel, - const Emchar *str, Charcount len); - void (*output_display_block_method) (struct window *, struct display_line *, - int, int, int, int, int, int, int); - int (*divider_height_method) (void); - int (*eol_cursor_width_method) (void); - void (*output_vertical_divider_method) (struct window *, int); - void (*clear_to_window_end_method) (struct window *, int, int); - void (*clear_region_method) (Lisp_Object, struct device*, struct frame*, face_index, - int, int, int, int, - Lisp_Object, Lisp_Object, Lisp_Object); - void (*clear_frame_method) (struct frame *); - void (*window_output_begin_method) (struct window *); - void (*frame_output_begin_method) (struct frame *); - void (*window_output_end_method) (struct window *); - void (*frame_output_end_method) (struct frame *); - int (*flash_method) (struct device *); - void (*ring_bell_method) (struct device *, int volume, int pitch, - int duration); - void (*frame_redraw_cursor_method) (struct frame *f); - void (*set_final_cursor_coords_method) (struct frame *, int, int); - void (*bevel_area_method) (struct window *, face_index, int, int, int, int, int, - int, enum edge_style); - void (*output_pixmap_method) (struct window *w, Lisp_Object image_instance, - struct display_box *db, struct display_glyph_area *dga, - face_index findex, int cursor_start, int cursor_width, - int cursor_height, int offset_bitmap); - void (*output_string_method) (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, int xoffset, - int start_pixpos, int width, face_index findex, - int cursor, int cursor_start, int cursor_width, - int cursor_height); - - /* color methods */ - int (*initialize_color_instance_method) (Lisp_Color_Instance *, - Lisp_Object name, - Lisp_Object device, - Error_Behavior errb); - void (*mark_color_instance_method) (Lisp_Color_Instance *); - void (*print_color_instance_method) (Lisp_Color_Instance *, - Lisp_Object printcharfun, - int escapeflag); - void (*finalize_color_instance_method) (Lisp_Color_Instance *); - int (*color_instance_equal_method) (Lisp_Color_Instance *, - Lisp_Color_Instance *, - int depth); - Hashcode (*color_instance_hash_method) (Lisp_Color_Instance *, - int depth); - Lisp_Object (*color_instance_rgb_components_method) (Lisp_Color_Instance *); - int (*valid_color_name_p_method) (struct device *, Lisp_Object color); - - /* font methods */ - int (*initialize_font_instance_method) (Lisp_Font_Instance *, - Lisp_Object name, - Lisp_Object device, - Error_Behavior errb); - void (*mark_font_instance_method) (Lisp_Font_Instance *); - void (*print_font_instance_method) (Lisp_Font_Instance *, - Lisp_Object printcharfun, - int escapeflag); - void (*finalize_font_instance_method) (Lisp_Font_Instance *); - Lisp_Object (*font_instance_truename_method) (Lisp_Font_Instance *, - Error_Behavior errb); - Lisp_Object (*font_instance_properties_method) (Lisp_Font_Instance *); - Lisp_Object (*list_fonts_method) (Lisp_Object pattern, - Lisp_Object device); - Lisp_Object (*find_charset_font_method) (Lisp_Object device, - Lisp_Object font, - Lisp_Object charset); - int (*font_spec_matches_charset_method) (struct device *d, - Lisp_Object charset, - const Intbyte *nonreloc, - Lisp_Object reloc, - Bytecount offset, - Bytecount length); - - /* image methods */ - void (*mark_image_instance_method) (Lisp_Image_Instance *); - void (*print_image_instance_method) (Lisp_Image_Instance *, - Lisp_Object printcharfun, - int escapeflag); - void (*finalize_image_instance_method) (Lisp_Image_Instance *); - void (*unmap_subwindow_method) (Lisp_Image_Instance *); - void (*map_subwindow_method) (Lisp_Image_Instance *, int x, int y, - struct display_glyph_area* dga); - void (*resize_subwindow_method) (Lisp_Image_Instance *, int w, int h); - void (*redisplay_subwindow_method) (Lisp_Image_Instance *); - void (*redisplay_widget_method) (Lisp_Image_Instance *); - int (*image_instance_equal_method) (Lisp_Image_Instance *, - Lisp_Image_Instance *, - int depth); - Hashcode (*image_instance_hash_method) (Lisp_Image_Instance *, - int depth); - void (*init_image_instance_from_eimage_method) (Lisp_Image_Instance *ii, - int width, int height, - int slices, - unsigned char *eimage, - int dest_mask, - Lisp_Object instantiator, - Lisp_Object domain); - Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method); - int (*colorize_image_instance_method) (Lisp_Object image_instance, - Lisp_Object fg, Lisp_Object bg); - void (*widget_query_string_geometry_method) (Lisp_Object string, - Lisp_Object face, - int* width, int* height, - Lisp_Object domain); - Lisp_Object image_conversion_list; - -#ifdef HAVE_TOOLBARS - /* toolbar methods */ - void (*output_frame_toolbars_method) (struct frame *); - void (*initialize_frame_toolbars_method) (struct frame *); - void (*free_frame_toolbars_method) (struct frame *); - void (*output_toolbar_button_method) (struct frame *, Lisp_Object); - void (*redraw_frame_toolbars_method) (struct frame *); - void (*redraw_exposed_toolbars_method) (struct frame *f, int x, int y, - int width, int height); -#endif - -#ifdef HAVE_SCROLLBARS - /* scrollbar methods */ - int (*inhibit_scrollbar_slider_size_change_method) (void); - void (*free_scrollbar_instance_method) (struct scrollbar_instance *); - void (*release_scrollbar_instance_method) (struct scrollbar_instance *); - void (*create_scrollbar_instance_method) (struct frame *, int, - struct scrollbar_instance *); - void (*update_scrollbar_instance_values_method) (struct window *, - struct scrollbar_instance *, - int, int, int, int, int, - int, int, int, int, int); - void (*update_scrollbar_instance_status_method) (struct window *, int, int, - struct - scrollbar_instance *); - void (*scrollbar_pointer_changed_in_window_method) (struct window *w); -#ifdef MEMORY_USAGE_STATS - int (*compute_scrollbar_instance_usage_method) (struct device *, - struct scrollbar_instance *, - struct overhead_stats *); -#endif -#endif /* HAVE_SCROLLBARS */ - -#ifdef HAVE_MENUBARS - /* menubar methods */ - void (*update_frame_menubars_method) (struct frame *); - void (*free_frame_menubars_method) (struct frame *); -#endif - -#ifdef HAVE_DIALOGS - /* dialog methods */ - Lisp_Object (*make_dialog_box_internal_method) (struct frame *, - Lisp_Object type, - Lisp_Object keys); -#endif -}; - -#define CONMETH_TYPE(meths) ((meths)->symbol) -#define CONMETH_IMPL_FLAG(meths, f) ((meths)->flags & (f)) - -#define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name) -#define CONSOLE_TYPE(c) ((c)->conmeths->symbol) -#define CONSOLE_IMPL_FLAG(c, f) CONMETH_IMPL_FLAG ((c)->conmeths, (f)) - -/******** Accessing / calling a console method *********/ - -#define HAS_CONTYPE_METH_P(meth, m) ((meth)->m##_method) -#define CONTYPE_METH(meth, m, args) (((meth)->m##_method) args) - -/* Call a void-returning console method, if it exists */ -#define MAYBE_CONTYPE_METH(meth, m, args) do { \ - struct console_methods *maybe_contype_meth_meth = (meth); \ - if (HAS_CONTYPE_METH_P (maybe_contype_meth_meth, m)) \ - CONTYPE_METH (maybe_contype_meth_meth, m, args); \ -} while (0) - -/* Call a console method, if it exists; otherwise return - the specified value - meth is multiply evaluated. */ -#define CONTYPE_METH_OR_GIVEN(meth, m, args, given) \ - (HAS_CONTYPE_METH_P (meth, m) ? \ - CONTYPE_METH (meth, m, args) : (given)) - -/* Call an int-returning console method, if it exists; otherwise - return 0 */ -#define MAYBE_INT_CONTYPE_METH(meth, m, args) \ - CONTYPE_METH_OR_GIVEN (meth, m, args, 0) - -/* Call an Lisp-Object-returning console method, if it exists; - otherwise return Qnil */ -#define MAYBE_LISP_CONTYPE_METH(meth, m, args) \ - CONTYPE_METH_OR_GIVEN (meth, m, args, Qnil) - -/******** Same functions, operating on a console instead of a - struct console_methods ********/ - -#define HAS_CONMETH_P(c, m) HAS_CONTYPE_METH_P ((c)->conmeths, m) -#define CONMETH(c, m, args) CONTYPE_METH ((c)->conmeths, m, args) -#define MAYBE_CONMETH(c, m, args) MAYBE_CONTYPE_METH ((c)->conmeths, m, args) -#define CONMETH_OR_GIVEN(c, m, args, given) \ - CONTYPE_METH_OR_GIVEN((c)->conmeths, m, args, given) -#define MAYBE_INT_CONMETH(c, m, args) \ - MAYBE_INT_CONTYPE_METH ((c)->conmeths, m, args) -#define MAYBE_LISP_CONMETH(c, m, args) \ - MAYBE_LISP_CONTYPE_METH ((c)->conmeths, m, args) - -/******** Defining new console types ********/ - -typedef struct console_type_entry console_type_entry; -struct console_type_entry -{ - Lisp_Object symbol; - struct console_methods *meths; -}; - -#define DECLARE_CONSOLE_TYPE(type) \ -extern struct console_methods * type##_console_methods - -#define DEFINE_CONSOLE_TYPE(type) \ -struct console_methods * type##_console_methods - -#define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \ - type##_console_methods = xnew_and_zero (struct console_methods); \ - type##_console_methods->name = obj_name; \ - type##_console_methods->symbol = Q##type; \ - defsymbol_nodump (&type##_console_methods->predicate_symbol, pred_sym); \ - add_entry_to_console_type_list (Q##type, type##_console_methods); \ - type##_console_methods->image_conversion_list = Qnil; \ - staticpro_nodump (&type##_console_methods->image_conversion_list); \ - dump_add_root_struct_ptr (&type##_console_methods, &console_methods_description); \ -} while (0) - -#define REINITIALIZE_CONSOLE_TYPE(type) do { \ - staticpro_nodump (&type##_console_methods->predicate_symbol); \ - staticpro_nodump (&type##_console_methods->image_conversion_list); \ -} while (0) - - -/* Declare that console-type TYPE has method M; used in - initialization routines */ -#define CONSOLE_HAS_METHOD(type, m) \ - (type##_console_methods->m##_method = type##_##m) - -/* Declare that console-type TYPE inherits method M - implementation from console-type FROMTYPE */ -#define CONSOLE_INHERITS_METHOD(type, fromtype, m) \ - (type##_console_methods->m##_method = fromtype##_##m) - -/* Define console type implementation flags */ -#define CONSOLE_IMPLEMENTATION_FLAGS(type, flg) \ - (type##_console_methods->flags = flg) - -struct console -{ - struct lcrecord_header header; - - /* Description of this console's methods. */ - struct console_methods *conmeths; - - /* A structure of auxiliary data specific to the console type. - struct x_console is used for X window frames; defined in console-x.h - struct tty_console is used to TTY's; defined in console-tty.h */ - void *console_data; - - /* Character that causes a quit. Normally C-g. - #### Should be possible for this not to be ASCII. (Currently works - under Windows.) */ - Emchar quit_char; - - /* ----- begin partially-completed console localization of - event loop ---- */ - - int local_var_flags; - -#define MARKED_SLOT(x) Lisp_Object x -#include "conslots.h" - - /* Where to store the next keystroke of the macro. - Index into con->kbd_macro_builder. */ - int kbd_macro_ptr; - - /* The finalized section of the macro starts at kbd_macro_buffer and - ends before this. This is not the same as kbd_macro_pointer, because - we advance this to kbd_macro_pointer when a key's command is complete. - This way, the keystrokes for "end-kbd-macro" are not included in the - macro. */ - int kbd_macro_end; - - /* ----- end partially-completed console localization of event loop ---- */ - - unsigned int input_enabled :1; -}; +struct console; DECLARE_LRECORD (console, struct console); #define XCONSOLE(x) XRECORD (x, console, struct console) @@ -473,6 +69,17 @@ #define CHECK_CONSOLE(x) CHECK_RECORD (x, console) #define CONCHECK_CONSOLE(x) CONCHECK_RECORD (x, console) +/* Basic properties available to non-privileged users; redefined in + console-impl.h */ + +struct console_methods; + +int console_live_p (struct console *c); +Lisp_Object console_device_list (struct console *c); + +#define CONSOLE_LIVE_P(c) console_live_p (c) +#define CONSOLE_DEVICE_LIST(c) console_device_list (c) + #define CHECK_LIVE_CONSOLE(x) do { \ CHECK_CONSOLE (x); \ if (! CONSOLE_LIVE_P (XCONSOLE (x))) \ @@ -484,129 +91,6 @@ x = wrong_type_argument (Qconsole_live_p, (x)); \ } while (0) -#define CONSOLE_TYPE_P(con, type) EQ (CONSOLE_TYPE (con), Q##type) - -#ifdef ERROR_CHECK_TYPES -INLINE_HEADER struct console * -error_check_console_type (struct console *con, Lisp_Object sym); -INLINE_HEADER struct console * -error_check_console_type (struct console *con, Lisp_Object sym) -{ - assert (EQ (CONSOLE_TYPE (con), sym)); - return con; -} -# define CONSOLE_TYPE_DATA(con, type) \ - (*(struct type##_console **) \ - &(error_check_console_type (con, Q##type))->console_data) -#else -# define CONSOLE_TYPE_DATA(con, type) \ - (*(struct type##_console **) &((con)->console_data)) -#endif - -#define CHECK_CONSOLE_TYPE(x, type) do { \ - CHECK_CONSOLE (x); \ - if (! CONSOLE_TYPE_P (XCONSOLE (x), type)) \ - dead_wrong_type_argument \ - (type##_console_methods->predicate_symbol, x); \ -} while (0) -#define CONCHECK_CONSOLE_TYPE(x, type) do { \ - CONCHECK_CONSOLE (x); \ - if (!(CONSOLEP (x) && \ - CONSOLE_TYPE_P (XCONSOLE (x), type))) \ - x = wrong_type_argument \ - (type##_console_methods->predicate_symbol, x); \ -} while (0) - -/* #### These should be in the console-*.h files but there are - too many places where the abstraction is broken. Need to - fix. */ - -#ifdef HAVE_GTK -#define CONSOLE_TYPESYM_GTK_P(typesym) EQ (typesym, Qgtk) -#else -#define CONSOLE_TYPESYM_GTK_P(typesym) 0 -#endif - -#ifdef HAVE_X_WINDOWS -#define CONSOLE_TYPESYM_X_P(typesym) EQ (typesym, Qx) -#else -#define CONSOLE_TYPESYM_X_P(typesym) 0 -#endif -#ifdef HAVE_TTY -#define CONSOLE_TYPESYM_TTY_P(typesym) EQ (typesym, Qtty) -#else -#define CONSOLE_TYPESYM_TTY_P(typesym) 0 -#endif -#ifdef HAVE_MS_WINDOWS -#define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) EQ (typesym, Qmswindows) -#else -#define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) 0 -#endif -#define CONSOLE_TYPESYM_STREAM_P(typesym) EQ (typesym, Qstream) - -#define CONSOLE_TYPESYM_WIN_P(typesym) \ - (CONSOLE_TYPESYM_GTK_P (typesym) || CONSOLE_TYPESYM_X_P (typesym) || CONSOLE_TYPESYM_MSWINDOWS_P (typesym)) - -#define CONSOLE_X_P(con) CONSOLE_TYPESYM_X_P (CONSOLE_TYPE (con)) -#define CHECK_X_CONSOLE(z) CHECK_CONSOLE_TYPE (z, x) -#define CONCHECK_X_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, x) - -#define CONSOLE_GTK_P(con) CONSOLE_TYPESYM_GTK_P (CONSOLE_TYPE (con)) -#define CHECK_GTK_CONSOLE(z) CHECK_CONSOLE_TYPE (z, gtk) -#define CONCHECK_GTK_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, gtk) - -#define CONSOLE_TTY_P(con) CONSOLE_TYPESYM_TTY_P (CONSOLE_TYPE (con)) -#define CHECK_TTY_CONSOLE(z) CHECK_CONSOLE_TYPE (z, tty) -#define CONCHECK_TTY_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, tty) - -#define CONSOLE_MSWINDOWS_P(con) CONSOLE_TYPESYM_MSWINDOWS_P (CONSOLE_TYPE (con)) -#define CHECK_MSWINDOWS_CONSOLE(z) CHECK_CONSOLE_TYPE (z, mswindows) -#define CONCHECK_MSWINDOWS_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, mswindows) - -#define CONSOLE_STREAM_P(con) CONSOLE_TYPESYM_STREAM_P (CONSOLE_TYPE (con)) -#define CHECK_STREAM_CONSOLE(z) CHECK_CONSOLE_TYPE (z, stream) -#define CONCHECK_STREAM_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, stream) - -#define CONSOLE_WIN_P(con) CONSOLE_TYPESYM_WIN_P (CONSOLE_TYPE (con)) - -EXFUN (Fconsole_disable_input, 1); -EXFUN (Fdelete_console, 2); -EXFUN (Fselect_console, 1); -EXFUN (Fselected_console, 0); - -extern Lisp_Object Qcreate_console_hook, Qdelete_console_hook; -extern Lisp_Object Vconsole_defaults, Vconsole_type_list, Vselected_console; - -/* This structure marks which slots in a console have corresponding - default values in console_defaults. - Each such slot has a nonzero value in this structure. - The value has only one nonzero bit. - - When a console has its own local value for a slot, - the bit for that slot (found in the same slot in this structure) - is turned on in the console's local_var_flags slot. - - If a slot in this structure is zero, then even though there may - be a DEFVAR_CONSOLE_LOCAL for the slot, there is no default value for it; - and the corresponding slot in console_defaults is not used. */ - -extern struct console console_local_flags; - -int valid_console_type_p (Lisp_Object type); - -#define CONSOLE_LIVE_P(con) (!EQ (CONSOLE_TYPE (con), Qdead)) - -#define CONSOLE_NAME(con) ((con)->name) -#define CONSOLE_CONNECTION(con) ((con)->connection) -#define CONSOLE_CANON_CONNECTION(con) ((con)->canon_connection) -#define CONSOLE_FUNCTION_KEY_MAP(con) ((con)->function_key_map) -#define CONSOLE_DEVICE_LIST(con) ((con)->device_list) -#define CONSOLE_SELECTED_DEVICE(con) ((con)->selected_device) -#define CONSOLE_SELECTED_FRAME(con) \ - DEVICE_SELECTED_FRAME (XDEVICE ((con)->selected_device)) -#define CONSOLE_LAST_NONMINIBUF_FRAME(con) NON_LVALUE ((con)->last_nonminibuf_frame) -#define CONSOLE_QUIT_CHAR(con) ((con)->quit_char) - #define CDFW_CONSOLE(obj) \ (WINDOWP (obj) ? WINDOW_CONSOLE (XWINDOW (obj)) \ : (FRAMEP (obj) ? FRAME_CONSOLE (XFRAME (obj)) \ @@ -618,8 +102,15 @@ #define CONSOLE_DEVICE_LOOP(devcons, con) \ LIST_LOOP (devcons, CONSOLE_DEVICE_LIST (con)) -DECLARE_CONSOLE_TYPE (dead); -extern console_type_entry_dynarr *the_console_type_entry_dynarr; +EXFUN (Fconsole_disable_input, 1); +EXFUN (Fdelete_console, 2); +EXFUN (Fselect_console, 1); +EXFUN (Fselected_console, 0); + +extern Lisp_Object Qcreate_console_hook, Qdelete_console_hook; +extern Lisp_Object Vconsole_defaults, Vconsole_type_list, Vselected_console; + +int valid_console_type_p (Lisp_Object type); Lisp_Object create_console (Lisp_Object name, Lisp_Object type, Lisp_Object connection, Lisp_Object props); @@ -634,5 +125,6 @@ void io_error_delete_console (Lisp_Object console); void set_console_last_nonminibuf_frame (struct console *con, Lisp_Object frame); +void stuff_buffered_input (Lisp_Object); #endif /* INCLUDED_console_h_ */ diff --text -u 'xemacs-21.5.6/src/data.c' 'xemacs-21.5.7/src/data.c' Index: ././src/data.c --- ././src/data.c Mon Apr 1 12:58:27 2002 +++ ././src/data.c Fri Jun 28 23:24:07 2002 @@ -79,12 +79,13 @@ { /* #### It would be really nice if this were a proper warning instead of brain-dead print ro Qexternal_debugging_output. */ - write_c_string ("Comparison between integer and character is constant nil (", - Qexternal_debugging_output); + write_c_string + (Qexternal_debugging_output, + "Comparison between integer and character is constant nil ("); Fprinc (obj1, Qexternal_debugging_output); - write_c_string (" and ", Qexternal_debugging_output); + write_c_string (Qexternal_debugging_output, " and "); Fprinc (obj2, Qexternal_debugging_output); - write_c_string (")\n", Qexternal_debugging_output); + write_c_string (Qexternal_debugging_output, ")\n"); debug_short_backtrace (debug_ebola_backtrace_length); } return EQ (obj1, obj2); @@ -363,7 +364,7 @@ */ (subr)) { - const CIntbyte *prompt; + const CIbyte *prompt; CHECK_SUBR (subr); prompt = XSUBR (subr)->prompt; return prompt ? list2 (Qinteractive, build_msg_string (prompt)) : Qnil; @@ -721,8 +722,8 @@ } else if (STRINGP (array)) { - if (idx >= XSTRING_CHAR_LENGTH (array)) goto range_error; - return make_char (XSTRING_CHAR (array, idx)); + if (idx >= string_char_length (array)) goto range_error; + return make_char (string_ichar (array, idx)); } #ifdef LOSING_BYTECODE else if (COMPILED_FUNCTIONP (array)) @@ -779,7 +780,7 @@ else if (STRINGP (array)) { CHECK_CHAR_COERCE_INT (newval); - if (idx >= XSTRING_CHAR_LENGTH (array)) goto range_error; + if (idx >= string_char_length (array)) goto range_error; set_string_char (array, idx, XCHAR (newval)); bump_string_modiff (array); } @@ -2003,6 +2004,314 @@ return new_list; } + +/************************************************************************/ +/* weak boxes */ +/************************************************************************/ + +static Lisp_Object Vall_weak_boxes; /* Gemarke es niemals ever!!! */ + +void +prune_weak_boxes (void) +{ + Lisp_Object rest, prev = Qnil; + int removep = 0; + + for (rest = Vall_weak_boxes; + !NILP(rest); + rest = XWEAK_BOX (rest)->next_weak_box) + { + if (! (marked_p (rest))) + /* This weak box itself is garbage. */ + removep = 1; + + if (! marked_p (XWEAK_BOX (rest)->value)) + { + XSET_WEAK_BOX (rest, Qnil); + removep = 1; + } + + if (removep) + { + /* Remove weak box from list. */ + if (NILP (prev)) + Vall_weak_boxes = XWEAK_BOX (rest)->next_weak_box; + else + XWEAK_BOX (prev)->next_weak_box = XWEAK_BOX (rest)->next_weak_box; + removep = 0; + } + else + prev = rest; + } +} + +static Lisp_Object +mark_weak_box (Lisp_Object obj) +{ + return Qnil; +} + +static void +print_weak_box (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) +{ + if (print_readably) + printing_unreadable_object ("#"); + write_fmt_string (printcharfun, "#"); +} + +static int +weak_box_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) +{ + struct weak_box *wb1 = XWEAK_BOX (obj1); + struct weak_box *wb2 = XWEAK_BOX (obj2); + + return (internal_equal (wb1->value, wb2->value, depth + 1)); +} + +static Hashcode +weak_box_hash (Lisp_Object obj, int depth) +{ + struct weak_box *wb = XWEAK_BOX (obj); + + return internal_hash (wb->value, depth + 1); +} + +Lisp_Object +make_weak_box (Lisp_Object value) +{ + Lisp_Object result; + + struct weak_box *wb = + alloc_lcrecord_type (struct weak_box, &lrecord_weak_box); + + wb->value = value; + result = wrap_weak_box (wb); + wb->next_weak_box = Vall_weak_boxes; + Vall_weak_boxes = result; + return result; +} + +static const struct lrecord_description weak_box_description[] = { + { XD_LO_LINK, offsetof (struct weak_box, value) }, + { XD_END} +}; + +DEFINE_LRECORD_IMPLEMENTATION ("weak_box", weak_box, + mark_weak_box, print_weak_box, + 0, weak_box_equal, weak_box_hash, + weak_box_description, + struct weak_box); + +DEFUN ("make-weak-box", Fmake_weak_box, 1, 1, 0, /* +Return a new weak box from value CONTENTS. +The weak box is a reference to CONTENTS which may be extracted with +`weak-box-ref'. However, the weak box does not contribute to the +reachability of CONTENTS. When CONTENTS is garbage-collected, +`weak-box-ref' will return NIL. +*/ + (value)) +{ + return make_weak_box(value); +} + +DEFUN ("weak-box-ref", Fweak_box_ref, 1, 1, 0, /* +Return the contents of weak box WEAK-BOX. +If the contents have been GCed, return NIL. +*/ + (wb)) +{ + return XWEAK_BOX (wb)->value; +} + +DEFUN ("weak-box-p", Fweak_boxp, 1, 1, 0, /* +Return non-nil if OBJECT is a weak box. +*/ + (object)) +{ + return WEAK_BOXP (object) ? Qt : Qnil; +} + +/************************************************************************/ +/* ephemerons */ +/************************************************************************/ + +static Lisp_Object Vall_ephemerons; /* Gemarke es niemals ever!!! */ +static Lisp_Object Vfinalize_list; + +int +finish_marking_ephemerons(void) +{ + Lisp_Object rest; + int did_mark = 0; + + for (rest = Vall_ephemerons; + !NILP (rest); + rest = XEPHEMERON_NEXT (rest)) + { + if (marked_p (rest) && ! marked_p (XEPHEMERON (rest)->cons_chain)) + { + MARK_CONS (XCONS (XEPHEMERON (rest)->cons_chain)); + mark_object (XCAR (XEPHEMERON (rest)->cons_chain)); + did_mark = 1; + } + } + return did_mark; +} + +void +prune_ephemerons(void) +{ + int removep = 0; + Lisp_Object rest = Vall_ephemerons, next, prev = Qnil; + + while (! NILP (rest)) + { + next = XEPHEMERON_NEXT (rest); + + if (marked_p (rest)) + /* The ephemeron itself is live ... */ + { + if (! marked_p(XEPHEMERON (rest)->key)) + /* ... but its key is garbage */ + { + removep = 1; + XSET_EPHEMERON_VALUE (rest, Qnil); + if (! NILP (XEPHEMERON_FINALIZER (rest))) + /* Register the finalizer */ + { + XSET_EPHEMERON_NEXT (rest, Vfinalize_list); + Vfinalize_list = XEPHEMERON (rest)->cons_chain; + } + } + } + else + /* The ephemeron itself is dead. */ + removep = 1; + + if (removep) + { + /* Remove it from the list. */ + if (NILP (prev)) + Vall_ephemerons = next; + else + XSET_EPHEMERON_NEXT (prev, next); + removep = 0; + } + else + prev = rest; + + rest = next; + } +} + +Lisp_Object +zap_finalize_list(void) +{ + Lisp_Object finalizers = Vfinalize_list; + + Vfinalize_list = Qnil; + + return finalizers; +} + +static Lisp_Object +mark_ephemeron (Lisp_Object obj) +{ + return Qnil; +} + +static void +print_ephemeron (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) +{ + if (print_readably) + printing_unreadable_object ("#"); + write_fmt_string (printcharfun, "#"); +} + +static int +ephemeron_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) +{ + return + internal_equal (XEPHEMERON_REF (obj1), XEPHEMERON_REF(obj2), depth + 1); +} + +static Hashcode +ephemeron_hash(Lisp_Object obj, int depth) +{ + return internal_hash (XEPHEMERON_REF (obj), depth + 1); +} + +Lisp_Object +make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer) +{ + Lisp_Object result, temp = Qnil; + struct gcpro gcpro1, gcpro2; + + struct ephemeron *eph = + alloc_lcrecord_type (struct ephemeron, &lrecord_ephemeron); + + eph->key = Qnil; + eph->cons_chain = Qnil; + eph->value = Qnil; + + result = wrap_ephemeron(eph); + GCPRO2 (result, temp); + + eph->key = key; + temp = Fcons(value, finalizer); + eph->cons_chain = Fcons(temp, Vall_ephemerons); + eph->value = value; + + Vall_ephemerons = result; + + UNGCPRO; + return result; +} + +static const struct lrecord_description ephemeron_description[] = { + { XD_LISP_OBJECT, offsetof(struct ephemeron, key)}, + { XD_LISP_OBJECT, offsetof(struct ephemeron, cons_chain)}, + { XD_LISP_OBJECT, offsetof(struct ephemeron, value)}, + { XD_END } +}; + +DEFINE_LRECORD_IMPLEMENTATION ("ephemeron", ephemeron, + mark_ephemeron, print_ephemeron, + 0, ephemeron_equal, ephemeron_hash, + ephemeron_description, + struct ephemeron); + +DEFUN ("make-ephemeron", Fmake_ephemeron, 2, 3, 0, /* +Return a new ephemeron with key KEY, value CONTENTS, and finalizer FINALIZER. +The ephemeron is a reference to CONTENTS which may be extracted with +`ephemeron-ref'. CONTENTS is only reachable through the ephemeron as +long as KEY is reachable; the ephemeron does not contribute to the +reachability of KEY. When KEY becomes unreachable while the ephemeron +itself is still reachable, CONTENTS is queued for finalization: FINALIZER +will possibly be called on CONTENTS some time in the future. Moreover, +future calls to `ephemeron-ref' will return NIL. +*/ + (key, value, finalizer)) +{ + return make_ephemeron(key, value, finalizer); +} + +DEFUN ("ephemeron-ref", Fephemeron_ref, 1, 1, 0, /* +Return the contents of ephemeron EPHEMERON. +If the contents have been GCed, return NIL. +*/ + (eph)) +{ + return XEPHEMERON_REF (eph); +} + +DEFUN ("ephemeron-p", Fephemeronp, 1, 1, 0, /* +Return non-nil if OBJECT is an ephemeron. +*/ + (object)) +{ + return EPHEMERONP (object) ? Qt : Qnil; +} /************************************************************************/ /* initialization */ @@ -2111,6 +2420,8 @@ syms_of_data (void) { INIT_LRECORD_IMPLEMENTATION (weak_list); + INIT_LRECORD_IMPLEMENTATION (ephemeron); + INIT_LRECORD_IMPLEMENTATION (weak_box); DEFSYMBOL (Qquote); DEFSYMBOL (Qlambda); @@ -2227,6 +2538,13 @@ DEFSUBR (Fweak_list_type); DEFSUBR (Fweak_list_list); DEFSUBR (Fset_weak_list_list); + + DEFSUBR (Fmake_ephemeron); + DEFSUBR (Fephemeron_ref); + DEFSUBR (Fephemeronp); + DEFSUBR (Fmake_weak_box); + DEFSUBR (Fweak_box_ref); + DEFSUBR (Fweak_boxp); } void @@ -2235,6 +2553,15 @@ /* This must not be staticpro'd */ Vall_weak_lists = Qnil; dump_add_weak_object_chain (&Vall_weak_lists); + + Vall_ephemerons = Qnil; + dump_add_weak_object_chain (&Vall_ephemerons); + + Vfinalize_list = Qnil; + staticpro (&Vfinalize_list); + + Vall_weak_boxes = Qnil; + dump_add_weak_object_chain (&Vall_weak_boxes); #ifdef DEBUG_XEMACS DEFVAR_BOOL ("debug-issue-ebola-notices", &debug_issue_ebola_notices /* diff --text -u 'xemacs-21.5.6/src/depend' 'xemacs-21.5.7/src/depend' Index: ././src/depend --- ././src/depend Sat Mar 16 19:39:15 2002 +++ ././src/depend Fri Jun 21 06:18:25 2002 @@ -7,61 +7,61 @@ #endif LISP_H=lisp.h config.h general-slots.h lrecord.h symeval.h symsinit.h text.h $(LISP_UNION_H) #if defined(HAVE_MS_WINDOWS) -console-msw.o: $(LISP_H) conslots.h console-msw.h console.h events.h intl-auto-encap-win32.h opaque.h systime.h syswindows.h -device-msw.o: $(LISP_H) charset.h conslots.h console-msw.h console-stream.h console.h device.h devslots.h events.h faces.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h systime.h syswindows.h toolbar.h window.h winslots.h -dialog-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar.h specifier.h sysfile.h syswindows.h toolbar.h window.h winslots.h -dired-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h intl-auto-encap-win32.h ndir.h regex.h sysdir.h sysfile.h sysfloat.h sysproc.h syspwd.h systime.h syswindows.h -event-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console-tty.h console.h device.h devslots.h dragdrop.h events.h faces.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h lstream.h menubar-msw.h menubar.h objects-msw.h objects.h process.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h syswindows.h toolbar.h window.h winslots.h -frame-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h device.h devslots.h elhash.h events.h faces.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h toolbar.h window.h winslots.h -glyphs-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h device.h devslots.h elhash.h faces.h file-coding.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h imgproc.h insdel.h intl-auto-encap-win32.h lstream.h objects-msw.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syswindows.h toolbar.h window.h winslots.h -gui-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h device.h devslots.h elhash.h events.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h toolbar.h window.h winslots.h -menubar-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-msw.h console.h device.h devslots.h elhash.h events.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h menubar-msw.h menubar.h opaque.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h toolbar.h window.h winslots.h -objects-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h device.h devslots.h hash.h insdel.h intl-auto-encap-win32.h objects-msw.h objects.h specifier.h syswindows.h -redisplay-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h debug.h device.h devslots.h events.h faces.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h gutter.h intl-auto-encap-win32.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h systime.h syswindows.h toolbar.h window.h winslots.h -scrollbar-msw.o: $(LISP_H) conslots.h console-msw.h console.h device.h devslots.h elhash.h events.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h systime.h syswindows.h toolbar.h window.h winslots.h -select-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h device.h devslots.h file-coding.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar.h select.h specifier.h syswindows.h toolbar.h window.h winslots.h -toolbar-msw.o: $(LISP_H) charset.h conslots.h console-msw.h console.h device.h devslots.h elhash.h faces.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h intl-auto-encap-win32.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h syswindows.h toolbar.h window.h winslots.h +console-msw.o: $(LISP_H) conslots.h console-impl.h console-msw-impl.h console-msw.h console.h events.h intl-auto-encap-win32.h opaque.h systime.h syswindows.h +device-msw.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console-stream.h console.h device-impl.h device.h devslots.h events.h faces.h frame.h intl-auto-encap-win32.h objects-msw.h objects.h redisplay.h sysdep.h systime.h syswindows.h +dialog-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h frame-impl.h frame.h frameslots.h gui.h intl-auto-encap-win32.h opaque.h redisplay.h sysfile.h syswindows.h +dired-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console-msw.h console.h intl-auto-encap-win32.h ndir.h regex.h syntax.h sysdir.h sysfile.h sysfloat.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h +event-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console-tty.h console.h device-impl.h device.h devslots.h dragdrop.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h lstream.h menubar-msw.h menubar.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h process.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h syswindows.h window-impl.h window.h winslots.h +frame-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h +glyphs-msw.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device-impl.h device.h devslots.h elhash.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h imgproc.h insdel.h intl-auto-encap-win32.h lstream.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syswindows.h window-impl.h window.h winslots.h +gui-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h elhash.h events.h frame-impl.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h +menubar-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h elhash.h events.h frame-impl.h frame.h frameslots.h gui.h intl-auto-encap-win32.h menubar-msw.h menubar.h opaque.h redisplay.h scrollbar.h systime.h syswindows.h window-impl.h window.h winslots.h +objects-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device-impl.h device.h devslots.h elhash.h insdel.h intl-auto-encap-win32.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h opaque.h specifier.h syswindows.h +redisplay-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h debug.h device-impl.h device.h devslots.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h gutter.h intl-auto-encap-win32.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h systime.h syswindows.h window-impl.h window.h winslots.h +scrollbar-msw.o: $(LISP_H) conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device.h elhash.h events.h frame-impl.h frame.h frameslots.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h +select-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h file-coding.h frame-impl.h frame.h frameslots.h intl-auto-encap-win32.h opaque.h redisplay.h select.h syswindows.h +toolbar-msw.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device.h elhash.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h syswindows.h toolbar.h window-impl.h window.h winslots.h #endif #if defined(HAVE_X_WINDOWS) -balloon-x.o: $(LISP_H) balloon_help.h conslots.h console-x.h console.h device.h devslots.h xintrinsic.h -console-x.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h process.h redisplay.h xintrinsic.h -device-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h device.h devslots.h elhash.h events.h faces.h frame.h frameslots.h glyphs-x.h glyphs.h gui.h objects-x.h objects.h offix-types.h offix.h redisplay.h scrollbar.h specifier.h sysdep.h sysdll.h sysfile.h systime.h toolbar.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmu.h -dialog-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-x.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui-x.h gui.h opaque.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h -frame-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h EmacsShell.h ExternalShell.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame.h frameslots.h glyphs-x.h glyphs.h gui.h gutter.h objects-x.h objects.h offix-types.h offix.h redisplay.h scrollbar-x.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h xmu.h -glyphs-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h device.h devslots.h faces.h file-coding.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h gui.h imgproc.h insdel.h lstream.h objects-x.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysfile.h sysproc.h systime.h toolbar.h window.h winslots.h xintrinsic.h xmu.h -gui-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui-x.h gui.h opaque.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h -intl-x.o: $(LISP_H) conslots.h console-x.h console.h xintrinsic.h -menubar-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-x.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui-x.h gui.h keymap.h menubar.h opaque.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h -objects-x.o: $(LISP_H) charset.h conslots.h console-x.h console.h device.h devslots.h insdel.h objects-x.h objects.h specifier.h xintrinsic.h -redisplay-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h debug.h device.h devslots.h faces.h file-coding.h frame.h frameslots.h glyphs-x.h glyphs.h gui.h gutter.h mule-ccl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysproc.h systime.h toolbar.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmprimitivep.h -scrollbar-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h conslots.h console-x.h console.h device.h devslots.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h gui.h redisplay.h scrollbar-x.h scrollbar.h specifier.h toolbar.h window.h winslots.h xintrinsic.h -select-x.o: $(LISP_H) charset.h conslots.h console-x.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h objects-x.h objects.h opaque.h redisplay.h scrollbar.h select-common.h select.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h -toolbar-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h charset.h conslots.h console-x.h console.h device.h devslots.h faces.h frame.h frameslots.h glyphs-x.h glyphs.h gui.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h toolbar-common.h toolbar.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h +balloon-x.o: $(LISP_H) balloon_help.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h xintrinsic.h +console-x.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h process.h redisplay.h xintrinsic.h +device-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h objects-x.h objects.h offix-types.h offix.h redisplay.h scrollbar.h specifier.h sysdep.h sysdll.h sysfile.h systime.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmu.h +dialog-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-x-impl.h console-x.h console.h events.h frame-impl.h frame.h frameslots.h gui-x.h gui.h opaque.h redisplay.h scrollbar.h systime.h window.h xintrinsic.h +frame-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h EmacsShell.h ExternalShell.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gutter.h objects-impl.h objects-x-impl.h objects-x.h objects.h offix-types.h offix.h redisplay.h scrollbar-x.h scrollbar.h specifier.h systime.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h xmu.h +glyphs-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h gui.h imgproc.h insdel.h lstream.h objects-impl.h objects-x-impl.h objects-x.h objects.h opaque.h process.h redisplay.h scrollbar.h specifier.h sysfile.h sysproc.h syssignal.h systime.h window-impl.h window.h winslots.h xintrinsic.h xmu.h +gui-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h events.h frame.h glyphs.h gui-x.h gui.h menubar.h opaque.h redisplay.h scrollbar.h specifier.h systime.h window-impl.h window.h winslots.h xintrinsic.h +intl-x.o: $(LISP_H) console-x.h console.h xintrinsic.h +menubar-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h gui-x.h gui.h keymap.h menubar.h opaque.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h xintrinsic.h +objects-x.o: $(LISP_H) charset.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h insdel.h objects-impl.h objects-x-impl.h objects-x.h objects.h specifier.h xintrinsic.h +redisplay-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h debug.h device-impl.h device.h devslots.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gutter.h mule-ccl.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysproc.h syssignal.h systime.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmprimitivep.h +scrollbar-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h redisplay.h scrollbar-x.h scrollbar.h specifier.h window-impl.h window.h winslots.h xintrinsic.h +select-x.o: $(LISP_H) charset.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h frame-impl.h frame.h frameslots.h objects-x.h objects.h opaque.h redisplay.h select-common.h select.h systime.h xintrinsic.h +toolbar-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h charset.h conslots.h console-impl.h console-x-impl.h console-x.h console.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h toolbar-common.h toolbar.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h #endif #if defined(HAVE_TTY) -console-tty.o: $(LISP_H) charset.h conslots.h console-stream.h console-tty.h console.h device.h devslots.h faces.h file-coding.h frame.h frameslots.h glyphs.h gui.h lstream.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syssignal.h systty.h toolbar.h window.h winslots.h -device-tty.o: $(LISP_H) charset.h conslots.h console-stream.h console-tty.h console.h device.h devslots.h events.h faces.h frame.h frameslots.h glyphs.h gui.h lstream.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h -event-tty.o: $(LISP_H) conslots.h console-tty.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h process.h redisplay.h scrollbar.h specifier.h sysproc.h syssignal.h systime.h systty.h syswait.h toolbar.h window.h winslots.h -frame-tty.o: $(LISP_H) conslots.h console-tty.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h -objects-tty.o: $(LISP_H) charset.h conslots.h console-tty.h console.h device.h devslots.h insdel.h objects-tty.h objects.h specifier.h syssignal.h systty.h -redisplay-tty.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-tty.h console.h device.h devslots.h events.h faces.h frame.h frameslots.h glyphs.h gui.h lstream.h objects-tty.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h +console-tty.o: $(LISP_H) charset.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h faces.h file-coding.h frame.h glyphs.h lstream.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systty.h window-impl.h window.h winslots.h +device-tty.o: $(LISP_H) charset.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h faces.h frame.h lstream.h redisplay.h sysdep.h sysfile.h syssignal.h systime.h systty.h +event-tty.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h events.h frame.h process.h redisplay.h sysproc.h syssignal.h systime.h systty.h syswait.h +frame-tty.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h systime.h systty.h +objects-tty.o: $(LISP_H) charset.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h insdel.h objects-impl.h objects-tty-impl.h objects-tty.h objects.h specifier.h systty.h +redisplay-tty.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs.h lstream.h objects-impl.h objects-tty-impl.h objects-tty.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h systty.h window-impl.h window.h winslots.h #endif #if defined(HAVE_GTK) -console-gtk.o: $(LISP_H) conslots.h console-gtk.h console.h process.h redisplay.h -device-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h device.h devslots.h elhash.h events.h faces.h frame.h frameslots.h gccache-gtk.h glyphs-gtk.h glyphs.h gtk-xemacs.h gui.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h toolbar.h window.h winslots.h -dialog-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h -event-gtk.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk.h console-tty.h console.h device.h devslots.h dragdrop.h elhash.h event-gtk.h events.h file-coding.h frame.h frameslots.h glyphs.h gtk-xemacs.h gui.h lstream.h objects-gtk.h objects.h offix-types.h offix.h process.h redisplay.h scrollbar.h specifier.h sysproc.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h xintrinsic.h -frame-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame.h frameslots.h glyphs-gtk.h glyphs.h gtk-xemacs.h gui.h objects-gtk.h objects.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h sysdll.h systime.h toolbar.h ui-gtk.h window.h winslots.h +console-gtk.o: $(LISP_H) conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h process.h redisplay.h +device-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h gccache-gtk.h glyphs-gtk.h glyphs.h gtk-xemacs.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h window-impl.h window.h winslots.h +dialog-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h console-gtk.h console.h events.h frame.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h systime.h window.h +event-gtk.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-tty.h console.h device-impl.h device.h devslots.h dragdrop.h elhash.h event-gtk.h events.h file-coding.h frame-impl.h frame.h frameslots.h gtk-xemacs.h lstream.h objects-gtk.h objects.h offix-types.h offix.h process.h redisplay.h scrollbar.h sysproc.h syssignal.h systime.h systty.h window.h xintrinsic.h +frame-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs-gtk.h glyphs.h gtk-xemacs.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h sysdll.h systime.h ui-gtk.h window-impl.h window.h winslots.h gccache-gtk.o: $(LISP_H) gccache-gtk.h hash.h -glyphs-gtk.o: $(LISP_H) bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h device.h devslots.h faces.h file-coding.h frame.h frameslots.h glyphs-gtk.h glyphs.h gui-gtk.h gui.h imgproc.h insdel.h lstream.h objects-gtk.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdll.h sysfile.h toolbar.h ui-gtk.h window.h winslots.h -gui-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -menubar-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h specifier.h sysdll.h systime.h toolbar.h ui-gtk.h window.h winslots.h -objects-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h device.h devslots.h insdel.h objects-gtk.h objects.h specifier.h -redisplay-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h debug.h device.h devslots.h faces.h file-coding.h frame.h frameslots.h gccache-gtk.h glyphs-gtk.h glyphs.h gui.h gutter.h mule-ccl.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysproc.h systime.h toolbar.h window.h winslots.h -scrollbar-gtk.o: $(LISP_H) conslots.h console-gtk.h console.h device.h devslots.h frame.h frameslots.h glyphs-gtk.h glyphs.h gui-gtk.h gui.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h toolbar.h window.h winslots.h -select-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h opaque.h redisplay.h scrollbar.h select-common.h select.h specifier.h systime.h toolbar.h window.h winslots.h -toolbar-gtk.o: $(LISP_H) conslots.h console-gtk.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h toolbar-common.h toolbar.h window.h winslots.h -ui-gtk.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-gtk.h console.h device.h devslots.h elhash.h emacs-marshals.c emacs-widget-accessors.c event-gtk.h events.h faces.h glade.c glyphs-gtk.h glyphs.h gtk-glue.c gui-gtk.h gui.h hash.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h sysdll.h systime.h ui-byhand.c ui-gtk.h window.h winslots.h +glyphs-gtk.o: $(LISP_H) bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-gtk.h glyphs.h gui-gtk.h gui.h imgproc.h insdel.h lstream.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdll.h sysfile.h ui-gtk.h window-impl.h window.h winslots.h +gui-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h frame.h gui-gtk.h gui.h opaque.h redisplay.h +menubar-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device.h events.h frame-impl.h frame.h frameslots.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h sysdll.h systime.h ui-gtk.h window.h +objects-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h insdel.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h specifier.h +redisplay-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h debug.h device-impl.h device.h devslots.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gccache-gtk.h glyphs-gtk.h glyphs.h gutter.h mule-ccl.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysproc.h syssignal.h systime.h window-impl.h window.h winslots.h +scrollbar-gtk.o: $(LISP_H) conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h frame-impl.h frame.h frameslots.h glyphs-gtk.h glyphs.h gui-gtk.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h window-impl.h window.h winslots.h +select-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h events.h frame.h opaque.h redisplay.h select-common.h select.h systime.h +toolbar-gtk.o: $(LISP_H) conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h frame.h redisplay.h toolbar-common.h +ui-gtk.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h console-gtk.h console.h device.h elhash.h emacs-marshals.c emacs-widget-accessors.c event-gtk.h events.h faces.h glade.c glyphs-gtk.h glyphs.h gtk-glue.c gui-gtk.h gui.h hash.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h sysdll.h systime.h ui-byhand.c ui-gtk.h window-impl.h window.h winslots.h #endif #if defined(HAVE_DATABASE) database.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h database.h sysfile.h @@ -69,9 +69,10 @@ #if defined(MULE) mule-canna.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h file-coding.h mule-ccl.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h file-coding.h mule-ccl.h -mule-charset.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h elhash.h faces.h lstream.h mule-ccl.h +mule-charset.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h elhash.h faces.h lstream.h mule-ccl.h objects.h mule-coding.o: $(LISP_H) charset.h file-coding.h mule-ccl.h -mule-wnnfns.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h redisplay.h scrollbar.h sysdep.h window.h winslots.h +mule-wnnfns.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h redisplay.h scrollbar.h sysdep.h window.h +mule.o: $(LISP_H) regex.h #endif #if defined(EXTERNAL_WIDGET) ExternalClient-Xlib.o: extw-Xlib.h @@ -80,149 +81,148 @@ extw-Xlib.o: config.h extw-Xlib.h extw-Xt.o: config.h extw-Xlib.h extw-Xt.h #endif -EmacsFrame.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h charset.h conslots.h console-x.h console.h device.h devslots.h faces.h frame.h frameslots.h glyphs-x.h glyphs.h gui.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h xmu.h +EmacsFrame.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h charset.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h xmu.h EmacsManager.o: EmacsManager.h EmacsManagerP.h config.h xintrinsicp.h xmmanagerp.h EmacsShell-sub.o: EmacsShell.h EmacsShellP.h config.h xintrinsic.h xintrinsicp.h EmacsShell.o: EmacsShell.h ExternalShell.h config.h xintrinsicp.h -abbrev.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h insdel.h redisplay.h scrollbar.h syntax.h window.h winslots.h -alloc.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-stream.h console.h device.h devslots.h dumper.h elhash.h events.h extents.h frame.h frameslots.h glyphs.h gui.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h toolbar.h window.h winslots.h -alloca.o: config.h +abbrev.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h insdel.h redisplay.h scrollbar.h syntax.h window.h +alloc.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h frame-impl.h frame.h frameslots.h glyphs.h opaque.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h window-impl.h window.h winslots.h +alloca.o: $(LISP_H) balloon_help.o: balloon_help.h config.h xintrinsic.h blocktype.o: $(LISP_H) blocktype.h -buffer.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h elhash.h extents.h faces.h file-coding.h frame.h frameslots.h glyphs.h gui.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h process.h redisplay.h scrollbar.h select.h specifier.h syntax.h sysdir.h sysfile.h syswindows.h toolbar.h window.h winslots.h -bytecode.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h opaque.h syntax.h -callint.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h events.h insdel.h redisplay.h scrollbar.h systime.h window.h winslots.h -callproc.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h file-coding.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswindows.h window.h winslots.h +buffer.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h process.h redisplay.h scrollbar.h select.h specifier.h syntax.h sysdir.h sysfile.h syswindows.h window.h +bytecode.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h opaque.h redisplay.h scrollbar.h syntax.h window.h +callint.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h events.h insdel.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h casefiddle.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h syntax.h casetab.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h opaque.h chartab.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h syntax.h -cm.o: $(LISP_H) conslots.h console-tty.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h lstream.h redisplay.h scrollbar.h specifier.h syssignal.h systty.h toolbar.h window.h winslots.h -cmdloop.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h -cmds.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h insdel.h syntax.h -console-stream.o: $(LISP_H) conslots.h console-stream.h console-tty.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h -console.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-tty.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h +cm.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h frame.h lstream.h redisplay.h systty.h +cmdloop.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-msw.h console.h device.h events.h frame.h intl-auto-encap-win32.h redisplay.h scrollbar.h systime.h syswindows.h window.h +cmds.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h extents.h insdel.h syntax.h +console-stream.o: $(LISP_H) conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h scrollbar.h sysdep.h sysfile.h systime.h systty.h window.h +console.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h scrollbar.h sysdep.h systime.h systty.h window.h data.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h sysfloat.h syssignal.h debug.o: $(LISP_H) bytecode.h debug.h -device.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h elhash.h events.h faces.h frame.h frameslots.h glyphs.h gui.h keymap.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h toolbar.h window.h winslots.h +device.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h keymap.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h toolbar.h window.h dgif_lib.o: $(LISP_H) gifrlib.h sysfile.h -dialog.o: $(LISP_H) conslots.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +dialog.o: $(LISP_H) conslots.h console-impl.h console.h frame-impl.h frame.h frameslots.h redisplay.h dired.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h elhash.h intl-auto-encap-win32.h ndir.h opaque.h regex.h syntax.h sysdep.h sysdir.h sysfile.h syspwd.h systime.h syswindows.h -doc.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h insdel.h keymap.h sysfile.h +doc.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h file-coding.h insdel.h keymap.h lstream.h sysfile.h doprnt.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h lstream.h dragdrop.o: $(LISP_H) dragdrop.h -dumper.o: $(LISP_H) conslots.h console-stream.h console.h dumper.h elhash.h file-coding.h intl-auto-encap-win32.h specifier.h sysfile.h syswindows.h +dumper.o: $(LISP_H) console-stream.h console.h dumper.h elhash.h file-coding.h intl-auto-encap-win32.h specifier.h sysfile.h syswindows.h dynarr.o: $(LISP_H) ecrt0.o: config.h -editfns.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h events.h extents.h frame.h frameslots.h glyphs.h gui.h insdel.h line-number.h ndir.h redisplay.h scrollbar.h specifier.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h systime.h toolbar.h window.h winslots.h +editfns.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h events.h frame.h insdel.h line-number.h ndir.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h window.h eldap.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h eldap.h opaque.h sysdep.h elhash.o: $(LISP_H) bytecode.h elhash.h opaque.h emacs-marshals.o: hash.h emacs-widget-accessors.o: -emacs.o: $(LISP_H) backtrace.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h dumper.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h paths.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysdll.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswindows.h toolbar.h window.h winslots.h -emodules.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h emodules.h file-coding.h frame.h frameslots.h glyphs.h gui.h insdel.h lstream.h redisplay.h scrollbar.h specifier.h sysdep.h sysdll.h toolbar.h window.h winslots.h +emacs.o: $(LISP_H) backtrace.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h console-msw.h console.h dumper.h frame.h intl-auto-encap-win32.h paths.h process.h redisplay.h sysdep.h sysdll.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswindows.h +emodules.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h emodules.h file-coding.h frame.h insdel.h lstream.h redisplay.h scrollbar.h sysdep.h sysdll.h window.h esd.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h miscplay.h sound.h sysfile.h -eval.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h conslots.h console.h opaque.h -event-Xt.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h Emacs.ad.h EmacsFrame.h blocktype.h charset.h conslots.h console-tty.h console-x.h console.h device.h devslots.h dragdrop.h elhash.h events.h file-coding.h frame.h frameslots.h glyphs.h gui.h lstream.h objects-x.h objects.h offix-types.h offix.h process.h redisplay.h scrollbar.h specifier.h sysproc.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h xintrinsic.h xintrinsicp.h -event-stream.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h elhash.h events.h file-coding.h frame.h frameslots.h glyphs.h gui.h insdel.h keymap.h lstream.h macros.h menubar.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syssignal.h systime.h toolbar.h window.h winslots.h -event-unixoid.o: $(LISP_H) conslots.h console-stream.h console-tty.h console.h device.h devslots.h events.h lstream.h process.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h -events.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk.h console-tty.h console-x.h console.h device.h devslots.h events.h extents.h frame.h frameslots.h glyphs.h gui.h keymap.h redisplay.h scrollbar.h specifier.h syssignal.h systime.h systty.h toolbar.h window.h winslots.h xintrinsic.h -extents.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h debug.h device.h devslots.h elhash.h extents.h faces.h frame.h frameslots.h glyphs.h gui.h gutter.h insdel.h keymap.h opaque.h process.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -faces.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h elhash.h extents.h faces.h frame.h frameslots.h glyphs.h gui.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +eval.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device.h frame.h lstream.h opaque.h redisplay.h scrollbar.h window.h +event-Xt.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h Emacs.ad.h EmacsFrame.h blocktype.h charset.h conslots.h console-impl.h console-tty.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h elhash.h events.h file-coding.h frame-impl.h frame.h frameslots.h glyphs.h lstream.h objects-x.h objects.h offix-types.h offix.h process.h redisplay.h scrollbar.h specifier.h sysproc.h syssignal.h systime.h systty.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h +event-stream.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h file-coding.h frame-impl.h frame.h frameslots.h gui.h insdel.h keymap.h lstream.h macros.h menubar.h process.h redisplay.h scrollbar.h sysdep.h sysfile.h syssignal.h systime.h window-impl.h window.h winslots.h +event-unixoid.o: $(LISP_H) conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device.h events.h lstream.h process.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h +events.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h events.h extents.h frame-impl.h frame.h frameslots.h glyphs.h keymap.h lstream.h redisplay.h scrollbar.h specifier.h systime.h systty.h toolbar.h window-impl.h window.h winslots.h +extents.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h debug.h device.h elhash.h extents-impl.h extents.h faces.h frame.h glyphs.h gutter.h insdel.h keymap.h opaque.h process.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +faces.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h extents-impl.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h file-coding.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h elhash.h file-coding.h insdel.h lstream.h opaque.h -fileio.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h events.h file-coding.h frame.h frameslots.h glyphs.h gui.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h redisplay.h scrollbar.h specifier.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h systime.h syswindows.h toolbar.h window.h winslots.h +fileio.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h events.h file-coding.h frame.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h window-impl.h window.h winslots.h filelock.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h ndir.h paths.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h filemode.o: $(LISP_H) sysfile.h floatfns.o: $(LISP_H) sysfloat.h syssignal.h -fns.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h events.h extents.h frame.h frameslots.h glyphs.h gui.h insdel.h lstream.h opaque.h redisplay.h scrollbar.h specifier.h sysfile.h sysproc.h systime.h toolbar.h window.h winslots.h +fns.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h console.h device.h events.h extents.h frame.h insdel.h lstream.h opaque.h process.h redisplay.h sysfile.h sysproc.h syssignal.h systime.h font-lock.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h syntax.h -frame.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h events.h extents.h faces.h frame.h frameslots.h glyphs.h gui.h gutter.h menubar.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h +frame.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h gutter.h menubar.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window-impl.h window.h winslots.h free-hook.o: $(LISP_H) hash.h general.o: $(LISP_H) getloadavg.o: $(LISP_H) sysfile.h gif_io.o: $(LISP_H) gifrlib.h sysfile.h glade.o: bytecode.h -glyphs-eimage.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h faces.h file-coding.h frame.h frameslots.h gifrlib.h glyphs.h gui.h lstream.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysfile.h toolbar.h window.h winslots.h -glyphs-shared.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h elhash.h faces.h frame.h frameslots.h glyphs.h gui.h imgproc.h insdel.h lstream.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h toolbar.h window.h winslots.h -glyphs-widget.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h faces.h frame.h frameslots.h glyphs.h gui.h insdel.h lstream.h objects.h opaque.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -glyphs.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h elhash.h faces.h frame.h frameslots.h glyphs.h gui.h insdel.h objects.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h sysfile.h toolbar.h window.h winslots.h +glyphs-eimage.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h faces.h file-coding.h frame.h gifrlib.h glyphs.h lstream.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysfile.h window-impl.h window.h winslots.h +glyphs-shared.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h elhash.h faces.h frame.h glyphs.h imgproc.h insdel.h lstream.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h window-impl.h window.h winslots.h +glyphs-widget.o: $(LISP_H) bytecode.h charset.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h faces.h frame.h glyphs.h gui.h insdel.h lstream.h objects.h opaque.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +glyphs.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h insdel.h objects-impl.h objects.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h sysfile.h window-impl.h window.h winslots.h gmalloc.o: $(LISP_H) getpagesize.h sysdep.h -gpmevent.o: $(LISP_H) commands.h conslots.h console-tty.h console.h device.h devslots.h events.h gpmevent.h lstream.h process.h sysdep.h sysproc.h syssignal.h systime.h systty.h +gpmevent.o: $(LISP_H) commands.h console-tty.h console.h device.h events.h gpmevent.h lstream.h process.h sysdep.h sysproc.h syssignal.h systime.h systty.h gtk-glue.o: -gtk-xemacs.o: $(LISP_H) charset.h conslots.h console-gtk.h console.h device.h devslots.h event-gtk.h faces.h frame.h frameslots.h glyphs.h gtk-xemacs.h gui.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -gui.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h elhash.h gui.h -gutter.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h faces.h frame.h frameslots.h glyphs.h gui.h gutter.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +gtk-xemacs.o: $(LISP_H) charset.h console-gtk.h console.h device.h event-gtk.h faces.h frame.h glyphs.h gtk-xemacs.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +gui.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h elhash.h gui.h menubar.h +gutter.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gutter.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h hash.o: $(LISP_H) hash.h hftctl.o: $(LISP_H) sysfile.h hpplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h sound.h imgproc.o: $(LISP_H) imgproc.h -indent.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h extents.h faces.h frame.h frameslots.h glyphs.h gui.h insdel.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -inline.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-gtk.h console-msw.h console.h database.h device.h devslots.h eldap.h elhash.h events.h extents.h faces.h file-coding.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h gui.h intl-auto-encap-win32.h keymap.h lstream.h objects.h opaque.h postgresql.h process.h rangetab.h redisplay.h scrollbar.h specifier.h syntax.h sysdll.h systime.h syswindows.h toolbar.h tooltalk.h ui-gtk.h window.h winslots.h xintrinsic.h -input-method-motif.o: $(LISP_H) EmacsFrame.h conslots.h console-x.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h xintrinsic.h -input-method-xlib.o: $(LISP_H) EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h -insdel.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h extents.h frame.h frameslots.h glyphs.h gui.h insdel.h line-number.h lstream.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +indent.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h extents.h faces.h frame.h glyphs.h insdel.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +inline.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h console-gtk.h console-msw.h console.h database.h device.h eldap.h elhash.h events.h extents.h faces.h file-coding.h frame.h glyphs-x.h glyphs.h gui-x.h gui.h intl-auto-encap-win32.h keymap.h lstream.h objects.h opaque.h postgresql.h process.h rangetab.h redisplay.h scrollbar.h specifier.h syntax.h sysdll.h sysfile.h systime.h syswindows.h toolbar.h tooltalk.h ui-gtk.h window-impl.h window.h winslots.h xintrinsic.h +input-method-motif.o: $(LISP_H) EmacsFrame.h console-x.h console.h device.h frame.h redisplay.h xintrinsic.h +input-method-xlib.o: $(LISP_H) EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h xintrinsic.h +insdel.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h extents.h frame.h insdel.h line-number.h lstream.h redisplay.h intl-auto-encap-win32.o: $(LISP_H) intl-auto-encap-win32.h syswindows.h -intl-encap-win32.o: $(LISP_H) conslots.h console-msw.h console.h intl-auto-encap-win32.h syswindows.h -intl-win32.o: $(LISP_H) charset.h conslots.h console-msw.h console.h device.h devslots.h elhash.h faces.h file-coding.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h syswindows.h toolbar.h window.h winslots.h +intl-encap-win32.o: $(LISP_H) console-msw.h console.h intl-auto-encap-win32.h syswindows.h +intl-win32.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h elhash.h faces.h file-coding.h frame-impl.h frame.h frameslots.h intl-auto-encap-win32.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h syswindows.h window-impl.h window.h winslots.h intl.o: $(LISP_H) -keymap.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h elhash.h events.h frame.h frameslots.h glyphs.h gui.h insdel.h keymap.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h +keymap.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h elhash.h events.h extents.h frame.h insdel.h keymap.h redisplay.h scrollbar.h systime.h window.h lastfile.o: config.h +libinterface.o: $(LISP_H) gifrlib.h libinterface.h libsst.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h libsst.h sound.h sysfile.h line-number.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h line-number.h linuxplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h miscplay.h sound.h sysfile.h syssignal.h systty.h lread.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h elhash.h file-coding.h intl-auto-encap-win32.h lstream.h opaque.h sysfile.h sysfloat.h syswindows.h lstream.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h lstream.h sysfile.h -macros.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h keymap.h macros.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h +macros.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device.h events.h frame.h keymap.h macros.h redisplay.h scrollbar.h systime.h window.h malloc.o: config.h getpagesize.h marker.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h md5.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h file-coding.h lstream.h -menubar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h keymap.h menubar.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -minibuf.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-stream.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h insdel.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h +menubar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h frame-impl.h frame.h frameslots.h gui.h keymap.h menubar.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +minibuf.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-stream.h console.h events.h frame-impl.h frame.h frameslots.h insdel.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h miscplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h miscplay.h sound.h sysfile.h syssignal.h nas.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h sound.h sysdep.h syssignal.h -native-gtk-toolbar.o: $(LISP_H) charset.h conslots.h console-gtk.h console.h device.h devslots.h faces.h frame.h frameslots.h glyphs-gtk.h glyphs.h gui.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -nt.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h intl-auto-encap-win32.h ndir.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h -ntheap.o: $(LISP_H) intl-auto-encap-win32.h syswindows.h +native-gtk-toolbar.o: $(LISP_H) charset.h console-gtk.h console.h faces.h frame.h glyphs-gtk.h glyphs.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window-impl.h window.h winslots.h +nt.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h intl-auto-encap-win32.h ndir.h process.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h +ntheap.o: $(LISP_H) intl-auto-encap-win32.h sysdep.h syswindows.h ntplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h intl-auto-encap-win32.h sound.h sysfile.h syswindows.h -ntproc.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h intl-auto-encap-win32.h process.h sysfile.h sysproc.h syssignal.h systime.h syswait.h syswindows.h -objects.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h elhash.h faces.h frame.h frameslots.h glyphs.h gui.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +objects.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h faces.h frame.h glyphs.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h offix.o: offix-cursors.h offix-types.h offix.h xintrinsic.h opaque.o: $(LISP_H) opaque.h -postgresql.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h postgresql.h sysdep.h -print.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-msw.h console-stream.h console-tty.h console.h device.h devslots.h extents.h frame.h frameslots.h glyphs.h gui.h insdel.h intl-auto-encap-win32.h lstream.h opaque.h redisplay.h scrollbar.h specifier.h sysfile.h syssignal.h systty.h syswindows.h toolbar.h window.h winslots.h -process-nt.o: $(LISP_H) conslots.h console-msw.h console.h hash.h intl-auto-encap-win32.h lstream.h process.h procimpl.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h -process-unix.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h events.h file-coding.h frame.h frameslots.h glyphs.h gui.h hash.h lstream.h opaque.h process.h procimpl.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h toolbar.h window.h winslots.h -process.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h events.h file-coding.h frame.h frameslots.h glyphs.h gui.h hash.h insdel.h lstream.h opaque.h process.h procimpl.h redisplay.h scrollbar.h specifier.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h toolbar.h window.h winslots.h +postgresql.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h postgresql.h process.h sysdep.h +print.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h extents.h frame.h insdel.h intl-auto-encap-win32.h lstream.h opaque.h redisplay.h sysfile.h systty.h syswindows.h +process-nt.o: $(LISP_H) console-msw.h console.h hash.h intl-auto-encap-win32.h lstream.h process.h procimpl.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h +process-unix.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h events.h file-coding.h frame.h hash.h lstream.h ndir.h opaque.h process.h procimpl.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h window.h +process.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h console.h device.h events.h file-coding.h frame.h hash.h insdel.h lstream.h opaque.h process.h procimpl.h redisplay.h scrollbar.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h window.h profile.o: $(LISP_H) backtrace.h bytecode.h elhash.h hash.h syssignal.h systime.h ralloc.o: $(LISP_H) getpagesize.h rangetab.o: $(LISP_H) rangetab.h realpath.o: $(LISP_H) intl-auto-encap-win32.h sysfile.h syswindows.h -redisplay-output.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h faces.h frame.h frameslots.h glyphs.h gui.h gutter.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h -redisplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-tty.h console.h debug.h device.h devslots.h elhash.h extents.h faces.h file-coding.h frame.h frameslots.h glyphs.h gui.h gutter.h insdel.h line-number.h menubar.h objects.h process.h redisplay.h scrollbar.h specifier.h sysfile.h syssignal.h systty.h toolbar.h window.h winslots.h +redisplay-output.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gutter.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +redisplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-tty.h console.h debug.h device-impl.h device.h devslots.h elhash.h events.h extents-impl.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs.h gui.h gutter.h insdel.h line-number.h menubar.h objects-impl.h objects.h process.h redisplay.h scrollbar.h specifier.h sysfile.h systime.h systty.h toolbar.h window-impl.h window.h winslots.h regex.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h regex.h syntax.h -scrollbar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h gutter.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +scrollbar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h frame-impl.h frame.h frameslots.h glyphs.h gutter.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h search.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h opaque.h regex.h syntax.h -select.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h extents.h frame.h frameslots.h glyphs.h gui.h objects.h opaque.h redisplay.h scrollbar.h select.h specifier.h toolbar.h window.h winslots.h -sgiplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h libst.h sound.h sysfile.h sysproc.h systime.h +select.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h extents.h frame.h objects.h opaque.h redisplay.h select.h +sgiplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h libst.h sound.h sysfile.h sysproc.h syssignal.h systime.h sheap.o: $(LISP_H) sheap-adjust.h sysfile.h -signal.o: $(LISP_H) conslots.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syssignal.h systime.h toolbar.h window.h winslots.h -sound.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-x.h console.h device.h devslots.h redisplay.h sound.h sysdep.h sysfile.h sysproc.h systime.h xintrinsic.h -specifier.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +signal.o: $(LISP_H) conslots.h console-impl.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h process.h redisplay.h sysdep.h sysfile.h syssignal.h systime.h +sound.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h intl-auto-encap-win32.h redisplay.h sound.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h xintrinsic.h +specifier.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h frame.h glyphs.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h strcat.o: config.h strcmp.o: config.h strcpy.o: config.h strftime.o: $(LISP_H) sunplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h sound.h sysdep.h sysfile.h syssignal.h sunpro.o: $(LISP_H) -symbols.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h elhash.h +symbols.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h elhash.h syntax.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h extents.h syntax.h -sysdep.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-stream.h console-tty.h console.h device.h devslots.h events.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h ndir.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h systty.h syswait.h syswindows.h toolbar.h window.h winslots.h +sysdep.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame.h intl-auto-encap-win32.h ndir.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h systty.h syswait.h syswindows.h window.h sysdll.o: config.h sysdll.h -termcap.o: $(LISP_H) conslots.h console.h device.h devslots.h +termcap.o: $(LISP_H) console.h device.h terminfo.o: config.h tests.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h elhash.h lstream.h opaque.h text.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h file-coding.h lstream.h -toolbar-common.o: $(LISP_H) charset.h conslots.h console-gtk.h console-x.h console.h device.h devslots.h faces.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h toolbar-common.h toolbar.h window.h winslots.h xintrinsic.h -toolbar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console.h device.h devslots.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +toolbar-common.o: $(LISP_H) charset.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h faces.h frame-impl.h frame.h frameslots.h glyphs.h redisplay.h scrollbar.h specifier.h toolbar-common.h toolbar.h window-impl.h window.h winslots.h xintrinsic.h +toolbar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h frame-impl.h frame.h frameslots.h glyphs.h redisplay.h scrollbar.h specifier.h toolbar.h window-impl.h window.h winslots.h tooltalk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h elhash.h process.h syssignal.h tooltalk.h tparam.o: $(LISP_H) ui-byhand.o: gui.h @@ -245,7 +245,7 @@ unicode.o: $(LISP_H) charset.h file-coding.h opaque.h sysfile.h vm-limit.o: $(LISP_H) mem-limits.h widget.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h -win32.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-msw.h console.h intl-auto-encap-win32.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h -window.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console.h device.h devslots.h elhash.h faces.h frame.h frameslots.h glyphs.h gui.h gutter.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h +win32.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console-msw.h console.h intl-auto-encap-win32.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h +window.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gutter.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h xgccache.o: $(LISP_H) hash.h xgccache.h xmu.o: config.h diff --text -u 'xemacs-21.5.6/src/device-gtk.c' 'xemacs-21.5.7/src/device-gtk.c' Index: ././src/device-gtk.c --- ././src/device-gtk.c Fri Mar 29 13:47:08 2002 +++ ././src/device-gtk.c Fri Jun 21 06:18:25 2002 @@ -1,6 +1,7 @@ /* Device functions for X windows. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -28,20 +29,21 @@ #include #include "lisp.h" -#include "console-gtk.h" -#include "gccache-gtk.h" -#include "glyphs-gtk.h" -#include "objects-gtk.h" -#include "gtk-xemacs.h" - #include "buffer.h" +#include "device-impl.h" +#include "elhash.h" #include "events.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "redisplay.h" #include "sysdep.h" #include "window.h" -#include "elhash.h" + +#include "console-gtk-impl.h" +#include "gccache-gtk.h" +#include "glyphs-gtk.h" +#include "objects-gtk.h" +#include "gtk-xemacs.h" #include "sysfile.h" #include "systime.h" @@ -54,8 +56,6 @@ #include #endif -Lisp_Object Vdefault_gtk_device; - /* Qdisplay in general.c */ Lisp_Object Qinit_pre_gtk_win, Qinit_post_gtk_win; @@ -121,6 +121,18 @@ extern void gdk_imlib_init(void); #endif +extern void emacs_gtk_selection_handle (GtkWidget *, + GtkSelectionData *selection_data, + guint info, + guint time_stamp, + gpointer data); +extern void emacs_gtk_selection_clear_event_handle (GtkWidget *widget, + GdkEventSelection *event, + gpointer data); +extern void emacs_gtk_selection_received (GtkWidget *widget, + GtkSelectionData *selection_data, + gpointer user_data); + #ifdef HAVE_BONOBO static CORBA_ORB orb; #endif @@ -358,22 +370,6 @@ #endif } - if (EQ (device, Vdefault_gtk_device)) - { - Lisp_Object devcons, concons; - /* #### handle deleting last X device */ - Vdefault_gtk_device = Qnil; - DEVICE_LOOP_NO_BREAK (devcons, concons) - { - if (DEVICE_GTK_P (XDEVICE (XCAR (devcons))) && - !EQ (device, XCAR (devcons))) - { - Vdefault_gtk_device = XCAR (devcons); - goto double_break; - } - } - } - double_break: free_gtk_device_struct (d); } @@ -400,15 +396,6 @@ /* display information functions */ /************************************************************************/ -DEFUN ("default-gtk-device", Fdefault_gtk_device, 0, 0, 0, /* -Return the default GTK device for resourcing. -This is the first-created GTK device that still exists. -*/ - ()) -{ - return Vdefault_gtk_device; -} - DEFUN ("gtk-display-visual-class", Fgtk_display_visual_class, 0, 1, 0, /* Return the visual class of the GTK display DEVICE is using. The returned value will be one of the symbols `static-gray', `gray-scale', @@ -685,7 +672,6 @@ void syms_of_device_gtk (void) { - DEFSUBR (Fdefault_gtk_device); DEFSUBR (Fgtk_keysym_on_keyboard_p); DEFSUBR (Fgtk_display_visual_class); DEFSUBR (Fgtk_display_visual_depth); @@ -719,8 +705,6 @@ { Fprovide (Qgtk); - staticpro (&Vdefault_gtk_device); - DEFVAR_LISP ("gtk-initial-argv-list", &Vgtk_initial_argv_list /* You don't want to know. This is used during startup to communicate the remaining arguments in @@ -736,7 +720,6 @@ This is used during startup to communicate the default geometry to GTK. */ ); - Vdefault_gtk_device = Qnil; Vgtk_initial_geometry = Qnil; Vgtk_initial_argv_list = Qnil; } diff --text -u /dev/null 'xemacs-21.5.7/src/device-impl.h' Index: ././src/device-impl.h --- ././src/device-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/device-impl.h Fri Jun 21 06:18:25 2002 @@ -0,0 +1,331 @@ +/* Define device-object for XEmacs. + Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995, 2002 Ben Wing + Copyright (C) 1995 Sun Microsystems + +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 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. */ + +/* Synched up with: Not in FSF. */ + +/* Written by Chuck Thompson and Ben Wing. */ + +#ifndef INCLUDED_device_impl_h_ +#define INCLUDED_device_impl_h_ + +#include "console-impl.h" +#include "device.h" + +/* This should really be in redisplay.h but by putting it here we + won't have to ensure that redisplay.h is always included before + this file. */ +struct pixel_to_glyph_translation_cache +{ + unsigned int valid :1; + struct frame *frame; + int low_x_coord, high_x_coord, col, obj_x; + int low_y_coord, high_y_coord, row, obj_y; + struct window *w; + Charbpos charpos; + Charbpos closest; + Charcount modeline_closest; + Lisp_Object obj1, obj2; + int retval; +}; + +/* Less public: */ +#define DEVICE_TYPE_NAME(d) ((d)->devmeths->name) +#define DEVICE_IMPL_FLAG(d, f) CONMETH_IMPL_FLAG ((d)->devmeths, (f)) +#define DEVICE_SPECIFIC_FRAME_PROPS(d) \ + ((d)->devmeths->device_specific_frame_props) + +/* More public: */ +#define DEVICE_TYPE(d) ((d)->devmeths->symbol) +#define XDEVICE_TYPE(d) DEVICE_TYPE (XDEVICE (d)) + +/******** Accessing / calling a device method *********/ + +#define HAS_DEVMETH_P(d, m) HAS_CONTYPE_METH_P ((d)->devmeths, m) +#define DEVMETH(d, m, args) CONTYPE_METH ((d)->devmeths, m, args) +#define MAYBE_DEVMETH(d, m, args) MAYBE_CONTYPE_METH ((d)->devmeths, m, args) +#define DEVMETH_OR_GIVEN(d, m, args, given) \ + CONTYPE_METH_OR_GIVEN((d)->devmeths, m, args, given) +#define MAYBE_INT_DEVMETH(d, m, args) \ + MAYBE_INT_CONTYPE_METH ((d)->devmeths, m, args) +#define MAYBE_LISP_DEVMETH(d, m, args) \ + MAYBE_LISP_CONTYPE_METH ((d)->devmeths, m, args) + +struct device +{ + struct lcrecord_header header; + + /* Methods for this device's console. This can also be retrieved + through device->console, but it's faster this way. */ + struct console_methods *devmeths; + + /* A structure of auxiliary data specific to the device type. + struct x_device is used for X window frames; defined in console-x.h + struct tty_device is used to TTY's; defined in console-tty.h */ + void *device_data; + + /* redisplay flags */ + unsigned int buffers_changed :1; + unsigned int clip_changed :1; + unsigned int extents_changed :1; + unsigned int faces_changed :1; + unsigned int frame_changed :1; + unsigned int glyphs_changed :1; + unsigned int subwindows_changed :1; + unsigned int subwindows_state_changed :1; + unsigned int icon_changed :1; + unsigned int menubar_changed :1; + unsigned int modeline_changed :1; + unsigned int point_changed :1; + unsigned int size_changed :1; + unsigned int gutter_changed :1; + unsigned int toolbar_changed :1; + unsigned int windows_changed :1; + unsigned int windows_structure_changed :1; + + unsigned int locked :1; + + /* Cache information about last pixel position translated to a + glyph. The law of locality applies very heavily here so caching + the value leads to a significant win. At the moment this is + really X specific but once we have generic mouse support it won't + be. */ + struct pixel_to_glyph_translation_cache pixel_to_glyph_cache; + + /* Output baud rate of device; used for redisplay decisions. */ + int baud_rate; + + /* sound flags */ + unsigned int on_console_p :1; + unsigned int connected_to_nas_p :1; + +#define MARKED_SLOT(x) Lisp_Object x +#include "devslots.h" + + /* File descriptors for input and output. Much of the time + (but not always) these will be the same. For an X device, + these both hold the file descriptor of the socket used + to communicate with the X server. For a TTY device, these + may or may not be the same and point to the terminal that + is used for I/O. */ + int infd, outfd; + + /* infd and outfd are moved outside HAVE_UNIXOID_EVENT_LOOP conditionals, + because Win32, presumably the first port which does not use select() + polling, DOES have handles for a console device. -- kkm */ + +#ifdef HAVE_UNIXOID_EVENT_LOOP + /* holds some data necessary for SIGIO control. Perhaps this should + be inside of device_data; but it is used for both TTY's and X + device. Perhaps it should be conditionalized on SIGIO; but + this requires including syssignal.h. */ + int old_fcntl_owner; +#endif +}; + +/* Redefine basic properties more efficiently */ + +#undef DEVICE_LIVE_P +#define DEVICE_LIVE_P(d) (!EQ (DEVICE_TYPE (d), Qdead)) +#undef DEVICE_CONSOLE +#define DEVICE_CONSOLE(d) ((d)->console) +#undef DEVICE_FRAME_LIST +#define DEVICE_FRAME_LIST(d) ((d)->frame_list) + +#define DEVICE_TYPE_P(d, type) EQ (DEVICE_TYPE (d), Q##type) + +#ifdef ERROR_CHECK_TYPES +DECLARE_INLINE_HEADER ( +struct device * +error_check_device_type (struct device *d, Lisp_Object sym) +) +{ + assert (EQ (DEVICE_TYPE (d), sym)); + return d; +} +# define DEVICE_TYPE_DATA(d, type) \ + ((struct type##_device *) error_check_device_type (d, Q##type)->device_data) +#else +# define DEVICE_TYPE_DATA(d, type) \ + ((struct type##_device *) (d)->device_data) +#endif + +#define CHECK_DEVICE_TYPE(x, type) \ + do { \ + CHECK_DEVICE (x); \ + if (!(DEVICEP (x) && DEVICE_TYPE_P (XDEVICE (x), \ + type))) \ + dead_wrong_type_argument \ + (type##_console_methods->predicate_symbol, x); \ + } while (0) +#define CONCHECK_DEVICE_TYPE(x, type) \ + do { \ + CONCHECK_DEVICE (x); \ + if (!(DEVICEP (x) && DEVICE_TYPE_P (XDEVICE (x), \ + type))) \ + x = wrong_type_argument \ + (type##_console_methods->predicate_symbol, x); \ + } while (0) + +#define DEVICE_DISPLAY_P(dev) \ + (DEVICE_LIVE_P (dev) && \ + !DEVICE_IMPL_FLAG (dev, XDEVIMPF_IS_A_PRINTER)) + +#define CHECK_DISPLAY_DEVICE(dev) \ + do { \ + CHECK_DEVICE (dev); \ + if (!(DEVICEP (dev) \ + && DEVICE_DISPLAY_P (XDEVICE (dev)))) \ + dead_wrong_type_argument (Qdisplay, dev); \ + } while (0) + +#define CONCHECK_DISPLAY_DEVICE(dev) \ + do { \ + CONCHECK_DEVICE (dev); \ + if (!(DEVICEP (dev) \ + && DEVICE_DISPLAY_P (XDEVICE (dev)))) \ + wrong_type_argument (Qdisplay, dev); \ + } while (0) + +#define DEVICE_PRINTER_P(dev) \ + (DEVICE_LIVE_P (dev) && !DEVICE_DISPLAY_P (dev)) + +#define CHECK_PRINTER_DEVICE(dev) \ + do { \ + CHECK_DEVICE (dev); \ + if (!(DEVICEP (dev) \ + && DEVICE_PRINTER_P (XDEVICE (dev)))) \ + dead_wrong_type_argument (Qprinter, dev); \ + } while (0) + +#define CONCHECK_PRINTER_DEVICE(dev) \ + do { \ + CONCHECK_DEVICE (dev); \ + if (!(DEVICEP (dev) \ + && DEVICE_PRINTER_P (XDEVICE (dev)))) \ + wrong_type_argument (Qprinter, dev); \ + } while (0) + +/* #### These should be in the device-*.h files but there are + too many places where the abstraction is broken. Need to + fix. */ + +#define DEVICE_X_P(dev) CONSOLE_TYPESYM_X_P (DEVICE_TYPE (dev)) +#define CHECK_X_DEVICE(z) CHECK_DEVICE_TYPE (z, x) +#define CONCHECK_X_DEVICE(z) CONCHECK_DEVICE_TYPE (z, x) + +#define DEVICE_GTK_P(dev) CONSOLE_TYPESYM_GTK_P (DEVICE_TYPE (dev)) +#define CHECK_GTK_DEVICE(z) CHECK_DEVICE_TYPE (z, gtk) +#define CONCHECK_GTK_DEVICE(z) CONCHECK_DEVICE_TYPE (z, gtk) + +#define DEVICE_MSWINDOWS_P(dev) CONSOLE_TYPESYM_MSWINDOWS_P (DEVICE_TYPE (dev)) +#define CHECK_MSWINDOWS_DEVICE(z) CHECK_DEVICE_TYPE (z, mswindows) +#define CONCHECK_MSWINDOWS_DEVICE(z) CONCHECK_DEVICE_TYPE (z, mswindows) + +#define DEVICE_TTY_P(dev) CONSOLE_TYPESYM_TTY_P (DEVICE_TYPE (dev)) +#define CHECK_TTY_DEVICE(z) CHECK_DEVICE_TYPE (z, tty) +#define CONCHECK_TTY_DEVICE(z) CONCHECK_DEVICE_TYPE (z, tty) + +#define DEVICE_STREAM_P(dev) CONSOLE_TYPESYM_STREAM_P (DEVICE_TYPE (dev)) +#define CHECK_STREAM_DEVICE(z) CHECK_DEVICE_TYPE (z, stream) +#define CONCHECK_STREAM_DEVICE(z) CONCHECK_DEVICE_TYPE (z, stream) + +#define DEVICE_WIN_P(dev) CONSOLE_TYPESYM_WIN_P (DEVICE_TYPE (dev)) + +#define DEVICE_REDISPLAY_INFO(d) ((d)->redisplay_info) + +#define DEVICE_NAME(d) ((d)->name) +#define DEVICE_CLASS(d) ((d)->device_class) +/* Catch people attempting to set this. */ +#define DEVICE_SELECTED_FRAME(d) NON_LVALUE ((d)->selected_frame) +#define DEVICE_FRAME_WITH_FOCUS_REAL(d) ((d)->frame_with_focus_real) +#define DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS(d) ((d)->frame_with_focus_for_hooks) +#define DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS(d) \ + ((d)->frame_that_ought_to_have_focus) +#define DEVICE_USER_DEFINED_TAGS(d) ((d)->user_defined_tags) +#define DEVICE_CONNECTION(d) ((d)->connection) +#define DEVICE_CANON_CONNECTION(d) ((d)->canon_connection) +#define DEVICE_BAUD_RATE(d) ((d)->baud_rate) +#define DEVICE_INFD(d) ((d)->infd) +#define DEVICE_OUTFD(d) ((d)->outfd) +#define DEVICE_OLD_FCNTL_OWNER(d) ((d)->old_fcntl_owner) +#define DEVICE_ON_CONSOLE_P(d) ((d)->on_console_p) +#define DEVICE_CONNECTED_TO_NAS_P(d) ((d)->connected_to_nas_p) + +#define LOCK_DEVICE(d) ((void) ((d)->locked = 1)) +#define UNLOCK_DEVICE(d) ((void) ((d)->locked = 0)) + +#define INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE(d) \ + ((void) ((d)->pixel_to_glyph_cache.valid = 0)) + +#define INVALIDATE_PIXEL_TO_GLYPH_CACHE do { \ + Lisp_Object IPTGC_devcons, IPTGC_concons; \ + DEVICE_LOOP_NO_BREAK (IPTGC_devcons, IPTGC_concons) \ + INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE (XDEVICE (XCAR (IPTGC_devcons))); \ +} while (0) + +#define MARK_DEVICE_FACES_CHANGED(d) \ + ((void) (faces_changed = (d)->faces_changed = 1)) + +#define MARK_DEVICE_GLYPHS_CHANGED(d) \ + ((void) (glyphs_changed = (d)->glyphs_changed = 1)) + +#define MARK_DEVICE_SUBWINDOWS_CHANGED(d) \ + ((void) (subwindows_changed = (d)->subwindows_changed = 1)) + +#define MARK_DEVICE_SUBWINDOWS_STATE_CHANGED(d) \ + ((void) (subwindows_state_changed = (d)->subwindows_state_changed = 1)) + +#define MARK_DEVICE_TOOLBARS_CHANGED(d) \ + ((void) (toolbar_changed = (d)->toolbar_changed = 1)) + +#define MARK_DEVICE_GUTTERS_CHANGED(d) \ + ((void) (gutter_changed = (d)->gutter_changed = 1)) + +#define MARK_DEVICE_SIZE_CHANGED(d) \ + ((void) (size_changed = (d)->size_changed = 1)) + +#define MARK_DEVICE_FRAMES_FACES_CHANGED(d) do { \ + struct device *mdffc_d = (d); \ + Lisp_Object frmcons; \ + DEVICE_FRAME_LOOP (frmcons, mdffc_d) \ + XFRAME (XCAR (frmcons))->faces_changed = 1; \ + MARK_DEVICE_FACES_CHANGED (mdffc_d); \ +} while (0) + +#define MARK_DEVICE_FRAMES_GLYPHS_CHANGED(d) do { \ + struct device *mdffc_d = (d); \ + Lisp_Object frmcons; \ + DEVICE_FRAME_LOOP (frmcons, mdffc_d) \ + XFRAME (XCAR (frmcons))->glyphs_changed = 1; \ + MARK_DEVICE_GLYPHS_CHANGED (mdffc_d); \ +} while (0) + +#define MARK_DEVICE_FRAME_CHANGED(d) \ + ((void) (frame_changed = (d)->frame_changed = 1)) + +#define MARK_DEVICE_WINDOWS_CHANGED(d) \ + ((void) (windows_changed = (d)->windows_changed = 1)) + +#define MARK_DEVICE_WINDOWS_STRUCTURE_CHANGED(d) \ + ((void) (windows_structure_changed = (d)->windows_structure_changed = 1)) + +#endif /* INCLUDED_device_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/device-msw.c' 'xemacs-21.5.7/src/device-msw.c' Index: ././src/device-msw.c --- ././src/device-msw.c Sun Mar 31 17:27:52 2002 +++ ././src/device-msw.c Fri Jun 21 06:18:25 2002 @@ -38,12 +38,12 @@ #include #include "lisp.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "faces.h" #include "frame.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "console-stream.h" #include "objects-msw.h" @@ -427,7 +427,7 @@ msprinter_default_printer (void) { Extbyte name[666]; - Intbyte *nameint; + Ibyte *nameint; if (qxeGetProfileString (XETEXT ("windows"), XETEXT ("device"), NULL, name, sizeof (name) / XETCHAR_SIZE) <= 0) @@ -438,7 +438,7 @@ return Qnil; /* this is destructive, but that's ok because the string is either in - name[] or alloca()ed */ + name[] or ALLOCA ()ed */ qxestrtok (nameint, ","); return build_intstring (nameint); @@ -596,7 +596,7 @@ Nothing wrong on the Windows side, just forge a unique connection name. Use the memory address of d as a unique suffix. */ - Intbyte new_connext[20]; + Ibyte new_connext[20]; qxesprintf (new_connext, ":%X", d->header.uid); new_connection = concat2 (devname, build_intstring (new_connext)); @@ -871,11 +871,12 @@ { Lisp_Devmode *ldm = decode_devmode (device); PAGESETUPDLGW pd; - DWORD data; + Extbyte measure[2 * MAX_XETCHAR_SIZE]; + int data; - qxeGetLocaleInfo (LOCALE_USER_DEFAULT, - LOCALE_IMEASURE | LOCALE_RETURN_NUMBER, - (Extbyte *) &data, sizeof (data)); + qxeGetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IMEASURE, + measure, sizeof (measure) / XETCHAR_SIZE); + data = xetcscmp (measure, XETEXT ("0")); memset (&pd, 0, sizeof (pd)); pd.lStructSize = sizeof (pd); @@ -1075,7 +1076,7 @@ if (print_readably) printing_unreadable_object ("#", dm->header.uid); - write_c_string ("#printer_name)) write_fmt_string_lisp (printcharfun, " for %S", 1, dm->printer_name); if (!NILP (dm->device)) @@ -1248,7 +1249,7 @@ if (GetLastError () != ERROR_INSUFFICIENT_BUFFER) signal_enum_printer_error (); - data_buf = (BYTE *) alloca (bytes_needed); + data_buf = (BYTE *) ALLOCA (bytes_needed); ok = qxeEnumPrinters (enum_flags, NULL, enum_level, data_buf, bytes_needed, &bytes_needed, &num_printers); if (!ok) diff --text -u 'xemacs-21.5.6/src/device-tty.c' 'xemacs-21.5.7/src/device-tty.c' Index: ././src/device-tty.c --- ././src/device-tty.c Sun Mar 31 17:27:53 2002 +++ ././src/device-tty.c Fri Jun 21 06:18:26 2002 @@ -27,7 +27,7 @@ #include #include "lisp.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "faces.h" #include "frame.h" @@ -35,7 +35,7 @@ #include "redisplay.h" #include "sysdep.h" -#include "console-tty.h" +#include "console-tty-impl.h" #include "console-stream.h" #include "sysfile.h" diff --text -u 'xemacs-21.5.6/src/device-x.c' 'xemacs-21.5.7/src/device-x.c' Index: ././src/device-x.c --- ././src/device-x.c Sun Mar 31 17:27:54 2002 +++ ././src/device-x.c Fri Jun 21 06:18:26 2002 @@ -31,16 +31,16 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "events.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "redisplay.h" #include "sysdep.h" #include "window.h" -#include "console-x.h" +#include "console-x-impl.h" #include "glyphs-x.h" #include "objects-x.h" @@ -63,7 +63,6 @@ #include "offix.h" #endif -Lisp_Object Vdefault_x_device; #ifdef MULE Lisp_Object Vx_app_defaults_directory; Lisp_Object Qget_coding_system_from_locale; @@ -138,15 +137,16 @@ # define FALLBACK_RESOURCE_NAME "infodock" #endif - if (!d) { - /* This isn't one of our displays. Let's crash? */ - stderr_out - ("\n%s: Fatal X Condition. Asked about display we don't own: \"%s\"\n", - (STRINGP (Vinvocation_name) ? - (char *) XSTRING_DATA (Vinvocation_name) : FALLBACK_RESOURCE_NAME), - DisplayString (dpy) ? DisplayString (dpy) : "???"); - abort(); - } + if (!d) + { + /* This isn't one of our displays. Let's crash? */ + stderr_out + ("\n%s: Fatal X Condition. Asked about display we don't own: \"%s\"\n", + (STRINGP (Vinvocation_name) ? + (char *) XSTRING_DATA (Vinvocation_name) : FALLBACK_RESOURCE_NAME), + DisplayString (dpy) ? DisplayString (dpy) : "???"); + abort(); + } #undef FALLBACK_RESOURCE_NAME @@ -219,7 +219,7 @@ strcat (buf2, "._no_._such_._resource_.Geometry"); if (XrmGetResource (XtDatabase (dpy), buf1, buf2, &type, &value) == True) { - Intbyte *app_name_int, *app_class_int, *value_addr_int; + Ibyte *app_name_int, *app_class_int, *value_addr_int; Lisp_Object codesys = coding_system_of_xrm_database (XtDatabase (dpy)); EXTERNAL_TO_C_STRING (app_name, app_name_int, codesys); EXTERNAL_TO_C_STRING (app_class, app_class_int, codesys); @@ -625,8 +625,6 @@ speed_up_interrupts (); screen = DefaultScreen (dpy); - if (NILP (Vdefault_x_device)) - Vdefault_x_device = device; #ifdef MULE { @@ -644,7 +642,7 @@ { LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, Qfile_name); - path = (Extbyte *) alloca (strlen (data_dir) + strlen (locale) + + path = (Extbyte *) ALLOCA (strlen (data_dir) + strlen (locale) + 7); sprintf (path, "%s%s/Emacs", data_dir, locale); if (!access (path, R_OK)) @@ -653,7 +651,7 @@ else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) { LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name); - path = (Extbyte *) alloca (strlen (data_dir) + 13 + strlen (locale) + + path = (Extbyte *) ALLOCA (strlen (data_dir) + 13 + strlen (locale) + 7); sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale); if (!access (path, R_OK)) @@ -914,22 +912,6 @@ #endif } - if (EQ (device, Vdefault_x_device)) - { - Lisp_Object devcons, concons; - /* #### handle deleting last X device */ - Vdefault_x_device = Qnil; - DEVICE_LOOP_NO_BREAK (devcons, concons) - { - if (DEVICE_X_P (XDEVICE (XCAR (devcons))) && - !EQ (device, XCAR (devcons))) - { - Vdefault_x_device = XCAR (devcons); - goto double_break; - } - } - } - double_break: free_x_device_struct (d); } @@ -1048,6 +1030,8 @@ } else { + int depth; + #ifdef EXTERNAL_WIDGET struct frame *f; struct device *d = get_device_from_display (disp); @@ -1083,11 +1067,14 @@ } #endif /* EXTERNAL_WIDGET */ + /* #### this should issue a warning instead of outputting to stderr */ + depth = begin_dont_check_for_quit (); stderr_out ("\n%s: ", (STRINGP (Vinvocation_name) ? (char *) XSTRING_DATA (Vinvocation_name) : "xemacs")); XmuPrintDefaultErrorMessage (disp, event, stderr); + unbind_to (depth); } return 0; } @@ -1116,7 +1103,7 @@ signal_if_x_error (Display *dpy, int resumable_p) { Extbyte buf[1024]; - Intbyte num[100]; + Ibyte num[100]; Lisp_Object data; if (! x_error_occurred_p (dpy)) return 0; @@ -1156,8 +1143,9 @@ if (NILP (find_nonminibuffer_frame_not_on_device (dev))) { + int depth = begin_dont_check_for_quit (); /* We're going down. */ - Intbyte *errmess; + Ibyte *errmess; GET_STRERROR (errmess, errno); stderr_out ("\n%s: Fatal I/O Error %d (%s) on display " "connection \"%s\"\n", @@ -1169,10 +1157,11 @@ NextRequest (disp) - 1, LastKnownRequestProcessed (disp), QLength (disp)); /* assert (!_Xdebug); */ + unbind_to (depth); } else { - Intbyte *errmess; + Ibyte *errmess; GET_STRERROR (errmess, errno); warn_when_safe (Qx, Qcritical, @@ -1327,7 +1316,7 @@ if (DEVICEP (device) && !DEVICE_X_P (XDEVICE (device))) device = Qnil; if (NILP (device)) - device = Vdefault_x_device; + device = get_default_device (Qx); if (NILP (device)) { *display_out = 0; @@ -1588,9 +1577,9 @@ if (!display) return Qnil; - return Fcons (make_string ((Intbyte *) Dynarr_atp (name_Extbyte_dynarr, 0), + return Fcons (make_string ((Ibyte *) Dynarr_atp (name_Extbyte_dynarr, 0), Dynarr_length (name_Extbyte_dynarr)), - make_string ((Intbyte *) Dynarr_atp (class_Extbyte_dynarr, 0), + make_string ((Ibyte *) Dynarr_atp (class_Extbyte_dynarr, 0), Dynarr_length (class_Extbyte_dynarr))); } @@ -1636,10 +1625,11 @@ DEFUN ("default-x-device", Fdefault_x_device, 0, 0, 0, /* Return the default X device for resourcing. This is the first-created X device that still exists. +See also `default-device'. */ ()) { - return Vdefault_x_device; + return get_default_device (Qx); } DEFUN ("x-display-visual-class", Fx_display_visual_class, 0, 1, 0, /* @@ -2106,7 +2096,4 @@ #endif Fprovide (Qx); - - staticpro (&Vdefault_x_device); - Vdefault_x_device = Qnil; } diff --text -u 'xemacs-21.5.6/src/device.c' 'xemacs-21.5.7/src/device.c' Index: ././src/device.c --- ././src/device.c Sun Mar 31 17:27:55 2002 +++ ././src/device.c Fri Jun 21 06:18:26 2002 @@ -1,7 +1,7 @@ /* Generic device functions. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 2002 Ben Wing + Copyright (C) 1995, 1996, 2002 Ben Wing. This file is part of XEmacs. @@ -22,20 +22,23 @@ /* Synched up with: Not in FSF. */ -/* Original version by Chuck Thompson; - rewritten and expanded by Ben Wing. */ +/* Written by Ben Wing, late 1995? + Based on prototype by Chuck Thompson. + device-system-metric stuff added 1998? by Kirill Katsnelson. +*/ #include #include "lisp.h" #include "buffer.h" #include "console.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "events.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "keymap.h" +#include "objects.h" #include "redisplay.h" #include "specifier.h" #include "sysdep.h" @@ -51,11 +54,13 @@ /* Vdefault_device is the firstly-created non-stream device that's still around. We don't really use it anywhere currently, but it might be used for resourcing at some point. (Currently we use - Vdefault_x_device.) */ + the default X device -- see Vdefault_device_plist.) */ Lisp_Object Vdefault_device; Lisp_Object Vcreate_device_hook, Vdelete_device_hook; +static Lisp_Object Vdefault_device_plist; + /* Device classes */ /* Qcolor defined in general.c */ Lisp_Object Qgrayscale, Qmono; @@ -155,6 +160,8 @@ struct device *d = alloc_lcrecord_type (struct device, &lrecord_device); struct gcpro gcpro1; + zero_lcrecord (d); + device = wrap_device (d); GCPRO1 (device); @@ -169,9 +176,7 @@ d->font_instance_cache = make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQUAL); #ifdef MULE - /* Note that the following table is bi-level. */ - d->charset_font_cache = - make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); + initialize_charset_font_caches (d); #endif /* Note that the image instance cache is actually bi-level. @@ -206,6 +211,24 @@ return DFW_DEVICE (object); } +Lisp_Object +device_console (struct device *d) +{ + return DEVICE_CONSOLE (d); +} + +int +device_live_p (struct device *d) +{ + return DEVICE_LIVE_P (d); +} + +Lisp_Object +device_frame_list (struct device *d) +{ + return DEVICE_FRAME_LIST (d); +} + DEFUN ("selected-device", Fselected_device, 0, 1, 0, /* Return the device which is currently active. @@ -329,8 +352,6 @@ return DEVICE_CONSOLE (decode_device (device)); } -#ifdef HAVE_WINDOW_SYSTEM - static void init_global_resources (struct device *d) { @@ -343,8 +364,6 @@ #endif } -#endif - static void init_device_resources (struct device *d) { @@ -357,6 +376,45 @@ #endif } +DEFUN ("default-device", Fdefault_device, 0, 1, 0, /* +Return the default device of type TYPE. +This is generally the first-created device of that TYPE that still exists. +It is used for resourcing and certain other things. On MS Windows, it +is not very useful because there is generally only one device. +If TYPE is omitted, it is derived from the selected device. +If there is no default device of TYPE, nil is returned. +*/ + (type)) +{ + if (NILP (type)) + type = XDEVICE_TYPE (Fselected_device (Qnil)); + else + /* For errors */ + decode_console_type (type, ERROR_ME); + + return Fplist_get (Vdefault_device_plist, type, Qnil); +} + +/* Return the default device for a device type. */ +Lisp_Object +get_default_device (Lisp_Object type) +{ + return Fplist_get (Vdefault_device_plist, type, Qnil); +} + +/* Set the default device for a device type. */ +void +set_default_device (Lisp_Object type, Lisp_Object device) +{ + Vdefault_device_plist = Fplist_put (Vdefault_device_plist, type, device); +} + +void +clear_default_devices (void) +{ + Vdefault_device_plist = Qnil; +} + static Lisp_Object semi_canonicalize_device_connection (struct console_methods *meths, Lisp_Object name, Error_Behavior errb) @@ -506,27 +564,16 @@ int speccount = specpdl_depth(); struct gcpro gcpro1, gcpro2, gcpro3; -#ifdef HAVE_X_WINDOWS - /* #### icky-poo. If this is the first X device we are creating, - then retrieve the global face resources. We have to do it - here, at the same time as (or just before) the device face - resources are retrieved; specifically, it needs to be done - after the device has been created but before any frames have - been popped up or much anything else has been done. It's - possible for other devices to specify different global - resources (there's a property on each X server's root window - that holds some resources); tough luck for the moment. - - This is a nasty violation of device independence, but - there's not a whole lot I can figure out to do about it. - The real problem is that the concept of resources is not - generalized away from X. Similar resource-related - device-independence violations occur in faces.el. */ - int first_x_device = NILP (Vdefault_x_device) && EQ (type, Qx); -#endif -#ifdef HAVE_GTK - int first_gtk_device = NILP (Vdefault_gtk_device) && EQ (type, Qgtk); -#endif + /* If this is the first device we are creating of a particular type + (e.g. X), then retrieve the global face resources. We have to do it + here, at the same time as (or just before) the device face resources + are retrieved; specifically, it needs to be done after the device has + been created but before any frames have been popped up or much + anything else has been done. It's possible for other devices to + specify different global resources (there's a property on each X + server's root window that holds some resources); tough luck for the + moment. */ + int first = NILP (get_default_device (type)); GCPRO3 (device, console, name); @@ -549,7 +596,7 @@ console = create_console (name, type, conconnect, props); } - record_unwind_protect(delete_deviceless_console, console); + record_unwind_protect (delete_deviceless_console, console); con = XCONSOLE (console); d = allocate_device (console); @@ -567,30 +614,39 @@ /* Do it this way so that the device list is in order of creation */ con->device_list = nconc2 (con->device_list, Fcons (device, Qnil)); + + if (NILP (get_default_device (type))) + set_default_device (type, device); + + note_object_created (device); + RESET_CHANGED_SET_FLAGS; if (NILP (Vdefault_device) || DEVICE_STREAM_P (XDEVICE (Vdefault_device))) Vdefault_device = device; init_device_sound (d); -#ifdef HAVE_X_WINDOWS - if (first_x_device) - init_global_resources (d); -#endif -#ifdef HAVE_GTK - if (first_gtk_device) - init_global_resources (d); -#endif - init_device_resources (d); - - MAYBE_DEVMETH (d, finish_init_device, (d, props)); /* If this is the first device on the console, make it the selected one. */ if (NILP (CONSOLE_SELECTED_DEVICE (con))) CONSOLE_SELECTED_DEVICE (con) = device; - /* #### the following should trap errors. */ + /* Needed before initialization of resources because they may do things + with the tags, esp. the face code. For example, + init-other-random-faces calls face-property-instance, and the + specifier code checks inst-pairs by seeing if the device matches the + tag; this fails for tags such as `default', if we haven't set up the + tags yet. */ setup_device_initial_specifier_tags (d); + if (!EQ (type, Qstream)) + { + if (first) + init_global_resources (d); + init_device_resources (d); + } + + MAYBE_DEVMETH (d, finish_init_device, (d, props)); + UNGCPRO; unbind_to (speccount); return device; @@ -643,7 +699,7 @@ { Lisp_Object device; - VOID_TO_LISP (device, closure); + device = VOID_TO_LISP (closure); if (FRAME_MINIBUF_ONLY_P (XFRAME (frame))) return 0; if (EQ (device, FRAME_DEVICE (XFRAME (frame)))) @@ -687,6 +743,10 @@ return; device = wrap_device (d); + + if (!force) + check_allowed_operation (OPERATION_DELETE_OBJECT, device, Qnil); + GCPRO1 (device); c = XCONSOLE (DEVICE_CONSOLE (d)); @@ -797,6 +857,29 @@ MAYBE_DEVMETH (d, delete_device, (d)); + /* Now see if we're the default device, and thus need to be changed. */ + { + /* Device type still OK, not set to null till down below. */ + Lisp_Object dt = DEVICE_TYPE (d); + + if (EQ (device, get_default_device (dt))) + { + Lisp_Object devcons, concons; + /* #### handle deleting last device */ + set_default_device (dt, Qnil); + DEVICE_LOOP_NO_BREAK (devcons, concons) + { + if (EQ (dt, XDEVICE_TYPE (XCAR (devcons))) && + !EQ (device, XCAR (devcons))) + { + set_default_device (dt, XCAR (devcons)); + goto double_break; + } + } + } + } + double_break: + CONSOLE_DEVICE_LIST (c) = delq_no_quit (device, CONSOLE_DEVICE_LIST (c)); RESET_CHANGED_SET_FLAGS; @@ -808,6 +891,7 @@ them. */ nuke_all_device_slots (d, Qnil); d->devmeths = dead_console_methods; + note_object_deleted (device); UNGCPRO; } @@ -1208,11 +1292,16 @@ return Qnil; } -void +Lisp_Object call_critical_lisp_code (struct device *d, Lisp_Object function, Lisp_Object object) { + /* This function cannot GC */ int count = begin_gc_forbidden (); + struct gcpro gcpro1; + Lisp_Object args[3]; + Lisp_Object retval; + specbind (Qinhibit_quit, Qt); record_unwind_protect (unlock_device, wrap_device (d)); @@ -1225,14 +1314,19 @@ */ LOCK_DEVICE (d); - /* But it's useful to have an error handler; otherwise an infinite + args[0] = Qreally_early_error_handler; + args[1] = function; + args[2] = object; + + GCPRO1_ARRAY (args, 3); + + /* It's useful to have an error handler; otherwise an infinite loop may result. */ - if (!NILP (object)) - call1_with_handler (Qreally_early_error_handler, function, object); - else - call0_with_handler (Qreally_early_error_handler, function); + retval = Fcall_with_condition_handler (!NILP (object) ? 3 : 2, args); + + UNGCPRO; - unbind_to (count); + return unbind_to_1 (count, retval); } @@ -1260,6 +1354,7 @@ DEFSUBR (Ffind_device); DEFSUBR (Fget_device); DEFSUBR (Fmake_device); + DEFSUBR (Fdefault_device); DEFSUBR (Fdelete_device); DEFSUBR (Fdevice_frame_list); DEFSUBR (Fdevice_class); @@ -1348,6 +1443,10 @@ One argument, the to-be-deleted device. */ ); Vdelete_device_hook = Qnil; + + /* Plist of device types and their default devices. */ + Vdefault_device_plist = Qnil; + staticpro (&Vdefault_device_plist); Vdevice_class_list = list3 (Qcolor, Qgrayscale, Qmono); staticpro (&Vdevice_class_list); diff --text -u 'xemacs-21.5.6/src/device.h' 'xemacs-21.5.7/src/device.h' Index: ././src/device.h --- ././src/device.h Sun Mar 31 17:27:55 2002 +++ ././src/device.h Fri Jun 21 06:18:26 2002 @@ -1,6 +1,6 @@ /* Define device-object for XEmacs. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995 Ben Wing + Copyright (C) 1995, 2002 Ben Wing Copyright (C) 1995 Sun Microsystems This file is part of XEmacs. @@ -29,112 +29,7 @@ #include "console.h" -/* This should really be in redisplay.h but by putting it here we - won't have to ensure that redisplay.h is always included before - this file. */ -struct pixel_to_glyph_translation_cache -{ - unsigned int valid :1; - struct frame *frame; - int low_x_coord, high_x_coord, col, obj_x; - int low_y_coord, high_y_coord, row, obj_y; - struct window *w; - Charbpos charbpos; - Charbpos closest; - Charcount modeline_closest; - Lisp_Object obj1, obj2; - int retval; -}; - -#define DEVICE_TYPE_NAME(d) ((d)->devmeths->name) -#define DEVICE_TYPE(d) ((d)->devmeths->symbol) -#define DEVICE_IMPL_FLAG(d, f) CONMETH_IMPL_FLAG ((d)->devmeths, (f)) -#define DEVICE_SPECIFIC_FRAME_PROPS(d) \ - ((d)->devmeths->device_specific_frame_props) - -/******** Accessing / calling a device method *********/ - -#define HAS_DEVMETH_P(d, m) HAS_CONTYPE_METH_P ((d)->devmeths, m) -#define DEVMETH(d, m, args) CONTYPE_METH ((d)->devmeths, m, args) -#define MAYBE_DEVMETH(d, m, args) MAYBE_CONTYPE_METH ((d)->devmeths, m, args) -#define DEVMETH_OR_GIVEN(d, m, args, given) \ - CONTYPE_METH_OR_GIVEN((d)->devmeths, m, args, given) -#define MAYBE_INT_DEVMETH(d, m, args) \ - MAYBE_INT_CONTYPE_METH ((d)->devmeths, m, args) -#define MAYBE_LISP_DEVMETH(d, m, args) \ - MAYBE_LISP_CONTYPE_METH ((d)->devmeths, m, args) - -struct device -{ - struct lcrecord_header header; - - /* Methods for this device's console. This can also be retrieved - through device->console, but it's faster this way. */ - struct console_methods *devmeths; - - /* A structure of auxiliary data specific to the device type. - struct x_device is used for X window frames; defined in console-x.h - struct tty_device is used to TTY's; defined in console-tty.h */ - void *device_data; - - /* redisplay flags */ - unsigned int buffers_changed :1; - unsigned int clip_changed :1; - unsigned int extents_changed :1; - unsigned int faces_changed :1; - unsigned int frame_changed :1; - unsigned int glyphs_changed :1; - unsigned int subwindows_changed :1; - unsigned int subwindows_state_changed :1; - unsigned int icon_changed :1; - unsigned int menubar_changed :1; - unsigned int modeline_changed :1; - unsigned int point_changed :1; - unsigned int size_changed :1; - unsigned int gutter_changed :1; - unsigned int toolbar_changed :1; - unsigned int windows_changed :1; - unsigned int windows_structure_changed :1; - - unsigned int locked :1; - - /* Cache information about last pixel position translated to a - glyph. The law of locality applies very heavily here so caching - the value leads to a significant win. At the moment this is - really X specific but once we have generic mouse support it won't - be. */ - struct pixel_to_glyph_translation_cache pixel_to_glyph_cache; - - /* Output baud rate of device; used for redisplay decisions. */ - int baud_rate; - - /* sound flags */ - unsigned int on_console_p :1; - unsigned int connected_to_nas_p :1; - -#define MARKED_SLOT(x) Lisp_Object x -#include "devslots.h" - - /* File descriptors for input and output. Much of the time - (but not always) these will be the same. For an X device, - these both hold the file descriptor of the socket used - to communicate with the X server. For a TTY device, these - may or may not be the same and point to the terminal that - is used for I/O. */ - int infd, outfd; - - /* infd and outfd are moved outside HAVE_UNIXOID_EVENT_LOOP conditionals, - because Win32, presumably the first port which does not use select() - polling, DOES have handles for a console device. -- kkm */ - -#ifdef HAVE_UNIXOID_EVENT_LOOP - /* holds some data necessary for SIGIO control. Perhaps this should - be inside of device_data; but it is used for both TTY's and X - device. Perhaps it should be conditionalized on SIGIO; but - this requires including syssignal.h and systty.h. */ - int old_fcntl_owner; -#endif -}; +struct device; DECLARE_LRECORD (device, struct device); #define XDEVICE(x) XRECORD (x, device, struct device) @@ -143,6 +38,22 @@ #define CHECK_DEVICE(x) CHECK_RECORD (x, device) #define CONCHECK_DEVICE(x) CONCHECK_RECORD (x, device) +/* Basic properties available to non-privileged users; redefined in + device-impl.h */ + +int device_live_p (struct device *d); +Lisp_Object device_console (struct device *d); +Lisp_Object device_frame_list (struct device *d); + +#define DEVICE_LIVE_P(d) device_live_p (d) +#define DEVICE_CONSOLE(d) device_console (d) +#define DEVICE_FRAME_LIST(d) device_frame_list (d) + +#define DEVICE_XCONSOLE(d) XCONSOLE (DEVICE_CONSOLE (d)) + +#define XDEVICE_CONSOLE(d) DEVICE_CONSOLE (XDEVICE (d)) +#define XDEVICE_XCONSOLE(d) XCONSOLE (XDEVICE_XCONSOLE (d)) + #define CHECK_LIVE_DEVICE(x) do { \ CHECK_DEVICE (x); \ if (! DEVICE_LIVE_P (XDEVICE (x))) \ @@ -154,200 +65,6 @@ x = wrong_type_argument (Qdevice_live_p, (x)); \ } while (0) -#define DEVICE_TYPE_P(d, type) EQ (DEVICE_TYPE (d), Q##type) - -#ifdef ERROR_CHECK_TYPES -INLINE_HEADER struct device * -error_check_device_type (struct device *d, Lisp_Object sym); -INLINE_HEADER struct device * -error_check_device_type (struct device *d, Lisp_Object sym) -{ - assert (EQ (DEVICE_TYPE (d), sym)); - return d; -} -# define DEVICE_TYPE_DATA(d, type) \ - ((struct type##_device *) error_check_device_type (d, Q##type)->device_data) -#else -# define DEVICE_TYPE_DATA(d, type) \ - ((struct type##_device *) (d)->device_data) -#endif - -#define CHECK_DEVICE_TYPE(x, type) \ - do { \ - CHECK_DEVICE (x); \ - if (!(DEVICEP (x) && DEVICE_TYPE_P (XDEVICE (x), \ - type))) \ - dead_wrong_type_argument \ - (type##_console_methods->predicate_symbol, x); \ - } while (0) -#define CONCHECK_DEVICE_TYPE(x, type) \ - do { \ - CONCHECK_DEVICE (x); \ - if (!(DEVICEP (x) && DEVICE_TYPE_P (XDEVICE (x), \ - type))) \ - x = wrong_type_argument \ - (type##_console_methods->predicate_symbol, x); \ - } while (0) - -#define DEVICE_DISPLAY_P(dev) \ - (DEVICE_LIVE_P (dev) && \ - !DEVICE_IMPL_FLAG (dev, XDEVIMPF_IS_A_PRINTER)) - -#define CHECK_DISPLAY_DEVICE(dev) \ - do { \ - CHECK_DEVICE (dev); \ - if (!(DEVICEP (dev) \ - && DEVICE_DISPLAY_P (XDEVICE (dev)))) \ - dead_wrong_type_argument (Qdisplay, dev); \ - } while (0) - -#define CONCHECK_DISPLAY_DEVICE(dev) \ - do { \ - CONCHECK_DEVICE (dev); \ - if (!(DEVICEP (dev) \ - && DEVICE_DISPLAY_P (XDEVICE (dev)))) \ - wrong_type_argument (Qdisplay, dev); \ - } while (0) - -#define DEVICE_PRINTER_P(dev) \ - (DEVICE_LIVE_P (dev) && !DEVICE_DISPLAY_P (dev)) - -#define CHECK_PRINTER_DEVICE(dev) \ - do { \ - CHECK_DEVICE (dev); \ - if (!(DEVICEP (dev) \ - && DEVICE_PRINTER_P (XDEVICE (dev)))) \ - dead_wrong_type_argument (Qprinter, dev); \ - } while (0) - -#define CONCHECK_PRINTER_DEVICE(dev) \ - do { \ - CONCHECK_DEVICE (dev); \ - if (!(DEVICEP (dev) \ - && DEVICE_PRINTER_P (XDEVICE (dev)))) \ - wrong_type_argument (Qprinter, dev); \ - } while (0) - -/* #### These should be in the device-*.h files but there are - too many places where the abstraction is broken. Need to - fix. */ - -#define DEVICE_X_P(dev) CONSOLE_TYPESYM_X_P (DEVICE_TYPE (dev)) -#define CHECK_X_DEVICE(z) CHECK_DEVICE_TYPE (z, x) -#define CONCHECK_X_DEVICE(z) CONCHECK_DEVICE_TYPE (z, x) - -#define DEVICE_GTK_P(dev) CONSOLE_TYPESYM_GTK_P (DEVICE_TYPE (dev)) -#define CHECK_GTK_DEVICE(z) CHECK_DEVICE_TYPE (z, gtk) -#define CONCHECK_GTK_DEVICE(z) CONCHECK_DEVICE_TYPE (z, gtk) - -#define DEVICE_MSWINDOWS_P(dev) CONSOLE_TYPESYM_MSWINDOWS_P (DEVICE_TYPE (dev)) -#define CHECK_MSWINDOWS_DEVICE(z) CHECK_DEVICE_TYPE (z, mswindows) -#define CONCHECK_MSWINDOWS_DEVICE(z) CONCHECK_DEVICE_TYPE (z, mswindows) - -#define DEVICE_TTY_P(dev) CONSOLE_TYPESYM_TTY_P (DEVICE_TYPE (dev)) -#define CHECK_TTY_DEVICE(z) CHECK_DEVICE_TYPE (z, tty) -#define CONCHECK_TTY_DEVICE(z) CONCHECK_DEVICE_TYPE (z, tty) - -#define DEVICE_STREAM_P(dev) CONSOLE_TYPESYM_STREAM_P (DEVICE_TYPE (dev)) -#define CHECK_STREAM_DEVICE(z) CHECK_DEVICE_TYPE (z, stream) -#define CONCHECK_STREAM_DEVICE(z) CONCHECK_DEVICE_TYPE (z, stream) - -#define DEVICE_WIN_P(dev) CONSOLE_TYPESYM_WIN_P (DEVICE_TYPE (dev)) - -EXFUN (Fdevice_console, 1); -EXFUN (Fdevice_name, 1); -EXFUN (Ffind_device, 2); -EXFUN (Fmake_device, 3); -EXFUN (Fselected_device, 1); - -extern Lisp_Object Qcreate_device_hook, Qdelete_device_hook, Qgrayscale; -extern Lisp_Object Qinit_post_tty_win, Qmono, Vdefault_x_device, Vdefault_gtk_device; -extern Lisp_Object Vdevice_class_list; - -int valid_device_class_p (Lisp_Object class); - -#define DEVICE_LIVE_P(d) (!EQ (DEVICE_TYPE (d), Qdead)) - -#define DEVICE_REDISPLAY_INFO(d) ((d)->redisplay_info) - -#define DEVICE_NAME(d) ((d)->name) -#define DEVICE_CLASS(d) ((d)->device_class) -/* Catch people attempting to set this. */ -#define DEVICE_SELECTED_FRAME(d) NON_LVALUE ((d)->selected_frame) -#define DEVICE_FRAME_WITH_FOCUS_REAL(d) ((d)->frame_with_focus_real) -#define DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS(d) ((d)->frame_with_focus_for_hooks) -#define DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS(d) \ - ((d)->frame_that_ought_to_have_focus) -#define DEVICE_USER_DEFINED_TAGS(d) ((d)->user_defined_tags) -#define DEVICE_FRAME_LIST(d) ((d)->frame_list) -#define DEVICE_CONNECTION(d) ((d)->connection) -#define DEVICE_CANON_CONNECTION(d) ((d)->canon_connection) -#define DEVICE_CONSOLE(d) ((d)->console) -#define DEVICE_BAUD_RATE(d) ((d)->baud_rate) -#define DEVICE_INFD(d) ((d)->infd) -#define DEVICE_OUTFD(d) ((d)->outfd) -#define DEVICE_OLD_FCNTL_OWNER(d) ((d)->old_fcntl_owner) -#define DEVICE_ON_CONSOLE_P(d) ((d)->on_console_p) -#define DEVICE_CONNECTED_TO_NAS_P(d) ((d)->connected_to_nas_p) - -#define LOCK_DEVICE(d) ((void) ((d)->locked = 1)) -#define UNLOCK_DEVICE(d) ((void) ((d)->locked = 0)) - -#define INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE(d) \ - ((void) ((d)->pixel_to_glyph_cache.valid = 0)) - -#define INVALIDATE_PIXEL_TO_GLYPH_CACHE do { \ - Lisp_Object IPTGC_devcons, IPTGC_concons; \ - DEVICE_LOOP_NO_BREAK (IPTGC_devcons, IPTGC_concons) \ - INVALIDATE_DEVICE_PIXEL_TO_GLYPH_CACHE (XDEVICE (XCAR (IPTGC_devcons))); \ -} while (0) - -#define MARK_DEVICE_FACES_CHANGED(d) \ - ((void) (faces_changed = (d)->faces_changed = 1)) - -#define MARK_DEVICE_GLYPHS_CHANGED(d) \ - ((void) (glyphs_changed = (d)->glyphs_changed = 1)) - -#define MARK_DEVICE_SUBWINDOWS_CHANGED(d) \ - ((void) (subwindows_changed = (d)->subwindows_changed = 1)) - -#define MARK_DEVICE_SUBWINDOWS_STATE_CHANGED(d) \ - ((void) (subwindows_state_changed = (d)->subwindows_state_changed = 1)) - -#define MARK_DEVICE_TOOLBARS_CHANGED(d) \ - ((void) (toolbar_changed = (d)->toolbar_changed = 1)) - -#define MARK_DEVICE_GUTTERS_CHANGED(d) \ - ((void) (gutter_changed = (d)->gutter_changed = 1)) - -#define MARK_DEVICE_SIZE_CHANGED(d) \ - ((void) (size_changed = (d)->size_changed = 1)) - -#define MARK_DEVICE_FRAMES_FACES_CHANGED(d) do { \ - struct device *mdffc_d = (d); \ - Lisp_Object frmcons; \ - DEVICE_FRAME_LOOP (frmcons, mdffc_d) \ - XFRAME (XCAR (frmcons))->faces_changed = 1; \ - MARK_DEVICE_FACES_CHANGED (mdffc_d); \ -} while (0) - -#define MARK_DEVICE_FRAMES_GLYPHS_CHANGED(d) do { \ - struct device *mdffc_d = (d); \ - Lisp_Object frmcons; \ - DEVICE_FRAME_LOOP (frmcons, mdffc_d) \ - XFRAME (XCAR (frmcons))->glyphs_changed = 1; \ - MARK_DEVICE_GLYPHS_CHANGED (mdffc_d); \ -} while (0) - -#define MARK_DEVICE_FRAME_CHANGED(d) \ - ((void) (frame_changed = (d)->frame_changed = 1)) - -#define MARK_DEVICE_WINDOWS_CHANGED(d) \ - ((void) (windows_changed = (d)->windows_changed = 1)) - -#define MARK_DEVICE_WINDOWS_STRUCTURE_CHANGED(d) \ - ((void) (windows_structure_changed = (d)->windows_structure_changed = 1)) - /* #### unify this with DOMAIN_DEVICE once the latter has image instances expunged from it. */ /* This turns out to be used heavily so we make it a macro to make it @@ -371,11 +88,23 @@ CONSOLE_DEVICE_LOOP (devcons, con) \ DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons))) +EXFUN (Fdevice_console, 1); +EXFUN (Fdevice_name, 1); +EXFUN (Ffind_device, 2); +EXFUN (Fmake_device, 3); +EXFUN (Fselected_device, 1); + +extern Lisp_Object Qcreate_device_hook, Qdelete_device_hook, Qgrayscale; +extern Lisp_Object Qinit_post_tty_win, Qmono; +extern Lisp_Object Vdevice_class_list; + +int valid_device_class_p (Lisp_Object class); + void select_device_1 (Lisp_Object); struct device *decode_device (Lisp_Object); void handle_asynch_device_change (void); -void call_critical_lisp_code (struct device *d, Lisp_Object function, - Lisp_Object object); +Lisp_Object call_critical_lisp_code (struct device *d, Lisp_Object function, + Lisp_Object object); void delete_device_internal (struct device *d, int force, int called_from_delete_console, int from_io_error); @@ -384,5 +113,9 @@ void set_device_selected_frame (struct device *d, Lisp_Object frame); Lisp_Object domain_device_type (Lisp_Object domain); int window_system_pixelated_geometry (Lisp_Object domain); + +Lisp_Object get_default_device (Lisp_Object type); +void set_default_device (Lisp_Object type, Lisp_Object device); +void clear_default_devices (void); #endif /* INCLUDED_device_h_ */ diff --text -u 'xemacs-21.5.6/src/devslots.h' 'xemacs-21.5.7/src/devslots.h' Index: ././src/devslots.h --- ././src/devslots.h Mon Jun 18 16:10:14 2001 +++ ././src/devslots.h Fri Jun 21 06:18:26 2002 @@ -1,5 +1,6 @@ /* Definitions of marked slots in consoles Copyright (C) 1990, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -104,7 +105,10 @@ given charset's registry. This speeds up the horrendously slow XListFonts() operation that needs to be done in order to determine an appropriate font. */ - MARKED_SLOT (charset_font_cache); + MARKED_SLOT (charset_font_cache_stage_1); + + /* Similar cache for stage 2, if it exists. See objects.c. */ + MARKED_SLOT (charset_font_cache_stage_2); #endif /* This is a bi-level cache, where the hash table in this slot here diff --text -u 'xemacs-21.5.6/src/dialog-gtk.c' 'xemacs-21.5.7/src/dialog-gtk.c' Index: ././src/dialog-gtk.c --- ././src/dialog-gtk.c Thu May 24 16:51:06 2001 +++ ././src/dialog-gtk.c Sun Jun 23 18:25:11 2002 @@ -24,9 +24,6 @@ #include #include "lisp.h" -#include "console-gtk.h" -#include "gui-gtk.h" - #include "buffer.h" #include "commands.h" /* zmacs_regions */ #include "events.h" @@ -34,6 +31,11 @@ #include "gui.h" #include "opaque.h" #include "window.h" +#include "console-impl.h" + +#include "console-gtk.h" +#include "console-gtk-impl.h" +#include "gui-gtk.h" Lisp_Object Qgtk_make_dialog_box_internal; diff --text -u 'xemacs-21.5.6/src/dialog-msw.c' 'xemacs-21.5.7/src/dialog-msw.c' Index: ././src/dialog-msw.c --- ././src/dialog-msw.c Fri Mar 29 13:47:12 2002 +++ ././src/dialog-msw.c Fri Jun 21 06:18:26 2002 @@ -32,11 +32,12 @@ #include "lisp.h" #include "buffer.h" -#include "console-msw.h" -#include "frame.h" +#include "frame-impl.h" #include "gui.h" #include "opaque.h" +#include "console-msw-impl.h" + #include "sysfile.h" Lisp_Object Qdialog_box_error; @@ -194,7 +195,7 @@ case WM_DESTROY: { Lisp_Object data; - VOID_TO_LISP (data, qxeGetWindowLong (hwnd, DWL_USER)); + data = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, DWL_USER)); Vdialog_data_list = delq_no_quit (data, Vdialog_data_list); } break; @@ -204,7 +205,7 @@ Lisp_Object fn, arg, data; struct mswindows_dialog_id *did; - VOID_TO_LISP (data, qxeGetWindowLong (hwnd, DWL_USER)); + data = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, DWL_USER)); did = XMSWINDOWS_DIALOG_ID (data); if (w_param != IDCANCEL) /* user pressed escape */ { @@ -220,9 +221,8 @@ else mswindows_enqueue_misc_user_event (did->frame, Qrun_hooks, Qmenu_no_selection_hook); - /* #### need to error-protect! will do so when i merge in - my stderr-proc ws */ - va_run_hook_with_args (Qdelete_dialog_box_hook, 1, data); + va_run_hook_with_args_trapping_problems + (0, Qdelete_dialog_box_hook, 1, data, 0); DestroyWindow (hwnd); } @@ -257,7 +257,7 @@ /* !!#### do Japanese chars count as two? */ int width = X_DLU_PER_CHAR * - intbyte_string_displayed_columns (XSTRING_DATA (text), + ibyte_string_displayed_columns (XSTRING_DATA (text), XSTRING_LENGTH (text)); return max (X_MIN_BUTTON, width); } @@ -589,14 +589,14 @@ /* Determine the final width layout */ { - Intbyte *p = XSTRING_DATA (question); + Ibyte *p = XSTRING_DATA (question); Charcount string_max = 0, this_length = 0; while (1) { - Emchar ch = charptr_emchar (p); - INC_CHARPTR (p); + Ichar ch = itext_ichar (p); + INC_IBYTEPTR (p); - if (ch == (Emchar)'\n' || ch == (Emchar)'\0') + if (ch == (Ichar)'\n' || ch == (Ichar)'\0') { string_max = max (this_length, string_max); this_length = 0; @@ -604,7 +604,7 @@ else ++this_length; - if (ch == (Emchar)'\0') + if (ch == (Ichar)'\0') break; } @@ -619,17 +619,17 @@ /* Now calculate the height for the text control */ { - Intbyte *p = XSTRING_DATA (question); + Ibyte *p = XSTRING_DATA (question); Charcount break_at = text_width / X_DLU_PER_CHAR; Charcount char_pos = 0; int num_lines = 1; - Emchar ch; + Ichar ch; - while ((ch = charptr_emchar (p)) != (Emchar) '\0') + while ((ch = itext_ichar (p)) != (Ichar) '\0') { - INC_CHARPTR (p); - char_pos += ch != (Emchar) '\n'; - if (ch == (Emchar) '\n' || char_pos == break_at) + INC_IBYTEPTR (p); + char_pos += ch != (Ichar) '\n'; + if (ch == (Ichar) '\n' || char_pos == break_at) { ++num_lines; char_pos = 0; @@ -722,7 +722,7 @@ /* Next thing to add is control text, as Unicode string */ { - Emchar accel_unused; + Ichar accel_unused; push_lisp_string_as_unicode (template_, @@ -782,7 +782,7 @@ int unbind_count = specpdl_depth (); record_unwind_protect (dialog_popped_down, Qnil); popup_up_p++; - + if (EQ (type, Qfile)) return unbind_to_1 (unbind_count, handle_file_dialog_box (f, keys)); else if (EQ (type, Qdirectory)) diff --text -u 'xemacs-21.5.6/src/dialog-x.c' 'xemacs-21.5.7/src/dialog-x.c' Index: ././src/dialog-x.c --- ././src/dialog-x.c Wed Mar 13 17:52:36 2002 +++ ././src/dialog-x.c Fri Jun 21 06:18:27 2002 @@ -1,7 +1,7 @@ /* Implements elisp-programmable dialog boxes -- X interface. Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems and INS Engineering Corp. - Copyright (C) 2000 Ben Wing. + Copyright (C) 2000, 2002 Ben Wing. This file is part of XEmacs. @@ -27,18 +27,18 @@ #include #include "lisp.h" -#include "console-x.h" -#include "EmacsFrame.h" -#include "gui-x.h" - #include "buffer.h" #include "commands.h" /* zmacs_regions */ #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "gui.h" #include "opaque.h" #include "window.h" +#include "console-x-impl.h" +#include "gui-x.h" + +#include "EmacsFrame.h" static void maybe_run_dbox_text_callback (LWLIB_ID id) @@ -52,7 +52,7 @@ { Lisp_Object text_field_callback; Extbyte *text_field_value = wv->value; - VOID_TO_LISP (text_field_callback, wv->call_data); + text_field_callback = VOID_TO_LISP (wv->call_data); text_field_callback = XCAR (XCDR (text_field_callback)); if (text_field_value) { @@ -126,7 +126,7 @@ int allow_text_p = 1; widget_value *prev = 0, *kids = 0; int n = 0; - int count = specpdl_depth (); + int count; Lisp_Object wv_closure, gui_item; Lisp_Object question = Qnil; Lisp_Object title = Qnil; /* #### currently unused */ @@ -162,7 +162,7 @@ the same as in menu_item_descriptor_to_widget_value(); see the large comment above that function. */ - begin_gc_forbidden (); + count = begin_gc_forbidden (); kids = prev = xmalloc_widget_value (); diff --text -u 'xemacs-21.5.6/src/dialog.c' 'xemacs-21.5.7/src/dialog.c' Index: ././src/dialog.c --- ././src/dialog.c Thu May 24 16:51:06 2001 +++ ././src/dialog.c Fri Jun 21 06:18:27 2002 @@ -25,8 +25,7 @@ #include #include "lisp.h" -#include "frame.h" -#include "device.h" +#include "frame-impl.h" Lisp_Object Vdelete_dialog_box_hook; Lisp_Object Qdelete_dialog_box_hook; @@ -40,15 +39,14 @@ (type, keys)) { struct frame *f = selected_frame (); - struct device *d = XDEVICE (f->device); CHECK_SYMBOL (type); - if (!HAS_DEVMETH_P (d, make_dialog_box_internal)) + if (!HAS_FRAMEMETH_P (f, make_dialog_box_internal)) signal_error (Qunimplemented, - "Device does not support dialogs", f->device); + "Device does not support dialogs", FRAME_DEVICE (f)); - return DEVMETH (d, make_dialog_box_internal, (f, type, keys)); + return FRAMEMETH (f, make_dialog_box_internal, (f, type, keys)); } void diff --text -u 'xemacs-21.5.6/src/dired-msw.c' 'xemacs-21.5.7/src/dired-msw.c' Index: ././src/dired-msw.c --- ././src/dired-msw.c Sun Mar 31 17:27:56 2002 +++ ././src/dired-msw.c Fri Jun 21 06:18:27 2002 @@ -76,6 +76,9 @@ #include "buffer.h" #include "regex.h" +#include "syntax.h" + +#include "console-msw.h" #include "sysdir.h" #include "sysfile.h" @@ -83,7 +86,7 @@ #include "sysproc.h" #include "syspwd.h" #include "systime.h" -#include "syswindows.h" + static int mswindows_ls_sort_case_insensitive; static Fixnum mswindows_ls_round_file_size; @@ -117,7 +120,7 @@ FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; - Intbyte *cFileName; + Ibyte *cFileName; } Win32_file; typedef struct @@ -189,6 +192,7 @@ int findex; DECLARE_EISTRING (win32pattern); HANDLE fh; + int errm; while (1) { @@ -197,7 +201,7 @@ /* PATTERN might be a flawed regular expression. Rather than catching and signalling our own errors, we just call compile_pattern to do the work for us. */ - bufp = compile_pattern (pattern, 0, Qnil, 0, ERROR_ME); + bufp = compile_pattern (pattern, 0, Qnil, Qnil, 0, 0, ERROR_ME); } /* Now *bufp is the compiled form of PATTERN; don't call anything which might compile a new regexp until we're done with the loop! */ @@ -221,6 +225,8 @@ */ findex = 0; fh = INVALID_HANDLE_VALUE; + errm = SetErrorMode (SEM_FAILCRITICALERRORS + | SEM_NOOPENFILEERRORBOX); while (1) { @@ -229,20 +235,28 @@ int result; WIN32_FIND_DATAW finddat; Win32_file file; + struct syntax_cache scache_struct; + struct syntax_cache *scache = &scache_struct; if (fh == INVALID_HANDLE_VALUE) { fh = qxeFindFirstFile (eiextdata (win32pattern), &finddat); if (fh == INVALID_HANDLE_VALUE) - report_file_error ("Opening directory", dirfile); + { + SetErrorMode (errm); + report_file_error ("Opening directory", dirfile); + } } else { if (! qxeFindNextFile (fh, &finddat)) { - if (GetLastError () == ERROR_NO_MORE_FILES) - break; - FindClose (fh); + if (GetLastError() == ERROR_NO_MORE_FILES) + { + break; + } + FindClose(fh); + SetErrorMode (errm); report_file_error ("Reading directory", dirfile); } } @@ -261,7 +275,7 @@ len = eilen (filename); result = (NILP (pattern) || (0 <= re_search (bufp, eidata (filename), - len, 0, len, 0))); + len, 0, len, 0, Qnil, 0, scache))); if (result) { if ( ! (eigetch_char (filename, 0) == '.' && @@ -272,7 +286,7 @@ hide_dot))) { file.cFileName = - (Intbyte *) xmalloc (sizeof (Intbyte) * (1 + len)); + (Ibyte *) xmalloc (sizeof (Ibyte) * (1 + len)); memcpy (file.cFileName, eidata (filename), len); file.cFileName[len] = '\0'; Dynarr_add (files, file); @@ -283,6 +297,8 @@ FindClose (fh); break; } + + SetErrorMode (errm); return (files); } @@ -292,7 +308,7 @@ Lisp_Object luser; double file_size; DECLARE_EISTRING (puta); - CIntbyte buf[666]; + CIbyte buf[666]; file_size = file->nFileSizeHigh * (double)UINT_MAX + file->nFileSizeLow; @@ -320,11 +336,11 @@ is_executable = 1; else if (qxestrcharlen (file->cFileName) > 4) { - Intbyte *end = file->cFileName + qxestrlen (file->cFileName); - DEC_CHARPTR (end); - DEC_CHARPTR (end); - DEC_CHARPTR (end); - DEC_CHARPTR (end); + Ibyte *end = file->cFileName + qxestrlen (file->cFileName); + DEC_IBYTEPTR (end); + DEC_IBYTEPTR (end); + DEC_IBYTEPTR (end); + DEC_IBYTEPTR (end); if (qxestrcasecmp (end, ".exe") == 0 || qxestrcasecmp (end, ".com") == 0 || qxestrcasecmp (end, ".bat") == 0 @@ -350,14 +366,14 @@ sprintf (buf, "%-9d", 0); else { - Intbyte *str; + Ibyte *str; str = XSTRING_DATA (luser); sprintf (buf, "%-8s ", str); } - eicat_raw (puta, (Intbyte *) buf, strlen (buf)); + eicat_raw (puta, (Ibyte *) buf, strlen (buf)); { - CIntbyte *cptr = buf; + CIbyte *cptr = buf; sprintf (buf, "%-8d ", getgid ()); cptr += 9; if (file_size > 99999999.0) @@ -374,7 +390,7 @@ ++cptr; { time_t t, now; - Intbyte *ctimebuf; + Ibyte *ctimebuf; if ( #if 0 @@ -456,14 +472,14 @@ if (!NILP (switches)) { - Intbyte *cptr, *cptr_end; + Ibyte *cptr, *cptr_end; CHECK_STRING (switches); cptr = XSTRING_DATA (switches); cptr_end = cptr + XSTRING_LENGTH (switches); while (cptr < cptr_end) { - Emchar ch = charptr_emchar (cptr); + Ichar ch = itext_ichar (cptr); switch (ch) { case 'A': @@ -486,7 +502,7 @@ sort_by = MSWINDOWS_SORT_BY_MOD_DATE; break; } - INC_CHARPTR (cptr); + INC_IBYTEPTR (cptr); } } diff --text -u 'xemacs-21.5.6/src/dired.c' 'xemacs-21.5.7/src/dired.c' Index: ././src/dired.c --- ././src/dired.c Sun Mar 31 17:27:57 2002 +++ ././src/dired.c Wed Jun 5 18:55:11 2002 @@ -1,6 +1,6 @@ /* Lisp functions for making directory listings. Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -78,7 +78,7 @@ Lisp_Object handler; struct re_pattern_buffer *bufp = NULL; int speccount = specpdl_depth (); - Intbyte *statbuf, *statbuf_tail; + Ibyte *statbuf, *statbuf_tail; struct gcpro gcpro1, gcpro2; GCPRO2 (directory, list); @@ -103,7 +103,7 @@ directory = Ffile_name_as_directory (directory); directorylen = XSTRING_LENGTH (directory); - statbuf = (Intbyte *) alloca (directorylen + MAXNAMLEN + 1); + statbuf = (Ibyte *) ALLOCA (directorylen + MAXNAMLEN + 1); memcpy (statbuf, XSTRING_DATA (directory), directorylen); statbuf_tail = statbuf + directorylen; @@ -117,7 +117,7 @@ /* MATCH might be a flawed regular expression. Rather than catching and signalling our own errors, we just call compile_pattern to do the work for us. */ - bufp = compile_pattern (match, 0, Qnil, 0, ERROR_ME); + bufp = compile_pattern (match, 0, Qnil, Qnil, 0, 0, ERROR_ME); } /* Now *bufp is the compiled form of MATCH; don't call anything @@ -130,9 +130,6 @@ if (!d) report_file_error ("Opening directory", directory); - regex_match_object = Qt; - regex_emacs_buffer = current_buffer; - record_unwind_protect (close_directory_unwind, make_opaque_ptr ((void *)d)); /* Loop reading blocks */ @@ -140,13 +137,16 @@ { DIRENTRY *dp = qxe_readdir (d); int len; + struct syntax_cache scache_struct; + struct syntax_cache *scache = &scache_struct; if (!dp) break; len = NAMLEN (dp); if (DIRENTRY_NONEMPTY (dp) && (NILP (match) - || (0 <= re_search (bufp, dp->d_name, len, 0, len, 0)))) + || (0 <= re_search (bufp, dp->d_name, len, 0, len, 0, Qnil, 0, + scache)))) { if (!NILP (files_only)) { @@ -168,7 +168,7 @@ { Lisp_Object name = - make_string ((Intbyte *)dp->d_name, len); + make_string ((Ibyte *)dp->d_name, len); if (!NILP (full)) name = concat2 (directory, name); @@ -250,7 +250,7 @@ Bytecount len = NAMLEN (dp); Bytecount pos = XSTRING_LENGTH (directory); int value; - Intbyte *fullname = (Intbyte *) alloca (len + pos + 2); + Ibyte *fullname = (Ibyte *) ALLOCA (len + pos + 2); memcpy (fullname, XSTRING_DATA (directory), pos); if (!IS_DIRECTORY_SEP (fullname[pos - 1])) @@ -284,7 +284,7 @@ qxe_closedir (d); free_opaque_ptr (obj); } - free_cons (XCONS (locative)); + free_cons (locative); return Qnil; } @@ -318,7 +318,7 @@ file = FILE_SYSTEM_CASE (file); #endif directory = Fexpand_file_name (directory, Qnil); - file_name_length = XSTRING_CHAR_LENGTH (file); + file_name_length = string_char_length (file); /* With passcount = 0, ignore files that end in an ignored extension. If nothing found then try again with passcount = 1, don't ignore them. @@ -353,13 +353,13 @@ Charcount cclen; int directoryp; int ignored_extension_p = 0; - Intbyte *d_name; + Ibyte *d_name; dp = qxe_readdir (d); if (!dp) break; - /* Cast to Intbyte* is OK, as qxe_readdir() Mule-encapsulates. */ - d_name = (Intbyte *) dp->d_name; + /* Cast to Ibyte* is OK, as qxe_readdir() Mule-encapsulates. */ + d_name = (Ibyte *) dp->d_name; len = NAMLEN (dp); cclen = bytecount_to_charcount (d_name, len); @@ -399,12 +399,12 @@ CHECK_STRING (elt); - skip = cclen - XSTRING_CHAR_LENGTH (elt); + skip = cclen - string_char_length (elt); if (skip < 0) continue; - if (0 > scmp (charptr_n_addr (d_name, skip), + if (0 > scmp (itext_n_addr (d_name, skip), XSTRING_DATA (elt), - XSTRING_CHAR_LENGTH (elt))) + string_char_length (elt))) { ignored_extension_p = 1; break; @@ -418,7 +418,7 @@ if (!passcount && ignored_extension_p) continue; - if (!passcount && regexp_ignore_completion_p (d_name, Qnil, 0, cclen)) + if (!passcount && regexp_ignore_completion_p (d_name, Qnil, 0, len)) continue; /* Update computation of how much all possible completions match */ @@ -440,15 +440,15 @@ else { bestmatch = name; - bestmatchsize = XSTRING_CHAR_LENGTH (name); + bestmatchsize = string_char_length (name); } NUNGCPRO; } else { Charcount compare = min (bestmatchsize, cclen); - Intbyte *p1 = XSTRING_DATA (bestmatch); - Intbyte *p2 = d_name; + Ibyte *p1 = XSTRING_DATA (bestmatch); + Ibyte *p2 = d_name; Charcount matchsize = scmp (p1, p2, compare); if (matchsize < 0) @@ -461,7 +461,7 @@ of the actual match. */ if ((matchsize == cclen && matchsize + !!directoryp - < XSTRING_CHAR_LENGTH (bestmatch)) + < string_char_length (bestmatch)) || /* If there is no exact match ignoring case, prefer a match that does not change the case @@ -469,7 +469,7 @@ (((matchsize == cclen) == (matchsize + !!directoryp - == XSTRING_CHAR_LENGTH (bestmatch))) + == string_char_length (bestmatch))) /* If there is more than one exact match aside from case, and one of them is exact including case, prefer that one. */ @@ -489,7 +489,7 @@ if (directoryp && compare == matchsize && bestmatchsize > matchsize - && IS_ANY_SEP (charptr_emchar_n (p1, matchsize))) + && IS_ANY_SEP (itext_ichar_n (p1, matchsize))) matchsize++; bestmatchsize = matchsize; } @@ -559,7 +559,7 @@ struct user_name { - Intbyte *ptr; + Ibyte *ptr; Bytecount len; }; @@ -593,7 +593,7 @@ if (! NILP (XCAR (cache_incomplete_p))) free_user_cache (&user_cache); - free_cons (XCONS (cache_incomplete_p)); + free_cons (cache_incomplete_p); return Qnil; } @@ -616,7 +616,7 @@ CHECK_STRING (user); - user_name_length = XSTRING_CHAR_LENGTH (user); + user_name_length = string_char_length (user); /* Cache user name lookups because it tends to be quite slow. * Rebuild the cache occasionally to catch changes */ @@ -649,7 +649,7 @@ DO_REALLOC (user_cache.user_names, user_cache.size, user_cache.length + 1, struct user_name); user_cache.user_names[user_cache.length].ptr = - (Intbyte *) xstrdup (pwd->pw_name); + (Ibyte *) xstrdup (pwd->pw_name); user_cache.user_names[user_cache.length].len = strlen (pwd->pw_name); user_cache.length++; } @@ -717,7 +717,7 @@ for (i = 0; i < user_cache.length; i++) { - Intbyte *u_name = user_cache.user_names[i].ptr; + Ibyte *u_name = user_cache.user_names[i].ptr; Bytecount len = user_cache.user_names[i].len; /* scmp() works in chars, not bytes, so we have to compute this: */ Charcount cclen = bytecount_to_charcount (u_name, len); @@ -744,15 +744,15 @@ else { bestmatch = name; - bestmatchsize = XSTRING_CHAR_LENGTH (name); + bestmatchsize = string_char_length (name); } NUNGCPRO; } else { Charcount compare = min (bestmatchsize, cclen); - Intbyte *p1 = XSTRING_DATA (bestmatch); - Intbyte *p2 = u_name; + Ibyte *p1 = XSTRING_DATA (bestmatch); + Ibyte *p2 = u_name; Charcount matchsize = scmp_1 (p1, p2, compare, 0); if (matchsize < 0) @@ -776,7 +776,7 @@ Lisp_Object -make_directory_hash_table (const Intbyte *path) +make_directory_hash_table (const Ibyte *path) { DIR *d; if ((d = qxe_opendir (path))) @@ -789,8 +789,8 @@ { Bytecount len = NAMLEN (dp); if (DIRENTRY_NONEMPTY (dp)) - /* Cast to Intbyte* is OK, as qxe_readdir() Mule-encapsulates. */ - Fputhash (make_string ((Intbyte *) dp->d_name, len), Qt, hash); + /* Cast to Ibyte* is OK, as qxe_readdir() Mule-encapsulates. */ + Fputhash (make_string ((Ibyte *) dp->d_name, len), Qt, hash); } qxe_closedir (d); return hash; @@ -867,7 +867,7 @@ #if 0 /* #### shouldn't this apply to WIN32_NATIVE and maybe CYGWIN? */ { - Intbyte *tmpnam = XSTRING_DATA (Ffile_name_nondirectory (filename)); + Ibyte *tmpnam = XSTRING_DATA (Ffile_name_nondirectory (filename)); Bytecount l = qxestrlen (tmpnam); if (l >= 5 @@ -907,7 +907,7 @@ if (XINT (values[7]) != s.st_size) values[7] = make_int (-1); filemodestring (&s, modes); - values[8] = make_string ((Intbyte *) modes, 10); + values[8] = make_string ((Ibyte *) modes, 10); #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ { struct stat sdir; diff --text -u 'xemacs-21.5.6/src/doc.c' 'xemacs-21.5.7/src/doc.c' Index: ././src/doc.c --- ././src/doc.c Fri Mar 29 13:47:12 2002 +++ ././src/doc.c Wed Jun 5 18:55:12 2002 @@ -22,37 +22,43 @@ /* Synched up with: FSF 19.30. */ -/* This file has been Mule-ized except as noted. */ +/* This file has been Mule-ized. */ #include #include "lisp.h" #include "buffer.h" #include "bytecode.h" +#include "file-coding.h" #include "insdel.h" #include "keymap.h" +#include "lstream.h" #include "sysfile.h" Lisp_Object Vinternal_doc_file_name; Lisp_Object QSsubstitute; -/* Read and return doc string from open file descriptor FD - at position POSITION. Does not close the file. Returns - string; or if error, returns a cons holding the error - data to pass to Fsignal. NAME_NONRELOC and NAME_RELOC - are only used for the error messages. */ +/* Read and return doc string or instructions from open file descriptor FD + at position POSITION. Does not close the file. Returns string; or if + error, returns a cons holding the error data to pass to Fsignal. + NAME_NONRELOC and NAME_RELOC are only used for the error messages. */ Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position, - Intbyte *name_nonreloc, Lisp_Object name_reloc) + Ibyte *name_nonreloc, Lisp_Object name_reloc, + int standard_doc_file) { - Intbyte buf[512 * 32 + 1]; - Intbyte *buffer = buf; + Ibyte buf[512 * 32 + 1]; + Ibyte *buffer = buf; int buffer_size = sizeof (buf); - Intbyte *from, *to; - REGISTER Intbyte *p = buffer; + Ibyte *from, *to; + REGISTER Ibyte *p = buffer; Lisp_Object return_me; + Lisp_Object fdstream = Qnil, instream = Qnil; + struct gcpro gcpro1, gcpro2; + + GCPRO2 (fdstream, instream); if (0 > lseek (fd, position, 0)) { @@ -64,6 +70,21 @@ goto done; } + fdstream = make_filedesc_input_stream (fd, 0, -1, 0); + Lstream_set_buffering (XLSTREAM (fdstream), LSTREAM_UNBUFFERED, 0); + instream = + make_coding_input_stream + /* Major trouble if we are too clever when reading byte-code + instructions! + + #### We should have a way of handling escape-quoted elc files + (i.e. files with non-ASCII/Latin-1 chars in them). Currently this + is "solved" in bytecomp.el by never inserting lazy references in + such files. */ + (XLSTREAM (fdstream), standard_doc_file ? Qescape_quoted : Qbinary, + CODING_DECODE, 0); + Lstream_set_buffering (XLSTREAM (instream), LSTREAM_UNBUFFERED, 0); + /* Read the doc string into a buffer. Use the fixed buffer BUF if it is big enough; otherwise allocate one. We store the buffer in use in BUFFER and its size in BUFFER_SIZE. */ @@ -76,14 +97,14 @@ /* Switch to a bigger buffer if we need one. */ if (space_left == 0) { - Intbyte *old_buffer = buffer; + Ibyte *old_buffer = buffer; if (buffer == buf) { - buffer = (Intbyte *) xmalloc (buffer_size *= 2); + buffer = (Ibyte *) xmalloc (buffer_size *= 2); memcpy (buffer, old_buffer, p - old_buffer); } else - buffer = (Intbyte *) xrealloc (buffer, buffer_size *= 2); + buffer = (Ibyte *) xrealloc (buffer, buffer_size *= 2); p += buffer - old_buffer; space_left = buffer_size - (p - buffer); } @@ -91,7 +112,7 @@ /* Don't read too much at one go. */ if (space_left > 1024 * 8) space_left = 1024 * 8; - nread = retry_read (fd, p, space_left); + nread = Lstream_read (XLSTREAM (instream), p, space_left); if (nread < 0) { return_me = list1 (build_msg_string @@ -102,13 +123,13 @@ if (!nread) break; { - Intbyte *p1 = qxestrchr (p, '\037'); /* End of doc string marker */ - if (p1) - { - *p1 = 0; - p = p1; - break; - } + Ibyte *p1 = qxestrchr (p, '\037'); /* End of doc string marker */ + if (p1) + { + *p1 = 0; + p = p1; + break; + } } p += nread; } @@ -139,10 +160,15 @@ } } - /* !!#### mrb: following STILL completely broken */ - return_me = make_ext_string ((Extbyte *) buffer, to - buffer, Qbinary); + return_me = make_string (buffer, to - buffer); done: + if (!NILP (instream)) + { + Lstream_delete (XLSTREAM (instream)); + Lstream_delete (XLSTREAM (fdstream)); + } + UNGCPRO; if (buffer != buf) /* We must have allocated buffer above */ xfree (buffer); return return_me; @@ -168,14 +194,16 @@ get_doc_string (Lisp_Object filepos) { REGISTER int fd; - REGISTER Intbyte *name_nonreloc = 0; + REGISTER Ibyte *name_nonreloc = 0; EMACS_INT position; Lisp_Object file, tem; Lisp_Object name_reloc = Qnil; + int standard_doc_file = 0; if (INTP (filepos)) { file = Vinternal_doc_file_name; + standard_doc_file = 1; position = XINT (filepos); } else if (CONSP (filepos) && INTP (XCDR (filepos))) @@ -207,7 +235,7 @@ /* sizeof ("../lib-src/") == 12 */ if (minsize < 12) minsize = 12; - name_nonreloc = alloca_intbytes (minsize + XSTRING_LENGTH (file) + 8); + name_nonreloc = alloca_ibytes (minsize + XSTRING_LENGTH (file) + 8); string_join (name_nonreloc, Vdoc_directory, file); } else @@ -221,10 +249,10 @@ if (purify_flag) { /* sizeof ("../lib-src/") == 12 */ - name_nonreloc = (Intbyte *) alloca (12 + XSTRING_LENGTH (file) + 8); + name_nonreloc = (Ibyte *) ALLOCA (12 + XSTRING_LENGTH (file) + 8); /* Preparing to dump; DOC file is probably not installed. So check in ../lib-src. */ - qxestrcpy (name_nonreloc, (Intbyte *) "../lib-src/"); + qxestrcpy (name_nonreloc, (Ibyte *) "../lib-src/"); qxestrcat (name_nonreloc, XSTRING_DATA (file)); fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0); @@ -232,12 +260,13 @@ #endif /* CANNOT_DUMP */ if (fd < 0) - signal_error (Qfile_error, "Cannot open doc string file", - name_nonreloc ? build_intstring (name_nonreloc) : - name_reloc); + report_file_error ("Cannot open doc string file", + name_nonreloc ? build_intstring (name_nonreloc) : + name_reloc); } - tem = unparesseuxify_doc_string (fd, position, name_nonreloc, name_reloc); + tem = unparesseuxify_doc_string (fd, position, name_nonreloc, name_reloc, + standard_doc_file); retry_close (fd); if (!STRINGP (tem)) @@ -393,7 +422,7 @@ } static void -weird_doc (Lisp_Object sym, const CIntbyte *weirdness, const CIntbyte *type, +weird_doc (Lisp_Object sym, const CIbyte *weirdness, const CIbyte *type, int pos) { if (!strcmp (weirdness, GETTEXT ("duplicate"))) return; @@ -401,7 +430,6 @@ weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos); } - DEFUN ("Snarf-documentation", Fsnarf_documentation, 1, 1, 0, /* Used during Emacs initialization, before dumping runnable Emacs, to find pointers to doc strings stored in `.../lib-src/DOC' and @@ -413,13 +441,21 @@ (filename)) { int fd; - Intbyte buf[1024 + 1]; + Ibyte buf[1024 + 1]; REGISTER int filled; REGISTER int pos; - REGISTER Intbyte *p, *end; + REGISTER Ibyte *p, *end; Lisp_Object sym, fun, tem; - Intbyte *name; + Ibyte *name; + /* This function should not pass the data it's reading through a coding + stream. The reason is that the only purpose of this function is to + find the file offsets for the documentation of the various functions, + not do anything with the documentation itself. If we pass through a + coding stream, the pointers will get messed up when we start reading + ISO 2022 data because our pointers will reflect internal format, not + external format. */ + #ifndef CANNOT_DUMP if (!purify_flag) invalid_operation ("Snarf-documentation can only be called in an undumped Emacs", Qunbound); @@ -431,7 +467,7 @@ if (!NILP (Vdoc_directory)) { CHECK_STRING (Vdoc_directory); - name = alloca_intbytes (XSTRING_LENGTH (filename) + name = alloca_ibytes (XSTRING_LENGTH (filename) + XSTRING_LENGTH (Vdoc_directory) + 1); qxestrcpy (name, XSTRING_DATA (Vdoc_directory)); @@ -439,8 +475,8 @@ else #endif /* CANNOT_DUMP */ { - name = alloca_intbytes (XSTRING_LENGTH (filename) + 14); - qxestrcpy (name, (Intbyte *) "../lib-src/"); + name = alloca_ibytes (XSTRING_LENGTH (filename) + 14); + qxestrcpy (name, (Ibyte *) "../lib-src/"); } qxestrcat (name, XSTRING_DATA (filename)); @@ -650,7 +686,6 @@ return Qnil; } - #if 1 /* Don't warn about functions whose doc was lost because they were wrapped by advice-freeze.el... */ static int @@ -766,18 +801,18 @@ (string)) { /* This function can GC */ - Intbyte *buf; + Ibyte *buf; int changed = 0; - REGISTER Intbyte *strdata; - REGISTER Intbyte *bufp; + REGISTER Ibyte *strdata; + REGISTER Ibyte *bufp; Bytecount strlength; Bytecount idx; Bytecount bsize; - Intbyte *new; + Ibyte *new; Lisp_Object tem = Qnil; Lisp_Object keymap = Qnil; Lisp_Object name = Qnil; - Intbyte *start; + Ibyte *start; Bytecount length; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -812,14 +847,14 @@ strlength = XSTRING_LENGTH (string); bsize = 1 + strlength; - buf = (Intbyte *) xmalloc (bsize); + buf = (Ibyte *) xmalloc (bsize); bufp = buf; /* Have to reset strdata every time GC might be called */ strdata = XSTRING_DATA (string); for (idx = 0; idx < strlength; ) { - Intbyte *strp = strdata + idx; + Ibyte *strp = strdata + idx; if (strp[0] != '\\') { @@ -884,7 +919,7 @@ if (NILP (tem)) /* but not on any keys */ { - new = (Intbyte *) xrealloc (buf, bsize += 4); + new = (Ibyte *) xrealloc (buf, bsize += 4); bufp += new - buf; buf = new; memcpy (bufp, "M-x ", 4); @@ -958,7 +993,7 @@ length = XSTRING_LENGTH (tem); subst: bsize += length; - new = (Intbyte *) xrealloc (buf, bsize); + new = (Ibyte *) xrealloc (buf, bsize); bufp += new - buf; buf = new; memcpy (bufp, start, length); diff --text -u 'xemacs-21.5.6/src/doprnt.c' 'xemacs-21.5.7/src/doprnt.c' Index: ././src/doprnt.c --- ././src/doprnt.c Fri Mar 29 13:47:13 2002 +++ ././src/doprnt.c Wed Jun 5 18:55:13 2002 @@ -69,7 +69,7 @@ long l; unsigned long ul; double d; - Intbyte *bp; + Ibyte *bp; }; /* We maintain a list of all the % specs in the specification, @@ -99,7 +99,7 @@ Note that MINLEN and MAXLEN are Charcounts but LEN is a Bytecount. */ static void -doprnt_2 (Lisp_Object stream, const Intbyte *string, Bytecount len, +doprnt_2 (Lisp_Object stream, const Ibyte *string, Bytecount len, Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag) { Lstream *lstr = XLSTREAM (stream); @@ -121,11 +121,11 @@ Lstream_putc (lstr, zero_flag ? '0' : ' '); } -static const Intbyte * -parse_off_posnum (const Intbyte *start, const Intbyte *end, int *returned_num) +static const Ibyte * +parse_off_posnum (const Ibyte *start, const Ibyte *end, int *returned_num) { - Intbyte arg_convert[100]; - REGISTER Intbyte *arg_ptr = arg_convert; + Ibyte arg_convert[100]; + REGISTER Ibyte *arg_ptr = arg_convert; *returned_num = -1; while (start != end && isdigit (*start)) @@ -160,23 +160,23 @@ } while (0) static printf_spec_dynarr * -parse_doprnt_spec (const Intbyte *format, Bytecount format_length) +parse_doprnt_spec (const Ibyte *format, Bytecount format_length) { - const Intbyte *fmt = format; - const Intbyte *fmt_end = format + format_length; + const Ibyte *fmt = format; + const Ibyte *fmt_end = format + format_length; printf_spec_dynarr *specs = Dynarr_new (printf_spec); int prev_argnum = 0; while (1) { struct printf_spec spec; - const Intbyte *text_end; - Intbyte ch; + const Ibyte *text_end; + Ibyte ch; xzero (spec); if (fmt == fmt_end) return specs; - text_end = (Intbyte *) memchr (fmt, '%', fmt_end - fmt); + text_end = (Ibyte *) memchr (fmt, '%', fmt_end - fmt); if (!text_end) text_end = fmt_end; spec.text_before = fmt - format; @@ -198,7 +198,7 @@ /* Is there a field number specifier? */ { - const Intbyte *ptr; + const Ibyte *ptr; int fieldspec; ptr = parse_off_posnum (fmt, fmt_end, &fieldspec); @@ -384,7 +384,7 @@ else if (strchr (double_converters, ch)) arg.d = va_arg (vargs, double); else if (strchr (string_converters, ch)) - arg.bp = va_arg (vargs, Intbyte *); + arg.bp = va_arg (vargs, Ibyte *); else abort (); Dynarr_add (args, arg); @@ -405,7 +405,7 @@ standard sprintf() behavior or `format' behavior.) */ static Bytecount -emacs_doprnt_1 (Lisp_Object stream, const Intbyte *format_nonreloc, +emacs_doprnt_1 (Lisp_Object stream, const Ibyte *format_nonreloc, Bytecount format_length, Lisp_Object format_reloc, int nargs, const Lisp_Object *largs, va_list vargs) { @@ -461,7 +461,7 @@ if (ch == '%') { - doprnt_2 (stream, (Intbyte *) &ch, 1, 0, -1, 0, 0); + doprnt_2 (stream, (Ibyte *) &ch, 1, 0, -1, 0, 0); continue; } @@ -504,7 +504,7 @@ else if (ch == 'S' || ch == 's') { - Intbyte *string; + Ibyte *string; Bytecount string_len; if (!largs) @@ -520,7 +520,7 @@ Do not hide bugs. --ben */ if (!string) - string = (Intbyte *) "(null)"; + string = (Ibyte *) "(null)"; #else assert (string); #endif @@ -591,17 +591,17 @@ if (ch == 'c') { - Emchar a; + Ichar a; Bytecount charlen; - Intbyte charbuf[MAX_EMCHAR_LEN]; + Ibyte charbuf[MAX_ICHAR_LEN]; - a = (Emchar) arg.l; + a = (Ichar) arg.l; - if (!valid_char_p (a)) + if (!valid_ichar_p (a)) syntax_error ("invalid character value %d to %%c spec", - make_char (a)); + make_int (a)); - charlen = set_charptr_emchar (charbuf, a); + charlen = set_itext_ichar (charbuf, a); doprnt_2 (stream, charbuf, charlen, spec->minwidth, -1, spec->minus_flag, spec->zero_flag); } @@ -658,7 +658,7 @@ sprintf (text_to_print, constructed_spec, arg.l); } - doprnt_2 (stream, (Intbyte *) text_to_print, + doprnt_2 (stream, (Ibyte *) text_to_print, strlen (text_to_print), 0, -1, 0, 0); } } @@ -673,7 +673,7 @@ */ Bytecount -emacs_doprnt_va (Lisp_Object stream, const Intbyte *format_nonreloc, +emacs_doprnt_va (Lisp_Object stream, const Ibyte *format_nonreloc, Bytecount format_length, Lisp_Object format_reloc, va_list vargs) { @@ -686,7 +686,7 @@ */ Bytecount -emacs_doprnt (Lisp_Object stream, const Intbyte *format_nonreloc, +emacs_doprnt (Lisp_Object stream, const Ibyte *format_nonreloc, Bytecount format_length, Lisp_Object format_reloc, int nargs, const Lisp_Object *largs, ...) { @@ -714,7 +714,7 @@ */ Lisp_Object -emacs_vsprintf_string_lisp (const CIntbyte *format_nonreloc, +emacs_vsprintf_string_lisp (const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, const Lisp_Object *largs) { @@ -725,7 +725,7 @@ gcpro1.nvars = nargs; stream = make_resizing_buffer_output_stream (); - emacs_doprnt (stream, (Intbyte *) format_nonreloc, format_nonreloc ? + emacs_doprnt (stream, (Ibyte *) format_nonreloc, format_nonreloc ? strlen (format_nonreloc) : 0, format_reloc, nargs, largs); Lstream_flush (XLSTREAM (stream)); @@ -740,7 +740,7 @@ (using variable arguments), rather than as an array. */ Lisp_Object -emacs_sprintf_string_lisp (const CIntbyte *format_nonreloc, +emacs_sprintf_string_lisp (const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, ...) { Lisp_Object *args = alloca_array (Lisp_Object, nargs); @@ -760,13 +760,13 @@ /* Like emacs_vsprintf_string_lisp() but returns a malloc()ed memory block. Return length out through LEN_OUT, if not null. */ -Intbyte * -emacs_vsprintf_malloc_lisp (const CIntbyte *format_nonreloc, +Ibyte * +emacs_vsprintf_malloc_lisp (const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, const Lisp_Object *largs, Bytecount *len_out) { Lisp_Object stream; - Intbyte *retval; + Ibyte *retval; Bytecount len; struct gcpro gcpro1, gcpro2; @@ -774,12 +774,12 @@ gcpro1.nvars = nargs; stream = make_resizing_buffer_output_stream (); - emacs_doprnt (stream, (Intbyte *) format_nonreloc, format_nonreloc ? + emacs_doprnt (stream, (Ibyte *) format_nonreloc, format_nonreloc ? strlen (format_nonreloc) : 0, format_reloc, nargs, largs); Lstream_flush (XLSTREAM (stream)); len = Lstream_byte_count (XLSTREAM (stream)); - retval = (Intbyte *) xmalloc (len + 1); + retval = (Ibyte *) xmalloc (len + 1); memcpy (retval, resizing_buffer_stream_ptr (XLSTREAM (stream)), len); retval[len] = '\0'; Lstream_delete (XLSTREAM (stream)); @@ -793,14 +793,14 @@ /* Like emacs_sprintf_string_lisp() but returns a malloc()ed memory block. Return length out through LEN_OUT, if not null. */ -Intbyte * -emacs_sprintf_malloc_lisp (Bytecount *len_out, const CIntbyte *format_nonreloc, +Ibyte * +emacs_sprintf_malloc_lisp (Bytecount *len_out, const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, ...) { Lisp_Object *args = alloca_array (Lisp_Object, nargs); va_list va; int i; - Intbyte *retval; + Ibyte *retval; va_start (va, nargs); for (i = 0; i < nargs; i++) @@ -815,13 +815,13 @@ from Lisp strings is OK because we explicitly inhibit GC. */ Lisp_Object -emacs_vsprintf_string (const CIntbyte *format, va_list vargs) +emacs_vsprintf_string (const CIbyte *format, va_list vargs) { Lisp_Object stream = make_resizing_buffer_output_stream (); Lisp_Object obj; int count = begin_gc_forbidden (); - emacs_doprnt_va (stream, (Intbyte *) format, strlen (format), Qnil, + emacs_doprnt_va (stream, (Ibyte *) format, strlen (format), Qnil, vargs); Lstream_flush (XLSTREAM (stream)); obj = make_string (resizing_buffer_stream_ptr (XLSTREAM (stream)), @@ -835,7 +835,7 @@ from Lisp strings is OK because we explicitly inhibit GC. */ Lisp_Object -emacs_sprintf_string (const CIntbyte *format, ...) +emacs_sprintf_string (const CIbyte *format, ...) { va_list vargs; Lisp_Object retval; @@ -850,20 +850,20 @@ from Lisp strings is OK because we explicitly inhibit GC. Return length out through LEN_OUT, if not null. */ -Intbyte * -emacs_vsprintf_malloc (const CIntbyte *format, va_list vargs, +Ibyte * +emacs_vsprintf_malloc (const CIbyte *format, va_list vargs, Bytecount *len_out) { int count = begin_gc_forbidden (); Lisp_Object stream = make_resizing_buffer_output_stream (); - Intbyte *retval; + Ibyte *retval; Bytecount len; - emacs_doprnt_va (stream, (Intbyte *) format, strlen (format), Qnil, + emacs_doprnt_va (stream, (Ibyte *) format, strlen (format), Qnil, vargs); Lstream_flush (XLSTREAM (stream)); len = Lstream_byte_count (XLSTREAM (stream)); - retval = (Intbyte *) xmalloc (len + 1); + retval = (Ibyte *) xmalloc (len + 1); memcpy (retval, resizing_buffer_stream_ptr (XLSTREAM (stream)), len); retval[len] = '\0'; end_gc_forbidden (count); @@ -878,11 +878,11 @@ from Lisp strings is OK because we explicitly inhibit GC. Return length out through LEN_OUT, if not null. */ -Intbyte * -emacs_sprintf_malloc (Bytecount *len_out, const CIntbyte *format, ...) +Ibyte * +emacs_sprintf_malloc (Bytecount *len_out, const CIbyte *format, ...) { va_list vargs; - Intbyte *retval; + Ibyte *retval; va_start (vargs, format); retval = emacs_vsprintf_malloc (format, vargs, len_out); @@ -895,14 +895,14 @@ because we explicitly inhibit GC. */ Bytecount -emacs_vsprintf (Intbyte *output, const CIntbyte *format, va_list vargs) +emacs_vsprintf (Ibyte *output, const CIbyte *format, va_list vargs) { Bytecount retval; int count = begin_gc_forbidden (); Lisp_Object stream = make_resizing_buffer_output_stream (); Bytecount len; - retval = emacs_doprnt_va (stream, (Intbyte *) format, strlen (format), Qnil, + retval = emacs_doprnt_va (stream, (Ibyte *) format, strlen (format), Qnil, vargs); Lstream_flush (XLSTREAM (stream)); len = Lstream_byte_count (XLSTREAM (stream)); @@ -919,7 +919,7 @@ because we explicitly inhibit GC. */ Bytecount -emacs_sprintf (Intbyte *output, const CIntbyte *format, ...) +emacs_sprintf (Ibyte *output, const CIbyte *format, ...) { va_list vargs; Bytecount retval; diff --text -u 'xemacs-21.5.6/src/dumper.c' 'xemacs-21.5.7/src/dumper.c' Index: ././src/dumper.c --- ././src/dumper.c Sun Mar 31 17:27:57 2002 +++ ././src/dumper.c Sun May 5 20:31:02 2002 @@ -1,7 +1,7 @@ /* Portable data dumper for XEmacs. Copyright (C) 1999-2000 Olivier Galibert Copyright (C) 2001 Martin Buchholz - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -152,7 +152,7 @@ (((type *) (ptr = (char*) (((type *) ptr) + 1)))[-1]) #define PDUMP_READ_ALIGNED(ptr, type) \ -((ptr = (char *) ALIGN_PTR (ptr, ALIGNOF (type))), PDUMP_READ (ptr, type)) +((ptr = (char *) ALIGN_PTR (ptr, type)), PDUMP_READ (ptr, type)) @@ -755,7 +755,7 @@ /* We have no way of knowing the required alignment for this structure, so just max it maximally aligned. */ - return ALIGN_SIZE (max_offset + size_at_max, ALIGNOF (max_align_t)); + return MAX_ALIGN_SIZE (max_offset + size_at_max); } /* Register the referenced objects in the array of COUNT objects of @@ -1355,11 +1355,11 @@ header.nb_root_struct_ptrs = Dynarr_length (pdump_root_struct_ptrs); header.nb_opaques = Dynarr_length (pdump_opaques); - cur_offset = ALIGN_SIZE (sizeof (header), ALIGNOF (max_align_t)); + cur_offset = MAX_ALIGN_SIZE (sizeof (header)); max_size = 0; pdump_scan_by_alignment (pdump_allocate_offset); - cur_offset = ALIGN_SIZE (cur_offset, ALIGNOF (max_align_t)); + cur_offset = MAX_ALIGN_SIZE (cur_offset); header.stab_offset = cur_offset; pdump_buf = xmalloc (max_size); @@ -1423,7 +1423,7 @@ p = pdump_start + header->stab_offset; /* Put back the pdump_root_struct_ptrs */ - p = (char *) ALIGN_PTR (p, ALIGNOF (pdump_static_pointer)); + p = (char *) ALIGN_PTR (p, pdump_static_pointer); for (i=0; inb_root_struct_ptrs; i++) { pdump_static_pointer ptr = PDUMP_READ (p, pdump_static_pointer); @@ -1444,7 +1444,7 @@ for (;;) { pdump_reloc_table rt = PDUMP_READ_ALIGNED (p, pdump_reloc_table); - p = (char *) ALIGN_PTR (p, ALIGNOF (char *)); + p = (char *) ALIGN_PTR (p, char *); if (rt.desc) { char **reloc = (char **)p; @@ -1461,7 +1461,7 @@ /* Put the pdump_root_objects variables in place */ i = PDUMP_READ_ALIGNED (p, Elemcount); - p = (char *) ALIGN_PTR (p, ALIGNOF (pdump_static_Lisp_Object)); + p = (char *) ALIGN_PTR (p, pdump_static_Lisp_Object); while (i--) { pdump_static_Lisp_Object obj = PDUMP_READ (p, pdump_static_Lisp_Object); @@ -1478,7 +1478,7 @@ for (;;) { pdump_reloc_table rt = PDUMP_READ_ALIGNED (p, pdump_reloc_table); - p = (char *) ALIGN_PTR (p, ALIGNOF (Lisp_Object)); + p = (char *) ALIGN_PTR (p, Lisp_Object); if (!rt.desc) break; if (rt.desc == hash_table_description) diff --text -u 'xemacs-21.5.6/src/editfns.c' 'xemacs-21.5.7/src/editfns.c' Index: ././src/editfns.c --- ././src/editfns.c Sun Mar 31 17:27:58 2002 +++ ././src/editfns.c Sun Jun 23 18:54:41 2002 @@ -32,13 +32,13 @@ #include "buffer.h" #include "casetab.h" #include "chartab.h" -#include "commands.h" +#include "commands.h" /* for zmacs_region functions */ #include "device.h" #include "events.h" /* for EVENTP */ -#include "extents.h" #include "frame.h" #include "insdel.h" #include "line-number.h" +#include "process.h" #include "window.h" #include "sysdep.h" @@ -82,7 +82,7 @@ init_editfns (void) { /* Only used in removed code below. */ - Intbyte *p; + Ibyte *p; environbuf = 0; @@ -108,7 +108,7 @@ (character)) { Bytecount len; - Intbyte str[MAX_EMCHAR_LEN]; + Ibyte str[MAX_ICHAR_LEN]; if (EVENTP (character)) { @@ -121,7 +121,7 @@ CHECK_CHAR_COERCE_INT (character); - len = set_charptr_emchar (str, XCHAR (character)); + len = set_itext_ichar (str, XCHAR (character)); return make_string (str, len); } @@ -134,7 +134,7 @@ CHECK_STRING (string); if (XSTRING_LENGTH (string) != 0) - return make_char (XSTRING_CHAR (string, 0)); + return make_char (string_ichar (string, 0)); else /* This used to return Qzero. That is broken, broken, broken. */ /* It might be kinder to signal an error directly. -slb */ @@ -178,25 +178,6 @@ return b->point_marker; } -/* The following two functions end up being identical but it's - cleaner to declare them separately. */ - -Charbpos -charbpos_clip_to_bounds (Charbpos lower, Charbpos num, Charbpos upper) -{ - return (num < lower ? lower : - num > upper ? upper : - num); -} - -Bytebpos -bytebpos_clip_to_bounds (Bytebpos lower, Bytebpos num, Bytebpos upper) -{ - return (num < lower ? lower : - num > upper ? upper : - num); -} - /* * Chuck says: * There is no absolute way to determine if goto-char is the function @@ -330,8 +311,9 @@ { struct buffer *b; - /* #### Huh? --hniksic */ - /*if (preparing_for_armageddon) return Qnil;*/ + /* There was once a check for preparing_for_armageddon here, which + did nothing; perhaps a left-over from FSF Emacs. Obviously + incorrect. --ben */ #ifdef ERROR_CHECK_TEXT assert (XINT (Fpoint (Qnil)) == @@ -381,7 +363,7 @@ for free in terms of GC junk. */ free_marker (XMARKER (XCAR (info))); free_marker (XMARKER (XCDR (info))); - free_cons (XCONS (info)); + free_cons (info); return Qnil; } @@ -610,22 +592,22 @@ */ ()) { - Intbyte *tmpdir; + Ibyte *tmpdir; #if defined(WIN32_NATIVE) tmpdir = egetenv ("TEMP"); if (!tmpdir) tmpdir = egetenv ("TMP"); if (!tmpdir) - tmpdir = (Intbyte *) "c:\\"; + tmpdir = (Ibyte *) "c:\\"; #else /* WIN32_NATIVE */ tmpdir = egetenv ("TMPDIR"); if (!tmpdir) { struct stat st; int myuid = getuid (); - Intbyte *login_name = user_login_name (NULL); + Ibyte *login_name = user_login_name (NULL); DECLARE_EISTRING (eipath); - Intbyte *path; + Ibyte *path; eicpy_c (eipath, "/tmp/"); eicat_rawz (eipath, login_name); @@ -660,7 +642,7 @@ if (qxe_stat (path, &st) == 0 && S_ISDIR (st.st_mode)) tmpdir = path; else - tmpdir = (Intbyte *) "/tmp"; + tmpdir = (Ibyte *) "/tmp"; } } #endif @@ -678,7 +660,7 @@ */ (uid)) { - Intbyte *returned_name; + Ibyte *returned_name; uid_t local_uid; if (!NILP (uid)) @@ -707,21 +689,21 @@ WARNING: The string returned comes from the data of a Lisp string and therefore will become garbage after the next GC. */ -Intbyte * +Ibyte * user_login_name (uid_t *uid) { /* uid == NULL to return name of this user */ if (uid != NULL) { struct passwd *pw = qxe_getpwuid (*uid); - return pw ? (Intbyte *) pw->pw_name : NULL; + return pw ? (Ibyte *) pw->pw_name : NULL; } else { /* #### - when euid != uid, then LOGNAME and USER are leftovers from the old environment (I site observed behavior on sunos and linux), so the environment variables should be disregarded in that case. --Stig */ - Intbyte *user_name = egetenv ("LOGNAME"); + Ibyte *user_name = egetenv ("LOGNAME"); if (!user_name) user_name = egetenv ( #ifdef WIN32_NATIVE @@ -741,7 +723,7 @@ cannot be determined. */ /* !!#### fix up in my mule ws */ - return (Intbyte *) (pw ? pw->pw_name : "unknown"); + return (Ibyte *) (pw ? pw->pw_name : "unknown"); #else /* For all but Cygwin return NULL (nil) */ return pw ? pw->pw_name : NULL; @@ -792,7 +774,7 @@ Lisp_Object user_name; struct passwd *pw = NULL; Lisp_Object tem; - const Intbyte *p, *q; + const Ibyte *p, *q; if (NILP (user) && STRINGP (Vuser_full_name)) return Vuser_full_name; @@ -810,15 +792,15 @@ /* #### - Stig sez: this should return nil instead of "unknown" when pw==0 */ /* Ben sez: bad idea because it's likely to break something */ #ifndef AMPERSAND_FULL_NAME - p = (Intbyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ + p = (Ibyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ q = qxestrchr (p, ','); #else - p = (Intbyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ + p = (Ibyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ q = qxestrchr (p, ','); #endif tem = ((!NILP (user) && !pw) ? Qnil - : make_string (p, (q ? q - p : qxestrlen (p)))); + : make_string (p, (q ? (Bytecount) (q - p) : qxestrlen (p)))); #ifdef AMPERSAND_FULL_NAME if (!NILP (tem)) @@ -841,7 +823,7 @@ return tem; } -static Intbyte *cached_home_directory; +static Ibyte *cached_home_directory; void uncache_home_directory (void) @@ -852,7 +834,7 @@ } /* Returns the home directory */ -Intbyte * +Ibyte * get_home_directory (void) { int output_home_warning = 0; @@ -865,13 +847,13 @@ else { #if defined (WIN32_NATIVE) - Intbyte *homedrive, *homepath; + Ibyte *homedrive, *homepath; if ((homedrive = egetenv ("HOMEDRIVE")) != NULL && (homepath = egetenv ("HOMEPATH")) != NULL) { cached_home_directory = - (Intbyte *) xmalloc (qxestrlen (homedrive) + + (Ibyte *) xmalloc (qxestrlen (homedrive) + qxestrlen (homepath) + 1); qxesprintf (cached_home_directory, "%s%s", homedrive, @@ -879,7 +861,7 @@ } else { - cached_home_directory = qxestrdup ((Intbyte *) "C:\\"); + cached_home_directory = qxestrdup ((Ibyte *) "C:\\"); output_home_warning = 1; } #else /* !WIN32_NATIVE */ @@ -889,7 +871,7 @@ * We probably should try to extract pw_dir from /etc/passwd, * before falling back to this. */ - cached_home_directory = qxestrdup ((Intbyte *) "/"); + cached_home_directory = qxestrdup ((Ibyte *) "/"); output_home_warning = 1; #endif /* !WIN32_NATIVE */ } @@ -912,7 +894,7 @@ */ ()) { - Intbyte *path = get_home_directory (); + Ibyte *path = get_home_directory (); return !path ? Qnil : Fexpand_file_name (Fsubstitute_in_file_name (build_intstring (path)), @@ -1081,7 +1063,7 @@ while (1) { - Extbyte *buf = (Extbyte *) alloca (size); + Extbyte *buf = (Extbyte *) ALLOCA (size); Extbyte *formext; *buf = 1; @@ -1247,7 +1229,7 @@ (specified_time)) { time_t value; - Intbyte *the_ctime; + Ibyte *the_ctime; EMACS_INT len; /* this is what make_ext_string() accepts; #### should it be an Bytecount? */ @@ -1334,7 +1316,7 @@ tem = build_ext_string (s, Qnative); else { - Intbyte buf[6]; + Ibyte buf[6]; /* No local time zone name is available; use "+-NNNN" instead. */ int am = (offset < 0 ? -offset : offset) / 60; @@ -1576,12 +1558,12 @@ (character, count, ignored, buffer)) { /* This function can GC */ - REGISTER Intbyte *string; - REGISTER int slen; - REGISTER int i, j; + REGISTER Ibyte *string; + REGISTER Bytecount slen; + REGISTER Bytecount i, j; REGISTER Bytecount n; REGISTER Bytecount charlen; - Intbyte str[MAX_EMCHAR_LEN]; + Ibyte str[MAX_ICHAR_LEN]; struct buffer *b = decode_buffer (buffer, 1); int cou; @@ -1594,12 +1576,12 @@ cou = XINT (count); } - charlen = set_charptr_emchar (str, XCHAR (character)); + charlen = set_itext_ichar (str, XCHAR (character)); n = cou * charlen; if (n <= 0) return Qnil; - slen = min (n, 768); - string = alloca_array (Intbyte, slen); + slen = min (n, (Bytecount) 768); + string = alloca_array (Ibyte, slen); /* Write as many copies of the character into the temp string as will fit. */ for (i = 0; i + charlen <= slen; i += charlen) for (j = 0; j < charlen; j++) @@ -1721,8 +1703,8 @@ for (i = 0; i < length; i++) { - Emchar c1 = BUF_FETCH_CHAR (bp1, begp1 + i); - Emchar c2 = BUF_FETCH_CHAR (bp2, begp2 + i); + Ichar c1 = BUF_FETCH_CHAR (bp1, begp1 + i); + Ichar c2 = BUF_FETCH_CHAR (bp2, begp2 + i); if (!NILP (trt)) { c1 = TRT_TABLE_OF (trt, c1); @@ -1769,7 +1751,7 @@ { /* This function can GC */ Charbpos pos, stop; - Emchar fromc, toc; + Ichar fromc, toc; int mc_count; struct buffer *buf = current_buffer; int count = specpdl_depth (); @@ -1850,26 +1832,26 @@ int cnt = 0; /* Number of changes made. */ int mc_count; struct buffer *buf = current_buffer; - Emchar oc; + Ichar oc; get_buffer_range_char (buf, start, end, &pos, &stop, 0); mc_count = begin_multiple_change (buf, pos, stop); if (STRINGP (table)) { - Charcount size = XSTRING_CHAR_LENGTH (table); + Charcount size = string_char_length (table); #ifdef MULE - /* Under Mule, XSTRING_CHAR(n) is O(n), so for large tables or - large regions it makes sense to create an array of Emchars. */ + /* Under Mule, string_ichar(n) is O(n), so for large tables or + large regions it makes sense to create an array of Ichars. */ if (size * (stop - pos) > 65536) { - Emchar *etable = alloca_array (Emchar, size); - convert_intbyte_string_into_emchar_string + Ichar *etable = alloca_array (Ichar, size); + convert_ibyte_string_into_ichar_string (XSTRING_DATA (table), XSTRING_LENGTH (table), etable); for (; pos < stop && (oc = BUF_FETCH_CHAR (buf, pos), 1); pos++) { if (oc < size) { - Emchar nc = etable[oc]; + Ichar nc = etable[oc]; if (nc != oc) { buffer_replace_char (buf, pos, nc, 0, 0); @@ -1885,7 +1867,7 @@ { if (oc < size) { - Emchar nc = XSTRING_CHAR (table, oc); + Ichar nc = string_ichar (table, oc); if (nc != oc) { buffer_replace_char (buf, pos, nc, 0, 0); @@ -1908,7 +1890,7 @@ retry: if (CHAR_OR_CHAR_INTP (replacement)) { - Emchar nc = XCHAR_OR_CHAR_INT (replacement); + Ichar nc = XCHAR_OR_CHAR_INT (replacement); if (nc != oc) { buffer_replace_char (buf, pos, nc, 0, 0); @@ -1917,7 +1899,7 @@ } else if (STRINGP (replacement)) { - Charcount incr = XSTRING_CHAR_LENGTH (replacement) - 1; + Charcount incr = string_char_length (replacement) - 1; buffer_delete_range (buf, pos, pos + 1, 0); buffer_insert_lisp_string_1 (buf, pos, replacement, 0); pos += incr, stop += incr; @@ -1935,15 +1917,14 @@ && (XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_GENERIC || XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_CHAR)) { - Lisp_Char_Table *ctable = XCHAR_TABLE (table); for (; pos < stop && (oc = BUF_FETCH_CHAR (buf, pos), 1); pos++) { - Lisp_Object replacement = get_char_table (oc, ctable); + Lisp_Object replacement = get_char_table (oc, table); retry2: if (CHAR_OR_CHAR_INTP (replacement)) { - Emchar nc = XCHAR_OR_CHAR_INT (replacement); + Ichar nc = XCHAR_OR_CHAR_INT (replacement); if (nc != oc) { buffer_replace_char (buf, pos, nc, 0, 0); @@ -1952,7 +1933,7 @@ } else if (STRINGP (replacement)) { - Charcount incr = XSTRING_CHAR_LENGTH (replacement) - 1; + Charcount incr = string_char_length (replacement) - 1; buffer_delete_range (buf, pos, pos + 1, 0); buffer_insert_lisp_string_1 (buf, pos, replacement, 0); pos += incr, stop += incr; @@ -1960,7 +1941,8 @@ } else if (!NILP (replacement)) { - replacement = wrong_type_argument (Qchar_or_string_p, replacement); + replacement = wrong_type_argument (Qchar_or_string_p, + replacement); goto retry2; } } @@ -1981,11 +1963,11 @@ (start, end, buffer)) { /* This function can GC */ - Charbpos bp_start, bp_end; + Charbpos char_start, char_end; struct buffer *buf = decode_buffer (buffer, 1); - get_buffer_range_char (buf, start, end, &bp_start, &bp_end, 0); - buffer_delete_range (buf, bp_start, bp_end, 0); + get_buffer_range_char (buf, start, end, &char_start, &char_end, 0); + buffer_delete_range (buf, char_start, char_end, 0); return Qnil; } @@ -1995,12 +1977,12 @@ if (BUF_BEGV (b) != BUF_BEG (b)) { clip_changed = 1; - SET_BOTH_BUF_BEGV (b, BUF_BEG (b), BI_BUF_BEG (b)); + SET_BOTH_BUF_BEGV (b, BUF_BEG (b), BYTE_BUF_BEG (b)); } if (BUF_ZV (b) != BUF_Z (b)) { clip_changed = 1; - SET_BOTH_BUF_ZV (b, BUF_Z (b), BI_BUF_Z (b)); + SET_BOTH_BUF_ZV (b, BUF_Z (b), BYTE_BUF_Z (b)); } if (clip_changed) { @@ -2038,21 +2020,21 @@ */ (start, end, buffer)) { - Charbpos bp_start, bp_end; + Charbpos char_start, char_end; struct buffer *buf = decode_buffer (buffer, 1); - Bytebpos bi_start, bi_end; + Bytebpos byte_start, byte_end; - get_buffer_range_char (buf, start, end, &bp_start, &bp_end, + get_buffer_range_char (buf, start, end, &char_start, &char_end, GB_ALLOW_PAST_ACCESSIBLE); - bi_start = charbpos_to_bytebpos (buf, bp_start); - bi_end = charbpos_to_bytebpos (buf, bp_end); + byte_start = charbpos_to_bytebpos (buf, char_start); + byte_end = charbpos_to_bytebpos (buf, char_end); - SET_BOTH_BUF_BEGV (buf, bp_start, bi_start); - SET_BOTH_BUF_ZV (buf, bp_end, bi_end); - if (BUF_PT (buf) < bp_start) - BUF_SET_PT (buf, bp_start); - if (BUF_PT (buf) > bp_end) - BUF_SET_PT (buf, bp_end); + SET_BOTH_BUF_BEGV (buf, char_start, byte_start); + SET_BOTH_BUF_ZV (buf, char_end, byte_end); + if (BUF_PT (buf) < char_start) + BUF_SET_PT (buf, char_start); + if (BUF_PT (buf) > char_end) + BUF_SET_PT (buf, char_end); MARK_CLIP_CHANGED; /* Changing the buffer bounds invalidates any recorded current column. */ invalidate_current_column (); @@ -2061,77 +2043,71 @@ } Lisp_Object -save_restriction_save (void) +save_restriction_save (struct buffer *buf) { - Lisp_Object bottom, top; - /* Note: I tried using markers here, but it does not win + Lisp_Object bottom = noseeum_make_marker (); + Lisp_Object top = noseeum_make_marker (); + + /* Formerly, this function remembered the amount of text on either side + of the restricted area, in a halfway attempt to account for insertion -- + it handles insertion inside the old restricted area, but not outside. + The comment read: + + [[ Note: I tried using markers here, but it does not win because insertion at the end of the saved region - does not advance mh and is considered "outside" the saved region. */ - bottom = make_int (BUF_BEGV (current_buffer) - BUF_BEG (current_buffer)); - top = make_int (BUF_Z (current_buffer) - BUF_ZV (current_buffer)); + does not advance mh and is considered "outside" the saved region. ]] - return noseeum_cons (Fcurrent_buffer (), noseeum_cons (bottom, top)); + But that was clearly before the advent of marker-insertion-type. --ben */ + + Fset_marker (bottom, make_int (BUF_BEGV (buf)), wrap_buffer (buf)); + Fset_marker (top, make_int (BUF_ZV (buf)), wrap_buffer (buf)); + Fset_marker_insertion_type (top, Qt); + + return noseeum_cons (wrap_buffer (buf), noseeum_cons (bottom, top)); } Lisp_Object save_restriction_restore (Lisp_Object data) { struct buffer *buf; - Charcount newhead, newtail; - Lisp_Object tem; + Lisp_Object markers = XCDR (data); int local_clip_changed = 0; buf = XBUFFER (XCAR (data)); - if (!BUFFER_LIVE_P (buf)) - { - /* someone could have killed the buffer in the meantime ... */ - free_cons (XCONS (XCDR (data))); - free_cons (XCONS (data)); - return Qnil; - } - tem = XCDR (data); - newhead = XINT (XCAR (tem)); - newtail = XINT (XCDR (tem)); - - free_cons (XCONS (XCDR (data))); - free_cons (XCONS (data)); - - if (newhead + newtail > BUF_Z (buf) - BUF_BEG (buf)) + /* someone could have killed the buffer in the meantime ... */ + if (BUFFER_LIVE_P (buf)) { - newhead = 0; - newtail = 0; - } - - { - Charbpos start, end; - Bytebpos bi_start, bi_end; + Charbpos start = marker_position (XCAR (markers)); + Charbpos end = marker_position (XCDR (markers)); + Bytebpos byte_start = charbpos_to_bytebpos (buf, start); + Bytebpos byte_end = charbpos_to_bytebpos (buf, end); - start = BUF_BEG (buf) + newhead; - end = BUF_Z (buf) - newtail; + if (BUF_BEGV (buf) != start) + { + local_clip_changed = 1; + SET_BOTH_BUF_BEGV (buf, start, byte_start); + narrow_line_number_cache (buf); + } + if (BUF_ZV (buf) != end) + { + local_clip_changed = 1; + SET_BOTH_BUF_ZV (buf, end, byte_end); + } - bi_start = charbpos_to_bytebpos (buf, start); - bi_end = charbpos_to_bytebpos (buf, end); + if (local_clip_changed) + MARK_CLIP_CHANGED; - if (BUF_BEGV (buf) != start) - { - local_clip_changed = 1; - SET_BOTH_BUF_BEGV (buf, start, bi_start); - narrow_line_number_cache (buf); - } - if (BUF_ZV (buf) != end) - { - local_clip_changed = 1; - SET_BOTH_BUF_ZV (buf, end, bi_end); - } - } - if (local_clip_changed) - MARK_CLIP_CHANGED; + /* If point is outside the new visible range, move it inside. */ + BUF_SET_PT (buf, charbpos_clip_to_bounds (BUF_BEGV (buf), BUF_PT (buf), + BUF_ZV (buf))); + } - /* If point is outside the new visible range, move it inside. */ - BUF_SET_PT (buf, - charbpos_clip_to_bounds (BUF_BEGV (buf), - BUF_PT (buf), - BUF_ZV (buf))); + /* Free all the junk we allocated, so that a `save-restriction' comes + for free in terms of GC junk. */ + free_marker (XMARKER (XCAR (markers))); + free_marker (XMARKER (XCDR (markers))); + free_cons (markers); + free_cons (data); return Qnil; } @@ -2148,8 +2124,9 @@ The value returned is the value of the last form in BODY. -`save-restriction' can get confused if, within the BODY, you widen -and then make changes outside the area within the saved restrictions. +As of XEmacs 22.0, `save-restriction' correctly handles all modifications +made within BODY. (Formerly, it got confused if, within the BODY, you +widened and then made changes outside the old restricted area.) Note: if you are using both `save-excursion' and `save-restriction', use `save-excursion' outermost: @@ -2158,9 +2135,9 @@ (body)) { /* This function can GC */ - int speccount = specpdl_depth (); - - record_unwind_protect (save_restriction_restore, save_restriction_save ()); + int speccount = + record_unwind_protect (save_restriction_restore, + save_restriction_save (current_buffer)); return unbind_to_1 (speccount, Fprogn (body)); } @@ -2253,7 +2230,7 @@ */ (character1, character2, buffer)) { - Emchar x1, x2; + Ichar x1, x2; struct buffer *b = decode_buffer (buffer, 1); CHECK_CHAR_COERCE_INT (character1); diff --text -u 'xemacs-21.5.6/src/eldap.c' 'xemacs-21.5.7/src/eldap.c' Index: ././src/eldap.c --- ././src/eldap.c Sun Mar 31 17:27:59 2002 +++ ././src/eldap.c Sun Jun 23 18:54:41 2002 @@ -35,6 +35,7 @@ #include "opaque.h" #include "sysdep.h" #include "buffer.h" +#include "process.h" /* for report_process_error */ #include @@ -113,7 +114,7 @@ write_fmt_string_lisp (printcharfun, "#host); if (!ldap->ld) - write_c_string ("(dead) ",printcharfun); + write_c_string (printcharfun,"(dead) "); write_fmt_string (printcharfun, " 0x%lx>", (long)ldap); } @@ -324,7 +325,7 @@ err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth); if (err != LDAP_SUCCESS) { - Intbyte *interrmess; + Ibyte *interrmess; EXTERNAL_TO_C_STRING (ldap_err2string (err), interrmess, Qnative); signal_error (Qprocess_error, "Failed binding to the server", build_intstring (interrmess)); diff --text -u 'xemacs-21.5.6/src/elhash.c' 'xemacs-21.5.7/src/elhash.c' Index: ././src/elhash.c --- ././src/elhash.c Mon Apr 1 12:58:28 2002 +++ ././src/elhash.c Sun May 5 20:31:04 2002 @@ -314,16 +314,16 @@ int count = 0; hentry *e, *sentinel; - write_c_string (" data (", printcharfun); + write_c_string (printcharfun, " data ("); for (e = ht->hentries, sentinel = e + ht->size; e < sentinel; e++) if (!HENTRY_CLEAR_P (e)) { if (count > 0) - write_c_string (" ", printcharfun); + write_c_string (printcharfun, " "); if (!print_readably && count > 3) { - write_c_string ("...", printcharfun); + write_c_string (printcharfun, "..."); break; } print_internal (e->key, printcharfun, 1); @@ -331,7 +331,7 @@ count++; } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); } static void @@ -339,16 +339,16 @@ { Lisp_Hash_Table *ht = XHASH_TABLE (obj); - write_c_string (print_readably ? "#s(hash-table" : "#test_function) - write_c_string (" test eq", printcharfun); + write_c_string (printcharfun, " test eq"); else if (ht->test_function == lisp_object_equal_equal) - write_c_string (" test equal", printcharfun); + write_c_string (printcharfun, " test equal"); else if (ht->test_function == lisp_object_eql_equal) DO_NOTHING; else @@ -378,7 +378,7 @@ print_hash_table_data (ht, printcharfun); if (print_readably) - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); else { write_fmt_string (printcharfun, " 0x%x>", ht->header.uid); @@ -1611,7 +1611,7 @@ } #if 0 -xxDEFUN ("internal-hash-value", Finternal_hash_value, 1, 1, 0, /* +DEFUN ("internal-hash-value", Finternal_hash_value, 1, 1, 0, /* Hash value of OBJECT. For debugging. The value is returned as (HIGH . LOW). */ diff --text -u 'xemacs-21.5.6/src/emacs-marshals.c' 'xemacs-21.5.7/src/emacs-marshals.c' Index: ././src/emacs-marshals.c --- ././src/emacs-marshals.c Sat Mar 16 19:39:16 2002 +++ ././src/emacs-marshals.c Thu May 9 22:49:42 2002 @@ -851,17 +851,17 @@ } static void -emacs_gtk_marshal_NONE__POINTER_INT (ffi_actual_function func, GtkArg *args) +emacs_gtk_marshal_NONE__POINTER_INT_INT (ffi_actual_function func, GtkArg *args) { __NONE_fn rfunc = (__NONE_fn) func; - (*rfunc) (GTK_VALUE_POINTER (args[0]), GTK_VALUE_INT (args[1])); + (*rfunc) (GTK_VALUE_POINTER (args[0]), GTK_VALUE_INT (args[1]), GTK_VALUE_INT (args[2])); } static void -emacs_gtk_marshal_NONE__POINTER_INT_INT (ffi_actual_function func, GtkArg *args) +emacs_gtk_marshal_NONE__POINTER_INT (ffi_actual_function func, GtkArg *args) { __NONE_fn rfunc = (__NONE_fn) func; - (*rfunc) (GTK_VALUE_POINTER (args[0]), GTK_VALUE_INT (args[1]), GTK_VALUE_INT (args[2])); + (*rfunc) (GTK_VALUE_POINTER (args[0]), GTK_VALUE_INT (args[1])); } static void @@ -1344,6 +1344,16 @@ } static void +emacs_gtk_marshal_POINTER__STRING_INT (ffi_actual_function func, GtkArg *args) +{ + __POINTER_fn rfunc = (__POINTER_fn) func; + void * *return_val; + + return_val = GTK_RETLOC_POINTER (args[2]); + *return_val = (*rfunc) (GTK_VALUE_STRING (args[0]), GTK_VALUE_INT (args[1])); +} + +static void emacs_gtk_marshal_POINTER__NONE (ffi_actual_function func, GtkArg *args) { __POINTER_fn rfunc = (__POINTER_fn) func; @@ -1598,8 +1608,8 @@ puthash ("emacs_gtk_marshal_NONE__OBJECT_STRING_STRING", (void *) emacs_gtk_marshal_NONE__OBJECT_STRING_STRING, marshaller_hashtable); puthash ("emacs_gtk_marshal_NONE__OBJECT_STRING", (void *) emacs_gtk_marshal_NONE__OBJECT_STRING, marshaller_hashtable); puthash ("emacs_gtk_marshal_NONE__OBJECT", (void *) emacs_gtk_marshal_NONE__OBJECT, marshaller_hashtable); - puthash ("emacs_gtk_marshal_NONE__POINTER_INT", (void *) emacs_gtk_marshal_NONE__POINTER_INT, marshaller_hashtable); puthash ("emacs_gtk_marshal_NONE__POINTER_INT_INT", (void *) emacs_gtk_marshal_NONE__POINTER_INT_INT, marshaller_hashtable); + puthash ("emacs_gtk_marshal_NONE__POINTER_INT", (void *) emacs_gtk_marshal_NONE__POINTER_INT, marshaller_hashtable); puthash ("emacs_gtk_marshal_NONE__POINTER_POINTER_BOOL_INT_INT_INT_INT_INT_INT", (void *) emacs_gtk_marshal_NONE__POINTER_POINTER_BOOL_INT_INT_INT_INT_INT_INT, marshaller_hashtable); puthash ("emacs_gtk_marshal_NONE__POINTER_POINTER_BOOL_INT_INT_INT_INT", (void *) emacs_gtk_marshal_NONE__POINTER_POINTER_BOOL_INT_INT_INT_INT, marshaller_hashtable); puthash ("emacs_gtk_marshal_NONE__POINTER_POINTER_INT_INT_INT_INT", (void *) emacs_gtk_marshal_NONE__POINTER_POINTER_INT_INT_INT_INT, marshaller_hashtable); @@ -1651,6 +1661,7 @@ puthash ("emacs_gtk_marshal_POINTER__OBJECT_POINTER", (void *) emacs_gtk_marshal_POINTER__OBJECT_POINTER, marshaller_hashtable); puthash ("emacs_gtk_marshal_POINTER__OBJECT", (void *) emacs_gtk_marshal_POINTER__OBJECT, marshaller_hashtable); puthash ("emacs_gtk_marshal_POINTER__POINTER", (void *) emacs_gtk_marshal_POINTER__POINTER, marshaller_hashtable); + puthash ("emacs_gtk_marshal_POINTER__STRING_INT", (void *) emacs_gtk_marshal_POINTER__STRING_INT, marshaller_hashtable); puthash ("emacs_gtk_marshal_POINTER__NONE", (void *) emacs_gtk_marshal_POINTER__NONE, marshaller_hashtable); puthash ("emacs_gtk_marshal_STRING__INT_INT_INT", (void *) emacs_gtk_marshal_STRING__INT_INT_INT, marshaller_hashtable); puthash ("emacs_gtk_marshal_STRING__INT", (void *) emacs_gtk_marshal_STRING__INT, marshaller_hashtable); diff --text -u 'xemacs-21.5.6/src/emacs.c' 'xemacs-21.5.7/src/emacs.c' Index: ././src/emacs.c --- ././src/emacs.c Mon Apr 1 12:58:29 2002 +++ ././src/emacs.c Fri Jun 21 06:18:27 2002 @@ -130,7 +130,7 @@ version 21.5.3 "asparagus" released September 7, 2001. version 21.5.4 "bamboo" released January 8, 2002. version 21.5.5 "beets" released March 5, 2002. - +version 21.5.6 "bok choi" released April 5, 2002. -- A time line for GNU Emacs version 19 is @@ -251,7 +251,6 @@ #include "frame.h" #include "sysdep.h" -#include "syssignal.h" /* Always include before systty.h */ #include "systty.h" #include "sysfile.h" #include "systime.h" @@ -274,13 +273,13 @@ #endif #if defined (WIN32_NATIVE) || defined (CYGWIN) -#include "syswindows.h" +#include "console-msw.h" #endif /* For PATH_EXEC */ #include -#if defined (HEAP_IN_DATA) && !defined(PDUMP) +#if defined (HEAP_IN_DATA) && !defined (PDUMP) void report_sheap_usage (int die_if_pure_storage_exceeded); #endif @@ -376,8 +375,6 @@ /* Some FSF junk with running_asynch_code, to preserve the match data. Not necessary because we don't call process filters asynchronously (i.e. from within QUIT). */ -/* #### Delete this when merging the rest of my code */ -int running_asynch_code; /* If non-zero, a window-system was specified on the command line. */ int display_arg; @@ -472,8 +469,6 @@ Lisp_Object Qkill_emacs_hook; Lisp_Object Qsave_buffers_kill_emacs; -extern Lisp_Object Vlisp_EXEC_SUFFIXES; - /* Nonzero if handling a fatal error already. */ int fatal_error_in_progress; @@ -497,6 +492,10 @@ static DWORD mswindows_handle_hardware_exceptions (DWORD code); #endif +#ifdef WIN32_NATIVE +static DWORD CALLBACK wait_for_termination_signal (LPVOID handle); +#endif + /************************************************************************/ /* Functions to handle arguments */ @@ -518,16 +517,20 @@ if (i == 0) { /* Do not trust to what crt0 has stuffed into argv[0] */ - Extbyte full_exe_path[PATH_MAX]; + Extbyte *full_exe_path; Lisp_Object fullpath; - qxeGetModuleFileName (NULL, full_exe_path, PATH_MAX); + full_exe_path = mswindows_get_module_file_name (); + assert (full_exe_path); fullpath = build_tstr_string (full_exe_path); + xfree (full_exe_path); result = Fcons (fullpath, result); -#if defined(HAVE_SHLIB) +#ifdef HAVE_SHLIB { Extbyte *fullpathext; + /* Don't use full_exe_path directly because it's probably + in a different format. */ LISP_STRING_TO_EXTERNAL (fullpath, fullpathext, Qdll_filename_encoding); (void) dll_init (fullpathext); @@ -705,9 +708,9 @@ initialized!=0 && restart==0 => either xemacs after conventional dump, or xemacs post pdump_load() */ -DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); +DECLARE_DOESNT_RETURN (main_1 (int, Extbyte **, Extbyte **, int)); DOESNT_RETURN -main_1 (int argc, char **argv, char **envp, int restart) +main_1 (int argc, Extbyte **argv, Extbyte **envp, int restart) { char stack_bottom_variable; int skip_args = 0; @@ -717,6 +720,16 @@ extern int malloc_cookie; #endif + /* !!#### Under MS Windows, this should all be rewritten to deal with + Unicode arguments and environment. We need to retrieve the command + line with GetCommandLine and convert to argv format with + CommandLineToArgvW. Unfortunately we have a bootstrapping problem + currently because we can't initialize the Unicode tables until we've + computed the location of data-directory, which doesn't happen till + startup.el, which is way late. We need to be dumping the Unicode + data, which means we need to fix pdump to correctly dump the "union" + format used by the tables. */ + #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \ && !defined (DOUG_LEA_MALLOC)) /* Make sure that any libraries we link against haven't installed a @@ -812,7 +825,7 @@ arguments below in standard_args[], with the help text in startup.el, and with the list of non-clobbered variables near where pdump_load() is called! */ - + /* Handle the -sd/--show-dump-id switch, which means show the hex dump_id and quit */ if (argmatch (argv, argc, "-sd", "--show-dump-id", 0, NULL, &skip_args)) @@ -824,7 +837,7 @@ #endif exit (0); } - + /* Handle the -t switch, which specifies filename to use as terminal */ { Extbyte *term; @@ -865,6 +878,30 @@ } #ifdef WIN32_NATIVE + { + /* Since we aren't a console application, we can't easily be terminated + using ^C. (We aren't a console application to avoid Windows from + automatically and unwantedly creating a console window for us. If + only the Windows designers had some sense in them and didn't create + this artificial console/non-console distinction!) Therefore, we set + up a communication path with i.exe so that when a ^C is sent to it + (using GenerateConsoleCtrlEvent), it in turn signals us to commit + suicide. (This is cleaner than using TerminateProcess()). This + makes (e.g.) the "Stop Build" command from VC++ correctly terminate + XEmacs. */ + + char *heventstr; + if (argmatch (argv, argc, "-mswindows-termination-handle", 0, 0, + &heventstr, &skip_args)) + { + HANDLE hevent = (HANDLE) atol (heventstr); + DWORD unused; + HANDLE h_thread = CreateThread (NULL, 0, wait_for_termination_signal, + (void *) hevent, 0, &unused); + CloseHandle (h_thread); + } + } + /* Handle the -nuni switch, which forces XEmacs to use the ANSI versions of Unicode-split API's even on Windows NT, which has full Unicode support. This helps flush out problems in the code @@ -898,7 +935,7 @@ 0, NULL, &skip_args)) #endif inhibit_site_modules = 1; - + if (argmatch (argv, argc, "-vanilla", "--vanilla", 0, NULL, &skip_args)) { @@ -1093,13 +1130,6 @@ purify_flag = 1; #endif - if (initialized) - { - /* Reset some vars that were also set during loadup (we called - these same functions below) */ - init_alloc_early (); - } - if (!initialized) { /* Initialize things so that new Lisp objects @@ -1126,11 +1156,16 @@ /* Make sure that eistrings can be created. */ init_eistring_once_early (); + } - /* Initialize some vars that will also be reset post-dumping - (see above) */ - init_alloc_early (); + /* The following will get called in raw-temacs, post-dump/pdump-load XEmacs, + and run-temacs. */ + /* Initialize some vars that will also be reset post-dumping */ + init_alloc_early (); + + if (!initialized) + { /* Now declare all the symbols and define all the Lisp primitives. The *only* thing that the syms_of_*() functions are allowed to do @@ -1151,7 +1186,6 @@ syms_of_buffer (); syms_of_bytecode (); syms_of_callint (); - syms_of_callproc (); syms_of_casefiddle (); syms_of_casetab (); syms_of_chartab (); @@ -1192,7 +1226,9 @@ #endif /* CLASH_DETECTION */ syms_of_floatfns (); syms_of_fns (); +#ifdef USE_C_FONT_LOCK syms_of_font_lock (); +#endif /* USE_C_FONT_LOCK */ syms_of_frame (); syms_of_general (); syms_of_glyphs (); @@ -1271,7 +1307,7 @@ syms_of_menubar_gtk (); #endif syms_of_select_gtk (); - + #ifdef HAVE_GUI_OBJECTS syms_of_gui_gtk (); #endif @@ -1572,7 +1608,7 @@ lstream_type_create (); lstream_type_create_file_coding (); -#if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) +#if defined (HAVE_MS_WINDOWS) && !defined (HAVE_MSG_SELECT) lstream_type_create_mswindows_selectable (); #endif @@ -1650,7 +1686,6 @@ vars_of_buffer (); vars_of_bytecode (); vars_of_callint (); - vars_of_callproc (); vars_of_chartab (); vars_of_cmdloop (); vars_of_cmds (); @@ -1673,7 +1708,7 @@ vars_of_editfns (); vars_of_emacs (); vars_of_eval (); - init_eval_early (); + init_eval_semi_early (); #ifdef HAVE_X_WINDOWS vars_of_event_Xt (); @@ -1696,7 +1731,9 @@ #endif vars_of_floatfns (); vars_of_fns (); +#ifdef USE_C_FONT_LOCK vars_of_font_lock (); +#endif /* USE_C_FONT_LOCK */ vars_of_frame (); vars_of_glyphs (); vars_of_glyphs_eimage (); @@ -1733,7 +1770,6 @@ #endif #ifdef WIN32_NATIVE vars_of_nt (); - vars_of_ntproc (); #endif vars_of_objects (); vars_of_print (); @@ -1753,6 +1789,7 @@ vars_of_ralloc (); #endif /* HAVE_MMAP && REL_ALLOC */ vars_of_redisplay (); + vars_of_regex (); #ifdef HAVE_SCROLLBARS vars_of_scrollbar (); #endif @@ -1895,6 +1932,7 @@ */ specifier_vars_of_glyphs (); + specifier_vars_of_glyphs_widget (); specifier_vars_of_gutter (); #ifdef HAVE_MENUBARS specifier_vars_of_menubar (); @@ -1914,20 +1952,19 @@ function and another. */ #ifdef MULE - /* These two depend on hash tables and various variables declared - earlier. The second may also depend on the first. */ + /* This depends on vars initialized in vars_of_unicode(). */ complex_vars_of_mule_charset (); #endif + /* This one doesn't depend on anything really, and could go into + vars_of_(), but lots of lots of code gets called and it's easily + possible that it could get changed to require being a + complex_vars_of_(), for example if a charset appears anywhere, + then we suddenly have dependence on the previous call. */ complex_vars_of_file_coding (); #ifdef HAVE_WIN32_CODING_SYSTEMS complex_vars_of_intl_win32 (); #endif - /* Calls Fmake_range_table(). */ - complex_vars_of_regex (); - /* Calls Fmake_range_table(). */ - complex_vars_of_search (); - /* Depends on specifiers. */ complex_vars_of_faces (); @@ -1960,10 +1997,6 @@ #ifdef HAVE_SCROLLBARS /* This calls Fmake_glyph_internal(). */ complex_vars_of_scrollbar (); -#ifdef HAVE_MS_WINDOWS - /* Calls make_lisp_hash_table(). */ - complex_vars_of_scrollbar_mswindows (); -#endif #endif /* This calls allocate_glyph(). */ @@ -1973,7 +2006,7 @@ knows what. */ complex_vars_of_chartab (); - /* This calls set_string_char(), which (under Mule) depends on the + /* This calls Fput_char_table(), which (under Mule) depends on the charsets being initialized. */ complex_vars_of_casetab (); @@ -2020,6 +2053,7 @@ reinit_alloc_once_early (); reinit_symbols_once_early (); reinit_opaque_once_early (); + reinit_eistring_once_early (); reinit_console_type_create_stream (); #ifdef HAVE_TTY @@ -2087,7 +2121,9 @@ reinit_vars_of_extents (); reinit_vars_of_file_coding (); reinit_vars_of_fileio (); +#ifdef USE_C_FONT_LOCK reinit_vars_of_font_lock (); +#endif /* USE_C_FONT_LOCK */ reinit_vars_of_glyphs (); reinit_vars_of_glyphs_widget (); reinit_vars_of_insdel (); @@ -2148,7 +2184,7 @@ engine. */ if (initialized) - init_eval_early (); + init_eval_semi_early (); #ifdef MULE init_mule_charset (); @@ -2178,19 +2214,19 @@ on out! */ #endif - init_callproc (); /* Set up the process environment (so that egetenv - works), the basic directory variables - (exec-directory and so on), and stuff - related to subprocesses. This should be - first because many of the functions below - call egetenv() to get environment variables. */ + init_xemacs_process (); /* Set up the process environment (so that + egetenv works), the basic directory variables + (exec-directory and so on), and stuff related + to subprocesses. This should be first because + many of the functions below call egetenv() to + get environment variables. */ #ifdef WIN32_NATIVE /* * For Win32, call init_environment() to properly enter environment/registry * variables into Vprocess_environment. */ - init_environment (); + init_mswindows_environment (); #endif init_initial_directory (); /* get the directory to use for the @@ -2202,7 +2238,7 @@ init_buffer_2 (); /* Set default directory of *scratch* buffer */ #ifdef WIN32_NATIVE - init_ntproc (); + init_nt (); init_select_mswindows (); #endif @@ -2212,7 +2248,6 @@ init_event_stream (); /* Set up so we can get user input. */ init_macros (); /* set up so we can run macros. */ init_editfns (); /* Determine the name of the user we're running as */ - init_xemacs_process (); /* set up for calling subprocesses */ #ifdef SUNPRO init_sunpro (); /* Set up Sunpro usage tracking */ #endif @@ -2270,7 +2305,7 @@ The Right Thing on that system. Rumor has it, this must be called for GNU dld in temacs and xemacs. */ { - char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory) + char *buf = (char *)ALLOCA (XSTRING_LENGTH (Vinvocation_directory) + XSTRING_LENGTH (Vinvocation_name) + 2); sprintf (buf, "%s/%s", XSTRING_DATA (Vinvocation_directory), @@ -2335,8 +2370,9 @@ { "-t", "--terminal", 100, 1 }, { "-nd", "--no-dump-file", 95, 0 }, { "-nw", "--no-windows", 90, 0 }, - { "-batch", "--batch", 85, 0 }, + { "-batch", "--batch", 88, 0 }, #ifdef WIN32_NATIVE + { "-mswindows-termination-handle", 0, 84, 1 }, { "-nuni", "--no-unicode-lib-calls", 83, 0 }, #endif /* WIN32_NATIVE */ { "-debug-paths", "--debug-paths", 82, 0 }, @@ -2827,8 +2863,15 @@ memory_warnings (my_edata, malloc_warning); #endif - UNGCPRO; + garbage_collect_1 (); +#ifdef PDUMP + pdump (); +#elif defined (WIN32_NATIVE) + unexec (XSTRING_DATA (filename), + STRINGP (symfile) ? XSTRING_DATA (symfile) : 0, + (uintptr_t) my_edata, 0, 0); +#else { Extbyte *filename_ext; Extbyte *symfile_ext; @@ -2840,15 +2883,9 @@ else symfile_ext = 0; - garbage_collect_1 (); - -#ifdef PDUMP - pdump (); -#else - -#ifdef DOUG_LEA_MALLOC +# ifdef DOUG_LEA_MALLOC malloc_state_ptr = malloc_get_state (); -#endif +# endif /* here we break our rule that the filename conversion should be performed at the actual time that the system call is made. It's a whole lot easier to do the conversion here than to @@ -2856,14 +2893,15 @@ conversion is applied everywhere. Don't worry about memory leakage because this call only happens once. */ unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0); -#ifdef DOUG_LEA_MALLOC +# ifdef DOUG_LEA_MALLOC free (malloc_state_ptr); -#endif -#endif /* not PDUMP */ +# endif } +#endif /* not PDUMP, not WIN32_NATIVE */ purify_flag = opurify; + UNGCPRO; return Qnil; } @@ -2992,7 +3030,7 @@ EMACS_SIGNAL (SIGBUS, old_sigbus); EMACS_SIGNAL (SIGSEGV, old_sigsegv); errno = old_errno; - + return retval; } @@ -3037,7 +3075,7 @@ { static int already_paused; - if (already_paused) + if (already_paused || !noninteractive) return; if (!allow_further) already_paused = 1; @@ -3052,6 +3090,18 @@ } #endif +#ifdef WIN32_NATIVE + +static DWORD CALLBACK +wait_for_termination_signal (LPVOID handle) +{ + HANDLE hevent = (HANDLE) handle; + WaitForSingleObject (hevent, INFINITE); + ExitProcess (0); + return 0; /* not reached */ +} + +#endif /* -------------------------------- */ /* a (more-or-less) normal shutdown */ /* -------------------------------- */ @@ -3261,7 +3311,7 @@ #ifdef HAVE_MS_WINDOWS pause_so_user_can_read_messages (1); #endif - + shut_down_emacs (0, STRINGP (arg) ? arg : Qnil, 0); #if defined(GNU_MALLOC) @@ -3281,6 +3331,24 @@ /* abnormal shutdowns: GP faults */ /* -------------------------------- */ +/* This is somewhat ad-hoc ... figure out whether the user is developing + XEmacs, which means (under MS Windows) they have a system debugger + installed that catches GP faults in any application and lets them open + up MS Dev Studio and start debugging the application -- similar to + producing a core dump and then going back with a debugger to investigate + the core dump, except that the program is still running. When this is + installed, it's better not to "pause so user gets messages" because the + debugger will pause anyway; and in case we're currently with a menu + popped up or somewhere else inside of an internal modal loop, we will + get wedged when we output the "pause". (It seems that the two modal + loops will fight each other and the return key will never be passed to + the "pause" handler so that XEmacs's GPF handler can return, resignal + the GPF, and properly go into the debugger.) */ +#if defined (ERROR_CHECK_TYPES) || defined (ERROR_CHECK_TEXT) || defined (ERROR_CHECK_GC) || defined (ERROR_CHECK_STRUCTURES) +#define USER_IS_DEVELOPING_XEMACS +#endif + + /* Handle bus errors, illegal instruction, etc: actual implementation. */ static void guts_of_fatal_error_signal (int sig) @@ -3332,7 +3400,7 @@ } } # endif -#ifdef HAVE_MS_WINDOWS +#if defined (HAVE_MS_WINDOWS) && !defined (USER_IS_DEVELOPING_XEMACS) pause_so_user_can_read_messages (0); #endif } @@ -3369,7 +3437,9 @@ { inhibit_non_essential_printing_operations = 1; preparing_for_armageddon = 1; +#if !defined (USER_IS_DEVELOPING_XEMACS) pause_so_user_can_read_messages (0); +#endif return EXCEPTION_EXECUTE_HANDLER; } diff --text -u 'xemacs-21.5.6/src/emodules.c' 'xemacs-21.5.7/src/emodules.c' Index: ././src/emodules.c --- ././src/emodules.c Wed Mar 13 17:52:38 2002 +++ ././src/emodules.c Wed Jun 5 18:55:15 2002 @@ -256,7 +256,7 @@ { if (INTP (XCAR (upto))) l = XINT (XCAR (upto)); - free_cons (XCONS (upto)); + free_cons (upto); } else l = XINT (upto); @@ -333,7 +333,7 @@ /* This is to get around the fact that build_string() is not declared as taking a const char * as an argument. I HATE compiler warnings. */ - tmod = (char *)alloca (strlen (module) + 1); + tmod = (char *)ALLOCA (strlen (module) + 1); strcpy (tmod, module); GCPRO2(filename, foundname); @@ -345,13 +345,13 @@ if (fd < 0) signal_error (Qdll_error, "Cannot open dynamic module", filename); - soname = (char *)alloca (XSTRING_LENGTH (foundname) + 1); + soname = (char *)ALLOCA (XSTRING_LENGTH (foundname) + 1); strcpy (soname, (char *)XSTRING_DATA (foundname)); dlhandle = dll_open (soname); if (dlhandle == (dll_handle)0) { - Intbyte *dllerrint; + Ibyte *dllerrint; EXTERNAL_TO_C_STRING (dll_error (dlhandle), dllerrint, Qnative); signal_error (Qdll_error, "Opening dynamic module", @@ -368,7 +368,7 @@ if ((f == (const char **)0) || (*f == (const char *)0)) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound); - mname = (char *)alloca (strlen (*f) + 1); + mname = (char *)ALLOCA (strlen (*f) + 1); strcpy (mname, *f); if (mname[0] == '\0') signal_error (Qdll_error, "Invalid dynamic module: Empty value for `emodule_name'", Qunbound); @@ -377,17 +377,17 @@ if ((f == (const char **)0) || (*f == (const char *)0)) signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound); - mver = (char *)alloca (strlen (*f) + 1); + mver = (char *)ALLOCA (strlen (*f) + 1); strcpy (mver, *f); f = (const char **)dll_variable (dlhandle, "emodule_title"); if ((f == (const char **)0) || (*f == (const char *)0)) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound); - mtitle = (char *)alloca (strlen (*f) + 1); + mtitle = (char *)ALLOCA (strlen (*f) + 1); strcpy (mtitle, *f); - symname = (char *)alloca (strlen (mname) + 15); + symname = (char *)ALLOCA (strlen (mname) + 15); strcpy (symname, "modules_of_"); strcat (symname, mname); @@ -437,6 +437,7 @@ { emodules_depth--; dll_close (dlhandle); + dlhandle = 0; /* Zero this out before module_load_unwind runs */ return; } @@ -492,7 +493,7 @@ emodules_doc_subr(const char *symname, const char *doc) { Bytecount len = strlen (symname); - Lisp_Object sym = oblookup (Vobarray, (const Intbyte *)symname, len); + Lisp_Object sym = oblookup (Vobarray, (const Ibyte *)symname, len); Lisp_Subr *subr; if (SYMBOLP(sym)) @@ -512,7 +513,7 @@ emodules_doc_sym (const char *symname, const char *doc) { Bytecount len = strlen (symname); - Lisp_Object sym = oblookup (Vobarray, (const Intbyte *)symname, len); + Lisp_Object sym = oblookup (Vobarray, (const Ibyte *)symname, len); Lisp_Object docstr; struct gcpro gcpro1; diff --text -u 'xemacs-21.5.6/src/eval.c' 'xemacs-21.5.7/src/eval.c' Index: ././src/eval.c --- ././src/eval.c Wed Apr 3 19:47:48 2002 +++ ././src/eval.c Fri Jun 28 23:21:41 2002 @@ -22,6 +22,119 @@ /* Synched up with: FSF 19.30 (except for Fsignal), Mule 2.0. */ +/* Authorship: + + Based on code from pre-release FSF 19, c. 1991. + Some work by Richard Mlynarik long ago (c. 1993?) -- + added call-with-condition-handler; synch. up to released FSF 19.7 + for lemacs 19.8. some signal changes. + Various work by Ben Wing, 1995-1996: + added all stuff dealing with trapping errors, suspended-errors, etc. + added most Fsignal front ends. + added warning code. + reworked the Fsignal code and synched the rest up to FSF 19.30. + Some changes by Martin Buchholz c. 1999? + e.g. PRIMITIVE_FUNCALL macros. + New call_trapping_problems code and large comments below + by Ben Wing, Mar-Apr 2000. +*/ + +/* This file has been Mule-ized. */ + +/* What is in this file? + + This file contains the engine for the ELisp interpreter in XEmacs. + The engine does the actual work of implementing function calls, + form evaluation, non-local exits (catch, throw, signal, + condition-case, call-with-condition-handler), unwind-protects, + dynamic bindings, let constructs, backtraces, etc. You might say + that this module is the very heart of XEmacs, and everything else + in XEmacs is merely an auxiliary module implementing some specific + functionality that may be called from the heart at an appropriate + time. + + The only exception is the alloc.c module, which implements the + framework upon which this module (eval.c) works. alloc.c works + with creating the actual Lisp objects themselves and garbage + collecting them as necessary, preseting a nice, high-level + interface for object creation, deletion, access, and modification. + + The only other exception that could be cited is the event-handling + module in event-stream.c. From its perspective, it is also the + heart of XEmacs, and controls exactly what gets done at what time. + From its perspective, eval.c is merely one of the auxiliary modules + out there that can be invoked by event-stream.c. + + Although the event-stream-centric view is a convenient fiction that + makes sense particularly from the user's perspective and from the + perspective of time, the engine-centric view is actually closest to + the truth, because anywhere within the event-stream module, you are + still somewhere in a Lisp backtrace, and event-loops are begun by + functions such as `command-loop-1', a Lisp function. + + As the Lisp engine is doing its thing, it maintains the state of + the engine primarily in five list-like items, with are: + + -- the backtrace list + -- the catchtag list + -- the condition-handler list + -- the specbind list + -- the GCPRO list. + + These are described in detail in the next comment. + + --ben + */ + +/* Note that there are five separate lists used to maintain state in + the evaluator. All of them conceptually are stacks (last-in, + first-out). All non-local exits happen ultimately through the + catch/throw mechanism, which uses one of the five lists (the + catchtag list) and records the current state of the others in each + frame of the list (some other information is recorded and restored + as well, such as the current eval depth), so that all the state of + the evaluator is restored properly when a non-local exit occurs. + (Note that the current state of the condition-handler list is not + recorded in the catchtag list. Instead, when a condition-case or + call-with-condition-handler is set up, it installs an + unwind-protect on the specbind list to restore the appropriate + setting for the condition-handler list. During the course of + handling the non-local exit, all entries on the specbind list that + are past the location stored in the catch frame are "unwound" + (i.e. variable bindings are restored and unwind-protects are + executed), so the condition-handler list gets reset properly. + + The five lists are + + 1. The backtrace list, which is chained through `struct backtrace's + declared in the stack frames of various primitives, and keeps + track of all Lisp function call entries and exits. + 2. The catchtag list, which is chained through `struct catchtag's + declared in the stack frames of internal_catch and condition_case_1, + and keeps track of information needed to reset the internal state + of the evaluator to the state that was current when the catch or + condition-case were established, in the event of a non-local exit. + 3. The condition-handler list, which is a simple Lisp list with new + entries consed onto the front of the list. It records condition-cases + and call-with-condition-handlers established either from C or from + Lisp. Unlike with the other lists (but similar to everything else + of a similar nature in the rest of the C and Lisp code), it takes care + of restoring itself appropriately in the event of a non-local exit + through the use of the unwind-protect mechanism. + 4. The specbind list, which is a contiguous array of `struct specbinding's, + expanded as necessary using realloc(). It holds dynamic variable + bindings (the only kind we currently have in ELisp) and unwind-protects. + 5. The GCPRO list, which is chained through `struct gcpro's declared in + the stack frames of any functions that need to GC-protect Lisp_Objects + declared on the stack. This is one of the most fragile areas of the + entire scheme -- you must not forget to UNGCPRO at the end of your + function, you must make sure you GCPRO in many circumstances you don't + think you have to, etc. See the internals manual for more information + about this. + + --ben +*/ + #include #include "lisp.h" @@ -29,8 +142,12 @@ #include "backtrace.h" #include "bytecode.h" #include "buffer.h" -#include "console.h" +#include "console-impl.h" +#include "device.h" +#include "frame.h" +#include "lstream.h" #include "opaque.h" +#include "window.h" struct backtrace *backtrace_list; @@ -66,6 +183,7 @@ /* If subrs take more than 8 arguments, more cases need to be added to this switch. (But wait - don't do it - if you really need a SUBR with more than 8 arguments, use max_args == MANY. + Or better, considering using a property list as one of your args. See the DEFUN macro in lisp.h) */ #define PRIMITIVE_FUNCALL(rv, fn, av, ac) do { \ void (*PF_fn)(void) = (void (*)(void)) fn; \ @@ -89,15 +207,22 @@ /* This is the list of current catches (and also condition-cases). - This is a stack: the most recent catch is at the head of the - list. Catches are created by declaring a 'struct catchtag' - locally, filling the .TAG field in with the tag, and doing - a setjmp() on .JMP. Fthrow() will store the value passed - to it in .VAL and longjmp() back to .JMP, back to the function - that established the catch. This will always be either - internal_catch() (catches established internally or through - `catch') or condition_case_1 (condition-cases established - internally or through `condition-case'). + This is a stack: the most recent catch is at the head of the list. + The list is threaded through the stack frames of the C functions + that set up the catches; this is similar to the way the GCPRO list + is handled, but different from the condition-handler list (which is + a simple Lisp list) and the specbind stack, which is a contiguous + array of `struct specbinding's, grown (using realloc()) as + necessary. (Note that all four of these lists behave as a stacks.) + + Catches are created by declaring a 'struct catchtag' locally, + filling the .TAG field in with the tag, and doing a setjmp() on + .JMP. Fthrow() will store the value passed to it in .VAL and + longjmp() back to .JMP, back to the function that established the + catch. This will always be either internal_catch() (catches + established internally or through `catch') or condition_case_1 + (condition-cases established internally or through + `condition-case'). The catchtag also records the current position in the call stack (stored in BACKTRACE_LIST), the current position @@ -105,10 +230,14 @@ unwind-protects), the value of LISP_EVAL_DEPTH, and the current position in the GCPRO stack. All of these are restored by Fthrow(). - */ + */ struct catchtag *catchlist; +/* A special tag that can be used internally from C code to catch + every attempt to throw past this level. */ +Lisp_Object Vcatch_everything_tag; + Lisp_Object Qautoload, Qmacro, Qexit; Lisp_Object Qinteractive, Qcommandp, Qdefun, Qprogn, Qvalues; Lisp_Object Vquit_flag, Vinhibit_quit; @@ -117,36 +246,30 @@ Lisp_Object Qdebug_on_signal, Qstack_trace_on_signal; Lisp_Object Qdebugger; Lisp_Object Qinhibit_quit; +Lisp_Object Qfinalize_list; Lisp_Object Qrun_hooks; Lisp_Object Qsetq; Lisp_Object Qdisplay_warning; Lisp_Object Vpending_warnings, Vpending_warnings_tail; Lisp_Object Qif; -/* Records whether we want errors to occur. This will be a boolean, - nil (errors OK) or t (no errors). If t, an error will cause a - throw to Qunbound_suspended_errors_tag. - - See call_with_suspended_errors(). */ -Lisp_Object Vcurrent_error_state; - -/* Current warning class when warnings occur, or nil for no warnings. - Only meaningful when Vcurrent_error_state is non-nil. - See call_with_suspended_errors(). */ -Lisp_Object Vcurrent_warning_class; - -/* Current warning level when warnings occur, or nil for no warnings. - Only meaningful when Vcurrent_error_state is non-nil. - See call_with_suspended_errors(). */ -Lisp_Object Vcurrent_warning_level; +/* Flags specifying which operations are currently inhibited. */ +int inhibit_flags; + +/* Buffers, frames, windows, devices, and consoles created since most + recent active + call_trapping_problems (INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION). +*/ +Lisp_Object Vdeletable_permanent_display_objects; + +/* Buffers created since most recent active + call_trapping_problems (INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION). */ +Lisp_Object Vmodifiable_buffers; /* Minimum level at which warnings are logged. Below this, they're ignored entirely -- not even generated. */ Lisp_Object Vlog_warning_minimum_level; -/* Special catch tag used in call_with_suspended_errors(). */ -Lisp_Object Qunbound_suspended_errors_tag; - /* Non-nil means record all fset's and provide's, to be undone if the file being autoloaded is not fully loaded. They are recorded by being consed onto the front of Vautoload_queue: @@ -225,48 +348,64 @@ /* Function to call to invoke the debugger */ Lisp_Object Vdebugger; -/* Chain of condition handlers currently in effect. - The elements of this chain are contained in the stack frames - of Fcondition_case and internal_condition_case. - When an error is signaled (by calling Fsignal, below), - this chain is searched for an element that applies. +/* List of condition handlers currently in effect. + The elements of this lists were at one point in the past + threaded through the stack frames of Fcondition_case and + related functions, but now are stored separately in a normal + stack. When an error is signaled (by calling Fsignal, below), + this list is searched for an element that applies. Each element of this list is one of the following: - A list of a handler function and possibly args to pass to - the function. This is a handler established with - `call-with-condition-handler' (q.v.). - - A list whose car is Qunbound and whose cdr is Qt. - This is a special condition-case handler established - by C code with condition_case_1(). All errors are - trapped; the debugger is not invoked even if - `debug-on-error' was set. + -- A list of a handler function and possibly args to pass to the + function. This is a handler established with the Lisp primitive + `call-with-condition-handler' or related C function + call_with_condition_handler(): + + If the handler function is an opaque ptr object, it is a handler + that was established in C using call_with_condition_handler(), + and the contents of the object are a function pointer which takes + three arguments, the signal name and signal data (same arguments + passed to `signal') and a third Lisp_Object argument, specified + in the call to call_with_condition_handler() and stored as the + second element of the list containing the handler functionl. + + If the handler function is a regular Lisp_Object, it is a handler + that was established using `call-with-condition-handler'. + Currently there are no more arguments in the list containing the + handler function, and only one argument is passed to the handler + function: a cons of the signal name and signal data arguments + passed to `signal'. + + -- A list whose car is Qunbound and whose cdr is Qt. This is a + special condition-case handler established by C code with + condition_case_1(). All errors are trapped; the debugger is not + invoked even if `debug-on-error' was set. + + -- A list whose car is Qunbound and whose cdr is Qerror. This is a + special condition-case handler established by C code with + condition_case_1(). It is like Qt except that the debugger is + invoked normally if it is called for. + + -- A list whose car is Qunbound and whose cdr is a list of lists + (CONDITION-NAME BODY ...) exactly as in `condition-case'. This is + a normal `condition-case' handler. + + Note that in all cases *except* the first, there is a corresponding + catch, whose TAG is the value of Vcondition_handlers just after the + handler data just described is pushed onto it. The reason is that + `condition-case' handlers need to throw back to the place where the + handler was installed before invoking it, while + `call-with-condition-handler' handlers are invoked in the + environment that `signal' was invoked in. */ - A list whose car is Qunbound and whose cdr is Qerror. - This is a special condition-case handler established - by C code with condition_case_1(). It is like Qt - except that the debugger is invoked normally if it is - called for. - - A list whose car is Qunbound and whose cdr is a list - of lists (CONDITION-NAME BODY ...) exactly as in - `condition-case'. This is a normal `condition-case' - handler. - - Note that in all cases *except* the first, there is a - corresponding catch, whose TAG is the value of - Vcondition_handlers just after the handler data just - described is pushed onto it. The reason is that - `condition-case' handlers need to throw back to the - place where the handler was installed before invoking - it, while `call-with-condition-handler' handlers are - invoked in the environment that `signal' was invoked - in. -*/ -static Lisp_Object Vcondition_handlers; +static Lisp_Object Vcondition_handlers; +/* I think we should keep this enabled all the time, not just when + error checking is enabled, because if one of these puppies pops up, + it will trash the stack if not caught, making it that much harder to + debug. It doesn't cause speed loss. */ #define DEFEND_AGAINST_THROW_RECURSION #ifdef DEFEND_AGAINST_THROW_RECURSION @@ -274,13 +413,6 @@ static int throw_level; #endif -#ifdef ERROR_CHECK_STRUCTURES -static void check_error_state_sanity (void); -#define CHECK_ERROR_STATE_SANITY() check_error_state_sanity () -#else -#define CHECK_ERROR_STATE_SANITY() -#endif - /************************************************************************/ /* The subr object type */ @@ -290,17 +422,17 @@ print_subr (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) { Lisp_Subr *subr = XSUBR (obj); - const CIntbyte *header = + const CIbyte *header = (subr->max_args == UNEVALLED) ? "#prompt ? " (interactive)>" : ">"; + const CIbyte *name = subr_name (subr); + const CIbyte *trailer = subr->prompt ? " (interactive)>" : ">"; if (print_readably) printing_unreadable_object ("%s%s%s", header, name, trailer); - write_c_string (header, printcharfun); - write_c_string (name, printcharfun); - write_c_string (trailer, printcharfun); + write_c_string (printcharfun, header); + write_c_string (printcharfun, name); + write_c_string (printcharfun, trailer); } static const struct lrecord_description subr_description[] = { @@ -317,15 +449,13 @@ /* Entering the debugger */ /************************************************************************/ -/* unwind-protect used by call_debugger() to restore the value of - entering_debugger. (We cannot use specbind() because the - variable is not Lisp-accessible.) */ - static Lisp_Object -restore_entering_debugger (Lisp_Object arg) +current_warning_level (void) { - entering_debugger = ! NILP (arg); - return arg; + if (inhibit_flags & ISSUE_WARNINGS_AT_DEBUG_LEVEL) + return Qdebug; + else + return Qwarning; } /* Actually call the debugger. ARG is a list of args that will be @@ -386,17 +516,24 @@ Lisp_Object val; int speccount; + debug_on_next_call = 0; + + if (inhibit_flags & INHIBIT_ENTERING_DEBUGGER) + { + if (!(inhibit_flags & INHIBIT_WARNING_ISSUE)) + warn_when_safe + (Qdebugger, current_warning_level (), + "Unable to enter debugger within critical section"); + return Qunbound; + } + if (lisp_eval_depth + 20 > max_lisp_eval_depth) max_lisp_eval_depth = lisp_eval_depth + 20; if (specpdl_size + 40 > max_specpdl_size) max_specpdl_size = specpdl_size + 40; - debug_on_next_call = 0; - speccount = specpdl_depth(); - record_unwind_protect (restore_entering_debugger, - (entering_debugger ? Qt : Qnil)); - entering_debugger = 1; - val = internal_catch (Qdebugger, call_debugger_259, arg, &threw); + speccount = internal_bind_int (&entering_debugger, 1); + val = internal_catch (Qdebugger, call_debugger_259, arg, &threw, 0); return unbind_to_1 (speccount, ((threw) ? Qunbound /* Not returning a value */ @@ -547,13 +684,26 @@ int *stack_trace_displayed, int *debugger_entered) { +#ifdef PIGS_FLY_AND_ALL_C_CODE_CAN_HANDLE_GC_OCCURRING_ALMOST_ANYWHERE /* This function can GC */ +#else /* reality check */ + /* This function cannot GC because it inhibits GC during its operation */ +#endif + Lisp_Object val = Qunbound; Lisp_Object all_handlers = Vcondition_handlers; Lisp_Object temp_data = Qnil; - int speccount = specpdl_depth(); + int outer_speccount = specpdl_depth(); + int speccount; + +#ifdef PIGS_FLY_AND_ALL_C_CODE_CAN_HANDLE_GC_OCCURRING_ALMOST_ANYWHERE struct gcpro gcpro1, gcpro2; GCPRO2 (all_handlers, temp_data); +#else + begin_gc_forbidden (); +#endif + + speccount = specpdl_depth(); Vcondition_handlers = active_handlers; @@ -592,6 +742,7 @@ specbind (Qstack_trace_on_signal, Qnil); val = call_debugger (list2 (Qerror, (Fcons (sig, data)))); + unbind_to (speccount); *debugger_entered = 1; } @@ -629,9 +780,11 @@ *debugger_entered = 1; } +#ifdef PIGS_FLY_AND_ALL_C_CODE_CAN_HANDLE_GC_OCCURRING_ALMOST_ANYWHERE UNGCPRO; +#endif Vcondition_handlers = all_handlers; - return unbind_to_1 (speccount, val); + return unbind_to_1 (outer_speccount, val); } @@ -710,7 +863,7 @@ { Lisp_Object cond = args[0]; Lisp_Object body; - + switch (nargs) { case 1: body = Qnil; break; @@ -1176,7 +1329,7 @@ ((INTP (documentation) && XINT (documentation) < 0) || (STRINGP (documentation) && - (XSTRING_BYTE (documentation, 0) == '*')) || + (string_byte (documentation, 0) == '*')) || /* If (STRING . INTEGER), a negative integer means a user variable. */ (CONSP (documentation) @@ -1280,7 +1433,7 @@ /* This function can GC */ Lisp_Object tag = Feval (XCAR (args)); Lisp_Object body = XCDR (args); - return internal_catch (tag, Fprogn, body, 0); + return internal_catch (tag, Fprogn, body, 0, 0); } /* Set up a catch, then call C function FUNC on argument ARG. @@ -1291,7 +1444,8 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object arg), Lisp_Object arg, - int * volatile threw) + int * volatile threw, + Lisp_Object * volatile thrown_tag) { /* This structure is made part of the chain `catchlist'. */ struct catchtag c; @@ -1299,6 +1453,7 @@ /* Fill in the components of c, and put it on the list. */ c.next = catchlist; c.tag = tag; + c.actual_tag = Qnil; c.val = Qnil; c.backlist = backtrace_list; #if 0 /* FSFmacs */ @@ -1318,12 +1473,14 @@ { /* Throw works by a longjmp that comes right here. */ if (threw) *threw = 1; + if (thrown_tag) *thrown_tag = c.actual_tag; return c.val; } c.val = (*func) (arg); if (threw) *threw = 0; + if (thrown_tag) *thrown_tag = Qnil; catchlist = c.next; - CHECK_ERROR_STATE_SANITY (); + check_catchlist_sanity (); return c.val; } @@ -1345,7 +1502,7 @@ This is used for correct unwinding in Fthrow and Fsignal. */ static void -unwind_to_catch (struct catchtag *c, Lisp_Object val) +unwind_to_catch (struct catchtag *c, Lisp_Object val, Lisp_Object tag) { REGISTER int last_time; @@ -1360,6 +1517,7 @@ (Can't overwrite tag slot because an unwind-protect may want to throw to this same tag, which isn't yet invalid.) */ c->val = val; + c->actual_tag = tag; #if 0 /* FSFmacs */ /* Restore the polling-suppression count. */ @@ -1375,7 +1533,7 @@ handlers. */ unbind_to (catchlist->pdlcount); catchlist = catchlist->next; - CHECK_ERROR_STATE_SANITY (); + check_catchlist_sanity (); } while (! last_time); #else @@ -1402,7 +1560,7 @@ /* Unwind the specpdl stack */ unbind_to (c->pdlcount); catchlist = c->next; - CHECK_ERROR_STATE_SANITY (); + check_catchlist_sanity (); #endif /* Former code */ gcprolist = c->gcpro; @@ -1439,7 +1597,9 @@ established at the same time, in initial_command_loop/ top_level_1. - #### Fix this horrifitude! + [[#### Fix this horrifitude!]] + + I don't think this is horrifitude, just defensive programming. --ben */ while (1) @@ -1451,8 +1611,8 @@ #endif for (c = catchlist; c; c = c->next) { - if (EQ (c->tag, tag)) - unwind_to_catch (c, val); + if (EQ (c->tag, tag) || EQ (c->tag, Vcatch_everything_tag)) + unwind_to_catch (c, val, tag); } if (!bomb_out_p) tag = Fsignal (Qno_catch, list2 (tag, val)); @@ -1522,22 +1682,25 @@ /* There is no problem freeing stuff here like there is in condition_case_unwind(), because there are no outside pointers (like the tag below in the catchlist) pointing to the objects. */ - Lisp_Cons *victim; + /* ((handler-fun . handler-args) ... other handlers) */ Lisp_Object tem = XCAR (loser); + int first = 1; while (CONSP (tem)) { - victim = XCONS (tem); - tem = victim->cdr; + Lisp_Object victim = tem; + if (first && OPAQUE_PTRP (XCAR (victim))) + free_opaque_ptr (XCAR (victim)); + first = 0; + tem = XCDR (victim); free_cons (victim); } - victim = XCONS (loser); if (EQ (loser, Vcondition_handlers)) /* may have been rebound to some tail */ - Vcondition_handlers = victim->cdr; + Vcondition_handlers = XCDR (loser); - free_cons (victim); + free_cons (loser); return Qnil; } @@ -1656,6 +1819,7 @@ Vcondition_handlers); #endif c.val = Qnil; + c.actual_tag = Qnil; c.backlist = backtrace_list; #if 0 /* FSFmacs */ /* #### */ @@ -1696,7 +1860,7 @@ GCPRO3 (harg, c.val, c.tag); catchlist = c.next; - CHECK_ERROR_STATE_SANITY (); + check_catchlist_sanity (); /* Note: The unbind also resets Vcondition_handlers. Maybe we should delete this here. */ Vcondition_handlers = XCDR (c.tag); @@ -1705,8 +1869,8 @@ UNGCPRO; /* free the conses *after* the unbind, because the unbind will run condition_case_unwind above. */ - free_cons (XCONS (XCAR (c.tag))); - free_cons (XCONS (c.tag)); + free_cons (XCAR (c.tag)); + free_cons (c.tag); return c.val; } @@ -1855,10 +2019,12 @@ int speccount = specpdl_depth(); Lisp_Object tem; - /* #### If there were a way to check that args[0] were a function - which accepted one arg, that should be done here ... */ + tem = Ffunction_max_args (args[0]); + if (! (XINT (Ffunction_min_args (args[0])) <= 1 + && (NILP (tem) || 1 <= XINT (tem)))) + invalid_argument ("Must be function of one argument", args[0]); - /* (handler-fun . handler-args) */ + /* (handler-fun . handler-args) but currently there are no handler-args */ tem = noseeum_cons (list1 (args[0]), Vcondition_handlers); record_unwind_protect (condition_bind_unwind, tem); Vcondition_handlers = tem; @@ -1867,6 +2033,40 @@ return unbind_to_1 (speccount, Ffuncall (nargs - 1, args + 1)); } +/* This is the C version of the above function. It calls FUN, passing it + ARG, first setting up HANDLER to catch signals in the environment in + which they were signalled. (HANDLER is only invoked if there was no + handler (either from condition-case or call-with-condition-handler) set + later on that handled the signal; therefore, this is a real error. + + HANDLER is invoked with three arguments: the ERROR-SYMBOL and DATA as + passed to `signal', and HANDLER_ARG. Originally I made HANDLER_ARG and + ARG be void * to facilitate passing structures, but I changed to + Lisp_Objects because all the other C interfaces to catch/condition-case/etc. + take Lisp_Objects, and it is easy enough to use make_opaque_ptr() et al. + to convert between Lisp_Objects and structure pointers. */ + +Lisp_Object +call_with_condition_handler (Lisp_Object (*handler) (Lisp_Object, Lisp_Object, + Lisp_Object), + Lisp_Object handler_arg, + Lisp_Object (*fun) (Lisp_Object), + Lisp_Object arg) +{ + /* This function can GC */ + int speccount = specpdl_depth(); + Lisp_Object tem; + + /* ((handler-fun . (handler-arg . nil)) ... ) */ + tem = noseeum_cons (noseeum_cons (make_opaque_ptr (handler), + noseeum_cons (handler_arg, Qnil)), + Vcondition_handlers); + record_unwind_protect (condition_bind_unwind, tem); + Vcondition_handlers = tem; + + return unbind_to_1 (speccount, (*fun) (arg)); +} + static int condition_type_p (Lisp_Object type, Lisp_Object conditions) { @@ -1910,16 +2110,42 @@ /* the workhorse error-signaling function */ /************************************************************************/ +/* This exists only for debugging purposes, as a place to put a breakpoint + that won't get signalled for errors occurring when + call_with_suspended_errors() was invoked. */ + +/* Don't make static or it might be compiled away */ +void signal_1 (void); + +void +signal_1 (void) +{ +} + /* #### This function has not been synched with FSF. It diverges significantly. */ -static Lisp_Object -signal_1 (Lisp_Object sig, Lisp_Object data) +/* The simplest external error function: it would be called + signal_continuable_error() in the terminology below, but it's + Lisp-callable. */ + +DEFUN ("signal", Fsignal, 2, 2, 0, /* +Signal a continuable error. Args are ERROR-SYMBOL, and associated DATA. +An error symbol is a symbol defined using `define-error'. +DATA should be a list. Its elements are printed as part of the error message. +If the signal is handled, DATA is made available to the handler. +See also the function `signal-error', and the functions to handle errors: +`condition-case' and `call-with-condition-handler'. + +Note that this function can return, if the debugger is invoked and the +user invokes the "return from signal" option. +*/ + (error_symbol, data)) { /* This function can GC */ - struct gcpro gcpro1, gcpro2; - Lisp_Object conditions; - Lisp_Object handlers; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; + Lisp_Object conditions = Qnil; + Lisp_Object handlers = Qnil; /* signal_call_debugger() could get called more than once (once when a call-with-condition-handler is about to be dealt with, and another when a condition-case handler @@ -1927,7 +2153,16 @@ stack trace aren't done more than once. */ int stack_trace_displayed = 0; int debugger_entered = 0; - GCPRO2 (conditions, handlers); + + /* Fsignal() is one of these functions that's called all the time + with newly-created Lisp objects. We allow this; but we must GC- + protect the objects because all sorts of weird stuff could + happen. */ + + GCPRO4 (conditions, handlers, error_symbol, data); + + if (!(inhibit_flags & CALL_WITH_SUSPENDED_ERRORS)) + signal_1 (); if (!initialized) { @@ -1937,12 +2172,22 @@ abort (); } - if (gc_in_progress || in_display) - /* This is one of many reasons why you can't run lisp code from redisplay. - There is no sensible way to handle errors there. */ + if (gc_in_progress) + /* We used to abort if in_display: + + [[This is one of many reasons why you can't run lisp code from + redisplay. There is no sensible way to handle errors there.]] + + The above comment is not correct. + + Inhibit GC until the redisplay code is careful enough to properly + GCPRO their structures; + + Surround all calls to Lisp code with error-trapping wrappers that + catch all errors. --ben */ abort (); - conditions = Fget (sig, Qerror_conditions, Qnil); + conditions = Fget (error_symbol, Qerror_conditions, Qnil); for (handlers = Vcondition_handlers; CONSP (handlers); @@ -1961,30 +2206,53 @@ NGCPRO1 (all_handlers); Vcondition_handlers = outer_handlers; - tem = signal_call_debugger (conditions, sig, data, + tem = signal_call_debugger (conditions, error_symbol, data, outer_handlers, 1, &stack_trace_displayed, &debugger_entered); if (!UNBOUNDP (tem)) RETURN_NUNGCPRO (return_from_signal (tem)); - tem = Fcons (sig, data); - if (NILP (handler_data)) - tem = call1 (handler_fun, tem); - else - { - /* (This code won't be used (for now?).) */ - struct gcpro nngcpro1; - Lisp_Object args[3]; - NNGCPRO1 (args[0]); - nngcpro1.nvars = 3; - args[0] = handler_fun; - args[1] = tem; - args[2] = handler_data; - nngcpro1.var = args; - tem = Fapply (3, args); - NNUNGCPRO; - } + if (OPAQUE_PTRP (handler_fun)) + { + if (NILP (handler_data)) + { + Lisp_Object (*hfun) (Lisp_Object, Lisp_Object) = + (Lisp_Object (*) (Lisp_Object, Lisp_Object)) + (get_opaque_ptr (handler_fun)); + + tem = (*hfun) (error_symbol, data); + } + else + { + Lisp_Object (*hfun) (Lisp_Object, Lisp_Object, Lisp_Object) = + (Lisp_Object (*) (Lisp_Object, Lisp_Object, Lisp_Object)) + (get_opaque_ptr (handler_fun)); + + assert (NILP (XCDR (handler_data))); + tem = (*hfun) (error_symbol, data, XCAR (handler_data)); + } + } + else + { + tem = Fcons (error_symbol, data); + if (NILP (handler_data)) + tem = call1 (handler_fun, tem); + else + { + /* (This code won't be used (for now?).) */ + struct gcpro nngcpro1; + Lisp_Object args[3]; + NNGCPRO1 (args[0]); + nngcpro1.nvars = 3; + args[0] = handler_fun; + args[1] = tem; + args[2] = handler_data; + nngcpro1.var = args; + tem = Fapply (3, args); + NNUNGCPRO; + } + } NUNGCPRO; #if 0 if (!EQ (tem, Qsignal)) @@ -2001,7 +2269,7 @@ else if (EQ (handler_data, Qt)) { UNGCPRO; - return Fthrow (handlers, Fcons (sig, data)); + return Fthrow (handlers, Fcons (error_symbol, data)); } /* `error' is used similarly to the way `t' is used, but in addition it invokes the debugger if debug_on_error. @@ -2009,7 +2277,8 @@ handler. */ else if (EQ (handler_data, Qerror)) { - Lisp_Object tem = signal_call_debugger (conditions, sig, data, + Lisp_Object tem = signal_call_debugger (conditions, error_symbol, + data, outer_handlers, 0, &stack_trace_displayed, &debugger_entered); @@ -2018,7 +2287,7 @@ if (!UNBOUNDP (tem)) return return_from_signal (tem); - tem = Fcons (sig, data); + tem = Fcons (error_symbol, data); return Fthrow (handlers, tem); } else @@ -2033,7 +2302,7 @@ if (condition_type_p (tem, conditions)) { - tem = signal_call_debugger (conditions, sig, data, + tem = signal_call_debugger (conditions, error_symbol, data, outer_handlers, 1, &stack_trace_displayed, &debugger_entered); @@ -2042,7 +2311,7 @@ return return_from_signal (tem); /* Doesn't return */ - tem = Fcons (Fcons (sig, data), Fcdr (clause)); + tem = Fcons (Fcons (error_symbol, data), Fcdr (clause)); return Fthrow (handlers, tem); } } @@ -2057,58 +2326,26 @@ there is no 'top-level catch. (That's why the "bomb-out" hack was added.) - #### Fix this horrifitude! - */ - signal_call_debugger (conditions, sig, data, Qnil, 0, + [[#### Fix this horrifitude!]] + + I don't think this is horrifitude, but just defensive coding. --ben */ + + signal_call_debugger (conditions, error_symbol, data, Qnil, 0, &stack_trace_displayed, &debugger_entered); UNGCPRO; - throw_or_bomb_out (Qtop_level, Qt, 1, sig, data); /* Doesn't return */ + throw_or_bomb_out (Qtop_level, Qt, 1, error_symbol, + data); /* Doesn't return */ return Qnil; } - /****************** Error functions class 1 ******************/ /* Class 1: General functions that signal an error. These functions take an error type and a list of associated error data. */ -/* The simplest external error function: it would be called - signal_continuable_error_1() in the terminology below, but it's - Lisp-callable. */ - -DEFUN ("signal", Fsignal, 2, 2, 0, /* -Signal a continuable error. Args are ERROR-SYMBOL, and associated DATA. -An error symbol is a symbol defined using `define-error'. -DATA should be a list. Its elements are printed as part of the error message. -If the signal is handled, DATA is made available to the handler. -See also the function `signal-error', and the functions to handle errors: -`condition-case' and `call-with-condition-handler'. - -Note that this function can return, if the debugger is invoked and the -user invokes the "return from signal" option. -*/ - (error_symbol, data)) -{ - /* Fsignal() is one of these functions that's called all the time - with newly-created Lisp objects. We allow this; but we must GC- - protect the objects because all sorts of weird stuff could - happen. */ - - struct gcpro gcpro1; - - GCPRO1 (data); - if (!NILP (Vcurrent_error_state)) - { - if (!NILP (Vcurrent_warning_class) && !NILP (Vcurrent_warning_level)) - warn_when_safe_lispobj (Vcurrent_warning_class, Vcurrent_warning_level, - Fcons (error_symbol, data)); - Fthrow (Qunbound_suspended_errors_tag, Qnil); - abort (); /* Better not get here! */ - } - RETURN_UNGCPRO (signal_1 (error_symbol, data)); -} +/* No signal_continuable_error_1(); it's called Fsignal(). */ /* Signal a non-continuable error. */ @@ -2118,10 +2355,15 @@ for (;;) Fsignal (sig, data); } -#ifdef ERROR_CHECK_STRUCTURES -static void -check_error_state_sanity (void) + +#ifdef ERROR_CHECK_CATCH + +void +check_catchlist_sanity (void) { +#if 0 + /* vou me tomar no cu! i just masked andy's missing-unbind + bug! */ struct catchtag *c; int found_error_tag = 0; @@ -2135,147 +2377,15 @@ } assert (found_error_tag || NILP (Vcurrent_error_state)); -} -#endif - -static Lisp_Object -restore_current_warning_class (Lisp_Object warning_class) -{ - Vcurrent_warning_class = warning_class; - return Qnil; -} - -static Lisp_Object -restore_current_warning_level (Lisp_Object warning_level) -{ - Vcurrent_warning_level = warning_level; - return Qnil; -} - -static Lisp_Object -restore_current_error_state (Lisp_Object error_state) -{ - Vcurrent_error_state = error_state; - return Qnil; +#endif /* vou me tomar no cul */ } -static Lisp_Object -call_with_suspended_errors_1 (Lisp_Object opaque_arg) +void +check_specbind_stack_sanity (void) { - Lisp_Object val; - Lisp_Object *kludgy_args = (Lisp_Object *) get_opaque_ptr (opaque_arg); - int speccount = specpdl_depth (); - - if (NILP (Vcurrent_error_state)) - { - record_unwind_protect (restore_current_error_state, - Vcurrent_error_state); - Vcurrent_error_state = Qt; - } - PRIMITIVE_FUNCALL (val, get_opaque_ptr (kludgy_args[0]), - kludgy_args + 2, XINT (kludgy_args[1])); - return unbind_to_1 (speccount, val); } -/* Many functions would like to do one of three things if an error - occurs: - - (1) signal the error, as usual. - (2) silently fail and return some error value. - (3) do as (2) but issue a warning in the process. - - Currently there's lots of stuff that passes an Error_Behavior - value and calls maybe_signal_error() and other such functions. - This approach is inherently error-prone and broken. A much - more robust and easier approach is to use call_with_suspended_errors(). - Wrap this around any function in which you might want errors - to not be errors. -*/ - -Lisp_Object -call_with_suspended_errors (lisp_fn_t fun, volatile Lisp_Object retval, - Lisp_Object class, Error_Behavior errb, - int nargs, ...) -{ - va_list vargs; - int speccount; - Lisp_Object kludgy_args[22]; - Lisp_Object *args = kludgy_args + 2; - int i; - - assert (SYMBOLP (class)); /* sanity-check */ - assert (!NILP (class)); - assert (nargs >= 0 && nargs < 20); - - va_start (vargs, nargs); - for (i = 0; i < nargs; i++) - args[i] = va_arg (vargs, Lisp_Object); - va_end (vargs); - - /* ERROR_ME means don't trap errors. (However, if errors are - already trapped, we leave them trapped.) - - Otherwise, we trap errors, and display as warnings if ERROR_ME_WARN. - - If ERROR_ME_NOT, we silently fail. - - If ERROR_ME_DEBUG_WARN, we display a warning, but at warning level to - `debug'. Normally these disappear, but can be seen if we changed - log-warning-minimum-level. - */ - - /* If error-checking is not disabled, just call the function. - It's important not to override disabled error-checking with - enabled error-checking. */ - - if (ERRB_EQ (errb, ERROR_ME)) - { - Lisp_Object val; - PRIMITIVE_FUNCALL (val, fun, args, nargs); - return val; - } - - speccount = specpdl_depth (); - if (NILP (Vcurrent_warning_class)) - { - /* Don't change the existing class. - #### Should we be consing the two together? */ - record_unwind_protect (restore_current_warning_class, - Vcurrent_warning_class); - Vcurrent_warning_class = class; - } - - record_unwind_protect (restore_current_warning_level, - Vcurrent_warning_level); - Vcurrent_warning_level = - (ERRB_EQ (errb, ERROR_ME_NOT) ? Qnil : - ERRB_EQ (errb, ERROR_ME_DEBUG_WARN) ? Qdebug : - Qwarning); - - - { - int threw; - Lisp_Object the_retval; - Lisp_Object opaque1 = make_opaque_ptr (kludgy_args); - Lisp_Object opaque2 = make_opaque_ptr ((void *) fun); - struct gcpro gcpro1, gcpro2; - - GCPRO2 (opaque1, opaque2); - kludgy_args[0] = opaque2; - kludgy_args[1] = make_int (nargs); - the_retval = internal_catch (Qunbound_suspended_errors_tag, - call_with_suspended_errors_1, - opaque1, &threw); - free_opaque_ptr (opaque1); - free_opaque_ptr (opaque2); - UNGCPRO; - /* Use the returned value except in non-local exit, when - RETVAL applies. */ - /* Some perverse compilers require the perverse cast below. */ - return unbind_to_1 (speccount, - threw ? *((Lisp_Object*) &(retval)) : the_retval); - } -} +#endif /* ERROR_CHECK_CATCH */ /* Signal a non-continuable error or display a warning or do nothing, according to ERRB. CLASS is the class of warning and should @@ -2337,7 +2447,7 @@ to signal_error_1(). */ Lisp_Object -build_error_data (const CIntbyte *reason, Lisp_Object frob) +build_error_data (const CIbyte *reason, Lisp_Object frob) { if (EQ (frob, Qunbound)) frob = Qnil; @@ -2352,13 +2462,13 @@ } DOESNT_RETURN -signal_error (Lisp_Object type, const CIntbyte *reason, Lisp_Object frob) +signal_error (Lisp_Object type, const CIbyte *reason, Lisp_Object frob) { signal_error_1 (type, build_error_data (reason, frob)); } void -maybe_signal_error (Lisp_Object type, const CIntbyte *reason, +maybe_signal_error (Lisp_Object type, const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { @@ -2369,14 +2479,14 @@ } Lisp_Object -signal_continuable_error (Lisp_Object type, const CIntbyte *reason, +signal_continuable_error (Lisp_Object type, const CIbyte *reason, Lisp_Object frob) { return Fsignal (type, build_error_data (reason, frob)); } Lisp_Object -maybe_signal_continuable_error (Lisp_Object type, const CIntbyte *reason, +maybe_signal_continuable_error (Lisp_Object type, const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { @@ -2398,7 +2508,7 @@ but these are more convenient in this particular case.) */ DOESNT_RETURN -signal_error_2 (Lisp_Object type, const CIntbyte *reason, +signal_error_2 (Lisp_Object type, const CIbyte *reason, Lisp_Object frob0, Lisp_Object frob1) { signal_error_1 (type, list3 (build_msg_string (reason), frob0, @@ -2406,7 +2516,7 @@ } void -maybe_signal_error_2 (Lisp_Object type, const CIntbyte *reason, +maybe_signal_error_2 (Lisp_Object type, const CIbyte *reason, Lisp_Object frob0, Lisp_Object frob1, Lisp_Object class, Error_Behavior errb) { @@ -2418,7 +2528,7 @@ } Lisp_Object -signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason, +signal_continuable_error_2 (Lisp_Object type, const CIbyte *reason, Lisp_Object frob0, Lisp_Object frob1) { return Fsignal (type, list3 (build_msg_string (reason), frob0, @@ -2426,7 +2536,7 @@ } Lisp_Object -maybe_signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason, +maybe_signal_continuable_error_2 (Lisp_Object type, const CIbyte *reason, Lisp_Object frob0, Lisp_Object frob1, Lisp_Object class, Error_Behavior errb) { @@ -2446,7 +2556,7 @@ is a single string, created using the arguments. */ DOESNT_RETURN -signal_ferror (Lisp_Object type, const CIntbyte *fmt, ...) +signal_ferror (Lisp_Object type, const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2461,7 +2571,7 @@ void maybe_signal_ferror (Lisp_Object type, Lisp_Object class, Error_Behavior errb, - const CIntbyte *fmt, ...) + const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2479,7 +2589,7 @@ } Lisp_Object -signal_continuable_ferror (Lisp_Object type, const CIntbyte *fmt, ...) +signal_continuable_ferror (Lisp_Object type, const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2494,7 +2604,7 @@ Lisp_Object maybe_signal_continuable_ferror (Lisp_Object type, Lisp_Object class, - Error_Behavior errb, const CIntbyte *fmt, ...) + Error_Behavior errb, const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2527,7 +2637,7 @@ */ DOESNT_RETURN -signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const CIntbyte *fmt, +signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const CIbyte *fmt, ...) { Lisp_Object obj; @@ -2544,7 +2654,7 @@ void maybe_signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, Lisp_Object class, Error_Behavior errb, - const CIntbyte *fmt, ...) + const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2564,7 +2674,7 @@ Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, - const CIntbyte *fmt, ...) + const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2581,7 +2691,7 @@ maybe_signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, Lisp_Object class, Error_Behavior errb, - const CIntbyte *fmt, ...) + const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2606,12 +2716,19 @@ void signal_quit (void) { - /* This function can GC */ + /* This function cannot GC. GC is prohibited because most callers do + not expect GC occurring in QUIT. Remove this if/when that gets fixed. + --ben */ + + int count; + if (EQ (Vquit_flag, Qcritical)) debug_on_quit |= 2; /* set critical bit. */ Vquit_flag = Qnil; + count = begin_gc_forbidden (); /* note that this is continuable. */ Fsignal (Qquit, Qnil); + unbind_to (count); } @@ -2662,161 +2779,161 @@ } DOESNT_RETURN -syntax_error (const CIntbyte *reason, Lisp_Object frob) +syntax_error (const CIbyte *reason, Lisp_Object frob) { signal_error (Qsyntax_error, reason, frob); } DOESNT_RETURN -syntax_error_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +syntax_error_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qsyntax_error, reason, frob1, frob2); } void -maybe_syntax_error (const CIntbyte *reason, Lisp_Object frob, +maybe_syntax_error (const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { maybe_signal_error (Qsyntax_error, reason, frob, class, errb); } DOESNT_RETURN -sferror (const CIntbyte *reason, Lisp_Object frob) +sferror (const CIbyte *reason, Lisp_Object frob) { signal_error (Qstructure_formation_error, reason, frob); } DOESNT_RETURN -sferror_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +sferror_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qstructure_formation_error, reason, frob1, frob2); } void -maybe_sferror (const CIntbyte *reason, Lisp_Object frob, +maybe_sferror (const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { maybe_signal_error (Qstructure_formation_error, reason, frob, class, errb); } DOESNT_RETURN -invalid_argument (const CIntbyte *reason, Lisp_Object frob) +invalid_argument (const CIbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_argument, reason, frob); } DOESNT_RETURN -invalid_argument_2 (const CIntbyte *reason, Lisp_Object frob1, +invalid_argument_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_argument, reason, frob1, frob2); } void -maybe_invalid_argument (const CIntbyte *reason, Lisp_Object frob, +maybe_invalid_argument (const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { maybe_signal_error (Qinvalid_argument, reason, frob, class, errb); } DOESNT_RETURN -invalid_constant (const CIntbyte *reason, Lisp_Object frob) +invalid_constant (const CIbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_constant, reason, frob); } DOESNT_RETURN -invalid_constant_2 (const CIntbyte *reason, Lisp_Object frob1, +invalid_constant_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_constant, reason, frob1, frob2); } void -maybe_invalid_constant (const CIntbyte *reason, Lisp_Object frob, +maybe_invalid_constant (const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { maybe_signal_error (Qinvalid_constant, reason, frob, class, errb); } DOESNT_RETURN -invalid_operation (const CIntbyte *reason, Lisp_Object frob) +invalid_operation (const CIbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_operation, reason, frob); } DOESNT_RETURN -invalid_operation_2 (const CIntbyte *reason, Lisp_Object frob1, +invalid_operation_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_operation, reason, frob1, frob2); } void -maybe_invalid_operation (const CIntbyte *reason, Lisp_Object frob, +maybe_invalid_operation (const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { maybe_signal_error (Qinvalid_operation, reason, frob, class, errb); } DOESNT_RETURN -invalid_change (const CIntbyte *reason, Lisp_Object frob) +invalid_change (const CIbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_change, reason, frob); } DOESNT_RETURN -invalid_change_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +invalid_change_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_change, reason, frob1, frob2); } void -maybe_invalid_change (const CIntbyte *reason, Lisp_Object frob, +maybe_invalid_change (const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { maybe_signal_error (Qinvalid_change, reason, frob, class, errb); } DOESNT_RETURN -invalid_state (const CIntbyte *reason, Lisp_Object frob) +invalid_state (const CIbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_state, reason, frob); } DOESNT_RETURN -invalid_state_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +invalid_state_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_state, reason, frob1, frob2); } void -maybe_invalid_state (const CIntbyte *reason, Lisp_Object frob, +maybe_invalid_state (const CIbyte *reason, Lisp_Object frob, Lisp_Object class, Error_Behavior errb) { maybe_signal_error (Qinvalid_state, reason, frob, class, errb); } DOESNT_RETURN -wtaerror (const CIntbyte *reason, Lisp_Object frob) +wtaerror (const CIbyte *reason, Lisp_Object frob) { signal_error (Qwrong_type_argument, reason, frob); } DOESNT_RETURN -stack_overflow (const CIntbyte *reason, Lisp_Object frob) +stack_overflow (const CIbyte *reason, Lisp_Object frob) { signal_error (Qstack_overflow, reason, frob); } DOESNT_RETURN -out_of_memory (const CIntbyte *reason, Lisp_Object frob) +out_of_memory (const CIbyte *reason, Lisp_Object frob) { signal_error (Qout_of_memory, reason, frob); } DOESNT_RETURN -printing_unreadable_object (const CIntbyte *fmt, ...) +printing_unreadable_object (const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -3145,15 +3262,140 @@ /* eval, funcall, apply */ /************************************************************************/ +/* NOTE: If you are hearing the endless complaint that function calls in + elisp are extremely slow, it just isn't true any more! The stuff below + -- in particular, the calling of subrs and compiled functions, the most + common cases -- has been highly optimized. There isn't a whole lot left + to do to squeeze more speed out except by switching to lexical + variables, which would eliminate the specbind loop. (But the real gain + from lexical variables would come from better optimization -- with + dynamic binding, you have the constant problem that any function call + that you haven't explicitly proven to be side-effect-free might + potentially side effect your local variables, which makes optimization + extremely difficult when there are function calls anywhere in a chunk of + code to be optimized. Even worse, you don't know that *your* local + variables aren't side-effecting an outer function's local variables, so + it's impossible to optimize away almost *any* variable assignment.) */ + static Lisp_Object funcall_lambda (Lisp_Object fun, int nargs, Lisp_Object args[]); static int in_warnings; -static Lisp_Object -in_warnings_restore (Lisp_Object minimus) + +void handle_compiled_function_with_and_rest (Lisp_Compiled_Function *f, + int nargs, + Lisp_Object args[]); + +/* The theory behind making this a separate function is to shrink + funcall_compiled_function() so as to increase the likelihood of a cache + hit in the L1 cache -- &rest processing is not going to be fast anyway. + The idea is the same as with execute_rare_opcode() in bytecode.c. We + make this non-static to ensure the compiler doesn't inline it. */ + +void +handle_compiled_function_with_and_rest (Lisp_Compiled_Function *f, int nargs, + Lisp_Object args[]) { - in_warnings = 0; - return Qnil; + REGISTER int i = 0; + int max_non_rest_args = f->args_in_array - 1; + int bindargs = min (nargs, max_non_rest_args); + + for (i = 0; i < bindargs; i++) + SPECBIND_FAST_UNSAFE (f->args[i], args[i]); + for (i = bindargs; i < max_non_rest_args; i++) + SPECBIND_FAST_UNSAFE (f->args[i], Qnil); + SPECBIND_FAST_UNSAFE + (f->args[max_non_rest_args], + nargs > max_non_rest_args ? + Flist (nargs - max_non_rest_args, &args[max_non_rest_args]) : + Qnil); +} + +/* Apply compiled-function object FUN to the NARGS evaluated arguments + in ARGS, and return the result of evaluation. */ +inline static Lisp_Object +funcall_compiled_function (Lisp_Object fun, int nargs, Lisp_Object args[]) +{ + /* This function can GC */ + int speccount = specpdl_depth(); + REGISTER int i = 0; + Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun); + + if (!OPAQUEP (f->instructions)) + /* Lazily munge the instructions into a more efficient form */ + optimize_compiled_function (fun); + + /* optimize_compiled_function() guaranteed that f->specpdl_depth is + the required space on the specbinding stack for binding the args + and local variables of fun. So just reserve it once. */ + SPECPDL_RESERVE (f->specpdl_depth); + + if (nargs == f->max_args) /* Optimize for the common case -- no unspecified + optional arguments. */ + { +#if 1 + for (i = 0; i < nargs; i++) + SPECBIND_FAST_UNSAFE (f->args[i], args[i]); +#else + /* Here's an alternate way to write the loop that tries to further + optimize funcalls for functions with few arguments by partially + unrolling the loop. It's not clear whether this is a win since it + increases the size of the function and the possibility of L1 cache + misses. (Microsoft VC++ 6 with /O2 /G5 generates 0x90 == 144 bytes + per SPECBIND_FAST_UNSAFE().) Tests under VC++ 6, running the byte + compiler repeatedly and looking at the total time, show very + little difference between the simple loop above, the unrolled code + below, and a "partly unrolled" solution with only cases 0-2 below + instead of 0-4. Therefore, I'm keeping it at the simple loop + because it's smaller. */ + switch (nargs) + { + default: + for (i = nargs - 1; i >= 4; i--) + SPECBIND_FAST_UNSAFE (f->args[i], args[i]); + case 4: SPECBIND_FAST_UNSAFE (f->args[3], args[3]); + case 3: SPECBIND_FAST_UNSAFE (f->args[2], args[2]); + case 2: SPECBIND_FAST_UNSAFE (f->args[1], args[1]); + case 1: SPECBIND_FAST_UNSAFE (f->args[0], args[0]); + case 0: break; + } +#endif + } + else if (nargs < f->min_args) + goto wrong_number_of_arguments; + else if (nargs < f->max_args) + { + for (i = 0; i < nargs; i++) + SPECBIND_FAST_UNSAFE (f->args[i], args[i]); + for (i = nargs; i < f->max_args; i++) + SPECBIND_FAST_UNSAFE (f->args[i], Qnil); + } + else if (f->max_args == MANY) + handle_compiled_function_with_and_rest (f, nargs, args); + else + { + wrong_number_of_arguments: + /* The actual printed compiled_function object is incomprehensible. + Check the backtrace to see if we can get a more meaningful symbol. */ + if (EQ (fun, indirect_function (*backtrace_list->function, 0))) + fun = *backtrace_list->function; + return Fsignal (Qwrong_number_of_arguments, + list2 (fun, make_int (nargs))); + } + + { + Lisp_Object value = + execute_optimized_program ((Opbyte *) XOPAQUE_DATA (f->instructions), + f->stack_depth, + XVECTOR_DATA (f->constants)); + + /* The attempt to optimize this by only unbinding variables failed + because using buffer-local variables as function parameters + leads to specpdl_ptr->func != 0 */ + /* UNBIND_TO_GCPRO_VARIABLES_ONLY (speccount, value); */ + UNBIND_TO_GCPRO (speccount, value); + return value; + } } DEFUN ("eval", Feval, 1, 1, 0, /* @@ -3167,20 +3409,20 @@ struct backtrace backtrace; /* I think this is a pretty safe place to call Lisp code, don't you? */ - while (!in_warnings && !NILP (Vpending_warnings)) + while (!in_warnings && !NILP (Vpending_warnings) + /* well, perhaps not so safe after all! */ + && !(inhibit_flags & INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY)) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - int speccount = specpdl_depth(); Lisp_Object this_warning_cons, this_warning, class, level, messij; + int speccount = internal_bind_int (&in_warnings, 1); - record_unwind_protect (in_warnings_restore, Qnil); - in_warnings = 1; this_warning_cons = Vpending_warnings; this_warning = XCAR (this_warning_cons); /* in case an error occurs in the warn function, at least it won't happen infinitely */ Vpending_warnings = XCDR (Vpending_warnings); - free_cons (XCONS (this_warning_cons)); + free_cons (this_warning_cons); class = XCAR (this_warning); level = XCAR (XCDR (this_warning)); messij = XCAR (XCDR (XCDR (this_warning))); @@ -3207,7 +3449,7 @@ } QUIT; - if (need_to_garbage_collect ()) + if (need_to_garbage_collect) { struct gcpro gcpro1; GCPRO1 (form); @@ -3431,9 +3673,29 @@ Lisp_Object *fun_args = args + 1; QUIT; - if (need_to_garbage_collect ()) - /* Callers should gcpro lexpr args */ - garbage_collect_1 (); + + if (funcall_allocation_flag) + { + if (need_to_garbage_collect) + /* Callers should gcpro lexpr args */ + garbage_collect_1 (); + if (need_to_check_c_alloca) + { + if (++funcall_alloca_count >= MAX_FUNCALLS_BETWEEN_ALLOCA_CLEANUP) + { + xemacs_c_alloca (0); + funcall_alloca_count = 0; + } + } + if (need_to_signal_post_gc) + { + static void run_post_gc_hook(void); /* forward */ + + need_to_signal_post_gc = 0; + recompute_funcall_allocation_flag(); + run_post_gc_hook(); + } + } if (++lisp_eval_depth > max_lisp_eval_depth) { @@ -3597,9 +3859,16 @@ } else if (COMPILED_FUNCTIONP (function)) { - arglist = compiled_function_arglist (XCOMPILED_FUNCTION (function)); - } - else if (CONSP (function)) + Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (function); + + if (function_min_args_p) + return make_int (f->min_args); + else if (f->max_args == MANY) + return Qnil; + else + return make_int (f->max_args); + } + else if (CONSP (function)) { Lisp_Object funcar = XCAR (function); @@ -3664,6 +3933,9 @@ Return the minimum number of arguments a function may be called with. The function may be any form that can be passed to `funcall', any special form, or any macro. + +To check if a function can be called with a specified number of +arguments, use `function-allows-args'. */ (function)) { @@ -3676,6 +3948,9 @@ any special form, or any macro. If the function takes an arbitrary number of arguments or is a built-in special form, nil is returned. + +To check if a function can be called with a specified number of +arguments, use `function-allows-args'. */ (function)) { @@ -3995,7 +4270,7 @@ #if 0 -/* From FSF 19.30, not currently used */ +/* From FSF 19.30, not currently used; seems like a big kludge. */ /* Run a hook symbol ARGS[0], but use FUNLIST instead of the actual present value of that symbol. @@ -4007,39 +4282,7 @@ Lisp_Object run_hook_list_with_args (Lisp_Object funlist, int nargs, Lisp_Object *args) { - Lisp_Object sym = args[0]; - Lisp_Object val; - struct gcpro gcpro1, gcpro2; - - GCPRO2 (sym, val); - - for (val = funlist; CONSP (val); val = XCDR (val)) - { - if (EQ (XCAR (val), Qt)) - { - /* t indicates this hook has a local binding; - it means to run the global binding too. */ - Lisp_Object globals; - - for (globals = Fdefault_value (sym); - CONSP (globals); - globals = XCDR (globals)) - { - args[0] = XCAR (globals); - /* In a global value, t should not occur. If it does, we - must ignore it to avoid an endless loop. */ - if (!EQ (args[0], Qt)) - Ffuncall (nargs, args); - } - } - else - { - args[0] = XCAR (val); - Ffuncall (nargs, args); - } - } - UNGCPRO; - return Qnil; + omitted; } #endif /* 0 */ @@ -4091,8 +4334,7 @@ Lisp_Object run_hook (Lisp_Object hook) { - Frun_hooks (1, &hook); - return Qnil; + return run_hook_with_args (1, &hook, RUN_HOOKS_TO_COMPLETION); } @@ -4392,350 +4634,906 @@ /* Error-catching front-ends to eval, funcall, apply */ /************************************************************************/ -/* Call function fn on no arguments, with condition handler */ -Lisp_Object -call0_with_handler (Lisp_Object handler, Lisp_Object fn) +int +get_inhibit_flags (void) { - /* This function can GC */ - struct gcpro gcpro1; - Lisp_Object args[2]; - args[0] = handler; - args[1] = fn; - GCPRO1 (args[0]); - gcpro1.nvars = 2; - RETURN_UNGCPRO (Fcall_with_condition_handler (2, args)); + return inhibit_flags; } -/* Call function fn with argument arg0, with condition handler */ -Lisp_Object -call1_with_handler (Lisp_Object handler, Lisp_Object fn, - Lisp_Object arg0) +void +check_allowed_operation (int what, Lisp_Object obj, Lisp_Object prop) { - /* This function can GC */ - struct gcpro gcpro1; - Lisp_Object args[3]; - args[0] = handler; - args[1] = fn; - args[2] = arg0; - GCPRO1 (args[0]); - gcpro1.nvars = 3; - RETURN_UNGCPRO (Fcall_with_condition_handler (3, args)); + if (inhibit_flags & INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION) + { + if (what == OPERATION_MODIFY_BUFFER_TEXT && BUFFERP (obj) + && NILP (memq_no_quit (obj, Vmodifiable_buffers))) + invalid_change + ("Modification of this buffer not currently permitted", obj); + } + if (inhibit_flags & INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION) + { + if (what == OPERATION_DELETE_OBJECT + && (BUFFERP (obj) || WINDOWP (obj) || FRAMEP (obj) || DEVICEP (obj) + || CONSOLEP (obj)) + && NILP (memq_no_quit (obj, Vdeletable_permanent_display_objects))) + invalid_change + ("Deletion of this object not currently permitted", obj); + } } - -/* The following functions provide you with error-trapping versions - of the various front-ends above. They take an additional - "warning_string" argument; if non-zero, a warning with this - string and the actual error that occurred will be displayed - in the *Warnings* buffer if an error occurs. In all cases, - QUIT is inhibited while these functions are running, and if - an error occurs, Qunbound is returned instead of the normal - return value. - */ +void +note_object_created (Lisp_Object obj) +{ + if (inhibit_flags & INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION) + { + if (BUFFERP (obj)) + Vmodifiable_buffers = Fcons (obj, Vmodifiable_buffers); + } + if (inhibit_flags & INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION) + { + if (BUFFERP (obj) || WINDOWP (obj) || FRAMEP (obj) || DEVICEP (obj) + || CONSOLEP (obj)) + Vdeletable_permanent_display_objects = + Fcons (obj, Vdeletable_permanent_display_objects); + } +} + +void +note_object_deleted (Lisp_Object obj) +{ + if (inhibit_flags & INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION) + { + if (BUFFERP (obj)) + Vmodifiable_buffers = delq_no_quit (obj, Vmodifiable_buffers); + } + if (inhibit_flags & INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION) + { + if (BUFFERP (obj) || WINDOWP (obj) || FRAMEP (obj) || DEVICEP (obj) + || CONSOLEP (obj)) + Vdeletable_permanent_display_objects = + delq_no_quit (obj, Vdeletable_permanent_display_objects); + } +} + +struct call_trapping_problems +{ + Lisp_Object catchtag; + Lisp_Object error_conditions; + Lisp_Object data; + Lisp_Object backtrace; + Lisp_Object warning_class; -/* #### This stuff needs to catch throws as well. We need to - improve internal_catch() so it can take a "catch anything" - argument similar to Qt or Qerror for condition_case_1(). */ + const CIbyte *warning_string; + Lisp_Object (*fun) (void *); + void *arg; +}; static Lisp_Object -caught_a_squirmer (Lisp_Object errordata, Lisp_Object arg) +flagged_a_squirmer (Lisp_Object error_conditions, Lisp_Object data, + Lisp_Object opaque) { - /* #### should be rewritten to work with emacs_sprintf_string_lisp(); but this - whole stuff is getting junked and replaced from my stderr-proc ws */ - if (!NILP (errordata)) + struct call_trapping_problems *p = + (struct call_trapping_problems *) get_opaque_ptr (opaque); + struct gcpro gcpro1; + Lisp_Object lstream = Qnil; + Lisp_Object errstr; + int speccount = specpdl_depth (); + + if (! (inhibit_flags & INHIBIT_WARNING_ISSUE)) { - Lisp_Object args[2]; + /* We're no longer protected against errors or quit here, so at + least let's temporarily inhibit quit. We definitely do not + want to inhibit quit during the calling of the function + itself!!!!!!!!!!! */ + + specbind (Qinhibit_quit, Qt); + + GCPRO1 (lstream); + lstream = make_resizing_buffer_output_stream (); + Fbacktrace (lstream, Qt); + Lstream_flush (XLSTREAM (lstream)); + p->backtrace = resizing_buffer_to_lisp_string (XLSTREAM (lstream)); + Lstream_delete (XLSTREAM (lstream)); + UNGCPRO; - if (!NILP (arg)) - { - Intbyte *str = (Intbyte *) get_opaque_ptr (arg); - args[0] = build_intstring (str); - } - else - args[0] = build_msg_string ("error"); /* #### This should call - (with-output-to-string (display-error errordata)) + (with-output-to-string (display-error (cons error_conditions data)) but that stuff is all in Lisp currently. */ - args[1] = errordata; - warn_when_safe_lispobj - (Qerror, Qwarning, - emacs_vsprintf_string_lisp ("%s: %s", Qnil, 2, args)); + errstr = + emacs_sprintf_string_lisp + ("%s: (%s %s)\n\nBacktrace follows:\n\n%s", + Qnil, 4, + build_msg_string (p->warning_string ? p->warning_string : "error"), + error_conditions, data, p->backtrace); + + warn_when_safe_lispobj (p->warning_class, current_warning_level (), + errstr); + + unbind_to (speccount); + } - return Qunbound; -} + else + p->backtrace = Qnil; -static Lisp_Object -allow_quit_caught_a_squirmer (Lisp_Object errordata, Lisp_Object arg) -{ - if (CONSP (errordata) && EQ (XCAR (errordata), Qquit)) - return Fsignal (Qquit, XCDR (errordata)); - return caught_a_squirmer (errordata, arg); -} + p->error_conditions = error_conditions; + p->data = data; -static Lisp_Object -safe_run_hook_caught_a_squirmer (Lisp_Object errordata, Lisp_Object arg) -{ - Lisp_Object hook = Fcar (arg); - arg = Fcdr (arg); - /* Clear out the hook. */ - Fset (hook, Qnil); - return caught_a_squirmer (errordata, arg); + Fthrow (p->catchtag, Qnil); + return Qnil; /* not reached */ } static Lisp_Object -allow_quit_safe_run_hook_caught_a_squirmer (Lisp_Object errordata, - Lisp_Object arg) +call_trapping_problems_2 (Lisp_Object opaque) { - Lisp_Object hook = Fcar (arg); - arg = Fcdr (arg); - if (!CONSP (errordata) || !EQ (XCAR (errordata), Qquit)) - /* Clear out the hook. */ - Fset (hook, Qnil); - return allow_quit_caught_a_squirmer (errordata, arg); + struct call_trapping_problems *p = + (struct call_trapping_problems *) get_opaque_ptr (opaque); + + return (p->fun) (p->arg); } static Lisp_Object -catch_them_squirmers_eval_in_buffer (Lisp_Object cons) +call_trapping_problems_1 (Lisp_Object opaque) { - return eval_in_buffer (XBUFFER (XCAR (cons)), XCDR (cons)); + return call_with_condition_handler (flagged_a_squirmer, opaque, + call_trapping_problems_2, opaque); } -Lisp_Object -eval_in_buffer_trapping_errors (const CIntbyte *warning_string, - struct buffer *buf, Lisp_Object form) +/* This is equivalent to (*fun) (arg), except that various conditions + can be trapped or inhibited, according to FLAGS. + + If FLAGS does not contain NO_INHIBIT_ERRORS, when an error occurs, + the error is caught and a warning is issued, specifying the + specific error that occurred and a backtrace. In that case, + WARNING_STRING should be given, and will be printed at the + beginning of the error to indicate where the error occurred. + + If FLAGS does not contain NO_INHIBIT_THROWS, all attempts to + `throw' out of the function being called are trapped, and a warning + issued. (Again, WARNING_STRING should be given.) + + (If FLAGS contains INHIBIT_WARNING_ISSUE, no warnings are issued; + this applies to recursive invocations of call_trapping_problems, too. + + If FLAGS contains ISSUE_WARNINGS_AT_DEBUG_LEVEL, warnings will be + issued, but at level `debug', which normally is below the minimum + specified by `log-warning-minimum-level', meaning such warnings will + be ignored entirely. The user can change this variable, however, + to see the warnings.) + + Note: If neither of NO_INHIBIT_THROWS or NO_INHIBIT_ERRORS is + given, you are *guaranteed* that there will be no non-local exits + out of this function. + + If FLAGS contains INHIBIT_QUIT, QUIT using C-g is inhibited. (This + is *rarely* a good idea. Unless you use NO_INHIBIT_ERRORS, QUIT is + automatically caught as well, and treated as an error; you can + check for this using EQ (problems->error_conditions, Qquit). + + If FLAGS contains UNINHIBIT_QUIT, QUIT checking will be explicitly + turned on. (It will abort the code being called, but will still be + trapped and reported as an error, unless NO_INHIBIT_ERRORS is + given.) This is useful when QUIT checking has been turned off by a + higher-level caller. + + If FLAGS contains INHIBIT_GC, garbage collection is inhibited. + This is useful for Lisp called within redisplay or inside of the + QUIT macro (where GC is generally not expected), for example. + + If FLAGS contains INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION, + Lisp code is not allowed to delete any window, buffers, frames, devices, + or consoles that were already in existence at the time this function + was called. (However, it's perfectly legal for code to create a new + buffer and then delete it.) + + #### It might be useful to have a flag that inhibits deletion of a + specific permanent display object and everything it's attached to + (e.g. a window, and the buffer, frame, device, and console it's + attached to. + + If FLAGS contains INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION, Lisp + code is not allowed to modify the text of any buffers that were + already in existence at the time this function was called. + (However, it's perfectly legal for code to create a new buffer and + then modify its text.) + + [These last two flags are implemented using global variables + Vdeletable_permanent_display_objects and Vmodifiable_buffers, + which keep track of a list of all buffers or permanent display + objects created since the last time one of these flags was set. + The code that deletes buffers, etc. and modifies buffers checks + + (1) if the corresponding flag is set (through the global variable + inhibit_flags or its accessor function get_inhibit_flags()), and + + (2) if the object to be modified or deleted is not in the + appropriate list. + + If so, it signals an error. + + Recursive calls to call_trapping_problems() are allowed. In + the case of the two flags mentioned above, the current values + of the global variables are stored in an unwind-protect, and + they're reset to nil.] + + If FLAGS contains INHIBIT_ENTERING_DEBUGGER, the debugger will not + be entered if an error occurs inside the Lisp code being called, + even when the user has requested an error. In such case, a warning + is issued stating that access to the debugger is denied, unless + INHIBIT_WARNING_ISSUE has also been supplied. This is useful when + calling Lisp code inside redisplay, in menu callbacks, etc. because + in such cases either the display is in an inconsistent state or + doing window operations is explicitly forbidden by the OS, and the + debugger would causes visual changes on the screen and might create + another frame. + + If FLAGS contains INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY, no + changes of any sort to extents, faces, glyphs, buffer text, + specifiers relating to display, other variables relating to + display, splitting, deleting, or resizing windows or frames, + deleting buffers, windows, frames, devices, or consoles, etc. is + allowed. This is for things called absolutely in the middle of + redisplay, which expects things to be *exactly* the same after the + call as before. This isn't completely implemented and needs to be + thought out some more to determine exactly what its semantics are. + For the moment, turning on this flag also turns on + + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION + INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION + INHIBIT_ENTERING_DEBUGGER + INHIBIT_WARNING_ISSUE + INHIBIT_GC + + #### The following five flags are defined, but unimplemented: + + #define INHIBIT_EXISTING_CODING_SYSTEM_DELETION (1<<6) + #define INHIBIT_EXISTING_CHARSET_DELETION (1<<7) + #define INHIBIT_PERMANENT_DISPLAY_OBJECT_CREATION (1<<8) + #define INHIBIT_CODING_SYSTEM_CREATION (1<<9) + #define INHIBIT_CHARSET_CREATION (1<<10) + + FLAGS containing CALL_WITH_SUSPENDED_ERRORS is a sign that + call_with_suspended_errors() was invoked. This exists only for + debugging purposes -- often we want to break when a signal happens, + but ignore signals from call_with_suspended_errors(), because they + occur often and for legitimate reasons. + + If PROBLEM is non-zero, it should be a pointer to a structure into + which exact information about any occurring problems (either an + error or an attempted throw past this boundary). + + If a problem occurred and aborted operation (error, quit, or + invalid throw), Qunbound is returned. Otherwise the return value + from the call to (*fun) (arg) is returned. */ + +Lisp_Object +call_trapping_problems (Lisp_Object warning_class, + const CIbyte *warning_string, + int flags, + struct call_trapping_problems_result *problem, + Lisp_Object (*fun) (void *), + void *arg) { int speccount = specpdl_depth(); - Lisp_Object tem; - Lisp_Object buffer; - Lisp_Object cons; - Lisp_Object opaque; - struct gcpro gcpro1, gcpro2; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; + struct call_trapping_problems package; + Lisp_Object opaque, thrown_tag, tem; + int thrown = 0; + + assert (SYMBOLP (warning_class)); /* sanity-check */ + assert (!NILP (warning_class)); + + flags ^= INTERNAL_INHIBIT_ERRORS | INTERNAL_INHIBIT_THROWS; + + package.warning_class = warning_class; + package.warning_string = warning_string; + package.fun = fun; + package.arg = arg; + package.catchtag = + flags & INTERNAL_INHIBIT_THROWS ? Vcatch_everything_tag : + flags & INTERNAL_INHIBIT_ERRORS ? make_opaque_ptr (0) : + Qnil; + package.error_conditions = Qnil; + package.data = Qnil; + package.backtrace = Qnil; + + if (flags & INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY) + flags |= INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION + | INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION + | INHIBIT_ENTERING_DEBUGGER + | INHIBIT_WARNING_ISSUE + | INHIBIT_GC; + + { + int new_inhibit_flags = inhibit_flags | flags; + if (new_inhibit_flags != inhibit_flags) + internal_bind_int (&inhibit_flags, new_inhibit_flags); + } + + if (flags & INHIBIT_QUIT) + specbind (Qinhibit_quit, Qt); + + if (flags & UNINHIBIT_QUIT) + begin_do_check_for_quit (); + + if (flags & INHIBIT_GC) + begin_gc_forbidden (); + + /* #### If we have nested calls to call_trapping_problems(), and the + inner one creates some buffers/etc., should the outer one be able + to delete them? I think so, but it means we need to combine rather + than just reset the value. */ + if (flags & INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION) + internal_bind_lisp_object (&Vdeletable_permanent_display_objects, Qnil); + + if (flags & INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION) + internal_bind_lisp_object (&Vmodifiable_buffers, Qnil); + + if (flags & (INTERNAL_INHIBIT_THROWS | INTERNAL_INHIBIT_ERRORS)) + opaque = make_opaque_ptr (&package); + else + opaque = Qnil; + + GCPRO5 (package.catchtag, package.error_conditions, package.data, + package.backtrace, opaque); - buffer = wrap_buffer (buf); + if (flags & INTERNAL_INHIBIT_ERRORS) + /* We need a catch so that our condition-handler can throw back here + after printing the warning. (We print the warning in the stack + context of the error, so we can get a backtrace.) */ + tem = internal_catch (package.catchtag, call_trapping_problems_1, opaque, + &thrown, &thrown_tag); + else if (flags & INTERNAL_INHIBIT_THROWS) + /* We skip over the first wrapper, which traps errors. */ + tem = internal_catch (package.catchtag, call_trapping_problems_2, opaque, + &thrown, &thrown_tag); + else + /* Nothing special. */ + tem = (fun) (arg); - specbind (Qinhibit_quit, Qt); - /* begin_gc_forbidden(); Currently no reason to do this; */ + if (thrown && !EQ (thrown_tag, package.catchtag) + && (!flags & INHIBIT_WARNING_ISSUE)) + { + Lisp_Object errstr; - cons = noseeum_cons (buffer, form); - opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); - GCPRO2 (cons, opaque); - /* Qerror not Qt, so you can get a backtrace */ - tem = condition_case_1 (Qerror, - catch_them_squirmers_eval_in_buffer, cons, - caught_a_squirmer, opaque); - free_cons (XCONS (cons)); - if (OPAQUE_PTRP (opaque)) + if (!(flags & INHIBIT_QUIT)) + /* We're no longer protected against errors or quit here, so at + least let's temporarily inhibit quit. */ + specbind (Qinhibit_quit, Qt); + errstr = + emacs_sprintf_string_lisp + ("%s: Attempt to throw outside of function " + "to catch `%s' with value `%s'", + Qnil, 3, build_msg_string (warning_string ? warning_string : "error"), + thrown_tag, tem); + + warn_when_safe_lispobj (Qerror, current_warning_level (), errstr); + } + + if (problem) + { + if (!thrown) + { + problem->caught_error = 0; + problem->caught_throw = 0; + problem->error_conditions = Qnil; + problem->data = Qnil; + problem->backtrace = Qnil; + problem->thrown_tag = Qnil; + problem->thrown_value = Qnil; + } + else if (EQ (thrown_tag, package.catchtag)) + { + problem->caught_error = 1; + problem->caught_throw = 0; + problem->error_conditions = package.error_conditions; + problem->data = package.data; + problem->backtrace = package.backtrace; + problem->thrown_tag = Qnil; + problem->thrown_value = Qnil; + } + else + { + problem->caught_error = 0; + problem->caught_throw = 1; + problem->error_conditions = Qnil; + problem->data = Qnil; + problem->backtrace = Qnil; + problem->thrown_tag = thrown_tag; + problem->thrown_value = tem; + } + } + + if (!NILP (package.catchtag) && + !EQ (package.catchtag, Vcatch_everything_tag)) + free_opaque_ptr (package.catchtag); + + if (!NILP (opaque)) free_opaque_ptr (opaque); - UNGCPRO; - return unbind_to_1 (speccount, tem); + unbind_to (speccount); + RETURN_UNGCPRO (thrown ? Qunbound : tem); } +struct va_call_trapping_problems +{ + lisp_fn_t fun; + int nargs; + Lisp_Object *args; +}; + static Lisp_Object -catch_them_squirmers_run_hook (Lisp_Object hook_symbol) +va_call_trapping_problems_1 (void *ai_mi_madre) { - /* This function can GC */ - run_hook (hook_symbol); - return Qnil; + struct va_call_trapping_problems *ai_no_corrida = + (struct va_call_trapping_problems *) ai_mi_madre; + Lisp_Object pegar_no_bumbum; + + PRIMITIVE_FUNCALL (pegar_no_bumbum, ai_no_corrida->fun, + ai_no_corrida->args, ai_no_corrida->nargs); + return pegar_no_bumbum; } +/* #### document me. */ + Lisp_Object -run_hook_trapping_errors (const CIntbyte *warning_string, - Lisp_Object hook_symbol) +va_call_trapping_problems (Lisp_Object warning_class, + const CIbyte *warning_string, + int flags, + struct call_trapping_problems_result *problem, + lisp_fn_t fun, int nargs, ...) { - int speccount; - Lisp_Object tem; - Lisp_Object opaque; + va_list vargs; + Lisp_Object args[20]; + int i; + struct va_call_trapping_problems fazer_invocacao_atrapalhando_problemas; struct gcpro gcpro1; - if (!initialized || preparing_for_armageddon) - return Qnil; - tem = find_symbol_value (hook_symbol); - if (NILP (tem) || UNBOUNDP (tem)) - return Qnil; + assert (nargs >= 0 && nargs < 20); - speccount = specpdl_depth(); - specbind (Qinhibit_quit, Qt); + va_start (vargs, nargs); + for (i = 0; i < nargs; i++) + args[i] = va_arg (vargs, Lisp_Object); + va_end (vargs); - opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); - GCPRO1 (opaque); - /* Qerror not Qt, so you can get a backtrace */ - tem = condition_case_1 (Qerror, - catch_them_squirmers_run_hook, hook_symbol, - caught_a_squirmer, opaque); - if (OPAQUE_PTRP (opaque)) - free_opaque_ptr (opaque); - UNGCPRO; + fazer_invocacao_atrapalhando_problemas.fun = fun; + fazer_invocacao_atrapalhando_problemas.nargs = nargs; + fazer_invocacao_atrapalhando_problemas.args = args; - return unbind_to_1 (speccount, tem); + GCPRO1_ARRAY (args, nargs); + RETURN_UNGCPRO + (call_trapping_problems + (warning_class, warning_string, flags, problem, + va_call_trapping_problems_1, &fazer_invocacao_atrapalhando_problemas)); } -/* Same as run_hook_trapping_errors() but also set the hook to nil - if an error occurs. */ +/* this is an older interface, barely different from + va_call_trapping_problems. + + #### eliminate this or at least merge the ERROR_BEHAVIOR stuff into + va_call_trapping_problems(). */ Lisp_Object -safe_run_hook_trapping_errors (const CIntbyte *warning_string, - Lisp_Object hook_symbol, - int allow_quit) +call_with_suspended_errors (lisp_fn_t fun, Lisp_Object retval, + Lisp_Object class, Error_Behavior errb, + int nargs, ...) { - int speccount = specpdl_depth(); - Lisp_Object tem; - Lisp_Object cons = Qnil; + va_list vargs; + Lisp_Object args[20]; + int i; + struct va_call_trapping_problems fazer_invocacao_atrapalhando_problemas; + int flags; struct gcpro gcpro1; - if (!initialized || preparing_for_armageddon) - return Qnil; - tem = find_symbol_value (hook_symbol); - if (NILP (tem) || UNBOUNDP (tem)) - return Qnil; + assert (SYMBOLP (class)); /* sanity-check */ + assert (!NILP (class)); + assert (nargs >= 0 && nargs < 20); - if (!allow_quit) - specbind (Qinhibit_quit, Qt); + va_start (vargs, nargs); + for (i = 0; i < nargs; i++) + args[i] = va_arg (vargs, Lisp_Object); + va_end (vargs); - cons = noseeum_cons (hook_symbol, - warning_string ? make_opaque_ptr ((void *)warning_string) - : Qnil); - GCPRO1 (cons); - /* Qerror not Qt, so you can get a backtrace */ - tem = condition_case_1 (Qerror, - catch_them_squirmers_run_hook, - hook_symbol, - allow_quit ? - allow_quit_safe_run_hook_caught_a_squirmer : - safe_run_hook_caught_a_squirmer, - cons); - if (OPAQUE_PTRP (XCDR (cons))) - free_opaque_ptr (XCDR (cons)); - free_cons (XCONS (cons)); - UNGCPRO; + /* If error-checking is not disabled, just call the function. */ - return unbind_to_1 (speccount, tem); + if (ERRB_EQ (errb, ERROR_ME)) + { + Lisp_Object val; + PRIMITIVE_FUNCALL (val, fun, args, nargs); + return val; + } + + if (ERRB_EQ (errb, ERROR_ME_NOT)) /* person wants no warnings */ + flags = INHIBIT_WARNING_ISSUE | INHIBIT_ENTERING_DEBUGGER; + else if (ERRB_EQ (errb, ERROR_ME_DEBUG_WARN)) + flags = ISSUE_WARNINGS_AT_DEBUG_LEVEL | INHIBIT_ENTERING_DEBUGGER; + else + { + assert (ERRB_EQ (errb, ERROR_ME_WARN)); + flags = INHIBIT_ENTERING_DEBUGGER; + } + + flags |= CALL_WITH_SUSPENDED_ERRORS; + + fazer_invocacao_atrapalhando_problemas.fun = fun; + fazer_invocacao_atrapalhando_problemas.nargs = nargs; + fazer_invocacao_atrapalhando_problemas.args = args; + + GCPRO1_ARRAY (args, nargs); + { + Lisp_Object its_way_too_goddamn_late = + call_trapping_problems + (class, 0, flags, 0, va_call_trapping_problems_1, + &fazer_invocacao_atrapalhando_problemas); + UNGCPRO; + if (UNBOUNDP (its_way_too_goddamn_late)) + return retval; + else + return its_way_too_goddamn_late; + } } +struct calln_trapping_problems +{ + int nargs; + Lisp_Object *args; +}; + static Lisp_Object -catch_them_squirmers_call0 (Lisp_Object function) +calln_trapping_problems_1 (void *puta) { - /* This function can GC */ - return call0 (function); + struct calln_trapping_problems *p = (struct calln_trapping_problems *) puta; + + return Ffuncall (p->nargs, p->args); } -Lisp_Object -call0_trapping_errors (const CIntbyte *warning_string, Lisp_Object function) +static Lisp_Object +calln_trapping_problems (Lisp_Object warning_class, + const CIbyte *warning_string, int flags, + struct call_trapping_problems_result *problem, + int nargs, Lisp_Object *args) { - int speccount; - Lisp_Object tem; - Lisp_Object opaque = Qnil; - struct gcpro gcpro1, gcpro2; + struct calln_trapping_problems foo; + struct gcpro gcpro1; - if (SYMBOLP (function)) + if (SYMBOLP (args[0])) { - tem = XSYMBOL (function)->function; + Lisp_Object tem = XSYMBOL (args[0])->function; if (NILP (tem) || UNBOUNDP (tem)) - return Qnil; + { + if (problem) + { + problem->caught_error = 0; + problem->caught_throw = 0; + problem->error_conditions = Qnil; + problem->data = Qnil; + problem->backtrace = Qnil; + problem->thrown_tag = Qnil; + problem->thrown_value = Qnil; + } + return Qnil; + } } - GCPRO2 (opaque, function); - speccount = specpdl_depth(); - specbind (Qinhibit_quit, Qt); - /* begin_gc_forbidden(); Currently no reason to do this; */ + foo.nargs = nargs; + foo.args = args; - opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); - /* Qerror not Qt, so you can get a backtrace */ - tem = condition_case_1 (Qerror, - catch_them_squirmers_call0, function, - caught_a_squirmer, opaque); - if (OPAQUE_PTRP (opaque)) - free_opaque_ptr (opaque); - UNGCPRO; + GCPRO1_ARRAY (args, nargs); + RETURN_UNGCPRO (call_trapping_problems (warning_class, warning_string, + flags, problem, + calln_trapping_problems_1, + &foo)); +} + +/* #### fix these functions to follow the calling convention of + call_trapping_problems! */ + +Lisp_Object +call0_trapping_problems (const CIbyte *warning_string, Lisp_Object function, + int flags) +{ + return calln_trapping_problems (Qerror, warning_string, flags, 0, 1, + &function); +} + +Lisp_Object +call1_trapping_problems (const CIbyte *warning_string, Lisp_Object function, + Lisp_Object object, int flags) +{ + Lisp_Object args[2]; + + args[0] = function; + args[1] = object; + + return calln_trapping_problems (Qerror, warning_string, flags, 0, 2, + args); +} + +Lisp_Object +call2_trapping_problems (const CIbyte *warning_string, Lisp_Object function, + Lisp_Object object1, Lisp_Object object2, + int flags) +{ + Lisp_Object args[3]; + + args[0] = function; + args[1] = object1; + args[2] = object2; + + return calln_trapping_problems (Qerror, warning_string, flags, 0, 3, + args); +} + +Lisp_Object +call3_trapping_problems (const CIbyte *warning_string, Lisp_Object function, + Lisp_Object object1, Lisp_Object object2, + Lisp_Object object3, int flags) +{ + Lisp_Object args[4]; + + args[0] = function; + args[1] = object1; + args[2] = object2; + args[3] = object3; - return unbind_to_1 (speccount, tem); + return calln_trapping_problems (Qerror, warning_string, flags, 0, 4, + args); } +Lisp_Object +call4_trapping_problems (const CIbyte *warning_string, Lisp_Object function, + Lisp_Object object1, Lisp_Object object2, + Lisp_Object object3, Lisp_Object object4, + int flags) +{ + Lisp_Object args[5]; + + args[0] = function; + args[1] = object1; + args[2] = object2; + args[3] = object3; + args[4] = object4; + + return calln_trapping_problems (Qerror, warning_string, flags, 0, 5, + args); +} + +Lisp_Object +call5_trapping_problems (const CIbyte *warning_string, Lisp_Object function, + Lisp_Object object1, Lisp_Object object2, + Lisp_Object object3, Lisp_Object object4, + Lisp_Object object5, int flags) +{ + Lisp_Object args[6]; + + args[0] = function; + args[1] = object1; + args[2] = object2; + args[3] = object3; + args[4] = object4; + args[5] = object5; + + return calln_trapping_problems (Qerror, warning_string, flags, 0, 6, + args); +} + +struct eval_in_buffer_trapping_problems +{ + struct buffer *buf; + Lisp_Object form; +}; + static Lisp_Object -catch_them_squirmers_call1 (Lisp_Object cons) +eval_in_buffer_trapping_problems_1 (void *arg) { - /* This function can GC */ - return call1 (XCAR (cons), XCDR (cons)); + struct eval_in_buffer_trapping_problems *p = + (struct eval_in_buffer_trapping_problems *) arg; + + return eval_in_buffer (p->buf, p->form); +} + +/* #### fix these functions to follow the calling convention of + call_trapping_problems! */ + +Lisp_Object +eval_in_buffer_trapping_problems (const CIbyte *warning_string, + struct buffer *buf, Lisp_Object form, + int flags) +{ + struct eval_in_buffer_trapping_problems p; + Lisp_Object buffer = wrap_buffer (buf); + struct gcpro gcpro1, gcpro2; + + GCPRO2 (buffer, form); + p.buf = buf; + p.form = form; + RETURN_UNGCPRO (call_trapping_problems (Qerror, warning_string, flags, 0, + eval_in_buffer_trapping_problems_1, + &p)); +} + +Lisp_Object +run_hook_trapping_problems (const CIbyte *warning_string, + Lisp_Object hook_symbol, + int flags) +{ + return run_hook_with_args_trapping_problems (warning_string, 1, &hook_symbol, + RUN_HOOKS_TO_COMPLETION, + flags); } static Lisp_Object -catch_them_squirmers_call2 (Lisp_Object cons) +safe_run_hook_trapping_problems_1 (void *puta) { - /* This function can GC */ - return call2 (XCAR (cons), XCAR (XCDR (cons)), XCAR (XCDR (XCDR (cons)))); + Lisp_Object hook = VOID_TO_LISP (puta); + + run_hook (hook); + return Qnil; } +/* Same as run_hook_trapping_problems() but also set the hook to nil + if an error occurs (but not a quit). */ + Lisp_Object -call1_trapping_errors (const CIntbyte *warning_string, Lisp_Object function, - Lisp_Object object) +safe_run_hook_trapping_problems (const CIbyte *warning_string, + Lisp_Object hook_symbol, + int flags) { - int speccount = specpdl_depth(); Lisp_Object tem; - Lisp_Object cons = Qnil; - Lisp_Object opaque = Qnil; - struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; + struct gcpro gcpro1, gcpro2; + struct call_trapping_problems_result prob; - if (SYMBOLP (function)) - { - tem = XSYMBOL (function)->function; - if (NILP (tem) || UNBOUNDP (tem)) - return Qnil; - } + if (!initialized || preparing_for_armageddon) + return Qnil; + tem = find_symbol_value (hook_symbol); + if (NILP (tem) || UNBOUNDP (tem)) + return Qnil; - GCPRO4 (cons, opaque, function, object); + GCPRO2 (hook_symbol, tem); + tem = call_trapping_problems (Qerror, warning_string, flags, + &prob, + safe_run_hook_trapping_problems_1, + LISP_TO_VOID (hook_symbol)); + if (prob.caught_throw || (prob.caught_error && !EQ (prob.error_conditions, + Qquit))) + Fset (hook_symbol, Qnil); + RETURN_UNGCPRO (tem); +} - specbind (Qinhibit_quit, Qt); - /* begin_gc_forbidden(); Currently no reason to do this; */ +struct run_hook_with_args_in_buffer_trapping_problems +{ + struct buffer *buf; + int nargs; + Lisp_Object *args; + enum run_hooks_condition cond; +}; - cons = noseeum_cons (function, object); - opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); - /* Qerror not Qt, so you can get a backtrace */ - tem = condition_case_1 (Qerror, - catch_them_squirmers_call1, cons, - caught_a_squirmer, opaque); - if (OPAQUE_PTRP (opaque)) - free_opaque_ptr (opaque); - free_cons (XCONS (cons)); - UNGCPRO; +static Lisp_Object +run_hook_with_args_in_buffer_trapping_problems_1 (void *puta) +{ + struct run_hook_with_args_in_buffer_trapping_problems *porra = + (struct run_hook_with_args_in_buffer_trapping_problems *) puta; - return unbind_to_1 (speccount, tem); + return run_hook_with_args_in_buffer (porra->buf, porra->nargs, porra->args, + porra->cond); } +/* #### fix these functions to follow the calling convention of + call_trapping_problems! */ + Lisp_Object -call2_trapping_errors (const CIntbyte *warning_string, Lisp_Object function, - Lisp_Object object1, Lisp_Object object2) +run_hook_with_args_in_buffer_trapping_problems (const CIbyte *warning_string, + struct buffer *buf, int nargs, + Lisp_Object *args, + enum run_hooks_condition cond, + int flags) { - int speccount = specpdl_depth(); - Lisp_Object tem; - Lisp_Object cons = Qnil; - Lisp_Object opaque = Qnil; - struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; + Lisp_Object sym, val, ret; + struct run_hook_with_args_in_buffer_trapping_problems diversity_and_distrust; + struct gcpro gcpro1; - if (SYMBOLP (function)) - { - tem = XSYMBOL (function)->function; - if (NILP (tem) || UNBOUNDP (tem)) - return Qnil; - } + if (!initialized || preparing_for_armageddon) + /* We need to bail out of here pronto. */ + return Qnil; - GCPRO5 (cons, opaque, function, object1, object2); - specbind (Qinhibit_quit, Qt); - /* begin_gc_forbidden(); Currently no reason to do this; */ - - cons = list3 (function, object1, object2); - opaque = (warning_string ? make_opaque_ptr ((void *)warning_string) : Qnil); - /* Qerror not Qt, so you can get a backtrace */ - tem = condition_case_1 (Qerror, - catch_them_squirmers_call2, cons, - caught_a_squirmer, opaque); - if (OPAQUE_PTRP (opaque)) - free_opaque_ptr (opaque); - free_list (cons); - UNGCPRO; + GCPRO1_ARRAY (args, nargs); + + sym = args[0]; + val = symbol_value_in_buffer (sym, wrap_buffer (buf)); + ret = (cond == RUN_HOOKS_UNTIL_FAILURE ? Qt : Qnil); + + if (UNBOUNDP (val) || NILP (val)) + RETURN_UNGCPRO (ret); + + diversity_and_distrust.buf = buf; + diversity_and_distrust.nargs = nargs; + diversity_and_distrust.args = args; + diversity_and_distrust.cond = cond; + + RETURN_UNGCPRO + (call_trapping_problems + (Qerror, warning_string, + flags, 0, + run_hook_with_args_in_buffer_trapping_problems_1, + &diversity_and_distrust)); +} + +Lisp_Object +run_hook_with_args_trapping_problems (const CIbyte *warning_string, + int nargs, + Lisp_Object *args, + enum run_hooks_condition cond, + int flags) +{ + return run_hook_with_args_in_buffer_trapping_problems + (warning_string, current_buffer, nargs, args, cond, flags); +} + +Lisp_Object +va_run_hook_with_args_trapping_problems (const CIbyte *warning_string, + Lisp_Object hook_var, + int nargs, ...) +{ + /* This function can GC */ + struct gcpro gcpro1; + int i; + va_list vargs; + Lisp_Object *funcall_args = alloca_array (Lisp_Object, 1 + nargs); + int flags; + + va_start (vargs, nargs); + funcall_args[0] = hook_var; + for (i = 0; i < nargs; i++) + funcall_args[i + 1] = va_arg (vargs, Lisp_Object); + flags = va_arg (vargs, int); + va_end (vargs); - return unbind_to_1 (speccount, tem); + GCPRO1_ARRAY (funcall_args, nargs + 1); + RETURN_UNGCPRO (run_hook_with_args_in_buffer_trapping_problems + (warning_string, current_buffer, nargs + 1, funcall_args, + RUN_HOOKS_TO_COMPLETION, flags)); } +Lisp_Object +va_run_hook_with_args_in_buffer_trapping_problems (const CIbyte * + warning_string, + struct buffer *buf, + Lisp_Object hook_var, + int nargs, ...) +{ + /* This function can GC */ + struct gcpro gcpro1; + int i; + va_list vargs; + Lisp_Object *funcall_args = alloca_array (Lisp_Object, 1 + nargs); + int flags; + + va_start (vargs, nargs); + funcall_args[0] = hook_var; + for (i = 0; i < nargs; i++) + funcall_args[i + 1] = va_arg (vargs, Lisp_Object); + flags = va_arg (vargs, int); + va_end (vargs); + + GCPRO1_ARRAY (funcall_args, nargs + 1); + RETURN_UNGCPRO (run_hook_with_args_in_buffer_trapping_problems + (warning_string, buf, nargs + 1, funcall_args, + RUN_HOOKS_TO_COMPLETION, flags)); +} + +static void +run_post_gc_hook() +{ + Lisp_Object args[2]; + + args[0] = Qpost_gc_hook; + args[1] = Fcons (Fcons (Qfinalize_list, zap_finalize_list()), Qnil); + + run_hook_with_args_trapping_problems + ("Error in post-gc-hook", + 2, args, + RUN_HOOKS_TO_COMPLETION, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); +} /************************************************************************/ /* The special binding stack */ @@ -4772,6 +5570,7 @@ } XREALLOC_ARRAY (specpdl, struct specbinding, specpdl_size); specpdl_ptr = specpdl + specpdl_depth(); + check_specbind_stack_sanity (); } @@ -4781,9 +5580,9 @@ { Lisp_Object current = Fcurrent_buffer (); Lisp_Object symbol = specpdl_ptr->symbol; - Lisp_Cons *victim = XCONS (ovalue); - Lisp_Object buf = get_buffer (victim->car, 0); - ovalue = victim->cdr; + Lisp_Object victim = ovalue; + Lisp_Object buf = get_buffer (XCAR (victim), 0); + ovalue = XCDR (victim); free_cons (victim); @@ -4851,6 +5650,8 @@ specbind (Lisp_Object symbol, Lisp_Object value) { SPECBIND (symbol, value); + + check_specbind_stack_sanity (); } void @@ -4883,6 +5684,8 @@ specpdl_depth_counter++; Fset (symbol, value); + + check_specbind_stack_sanity (); } /* Record an unwind-protect -- FUNCTION will be called with ARG no matter @@ -4902,6 +5705,7 @@ specpdl_ptr->old_value = arg; specpdl_ptr++; specpdl_depth_counter++; + check_specbind_stack_sanity (); return specpdl_depth_counter - 1; } @@ -4912,13 +5716,13 @@ Lisp_Object *addr = (Lisp_Object *) get_opaque_ptr (opaque); *addr = XCDR (cons); free_opaque_ptr (opaque); - free_cons (XCONS (cons)); + free_cons (cons); return Qnil; } /* Establish an unwind-protect which will restore the Lisp_Object pointed to by ADDR with the value VAL. */ -int +static int record_unwind_protect_restoring_lisp_object (Lisp_Object *addr, Lisp_Object val) { @@ -4959,14 +5763,14 @@ *addr = val; free_opaque_ptr (opaque); - free_cons (XCONS (cons)); + free_cons (cons); return Qnil; } /* Establish an unwind-protect which will restore the int pointed to by ADDR with the value VAL. This function works correctly with all ints, even those that don't fit into a Lisp integer. */ -int +static int record_unwind_protect_restoring_int (int *addr, int val) { Lisp_Object opaque = make_opaque_ptr (addr); @@ -5033,6 +5837,7 @@ unbind_to_1 (int count, Lisp_Object value) { UNBIND_TO_GCPRO (count, value); + check_specbind_stack_sanity (); return value; } @@ -5092,6 +5897,7 @@ #endif } Vquit_flag = oquit; + check_specbind_stack_sanity (); } @@ -5172,19 +5978,18 @@ || specpdl[speccount - 1].func == specbind_unwind_local || specpdl[speccount - 1].func == specbind_unwind_wasnt_local) { - write_c_string (((!printing_bindings) ? " # bind (" : " "), - stream); + write_c_string (stream, !printing_bindings ? " # bind (" : " "); Fprin1 (specpdl[speccount - 1].symbol, stream); printing_bindings = 1; } else { - if (printing_bindings) write_c_string (")\n", stream); - write_c_string (" # (unwind-protect ...)\n", stream); + if (printing_bindings) write_c_string (stream, ")\n"); + write_c_string (stream, " # (unwind-protect ...)\n"); printing_bindings = 0; } } - if (printing_bindings) write_c_string (")\n", stream); + if (printing_bindings) write_c_string (stream, ")\n"); } DEFUN ("backtrace", Fbacktrace, 0, 2, "", /* @@ -5216,7 +6021,10 @@ entering_debugger = 0; - Vprint_level = make_int (3); + if (!NILP (detailed)) + Vprint_level = make_int (50); + else + Vprint_level = make_int (3); print_readably = 0; print_escape_newlines = 1; @@ -5242,15 +6050,15 @@ speccount = catches->pdlcount; if (catchpdl == speccount) { - write_c_string (" # (catch ", stream); + write_c_string (stream, " # (catch "); Fprin1 (catches->tag, stream); - write_c_string (" ...)\n", stream); + write_c_string (stream, " ...)\n"); } else { - write_c_string (" # (condition-case ... . ", stream); + write_c_string (stream, " # (condition-case ... . "); Fprin1 (Fcdr (Fcar (catches->tag)), stream); - write_c_string (")\n", stream); + write_c_string (stream, ")\n"); } catches = catches->next; } @@ -5263,18 +6071,17 @@ backtrace_specials (speccount, backlist->pdlcount, stream); speccount = backlist->pdlcount; } - write_c_string (((backlist->debug_on_exit) ? "* " : " "), - stream); + write_c_string (stream, backlist->debug_on_exit ? "* " : " "); if (backlist->nargs == UNEVALLED) { Fprin1 (Fcons (*backlist->function, *backlist->args), stream); - write_c_string ("\n", stream); /* from FSFmacs 19.30 */ + write_c_string (stream, "\n"); /* from FSFmacs 19.30 */ } else { Lisp_Object tem = *backlist->function; Fprin1 (tem, stream); /* This can QUIT */ - write_c_string ("(", stream); + write_c_string (stream, "("); if (backlist->nargs == MANY) { int i; @@ -5286,7 +6093,7 @@ !NILP (tail); tail = Fcdr (tail), i++) { - if (i != 0) write_c_string (" ", stream); + if (i != 0) write_c_string (stream, " "); Fprin1 (Fcar (tail), stream); } NUNGCPRO; @@ -5296,15 +6103,16 @@ int i; for (i = 0; i < backlist->nargs; i++) { - if (!i && EQ(tem, Qbyte_code)) { - write_c_string("\"...\"", stream); - continue; - } - if (i != 0) write_c_string (" ", stream); + if (!i && EQ (tem, Qbyte_code)) + { + write_c_string (stream, "\"...\""); + continue; + } + if (i != 0) write_c_string (stream, " "); Fprin1 (backlist->args[i], stream); } } - write_c_string (")\n", stream); + write_c_string (stream, ")\n"); } backlist = backlist->next; } @@ -5389,7 +6197,7 @@ automatically be called when it is safe to do so. */ void -warn_when_safe (Lisp_Object class, Lisp_Object level, const CIntbyte *fmt, ...) +warn_when_safe (Lisp_Object class, Lisp_Object level, const CIbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -5439,6 +6247,7 @@ DEFSYMBOL (Qvalues); DEFSYMBOL (Qdisplay_warning); DEFSYMBOL (Qrun_hooks); + DEFSYMBOL (Qfinalize_list); DEFSYMBOL (Qif); DEFSUBR (For); @@ -5488,7 +6297,7 @@ } void -init_eval_early (void) +init_eval_semi_early (void) { specpdl_ptr = specpdl; specpdl_depth_counter = 0; @@ -5506,9 +6315,6 @@ { preparing_for_armageddon = 0; in_warnings = 0; - Qunbound_suspended_errors_tag = make_opaque_ptr (&Qunbound_suspended_errors_tag); - staticpro_nodump (&Qunbound_suspended_errors_tag); - specpdl_size = 50; specpdl = xnew_array (struct specbinding, specpdl_size); /* XEmacs change: increase these values. */ @@ -5537,8 +6343,14 @@ */ ); DEFVAR_LISP ("quit-flag", &Vquit_flag /* -Non-nil causes `eval' to abort, unless `inhibit-quit' is non-nil. -Typing C-G sets `quit-flag' non-nil, regardless of `inhibit-quit'. +t causes running Lisp code to abort, unless `inhibit-quit' is non-nil. +`critical' causes running Lisp code to abort regardless of `inhibit-quit'. +Normally, you do not need to set this value yourself. It is set to +t each time a Control-G is detected, and to `critical' each time a +Shift-Control-G is detected. The XEmacs core C code is littered with +calls to the QUIT; macro, which check the values of `quit-flag' and +`inhibit-quit' and abort (or more accurately, call (signal 'quit)) if +it's correct to do so. */ ); Vquit_flag = Qnil; @@ -5547,9 +6359,11 @@ Note that `quit-flag' will still be set by typing C-g, so a quit will be signalled as soon as `inhibit-quit' is nil. To prevent this happening, set `quit-flag' to nil -before making `inhibit-quit' nil. The value of `inhibit-quit' is -ignored if a critical quit is requested by typing control-shift-G in -an X frame. +before making `inhibit-quit' nil. + +The value of `inhibit-quit' is ignored if a critical quit is +requested by typing control-shift-G in a window-system frame; +this is explained in more detail in `quit-flag'. */ ); Vinhibit_quit = Qnil; @@ -5634,6 +6448,9 @@ */ ); Vdebugger = Qnil; + staticpro (&Vcatch_everything_tag); + Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0); + staticpro (&Vpending_warnings); Vpending_warnings = Qnil; dump_add_root_object (&Vpending_warnings_tail); @@ -5647,12 +6464,11 @@ staticpro (&Vcondition_handlers); - staticpro (&Vcurrent_warning_class); - Vcurrent_warning_class = Qnil; + staticpro (&Vdeletable_permanent_display_objects); + Vdeletable_permanent_display_objects = Qnil; - staticpro (&Vcurrent_warning_level); - Vcurrent_warning_level = Qnil; + staticpro (&Vmodifiable_buffers); + Vmodifiable_buffers = Qnil; - staticpro (&Vcurrent_error_state); - Vcurrent_error_state = Qnil; /* errors as normal */ + inhibit_flags = 0; } diff --text -u 'xemacs-21.5.6/src/event-Xt.c' 'xemacs-21.5.7/src/event-Xt.c' Index: ././src/event-Xt.c --- ././src/event-Xt.c Mon Apr 1 12:58:32 2002 +++ ././src/event-Xt.c Fri Jun 21 06:18:28 2002 @@ -28,11 +28,11 @@ #include "blocktype.h" #include "charset.h" #include "console.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "events.h" #include "file-coding.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "lstream.h" #include "process.h" @@ -41,7 +41,7 @@ #include "console-tty.h" -#include "console-x.h" +#include "console-x-impl.h" #include "objects-x.h" #include "../lwlib/lwlib.h" #include "EmacsFrame.h" @@ -68,6 +68,7 @@ #endif static void handle_focus_event_1 (struct frame *f, int in_p); +static void handle_focus_event_2 (Window w, struct frame *f, int in_p); static struct event_stream *Xt_event_stream; @@ -181,7 +182,7 @@ #ifdef MULE Lisp_Object charset = Qzero; #define USE_CHARSET(var,cs) \ - ((var) = CHARSET_BY_LEADING_BYTE (LEADING_BYTE_##cs)) + ((var) = charset_by_leading_byte (LEADING_BYTE_##cs)) #else #define USE_CHARSET(var,lb) #endif /* MULE */ @@ -286,7 +287,7 @@ return Qnil; #ifdef MULE - return make_char (MAKE_CHAR (charset, code, 0)); + return make_char (make_ichar (charset, code, 0)); #else return make_char (code + 0x80); #endif @@ -845,7 +846,7 @@ Of course, we DO worry about it, so we need a special translation. */ void -emacs_Xt_mapping_action (Widget w, XEvent* event) +emacs_Xt_mapping_action (Widget w, XEvent *event) { struct device *d = get_device_from_display (event->xany.display); @@ -1049,7 +1050,7 @@ { /* Generate multiple emacs events */ struct device *d = get_device_from_display (event->display); - Emchar ch; + Ichar ch; Lisp_Object instream, fb_instream; Lstream *istr; struct gcpro gcpro1, gcpro2; @@ -1064,7 +1065,7 @@ istr = XLSTREAM (instream); GCPRO2 (instream, fb_instream); - while ((ch = Lstream_get_emchar (istr)) != EOF) + while ((ch = Lstream_get_ichar (istr)) != EOF) { Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); Lisp_Event *ev = XEVENT (emacs_event); @@ -1083,7 +1084,7 @@ } case XLookupNone: return Qnil; case XBufferOverflow: - bufptr = (char *) alloca (len+1); + bufptr = (char *) ALLOCA (len+1); bufsiz = len+1; goto Lookup_String; } @@ -1401,7 +1402,7 @@ { len = strlen ((char*)data); hurl = dnd_url_hexify_string ((char *)data, "file:"); - l_item = make_string ((Intbyte *)hurl, strlen (hurl)); + l_item = make_string ((Ibyte *)hurl, strlen (hurl)); l_dndlist = Fcons (l_item, l_dndlist); data += len + 1; xfree (hurl); @@ -1411,8 +1412,8 @@ break; case DndText: l_type = Qdragdrop_MIME; - l_dndlist = list1 ( list3 ( list1 ( make_string ((Intbyte *)"text/plain", 10) ), - make_string ((Intbyte *)"8bit", 4), + l_dndlist = list1 ( list3 ( list1 ( make_string ((Ibyte *)"text/plain", 10) ), + make_string ((Ibyte *)"8bit", 4), make_ext_string ((Extbyte *)data, strlen((char *)data), Qctext) ) ); @@ -1437,7 +1438,7 @@ { char *hurl = dnd_url_hexify_string ((char *) data, "file:"); - l_dndlist = list1 ( make_string ((Intbyte *)hurl, + l_dndlist = list1 ( make_string ((Ibyte *)hurl, strlen (hurl)) ); l_type = Qdragdrop_URL; @@ -1453,8 +1454,8 @@ l_type = Qdragdrop_URL; break; default: /* Unknown, RawData and any other type */ - l_dndlist = list1 ( list3 ( list1 ( make_string ((Intbyte *)"application/octet-stream", 24) ), - make_string ((Intbyte *)"8bit", 4), + l_dndlist = list1 ( list3 ( list1 ( make_string ((Ibyte *)"application/octet-stream", 24) ), + make_string ((Ibyte *)"8bit", 4), make_ext_string ((Extbyte *)data, size, Qbinary) ) ); @@ -1536,6 +1537,16 @@ static void handle_focus_event_1 (struct frame *f, int in_p) { + handle_focus_event_2 (XtWindow (FRAME_X_TEXT_WIDGET (f)), f, in_p); +} + +static void +handle_focus_event_2 (Window win, struct frame *f, int in_p) +{ + /* Although this treats focus differently for all widgets (including + the frame) it seems to work ok. */ + Widget needs_it = XtWindowToWidget (FRAME_X_DISPLAY (f), win); + #if XtSpecificationRelease > 5 widget_with_focus = XtGetKeyboardFocusWidget (FRAME_X_TEXT_WIDGET (f)); #endif @@ -1566,14 +1577,19 @@ click in the frame. Why is this? */ if (in_p #if XtSpecificationRelease > 5 - && FRAME_X_TEXT_WIDGET (f) != widget_with_focus + && needs_it != widget_with_focus #endif ) { - lw_set_keyboard_focus (FRAME_X_SHELL_WIDGET (f), - FRAME_X_TEXT_WIDGET (f)); + lw_set_keyboard_focus (FRAME_X_SHELL_WIDGET (f), needs_it); } + /* If we are focusing on a native widget then record and exit. */ + if (needs_it != FRAME_X_TEXT_WIDGET (f)) { + widget_with_focus = needs_it; + return; + } + /* We have the focus now. See comment in emacs_Xt_handle_widget_losing_focus (). */ if (in_p) @@ -1595,16 +1611,33 @@ } } +/* Create a synthetic X focus event. */ +void +enqueue_focus_event (Widget wants_it, Lisp_Object frame, int in_p) +{ + Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); + Lisp_Event *ev = XEVENT (emacs_event); + XEvent *x_event = &ev->event.magic.underlying_x_event; + + x_event->type = in_p ? FocusIn : FocusOut; + x_event->xfocus.window = XtWindow (wants_it); + + ev->channel = frame; + ev->event_type = magic_event; + + enqueue_Xt_dispatch_event (emacs_event); +} + /* The idea here is that when a widget glyph gets unmapped we don't want the focus to stay with it if it has focus - because it may - well just get deleted next andthen we have lost the focus until the + well just get deleted next and then we have lost the focus until the user does something. So handle_focus_event_1 records the widget with keyboard focus when FocusOut is processed, and then, when a widget gets unmapped, it calls this function to restore focus if appropriate. */ -void emacs_Xt_handle_widget_losing_focus (struct frame* f, Widget losing_widget); +void emacs_Xt_handle_widget_losing_focus (struct frame *f, Widget losing_widget); void -emacs_Xt_handle_widget_losing_focus (struct frame* f, Widget losing_widget) +emacs_Xt_handle_widget_losing_focus (struct frame *f, Widget losing_widget) { if (losing_widget == widget_with_focus) { @@ -1647,10 +1680,12 @@ if (!FRAME_VISIBLE_P (f) && is_visible) { FRAME_VISIBLE_P (f) = is_visible; - /* This improves the double flicker when uniconifying a frame + /* [[ This improves the double flicker when uniconifying a frame some. A lot of it is not showing a buffer which has changed while the frame was iconified. To fix it further requires - the good 'ol double redisplay structure. */ + the good 'ol double redisplay structure. ]] -- comment is + invalid, obviously predates 19.12, when the double redisplay + structure (i.e. current + desired) was put back in. --ben */ MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); va_run_hook_with_args (Qmap_frame_hook, 1, frame); } @@ -1845,11 +1880,11 @@ does the wrong thing. */ static void -emacs_Xt_force_event_pending (struct frame* f) +emacs_Xt_force_event_pending (struct frame *f) { XEvent event; - Display* dpy = DEVICE_X_DISPLAY (XDEVICE (FRAME_DEVICE (f))); + Display *dpy = DEVICE_X_DISPLAY (XDEVICE (FRAME_DEVICE (f))); event.xclient.type = ClientMessage; event.xclient.display = dpy; event.xclient.message_type = XInternAtom (dpy, "BumpQueue", False); @@ -1868,8 +1903,8 @@ { Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); if (CONSOLE_X_P (XCONSOLE (console))) - write_c_string (x_event_name (event->event.magic.underlying_x_event.type), - pstream); + write_c_string + (pstream, x_event_name (event->event.magic.underlying_x_event.type)); } static int @@ -1974,7 +2009,7 @@ if (FRAME_X_EXTERNAL_WINDOW_P (f)) break; #endif - handle_focus_event_1 (f, event->type == FocusIn); + handle_focus_event_2 (event->xfocus.window, f, event->type == FocusIn); break; case ClientMessage: @@ -2309,39 +2344,62 @@ } static void -emacs_Xt_select_process (Lisp_Process *p) +emacs_Xt_select_process (Lisp_Process *process, int doin, int doerr) { - Lisp_Object process; - int infd = event_stream_unixoid_select_process (p); + Lisp_Object proc; + int infd, errfd; + + event_stream_unixoid_select_process (process, doin, doerr, &infd, &errfd); - process = wrap_process (p); - select_filedesc (infd, process); + proc = wrap_process (process); + if (doin) + select_filedesc (infd, proc); + if (doerr) + select_filedesc (errfd, proc); } static void -emacs_Xt_unselect_process (Lisp_Process *p) +emacs_Xt_unselect_process (Lisp_Process *process, int doin, int doerr) { - int infd = event_stream_unixoid_unselect_process (p); + int infd, errfd; - unselect_filedesc (infd); + event_stream_unixoid_unselect_process (process, doin, doerr, &infd, &errfd); + + if (doin) + unselect_filedesc (infd); + if (doerr) + unselect_filedesc (errfd); } -static USID -emacs_Xt_create_stream_pair (void* inhandle, void* outhandle, - Lisp_Object* instream, Lisp_Object* outstream, int flags) -{ - USID u = event_stream_unixoid_create_stream_pair - (inhandle, outhandle, instream, outstream, flags); - if (u != USID_ERROR) - u = USID_DONTHASH; - return u; +static void +emacs_Xt_create_io_streams (void *inhandle, void *outhandle, + void *errhandle, Lisp_Object *instream, + Lisp_Object *outstream, + Lisp_Object *errstream, + USID *in_usid, + USID *err_usid, + int flags) +{ + event_stream_unixoid_create_io_streams + (inhandle, outhandle, errhandle, instream, outstream, + errstream, in_usid, err_usid, flags); + if (*in_usid != USID_ERROR) + *in_usid = USID_DONTHASH; + if (*err_usid != USID_ERROR) + *err_usid = USID_DONTHASH; } -static USID -emacs_Xt_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream) +static void +emacs_Xt_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID *in_usid, + USID *err_usid) { - event_stream_unixoid_delete_stream_pair (instream, outstream); - return USID_DONTHASH; + event_stream_unixoid_delete_io_streams + (instream, outstream, errstream, in_usid, err_usid); + *in_usid = USID_DONTHASH; + *err_usid = USID_DONTHASH; } /* This is called from GC when a process object is about to be freed. @@ -2352,12 +2410,13 @@ { #if 0 /* #### */ int i; - Lisp_Object instr, outstr; + Lisp_Object instr, outstr, errstr; - get_process_streams (p, &instr, &outstr); + get_process_streams (p, &instr, &outstr, &errstr); /* if it still has fds, then it hasn't been killed yet. */ assert (NILP(instr)); assert (NILP(outstr)); + assert (NILP(errstr)); /* Better not still be in the "with input" table; we know it's got no fds. */ for (i = 0; i < MAXDESC; i++) { @@ -2903,7 +2962,7 @@ SELECT_TYPE temp_mask; int infd = DEVICE_INFD (d); struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); - Emchar quit_char = CONSOLE_QUIT_CHAR (con); + Ichar quit_char = CONSOLE_QUIT_CHAR (con); FD_ZERO (&temp_mask); FD_SET (infd, &temp_mask); @@ -2911,7 +2970,7 @@ while (1) { Lisp_Object event; - Emchar the_char; + Ichar the_char; if (!poll_fds_for_input (temp_mask)) return; @@ -3273,7 +3332,7 @@ String *params, Cardinal *num_params) { - struct frame* f = + struct frame *f = x_any_widget_or_parent_to_frame (get_device_from_display (event->xany.display), w); XtSetKeyboardFocus (FRAME_X_SHELL_WIDGET (f), w); @@ -3330,8 +3389,8 @@ Xt_event_stream->select_process_cb = emacs_Xt_select_process; Xt_event_stream->unselect_process_cb = emacs_Xt_unselect_process; Xt_event_stream->quit_p_cb = emacs_Xt_quit_p; - Xt_event_stream->create_stream_pair_cb = emacs_Xt_create_stream_pair; - Xt_event_stream->delete_stream_pair_cb = emacs_Xt_delete_stream_pair; + Xt_event_stream->create_io_streams_cb = emacs_Xt_create_io_streams; + Xt_event_stream->delete_io_streams_cb = emacs_Xt_delete_io_streams; Xt_event_stream->current_event_timestamp_cb = emacs_Xt_current_event_timestamp; diff --text -u 'xemacs-21.5.6/src/event-gtk.c' 'xemacs-21.5.7/src/event-gtk.c' Index: ././src/event-gtk.c --- ././src/event-gtk.c Sun Mar 31 17:28:06 2002 +++ ././src/event-gtk.c Sun Jun 23 18:25:12 2002 @@ -28,28 +28,30 @@ #include #include "lisp.h" -#include "console-gtk.h" - #include "blocktype.h" #include "buffer.h" #include "commands.h" #include "console.h" -#include "console-tty.h" +#include "device-impl.h" +#include "elhash.h" #include "events.h" -#include "frame.h" -#include "objects-gtk.h" +#include "file-coding.h" +#include "frame-impl.h" +#include "lstream.h" #include "process.h" #include "redisplay.h" -#include "elhash.h" +#include "window.h" + +#include "console-tty.h" + +#include "console-gtk-impl.h" +#include "objects-gtk.h" #include "gtk-xemacs.h" #include "systime.h" #include "sysproc.h" /* for MAXDESC */ -#include "lstream.h" -#include "file-coding.h" - #include #ifdef HAVE_DRAGNDROP @@ -148,10 +150,12 @@ if (!FRAME_VISIBLE_P (f) && is_visible) { FRAME_VISIBLE_P (f) = is_visible; - /* This improves the double flicker when uniconifying a frame + /* [[ This improves the double flicker when uniconifying a frame some. A lot of it is not showing a buffer which has changed while the frame was iconified. To fix it further requires - the good 'ol double redisplay structure. */ + the good 'ol double redisplay structure. ]] -- comment is + invalid, obviously predates 19.12, when the double redisplay + structure (i.e. current + desired) was put back in. --ben */ MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); va_run_hook_with_args (Qmap_frame_hook, 1, frame); } @@ -192,9 +196,6 @@ static void handle_client_message (struct frame *f, GdkEvent *event) { - Lisp_Object frame = wrap_frame (f); - - /* The event-Xt code used to handle WM_DELETE_WINDOW here, but we handle that directly in frame-gtk.c */ @@ -210,8 +211,9 @@ { Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (emacs_event)); if (CONSOLE_GTK_P (XCONSOLE (console))) - write_c_string (gtk_event_name (emacs_event->event.magic.underlying_gdk_event.type), - pstream); + write_c_string + (pstream, + gtk_event_name (emacs_event->event.magic.underlying_gdk_event.type)); } static int @@ -445,7 +447,7 @@ if (event->length != 1) { /* Generate multiple emacs events */ - Emchar ch; + Ichar ch; Lisp_Object instream, fb_instream; Lstream *istr; struct gcpro gcpro1, gcpro2; @@ -462,7 +464,7 @@ istr = XLSTREAM (instream); GCPRO2 (instream, fb_instream); - while ((ch = Lstream_get_emchar (istr)) != EOF) + while ((ch = Lstream_get_ichar (istr)) != EOF) { Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); struct Lisp_Event *ev = XEVENT (emacs_event); @@ -496,10 +498,11 @@ static int timeout_id_tick; -struct GTK_timeout { - int id; - guint timeout_id; - struct GTK_timeout *next; +struct GTK_timeout +{ + int id; + guint timeout_id; + struct GTK_timeout *next; } *pending_timeouts, *completed_timeouts; struct GTK_timeout_blocktype @@ -526,7 +529,7 @@ /* Add this one to the list of completed timeouts */ timeout->next = completed_timeouts; completed_timeouts = timeout; - return(FALSE); + return FALSE; } static int @@ -685,15 +688,11 @@ } filedesc_with_input[closure->fd] = closure->what; if (PROCESSP (closure->what)) - { - /* Don't increment this if the current process is already marked - * as having input. */ - process_events_occurred++; - } + /* Don't increment this if the current process is already marked + * as having input. */ + process_events_occurred++; else - { - tty_events_occurred++; - } + tty_events_occurred++; } } @@ -778,39 +777,62 @@ } static void -emacs_gtk_select_process (struct Lisp_Process *p) +emacs_gtk_select_process (Lisp_Process *process, int doin, int doerr) { - Lisp_Object process; - int infd = event_stream_unixoid_select_process (p); + Lisp_Object proc; + int infd, errfd; + + event_stream_unixoid_select_process (process, doin, doerr, &infd, &errfd); - process = wrap_process (p); - select_filedesc (infd, process); + proc = wrap_process (process); + if (doin) + select_filedesc (infd, proc); + if (doerr) + select_filedesc (errfd, proc); } static void -emacs_gtk_unselect_process (struct Lisp_Process *p) +emacs_gtk_unselect_process (Lisp_Process *process, int doin, int doerr) { - int infd = event_stream_unixoid_unselect_process (p); + int infd, errfd; - unselect_filedesc (infd); + event_stream_unixoid_unselect_process (process, doin, doerr, &infd, &errfd); + + if (doin) + unselect_filedesc (infd); + if (doerr) + unselect_filedesc (errfd); } -static USID -emacs_gtk_create_stream_pair (void* inhandle, void* outhandle, - Lisp_Object* instream, Lisp_Object* outstream, int flags) -{ - USID u = event_stream_unixoid_create_stream_pair - (inhandle, outhandle, instream, outstream, flags); - if (u != USID_ERROR) - u = USID_DONTHASH; - return u; +static void +emacs_gtk_create_io_streams (void *inhandle, void *outhandle, + void *errhandle, Lisp_Object *instream, + Lisp_Object *outstream, + Lisp_Object *errstream, + USID *in_usid, + USID *err_usid, + int flags) +{ + event_stream_unixoid_create_io_streams + (inhandle, outhandle, errhandle, instream, outstream, + errstream, in_usid, err_usid, flags); + if (*in_usid != USID_ERROR) + *in_usid = USID_DONTHASH; + if (*err_usid != USID_ERROR) + *err_usid = USID_DONTHASH; } -static USID -emacs_gtk_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream) +static void +emacs_gtk_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID *in_usid, + USID *err_usid) { - event_stream_unixoid_delete_stream_pair (instream, outstream); - return USID_DONTHASH; + event_stream_unixoid_delete_io_streams + (instream, outstream, errstream, in_usid, err_usid); + *in_usid = USID_DONTHASH; + *err_usid = USID_DONTHASH; } /* This is called from GC when a process object is about to be freed. @@ -988,7 +1010,7 @@ /* Random filename */ char *hurl = dnd_url_hexify_string (data->data, "file:"); - l_dndlist = list1 (make_string ((Intbyte *)hurl, strlen (hurl))); + l_dndlist = list1 (make_string ((Ibyte *)hurl, strlen (hurl))); l_type = Qdragdrop_URL; xfree (hurl); @@ -1186,9 +1208,11 @@ struct gtk_device *gd = NULL; gboolean accept_any_window = FALSE; + /* #### Under what circumstances can this happen???? Hunt out the code that + sets frame to 0 and fix it instead. */ if (!frame) { - frame = XFRAME (Fselected_frame (Vdefault_gtk_device)); + frame = XFRAME (Fselected_frame (get_default_device (Qgtk))); accept_any_window = TRUE; } @@ -1533,7 +1557,7 @@ SELECT_TYPE temp_mask; int infd = DEVICE_INFD (d); struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); - Emchar quit_char = CONSOLE_QUIT_CHAR (con); + Ichar quit_char = CONSOLE_QUIT_CHAR (con); FD_ZERO (&temp_mask); FD_SET (infd, &temp_mask); @@ -1541,7 +1565,7 @@ while (1) { Lisp_Object event; - Emchar the_char; + Ichar the_char; if (!poll_fds_for_input (temp_mask)) return; @@ -1759,8 +1783,8 @@ gtk_event_stream->select_process_cb = emacs_gtk_select_process; gtk_event_stream->unselect_process_cb = emacs_gtk_unselect_process; gtk_event_stream->quit_p_cb = emacs_gtk_quit_p; - gtk_event_stream->create_stream_pair_cb= emacs_gtk_create_stream_pair; - gtk_event_stream->delete_stream_pair_cb= emacs_gtk_delete_stream_pair; + gtk_event_stream->create_io_streams_cb= emacs_gtk_create_io_streams; + gtk_event_stream->delete_io_streams_cb= emacs_gtk_delete_io_streams; gtk_event_stream->force_event_pending = emacs_gtk_force_event_pending; the_GTK_timeout_blocktype = Blocktype_new (struct GTK_timeout_blocktype); diff --text -u 'xemacs-21.5.6/src/event-msw.c' 'xemacs-21.5.7/src/event-msw.c' Index: ././src/event-msw.c --- ././src/event-msw.c Sun Mar 31 17:28:07 2002 +++ ././src/event-msw.c Fri Jun 21 06:18:29 2002 @@ -39,11 +39,33 @@ #include #include "lisp.h" +#if defined (CYGWIN) && !defined (HAVE_MSG_SELECT) +#error We do not support non-select() versions (i.e. very old) of Cygwin. +#endif + +/* Acceptable are: + + WIN32_NATIVE and HAVE_WIN32_PROCESSES and nothing else + + CYGWIN and HAVE_MSG_SELECT and HAVE_UNIX_PROCESSES and nothing else +*/ +#ifdef WIN32_NATIVE +# if !(defined (HAVE_WIN32_PROCESSES) && !defined (HAVE_UNIX_PROCESSES) && !defined (HAVE_MSG_SELECT) && !defined (CYGWIN)) +# error Something is wrong with your process definitions for Windows native. +# endif +#elif defined (CYGWIN) +# if !(defined (HAVE_UNIX_PROCESSES) && defined (HAVE_MSG_SELECT) && !defined (HAVE_WIN32_PROCESSES) && !defined (WIN32_NATIVE)) +# error Something is wrong with your process definitions for Cygwin. +# endif +#else +# error Something is wrong -- you are neither Windows native (possibly MinGW) nor Cygwin. +#endif + #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "lstream.h" #include "process.h" @@ -51,8 +73,8 @@ #include "sysdep.h" #include "window.h" -#include "console-msw.h" -#include "objects-msw.h" +#include "console-msw-impl.h" +#include "objects-msw-impl.h" #ifdef HAVE_SCROLLBARS # include "scrollbar-msw.h" @@ -72,10 +94,8 @@ #include "systime.h" #include "syswait.h" -#ifdef HAVE_MSG_SELECT +#ifdef CYGWIN #include "console-tty.h" -#elif defined (CYGWIN) -typedef unsigned int SOCKET; #endif #ifdef HAVE_MENUBARS @@ -105,12 +125,25 @@ static struct event_stream *mswindows_event_stream; -#ifdef HAVE_MSG_SELECT +#ifdef CYGWIN + extern SELECT_TYPE input_wait_mask, non_fake_input_wait_mask; extern SELECT_TYPE process_only_mask, tty_only_mask; SELECT_TYPE zero_mask; extern int signal_event_pipe_initialized; int windows_fd; + +#else + +/* The number of things we can wait on */ +#define MAX_WAITABLE (MAXIMUM_WAIT_OBJECTS - 1) + +/* List of mswindows waitable handles. */ +static HANDLE mswindows_waitable_handles[MAX_WAITABLE]; + +/* Number of wait handles */ +static int mswindows_waitable_count = 0; + #endif /* @@ -122,17 +155,6 @@ static Lisp_Object mswindows_u_dispatch_event_queue, mswindows_u_dispatch_event_queue_tail; static Lisp_Object mswindows_s_dispatch_event_queue, mswindows_s_dispatch_event_queue_tail; -/* The number of things we can wait on */ -#define MAX_WAITABLE (MAXIMUM_WAIT_OBJECTS - 1) - -#ifndef HAVE_MSG_SELECT -/* List of mswindows waitable handles. */ -static HANDLE mswindows_waitable_handles[MAX_WAITABLE]; - -/* Number of wait handles */ -static int mswindows_waitable_count=0; -#endif /* HAVE_MSG_SELECT */ - /* Brush for painting widgets */ static HBRUSH widget_brush = 0; static LONG last_widget_brushed = 0; @@ -159,14 +181,17 @@ /* This is the event signaled by the event pump. See mswindows_pump_outstanding_events for comments */ -static Lisp_Object mswindows_error_caught_in_modal_loop; +static int mswindows_error_caught_in_modal_loop; static int mswindows_in_modal_loop; /* Count of wound timers */ static int mswindows_pending_timers_count; static DWORD mswindows_last_mouse_button_state; + +#ifndef CYGWIN /* Skips past slurp, shove, or winsock streams */ + /************************************************************************/ /* Pipe instream - reads process output */ /************************************************************************/ @@ -192,11 +217,11 @@ struct ntpipe_slurp_stream_shared_data { HANDLE hev_thread; /* Our thread blocks on this, signaled by caller */ - /* This is a manual-reset object. */ + /* This is a manual-reset object. */ HANDLE hev_caller; /* Caller blocks on this, and we signal it */ - /* This is a manual-reset object. */ + /* This is a manual-reset object. */ HANDLE hev_unsleep; /* Pipe read delay is canceled if this is set */ - /* This is a manual-reset object. */ + /* This is a manual-reset object. */ HANDLE hpipe; /* Pipe read end handle. */ LONG die_p; /* Thread must exit ASAP if non-zero */ BOOL eof_p : 1; /* Set when thread saw EOF */ @@ -467,6 +492,7 @@ LSTREAM_HAS_METHOD (ntpipe_slurp, reader); LSTREAM_HAS_METHOD (ntpipe_slurp, closer); } + /************************************************************************/ /* Pipe outstream - writes process input */ @@ -481,7 +507,7 @@ { LPARAM user_data; /* Any user data stored in the stream object */ HANDLE hev_thread; /* Our thread blocks on this, signaled by caller */ - /* This is an auto-reset object. */ + /* This is an auto-reset object. */ HANDLE hpipe; /* Pipe write end handle. */ HANDLE hthread; /* Reader thread handle. */ char buffer[MAX_SHOVE_BUFFER_SIZE]; /* Buffer being written */ @@ -494,7 +520,6 @@ DEFINE_LSTREAM_IMPLEMENTATION ("ntpipe-output", ntpipe_shove); -#ifndef HAVE_MSG_SELECT static DWORD WINAPI shove_thread (LPVOID vparam) { @@ -579,7 +604,6 @@ struct ntpipe_shove_stream *s = NTPIPE_SHOVE_STREAM_DATA(stream); return s->user_data; } -#endif static Bytecount ntpipe_shove_writer (Lstream *stream, const unsigned char *data, @@ -656,7 +680,6 @@ /************************************************************************/ /* Winsock I/O stream */ /************************************************************************/ -#if defined (HAVE_SOCKETS) && !defined(HAVE_MSG_SELECT) #define WINSOCK_READ_BUFFER_SIZE 1024 @@ -883,7 +906,7 @@ LSTREAM_HAS_METHOD (winsock, closer); LSTREAM_HAS_METHOD (winsock, was_blocked_p); } -#endif /* defined (HAVE_SOCKETS) */ +#endif /* ! CYGWIN */ /************************************************************************/ /* Dispatch queue management */ @@ -1104,7 +1127,7 @@ return Qnil; } -#ifndef HAVE_MSG_SELECT +#ifndef CYGWIN /************************************************************************/ /* Waitable handles manipulation */ /************************************************************************/ @@ -1140,7 +1163,8 @@ mswindows_waitable_handles [ix] = mswindows_waitable_handles [--mswindows_waitable_count]; } -#endif /* HAVE_MSG_SELECT */ + +#endif /* CYGWIN */ /* * Given a lisp process pointer remove the corresponding process handle @@ -1152,9 +1176,9 @@ void mswindows_unwait_process (Lisp_Process *p) { -#ifndef HAVE_MSG_SELECT +#ifndef CYGWIN remove_waitable_handle (get_nt_process_handle (p)); -#endif /* HAVE_MSG_SELECT */ +#endif /* CYGWIN */ } @@ -1177,24 +1201,38 @@ return !ascii_strcasecmp (class_name_buf, XEMACS_CLASS); } +struct mswindows_protect_modal_loop +{ + Lisp_Object (*bfun) (Lisp_Object barg); + Lisp_Object barg; +}; + static Lisp_Object -mswindows_modal_loop_error_handler (Lisp_Object cons_sig_data, - Lisp_Object u_n_u_s_e_d) +mswindows_protect_modal_loop_1 (void *gack) { - mswindows_error_caught_in_modal_loop = cons_sig_data; - return Qunbound; + struct mswindows_protect_modal_loop *gata = + (struct mswindows_protect_modal_loop *) gack; + + return (gata->bfun) (gata->barg); } Lisp_Object -mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg), - Lisp_Object barg) +mswindows_protect_modal_loop (const char *error_string, + Lisp_Object (*bfun) (Lisp_Object barg), + Lisp_Object barg, int flags) { Lisp_Object tmp; + struct mswindows_protect_modal_loop bluh; + + bluh.bfun = bfun; + bluh.barg = barg; ++mswindows_in_modal_loop; - tmp = condition_case_1 (Qt, - bfun, barg, - mswindows_modal_loop_error_handler, Qnil); + tmp = call_trapping_problems (Qevent, error_string, + flags, 0, + mswindows_protect_modal_loop_1, &bluh); + if (UNBOUNDP (tmp)) + mswindows_error_caught_in_modal_loop = 1; --mswindows_in_modal_loop; return tmp; @@ -1203,15 +1241,7 @@ void mswindows_unmodalize_signal_maybe (void) { - if (!NILP (mswindows_error_caught_in_modal_loop)) - { - /* Got an error while messages were pumped while - in window procedure - have to resignal */ - Lisp_Object sym = XCAR (mswindows_error_caught_in_modal_loop); - Lisp_Object data = XCDR (mswindows_error_caught_in_modal_loop); - mswindows_error_caught_in_modal_loop = Qnil; - Fsignal (sym, data); - } + mswindows_error_caught_in_modal_loop = 0; } /* @@ -1259,26 +1289,23 @@ * Return value is Qt if no errors was trapped, or Qunbound if * there was an error. * - * In case of error, a cons representing the error, in the - * form (SIGNAL . DATA), is stored in the module local variable - * mswindows_error_caught_in_modal_loop. This error is signaled - * again when DispatchMessage returns. Thus, Windows internal - * modal loops are protected against throws, which are proven - * to corrupt internal Windows structures. + * In case of error, a warning is issued and the module local variable + * mswindows_error_caught_in_modal_loop is set to non-zero. Thus, + * Windows internal modal loops are protected against throws, which + * are proven to corrupt internal Windows structures. * * In case of success, mswindows_error_caught_in_modal_loop is - * assigned Qnil. + * assigned 0. * * If the value of mswindows_error_caught_in_modal_loop is not - * nil already upon entry, the function just returns non-nil. + * zero already upon entry, the function just returns non-nil. * This situation means that a new event has been queued while * in cancel mode. The event will be dequeued on the next regular * call of next-event; the pump is off since error is caught. * The caller must *unconditionally* cancel modal loop if the * value returned by this function is nil. Otherwise, everything * will become frozen until the modal loop exits under normal - * condition (scrollbar drag is released, menu closed etc.) - */ + * condition (scrollbar drag is released, menu closed etc.) */ Lisp_Object mswindows_pump_outstanding_events (void) { @@ -1288,8 +1315,9 @@ struct gcpro gcpro1; GCPRO1 (result); - if (NILP(mswindows_error_caught_in_modal_loop)) - result = mswindows_protect_modal_loop (mswindows_unsafe_pump_events, Qnil); + if (!mswindows_error_caught_in_modal_loop) + result = mswindows_protect_modal_loop + ("Error during event handling", mswindows_unsafe_pump_events, Qnil, 0); UNGCPRO; return result; } @@ -1409,7 +1437,7 @@ while (NILP (mswindows_u_dispatch_event_queue) && NILP (mswindows_s_dispatch_event_queue)) { -#ifdef HAVE_MSG_SELECT +#ifdef CYGWIN int i; int active; SELECT_TYPE temp_mask = input_wait_mask; @@ -1506,7 +1534,7 @@ { assert(0); } -#else /* not HAVE_MSG_SELECT */ +#else /* not CYGWIN */ /* Now try getting a message or process event */ DWORD active; DWORD what_events; @@ -1592,18 +1620,18 @@ (hyphen, VK_SUBTRACT) key on an 82-key keyboard. */ - __try - { - active = MsgWaitForMultipleObjects (mswindows_waitable_count, - mswindows_waitable_handles, - FALSE, badly_p ? INFINITE : 0, - what_events); - } - __except (GetExceptionCode () == EXCEPTION_BREAKPOINT ? - EXCEPTION_CONTINUE_EXECUTION : - EXCEPTION_CONTINUE_SEARCH) - { - } + __try + { + active = MsgWaitForMultipleObjects (mswindows_waitable_count, + mswindows_waitable_handles, + FALSE, badly_p ? INFINITE : 0, + what_events); + } + __except (GetExceptionCode () == EXCEPTION_BREAKPOINT ? + EXCEPTION_CONTINUE_EXECUTION : + EXCEPTION_CONTINUE_SEARCH) + { + } /* This will assert if handle being waited for becomes abandoned. Not the case currently tho */ @@ -1629,7 +1657,8 @@ int ix = active - WAIT_OBJECT_0; /* First, try to find which process' output has signaled */ Lisp_Process *p = - get_process_from_usid (HANDLE_TO_USID (mswindows_waitable_handles[ix])); + get_process_from_usid (HANDLE_TO_USID + (mswindows_waitable_handles[ix])); if (p != NULL) { /* Found a signaled process input handle */ @@ -1652,22 +1681,20 @@ (1) accept-process-output will return when called on this process, and (2) status notifications will happen in accept-process-output, sleep-for, and sit-for. */ - /* #### horrible kludge till my real process fixes go in. - #### Replaced with a slightly less horrible kluge that - at least finds the right process instead of axing the - first one on the list. - */ if (!NILP (vproctail)) - { mswindows_enqueue_process_event (XPROCESS (vaffanculo)); + else + { + /* abort (); */ + /* #### FUCKME! When can this happen? I hit this abort() + when I tried enabling it. */ + /* Have to return something: there may be no accompanying + process event */ + mswindows_enqueue_magic_event (NULL, XM_BUMPQUEUE); } - else /* trash me soon. */ - /* Have to return something: there may be no accompanying - process event */ - mswindows_enqueue_magic_event (NULL, XM_BUMPQUEUE); } } -#endif /* not HAVE_MSG_SELECT */ +#endif /* not CYGWIN */ } /* while */ } @@ -1715,8 +1742,8 @@ { case XTYP_CONNECT: if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system)) - return (HDDEDATA)TRUE; - return (HDDEDATA)FALSE; + return (HDDEDATA) TRUE; + return (HDDEDATA) FALSE; case XTYP_WILDCONNECT: { @@ -1729,10 +1756,10 @@ || DdeCmpStringHandles (hszItem, mswindows_dde_service)) && !(hszTopic || DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system))) - return (DdeCreateDataHandle (mswindows_dde_mlid, (LPBYTE)pairs, + return (DdeCreateDataHandle (mswindows_dde_mlid, (LPBYTE) pairs, sizeof (pairs), 0L, 0, uFmt, 0)); } - return (HDDEDATA)NULL; + return (HDDEDATA) NULL; case XTYP_EXECUTE: if (!mswindows_dde_enable) @@ -1741,9 +1768,9 @@ if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system)) { DWORD len = DdeGetData (hdata, NULL, 0, 0); - LPBYTE extcmd = (LPBYTE) alloca (len+1); - Intbyte *cmd; - Intbyte *end; + LPBYTE extcmd = (LPBYTE) ALLOCA (len + 1); + Ibyte *cmd; + Ibyte *end; struct gcpro gcpro1, gcpro2; Lisp_Object l_dndlist = Qnil; Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); @@ -2197,7 +2224,8 @@ case WM_CLOSE: fobj = mswindows_find_frame (hwnd); - mswindows_enqueue_misc_user_event (fobj, Qeval, list3 (Qdelete_frame, fobj, Qt)); + mswindows_enqueue_misc_user_event (fobj, Qeval, list3 (Qdelete_frame, fobj, + Qt)); break; case WM_KEYUP: @@ -2333,7 +2361,7 @@ } else /* Normal keys & modifiers */ { - Emchar quit_ch = + Ichar quit_ch = CONSOLE_QUIT_CHAR (XCONSOLE (mswindows_find_console (hwnd))); POINT pnt = { LOWORD (GetMessagePos()), HIWORD (GetMessagePos()) }; MSG msg, tranmsg; @@ -2364,9 +2392,11 @@ keymap_sticky[extendedp ? VK_RMENU : VK_LMENU] |= 0x80; } +#ifdef HAVE_MENUBARS if (!NILP (Vmenu_accelerator_enabled) && !(mods & XEMACS_MOD_SHIFT) && message_ == WM_SYSKEYDOWN) potential_accelerator = 1; +#endif /* Remove shift modifier from an ascii character */ mods &= ~XEMACS_MOD_SHIFT; @@ -2396,8 +2426,8 @@ int mods_with_quit = mods; int length; Extbyte extchar[4]; - Intbyte *intchar; - Emchar ch; + Ibyte *intchar; + Ichar ch; if (XEUNICODE_P) { @@ -2405,7 +2435,7 @@ TO_INTERNAL_FORMAT (DATA, (extchar, length), C_STRING_ALLOCA, (intchar), Qmswindows_unicode); - ch = charptr_emchar (intchar); + ch = itext_ichar (intchar); } else { @@ -2417,7 +2447,7 @@ the following */ ((LCID) GetKeyboardLayout (0) & 0xFFFF), NULL)); - ch = charptr_emchar (intchar); + ch = itext_ichar (intchar); xfree (intchar); } @@ -2449,12 +2479,15 @@ mods_with_quit |= FAKE_MOD_QUIT_CRITICAL; mswindows_quit_chars_count++; } +#ifdef HAVE_MENUBARS else if (potential_accelerator && !got_accelerator && mswindows_char_is_accelerator (frame, ch)) { got_accelerator = 1; break; } +#endif /* HAVE_MENUBARS */ + lastev = mswindows_enqueue_keypress_event (hwnd, make_char (ch), mods_with_quit); @@ -2532,7 +2565,7 @@ (HKL) lcid); if (tounret > 0) { - Intbyte *intchar; + Ibyte *intchar; TO_INTERNAL_FORMAT (DATA, @@ -2540,7 +2573,7 @@ C_STRING_ALLOCA, intchar, Qmswindows_unicode); XEVENT (lastev)->event.key.alt_keychars[i] = - charptr_emchar (intchar); + itext_ichar (intchar); } } else @@ -2561,7 +2594,7 @@ it's like WM_IME_CHAR: DBCS chars have the lead byte in bits 8-15 of the short. */ - Intbyte *intchar; + Ibyte *intchar; Extbyte mbstuff[2]; Bytecount mblength = 0; WORD thechar = received_keys[tounret - 1]; @@ -2578,14 +2611,14 @@ NULL); XEVENT (lastev)->event.key.alt_keychars[i] = - charptr_emchar (intchar); + itext_ichar (intchar); xfree (intchar); } } } else { - Emchar altch; + Ichar altch; if (virtual_key >= 'A' && virtual_key <= 'Z') altch = @@ -3042,12 +3075,13 @@ } else { - if (!msframe->sizing && !FRAME_VISIBLE_P (frame)) + if (!msframe->sizing && !FRAME_VISIBLE_P (frame)) { mswindows_enqueue_magic_event (hwnd, XM_MAPFRAME); - /* APA: Now that the magic XM_MAPFRAME event has - * been sent we can mark the frame as visible (just - * like 21.1 did). */ - FRAME_VISIBLE_P (frame) = 1; + /* APA: Now that the magic XM_MAPFRAME event has + * been sent we can mark the frame as visible (just + * like 21.1 did). */ + FRAME_VISIBLE_P (frame) = 1; + } if (!msframe->sizing || mswindows_dynamic_frame_resize) redisplay (); @@ -3157,7 +3191,7 @@ mswindows_handle_scrollbar_event (hwndScrollBar, code, pos); GCPRO2 (emacs_event, fobj); - if (UNBOUNDP (mswindows_pump_outstanding_events())) /* Can GC */ + if (UNBOUNDP (mswindows_pump_outstanding_events ())) /* Can GC */ { /* Error during event pumping - cancel scroll */ qxeSendMessage (hwndScrollBar, WM_CANCELMODE, 0, 0); @@ -3250,7 +3284,7 @@ if (ii) { Lisp_Object image_instance; - VOID_TO_LISP (image_instance, ii); + image_instance = VOID_TO_LISP ((void *) ii); if (IMAGE_INSTANCEP (image_instance) && IMAGE_INSTANCE_TYPE_P (image_instance, IMAGE_WIDGET)) @@ -3291,7 +3325,7 @@ goto defproc; #ifdef HAVE_DRAGNDROP - case WM_DROPFILES: /* implementation ripped-off from event-Xt.c */ + case WM_DROPFILES: /* implementation ripped-off from event-Xt.c */ { UINT filecount, i; POINT point; @@ -3305,7 +3339,7 @@ GCPRO3 (emacs_event, l_dndlist, l_item); if (!DragQueryPoint ((HDROP) wParam, &point)) - point.x = point.y = -1; /* outside client area */ + point.x = point.y = -1; /* outside client area */ event->event_type = misc_user_event; event->channel = mswindows_find_frame (hwnd); @@ -3320,7 +3354,7 @@ filecount = qxeDragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0); for (i = 0; i < filecount; i++) { - Intbyte *fname; + Ibyte *fname; Extbyte *fname_ext; Bytecount fnamelen; Charcount len = qxeDragQueryFile ((HDROP) wParam, i, NULL, 0); @@ -3328,7 +3362,7 @@ * 3.10 of rfc1738 because they're missing the /// part and * because they may contain reserved characters. But that's OK - * they just need to be good enough to keep dragdrop.el happy. */ - fname_ext = (Extbyte *) alloca ((len + 1) * XETCHAR_SIZE); + fname_ext = (Extbyte *) ALLOCA ((len + 1) * XETCHAR_SIZE); qxeDragQueryFile ((HDROP) wParam, i, fname_ext, len + 1); TO_INTERNAL_FORMAT (DATA, (fname_ext, len * XETCHAR_SIZE), @@ -3511,7 +3545,7 @@ HIMC imc = ImmGetContext (hwnd); Extbyte *result; Bytecount len; - Intbyte *resultint, *endptr; + Ibyte *resultint, *endptr; Bytecount lenint; int speccount; @@ -3537,12 +3571,12 @@ while (resultint < endptr) { - Emchar ch = charptr_emchar (resultint); + Ichar ch = itext_ichar (resultint); if (ch == ' ') mswindows_enqueue_keypress_event (hwnd, QKspace, 0); else mswindows_enqueue_keypress_event (hwnd, make_char (ch), 0); - INC_CHARPTR (resultint); + INC_IBYTEPTR (resultint); } unbind_to (speccount); @@ -3909,7 +3943,7 @@ assert (!NILP (Vmswindows_frame_being_created)); return Vmswindows_frame_being_created; } - VOID_TO_LISP (f, l); + f = VOID_TO_LISP ((void *) l); return f; } @@ -3989,7 +4023,7 @@ emacs_mswindows_format_magic_event (Lisp_Event *emacs_event, Lisp_Object pstream) { -#define FROB(msg) case msg: write_c_string ("type=" #msg, pstream); break +#define FROB(msg) case msg: write_c_string (pstream, "type=" #msg); break switch (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event)) { @@ -4006,7 +4040,7 @@ if (!NILP (EVENT_CHANNEL (emacs_event))) { - write_c_string (" ", pstream); + write_c_string (pstream, " "); print_internal (EVENT_CHANNEL (emacs_event), pstream, 1); } } @@ -4089,62 +4123,121 @@ } } -#ifndef HAVE_MSG_SELECT +#ifndef CYGWIN + static HANDLE get_process_input_waitable (Lisp_Process *process) { - Lisp_Object instr, outstr, p; + Lisp_Object instr, outstr, errstr, p; p = wrap_process (process); - get_process_streams (process, &instr, &outstr); + get_process_streams (process, &instr, &outstr, &errstr); assert (!NILP (instr)); -#if defined (HAVE_SOCKETS) && !defined(HAVE_MSG_SELECT) return (network_connection_p (p) ? get_winsock_stream_waitable (XLSTREAM (instr)) : get_ntpipe_input_stream_waitable (XLSTREAM (instr))); -#else - return get_ntpipe_input_stream_waitable (XLSTREAM (instr)); -#endif } +static HANDLE +get_process_stderr_waitable (Lisp_Process *process) +{ + Lisp_Object instr, outstr, errstr; + get_process_streams (process, &instr, &outstr, &errstr); + if (NILP (errstr)) + return INVALID_HANDLE_VALUE; + return get_ntpipe_input_stream_waitable (XLSTREAM (errstr)); +} + +#endif /* not CYGWIN */ + static void -emacs_mswindows_select_process (Lisp_Process *process) +emacs_mswindows_select_process (Lisp_Process *process, int doin, int doerr) { - HANDLE hev = get_process_input_waitable (process); +#ifdef CYGWIN + int infd, errfd; + + event_stream_unixoid_select_process (process, doin, doerr, &infd, &errfd); +#else + HANDLE hev = INVALID_HANDLE_VALUE; + HANDLE herr = INVALID_HANDLE_VALUE; + + if (doin) + { + hev = get_process_input_waitable (process); + if (!add_waitable_handle (hev)) + { + hev = INVALID_HANDLE_VALUE; + goto err; + } + } - if (!add_waitable_handle (hev)) - invalid_operation ("Too many active processes", Qunbound); + if (doerr) + { + herr = get_process_stderr_waitable (process); + if (herr != INVALID_HANDLE_VALUE && !add_waitable_handle (herr)) + { + herr = INVALID_HANDLE_VALUE; + goto err; + } + } -#ifdef HAVE_WIN32_PROCESSES { + /* Also select on the process handle itself, so we can receive + exit notifications. Only do this once, not each time this + function is called (which can happen many times, e.g. if + (set-process-filter proc t) is called and then a process filter + is set again). It will be unselected in mswindows_need_event(). */ Lisp_Object p = wrap_process (process); if (!network_connection_p (p)) { - HANDLE hprocess = get_nt_process_handle (process); - if (!add_waitable_handle (hprocess)) - { - remove_waitable_handle (hev); - invalid_operation ("Too many active processes", Qunbound); - } + HANDLE hprocess = get_nt_process_handle_only_first_time (process); + if (hprocess != INVALID_HANDLE_VALUE + && !add_waitable_handle (hprocess)) + goto err; } } -#endif + + return; + + err: + if (hev != INVALID_HANDLE_VALUE) + remove_waitable_handle (hev); + if (herr != INVALID_HANDLE_VALUE) + remove_waitable_handle (herr); + invalid_operation ("Too many active processes", wrap_process (process)); +#endif /* CYGWIN */ } static void -emacs_mswindows_unselect_process (Lisp_Process *process) +emacs_mswindows_unselect_process (Lisp_Process *process, int doin, int doerr) { - /* Process handle is removed in the event loop as soon - as it is signaled, so don't bother here about it */ - HANDLE hev = get_process_input_waitable (process); - remove_waitable_handle (hev); +#ifdef CYGWIN + int infd, errfd; + + event_stream_unixoid_unselect_process (process, doin, doerr, &infd, &errfd); +#else + if (doin) + { + /* Process handle is removed in the event loop as soon + as it is signaled, so don't bother here about it */ + HANDLE hev = get_process_input_waitable (process); + remove_waitable_handle (hev); + } + if (doerr) + { + /* Process handle is removed in the event loop as soon + as it is signaled, so don't bother here about it */ + HANDLE herr = get_process_stderr_waitable (process); + if (herr != INVALID_HANDLE_VALUE) + remove_waitable_handle (herr); + } +#endif /* CYGWIN */ } -#endif /* HAVE_MSG_SELECT */ static void emacs_mswindows_select_console (struct console *con) { -#ifdef HAVE_MSG_SELECT +#ifdef CYGWIN if (CONSOLE_MSWINDOWS_P (con)) return; /* mswindows consoles are automatically selected */ @@ -4155,7 +4248,7 @@ static void emacs_mswindows_unselect_console (struct console *con) { -#ifdef HAVE_MSG_SELECT +#ifdef CYGWIN if (CONSOLE_MSWINDOWS_P (con)) return; /* mswindows consoles are automatically selected */ @@ -4203,107 +4296,95 @@ } } -USID -emacs_mswindows_create_stream_pair (void *inhandle, void *outhandle, - Lisp_Object *instream, - Lisp_Object *outstream, - int flags) -{ +static void +emacs_mswindows_create_io_streams (void *inhandle, void *outhandle, + void *errhandle, Lisp_Object *instream, + Lisp_Object *outstream, + Lisp_Object *errstream, + USID *in_usid, + USID *err_usid, + int flags) +{ +#ifdef CYGWIN + event_stream_unixoid_create_io_streams (inhandle, outhandle, + errhandle, instream, + outstream, errstream, + in_usid, err_usid, flags); +#else /* Handles for streams */ - HANDLE hin, hout; + HANDLE hin, hout, herr; /* fds. These just stored along with the streams, and are closed in delete stream pair method, because we need to handle fake unices here. */ - int fdi, fdo; + int fdi, fdo, fde; - /* Decode inhandle and outhandle. Their meaning depends on + /* Decode inhandle, outhandle, errhandle. Their meaning depends on the process implementation being used. */ -#if defined (HAVE_WIN32_PROCESSES) - /* We're passed in Windows handles. That's what we like most... */ hin = (HANDLE) inhandle; hout = (HANDLE) outhandle; - fdi = fdo = -1; -#elif defined (HAVE_UNIX_PROCESSES) - /* We are passed UNIX fds. This must be Cygwin. - Fetch os handles */ - hin = inhandle >= 0 ? (HANDLE)get_osfhandle ((int)inhandle) : INVALID_HANDLE_VALUE; - hout = outhandle >= 0 ? (HANDLE)get_osfhandle ((int)outhandle) : INVALID_HANDLE_VALUE; - fdi=(int)inhandle; - fdo=(int)outhandle; -#else -#error "So, WHICH kind of processes do you want?" -#endif + if (errhandle == (void *) -1) + herr = INVALID_HANDLE_VALUE; + else + herr = (HANDLE) errhandle; + fdi = fdo = fde = -1; *instream = (hin == INVALID_HANDLE_VALUE ? Qnil -#if defined (HAVE_SOCKETS) && !defined (HAVE_MSG_SELECT) : flags & STREAM_NETWORK_CONNECTION - ? make_winsock_input_stream ((SOCKET)hin, fdi) -#endif + ? make_winsock_input_stream ((SOCKET) hin, fdi) : make_ntpipe_input_stream (hin, fdi)); -#ifdef HAVE_WIN32_PROCESSES + *errstream = (herr == INVALID_HANDLE_VALUE + ? Qnil + : make_ntpipe_input_stream (herr, fde)); + *outstream = (hout == INVALID_HANDLE_VALUE ? Qnil -#if defined (HAVE_SOCKETS) && !defined (HAVE_MSG_SELECT) : flags & STREAM_NETWORK_CONNECTION ? make_winsock_output_stream ((SOCKET)hout, fdo) -#endif : make_ntpipe_output_stream (hout, fdo)); -#elif defined (HAVE_UNIX_PROCESSES) - *outstream = (fdo >= 0 - ? make_filedesc_output_stream (fdo, 0, -1, LSTR_BLOCKED_OK) - : Qnil); - -#if defined(HAVE_UNIX_PROCESSES) - /* FLAGS is process->pty_flag for UNIX_PROCESSES */ - if ((flags & STREAM_PTY_FLUSHING) && fdo >= 0) - { - Intbyte eof_char = get_eof_char (fdo); - int pty_max_bytes = get_pty_max_bytes (fdo); - filedesc_stream_set_pty_flushing (XLSTREAM(*outstream), pty_max_bytes, eof_char); - } -#endif -#endif - return (NILP (*instream) - ? USID_ERROR -#if defined(HAVE_SOCKETS) && !defined(HAVE_MSG_SELECT) - : flags & STREAM_NETWORK_CONNECTION - ? HANDLE_TO_USID (get_winsock_stream_waitable (XLSTREAM (*instream))) -#endif - : HANDLE_TO_USID (get_ntpipe_input_stream_waitable (XLSTREAM (*instream)))); + *in_usid = + (NILP (*instream) + ? USID_ERROR + : flags & STREAM_NETWORK_CONNECTION + ? HANDLE_TO_USID (get_winsock_stream_waitable (XLSTREAM (*instream))) + : HANDLE_TO_USID (get_ntpipe_input_stream_waitable (XLSTREAM + (*instream)))); + + *err_usid = + (NILP (*errstream) + ? USID_DONTHASH + : HANDLE_TO_USID (get_ntpipe_input_stream_waitable (XLSTREAM + (*errstream)))); +#endif /* CYGWIN */ } -USID -emacs_mswindows_delete_stream_pair (Lisp_Object instream, - Lisp_Object outstream) -{ - /* Oh nothing special here for Win32 at all */ -#if defined (HAVE_UNIX_PROCESSES) - int in = (NILP(instream) - ? -1 -#if defined(HAVE_SOCKETS) && !defined(HAVE_MSG_SELECT) - : LSTREAM_TYPE_P (XLSTREAM (instream), winsock) - ? get_winsock_stream_param (XLSTREAM (instream)) -#endif - : get_ntpipe_input_stream_param (XLSTREAM (instream))); - int out = (NILP(outstream) ? -1 - : filedesc_stream_fd (XLSTREAM (outstream))); - - if (in >= 0) - retry_close (in); - if (out != in && out >= 0) - retry_close (out); -#endif - - return (NILP (instream) - ? USID_DONTHASH -#if defined(HAVE_SOCKETS) && !defined(HAVE_MSG_SELECT) - : LSTREAM_TYPE_P (XLSTREAM (instream), winsock) - ? HANDLE_TO_USID (get_winsock_stream_waitable (XLSTREAM (instream))) -#endif - : HANDLE_TO_USID (get_ntpipe_input_stream_waitable (XLSTREAM (instream)))); +static void +emacs_mswindows_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID *in_usid, + USID *err_usid) +{ +#ifdef CYGWIN + event_stream_unixoid_delete_io_streams (instream, outstream, errstream, + in_usid, err_usid); +#else + *in_usid = + (NILP (instream) + ? USID_DONTHASH + : LSTREAM_TYPE_P (XLSTREAM (instream), winsock) + ? HANDLE_TO_USID (get_winsock_stream_waitable (XLSTREAM (instream))) + : HANDLE_TO_USID (get_ntpipe_input_stream_waitable (XLSTREAM + (instream)))); + + *err_usid = + (NILP (errstream) + ? USID_DONTHASH + : HANDLE_TO_USID (get_ntpipe_input_stream_waitable (XLSTREAM + (errstream)))); +#endif /* CYGWIN */ } static int @@ -4315,17 +4396,19 @@ #ifndef HAVE_X_WINDOWS /* This is called from GC when a process object is about to be freed. If we've still got pointers to it in this file, we're gonna lose hard. - */ +*/ +void debug_process_finalization (Lisp_Process *p); void debug_process_finalization (Lisp_Process *p) { #if 0 /* #### */ - Lisp_Object instr, outstr; + Lisp_Object instr, outstr, errstr; - get_process_streams (p, &instr, &outstr); + get_process_streams (p, &instr, &outstr, &errstr); /* if it still has fds, then it hasn't been killed yet. */ assert (NILP (instr)); assert (NILP (outstr)); + assert (NILP (errstr)); /* #### More checks here */ #endif @@ -4673,19 +4756,10 @@ mswindows_event_stream->quit_p_cb = emacs_mswindows_quit_p; mswindows_event_stream->select_console_cb = emacs_mswindows_select_console; mswindows_event_stream->unselect_console_cb = emacs_mswindows_unselect_console; -#ifdef HAVE_MSG_SELECT - mswindows_event_stream->select_process_cb = - (void (*)(Lisp_Process *)) event_stream_unixoid_select_process; - mswindows_event_stream->unselect_process_cb = - (void (*)(Lisp_Process *)) event_stream_unixoid_unselect_process; - mswindows_event_stream->create_stream_pair_cb = event_stream_unixoid_create_stream_pair; - mswindows_event_stream->delete_stream_pair_cb = event_stream_unixoid_delete_stream_pair; -#else mswindows_event_stream->select_process_cb = emacs_mswindows_select_process; mswindows_event_stream->unselect_process_cb = emacs_mswindows_unselect_process; - mswindows_event_stream->create_stream_pair_cb = emacs_mswindows_create_stream_pair; - mswindows_event_stream->delete_stream_pair_cb = emacs_mswindows_delete_stream_pair; -#endif + mswindows_event_stream->create_io_streams_cb = emacs_mswindows_create_io_streams; + mswindows_event_stream->delete_io_streams_cb = emacs_mswindows_delete_io_streams; mswindows_event_stream->current_event_timestamp_cb = emacs_mswindows_current_event_timestamp; } @@ -4705,9 +4779,7 @@ mswindows_s_dispatch_event_queue_tail = Qnil; dump_add_root_object (&mswindows_s_dispatch_event_queue_tail); - mswindows_error_caught_in_modal_loop = Qnil; - staticpro (&mswindows_error_caught_in_modal_loop); - + mswindows_error_caught_in_modal_loop = 0; #ifdef DEBUG_XEMACS DEFVAR_INT ("debug-mswindows-events", &debug_mswindows_events /* @@ -4786,9 +4858,9 @@ void lstream_type_create_mswindows_selectable (void) { +#ifndef CYGWIN init_slurp_stream (); init_shove_stream (); -#if defined (HAVE_SOCKETS) && !defined (HAVE_MSG_SELECT) init_winsock_stream (); #endif } @@ -4796,11 +4868,11 @@ void init_event_mswindows_late (void) { -#ifdef HAVE_MSG_SELECT +#ifdef CYGWIN windows_fd = retry_open ("/dev/windows", O_RDONLY | O_NONBLOCK, 0); - assert (windows_fd>=0); + assert (windows_fd >= 0); FD_SET (windows_fd, &input_wait_mask); - FD_ZERO(&zero_mask); + FD_ZERO (&zero_mask); #endif event_stream = mswindows_event_stream; diff --text -u 'xemacs-21.5.6/src/event-stream.c' 'xemacs-21.5.7/src/event-stream.c' Index: ././src/event-stream.c --- ././src/event-stream.c Sun Mar 31 17:28:09 2002 +++ ././src/event-stream.c Fri Jun 21 06:18:29 2002 @@ -75,17 +75,17 @@ #include "blocktype.h" #include "buffer.h" #include "commands.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "insdel.h" /* for buffer_reset_changes */ #include "keymap.h" #include "lstream.h" #include "macros.h" /* for defining_keyboard_macro */ #include "menubar.h" /* #### for evil kludges. */ #include "process.h" -#include "window.h" +#include "window-impl.h" #include "sysdep.h" /* init_poll_for_quit() */ #include "syssignal.h" /* SIGCHLD, etc. */ @@ -253,11 +253,11 @@ static void external_debugging_print_event (char *event_description, Lisp_Object event) { - write_c_string ("(", Qexternal_debugging_output); - write_c_string (event_description, Qexternal_debugging_output); - write_c_string (") ", Qexternal_debugging_output); + write_c_string (Qexternal_debugging_output, "("); + write_c_string (Qexternal_debugging_output, event_description); + write_c_string (Qexternal_debugging_output, ") "); print_internal (event, Qexternal_debugging_output, 1); - write_c_string ("\n", Qexternal_debugging_output); + write_c_string (Qexternal_debugging_output, "\n"); } #define DEBUG_PRINT_EMACS_EVENT(event_description, event) do { \ if (debug_emacs_events) \ @@ -372,7 +372,7 @@ { /* #### This badly needs to be turned into a Dynarr */ builder->echo_buf_length = 300; /* #### Kludge */ - builder->echo_buf = xnew_array (Intbyte, builder->echo_buf_length); + builder->echo_buf = xnew_array (Ibyte, builder->echo_buf_length); builder->echo_buf[0] = 0; } else @@ -475,30 +475,9 @@ check_event_stream_ok (enum event_stream_operation op) { if (!event_stream && noninteractive) - { - switch (op) - { - case EVENT_STREAM_PROCESS: - invalid_operation ("Can't start subprocesses in -batch mode", - Qunbound); - case EVENT_STREAM_TIMEOUT: - invalid_operation ("Can't add timeouts in -batch mode", Qunbound); - case EVENT_STREAM_CONSOLE: - invalid_operation ("Can't add consoles in -batch mode", Qunbound); - case EVENT_STREAM_READ: - invalid_operation ("Can't read events in -batch mode", Qunbound); - case EVENT_STREAM_NOTHING: - break; - default: - abort (); - } - } - else if (!event_stream) - { - invalid_operation - ("event-stream callbacks not initialized (internal error?)", - Qunbound); - } + /* See comment in init_event_stream() */ + init_event_stream (); + else assert (event_stream); } static int @@ -541,7 +520,7 @@ return 0; } -void +static void event_stream_next_event (Lisp_Event *event) { Lisp_Object event_obj; @@ -550,11 +529,20 @@ event_obj = wrap_event (event); zero_event (event); - /* If C-g was pressed, treat it as a character to be read. - Note that if C-g was pressed while we were blocking, - the SIGINT signal handler will be called. It will - set Vquit_flag and write a byte on our "fake pipe", - which will unblock us. */ + /* SIGINT occurs when C-g was pressed on a TTY. (SIGINT might have + been sent manually by the user, but we don't care; we treat it + the same.) + + The SIGINT signal handler sets Vquit_flag as well as sigint_happened + and write a byte on our "fake pipe", which unblocks us when we are + waiting for an event. */ + + /* If SIGINT was received after we disabled quit checking (because + we want to read C-g's as characters), but before we got a chance + to start reading, notice it now and treat it as a character to be + read. If above callers wanted this to be QUIT, they can + determine this by comparing the event against quit-char. */ + if (maybe_read_quit_event (event)) { DEBUG_PRINT_EMACS_EVENT ("SIGINT", event_obj); @@ -568,6 +556,14 @@ event_stream->next_event_cb (event); emacs_is_blocking = 0; + /* Now check to see if C-g was pressed while we were blocking. + We treat it as an event, just like above. */ + if (maybe_read_quit_event (event)) + { + DEBUG_PRINT_EMACS_EVENT ("SIGINT", event_obj); + return; + } + #ifdef DEBUG_XEMACS /* timeout events have more info set later, so print the event out in next_event_internal(). */ @@ -642,41 +638,90 @@ } void -event_stream_select_process (Lisp_Process *proc) +event_stream_select_process (Lisp_Process *proc, int doin, int doerr) { + int cur_in, cur_err; + check_event_stream_ok (EVENT_STREAM_PROCESS); - if (!get_process_selected_p (proc)) + + cur_in = get_process_selected_p (proc, 0); + if (cur_in) + doin = 0; + + if (!process_has_separate_stderr (wrap_process (proc))) + { + doerr = 0; + cur_err = 0; + } + else { - event_stream->select_process_cb (proc); - set_process_selected_p (proc, 1); + cur_err = get_process_selected_p (proc, 1); + if (cur_err) + doerr = 0; + } + + if (doin || doerr) + { + event_stream->select_process_cb (proc, doin, doerr); + set_process_selected_p (proc, cur_in || doin, cur_err || doerr); } } void -event_stream_unselect_process (Lisp_Process *proc) +event_stream_unselect_process (Lisp_Process *proc, int doin, int doerr) { + int cur_in, cur_err; + check_event_stream_ok (EVENT_STREAM_PROCESS); - if (get_process_selected_p (proc)) + + cur_in = get_process_selected_p (proc, 0); + if (!cur_in) + doin = 0; + + if (!process_has_separate_stderr (wrap_process (proc))) + { + doerr = 0; + cur_err = 0; + } + else + { + cur_err = get_process_selected_p (proc, 1); + if (!cur_err) + doerr = 0; + } + + if (doin || doerr) { - event_stream->unselect_process_cb (proc); - set_process_selected_p (proc, 0); + event_stream->unselect_process_cb (proc, doin, doerr); + set_process_selected_p (proc, cur_in && !doin, cur_err && !doerr); } } -USID -event_stream_create_stream_pair (void *inhandle, void *outhandle, - Lisp_Object *instream, Lisp_Object *outstream, int flags) +void +event_stream_create_io_streams (void *inhandle, void *outhandle, + void *errhandle, Lisp_Object *instream, + Lisp_Object *outstream, + Lisp_Object *errstream, + USID *in_usid, + USID *err_usid, + int flags) { check_event_stream_ok (EVENT_STREAM_PROCESS); - return event_stream->create_stream_pair_cb - (inhandle, outhandle, instream, outstream, flags); + event_stream->create_io_streams_cb + (inhandle, outhandle, errhandle, instream, outstream, errstream, + in_usid, err_usid, flags); } -USID -event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream) +void +event_stream_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID *in_usid, + USID *err_usid) { check_event_stream_ok (EVENT_STREAM_PROCESS); - return event_stream->delete_stream_pair_cb (instream, outstream); + event_stream->delete_io_streams_cb (instream, outstream, errstream, + in_usid, err_usid); } void @@ -707,7 +752,7 @@ /* This function can GC */ DECLARE_EISTRING_MALLOC (buf); Bytecount buf_index = command_builder->echo_buf_index; - Intbyte *e; + Ibyte *e; Bytecount len; if (buf_index < 0) @@ -755,9 +800,11 @@ /* This function can GC */ double echo_keystrokes; struct frame *f = selected_frame (); + int depth = begin_dont_check_for_quit (); + /* Message turns off echoing unless more keystrokes turn it on again. */ if (echo_area_active (f) && !EQ (Qcommand, echo_area_status (f))) - return; + goto done; if (INTP (Vecho_keystrokes) || FLOATP (Vecho_keystrokes)) echo_keystrokes = extract_float (Vecho_keystrokes); @@ -773,11 +820,9 @@ { if (!no_snooze) { - /* #### C-g here will cause QUIT. Setting dont_check_for_quit - doesn't work. See check_quit. */ if (NILP (Fsit_for (Vecho_keystrokes, Qnil))) /* input came in, so don't echo. */ - return; + goto done; } echo_area_message (f, command_builder->echo_buf, Qnil, 0, @@ -786,6 +831,10 @@ strlen ((char *) command_builder->echo_buf), Qcommand); } + + done: + Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ + unbind_to (depth); } static void @@ -810,7 +859,7 @@ static void maybe_kbd_translate (Lisp_Object event) { - Emchar c; + Ichar c; int did_translate = 0; if (XEVENT_TYPE (event) != key_press_event) @@ -1569,19 +1618,10 @@ return dequeue_event (&command_event_queue, &command_event_queue_tail); } -/* put the event on the typeahead queue, unless - the event is the quit char, in which case the `QUIT' - which will occur on the next trip through this loop is - all the processing we should do - leaving it on the queue - would cause the quit to be processed twice. - */ static void enqueue_command_event_1 (Lisp_Object event_to_copy) { - /* do not call check_quit() here. Vquit_flag was set in - next_event_internal. */ - if (NILP (Vquit_flag)) - enqueue_command_event (Fcopy_event (event_to_copy, Qnil)); + enqueue_command_event (Fcopy_event (event_to_copy, Qnil)); } void @@ -1990,12 +2030,23 @@ /* the number of keyboard characters read. callint.c wants this. */ Charcount num_input_chars; +/* Read an event from the window system (or tty). If ALLOW_QUEUED is + non-zero, read from the command-event queue first. + + If C-g was pressed, this function will attempt to QUIT. If you want + to read C-g as an event, wrap this function with a call to + begin_dont_check_for_quit(), and set Vquit_flag to Qnil just before + you unbind. In this case, TARGET_EVENT will contain a C-g. + + Note that even if you are interested in C-g doing QUIT, a caller of you + might not be. +*/ + static void next_event_internal (Lisp_Object target_event, int allow_queued) { struct gcpro gcpro1; - /* QUIT; This is incorrect - the caller must do this because some - callers (ie, Fnext_event()) do not want to QUIT. */ + QUIT; assert (NILP (XEVENT_NEXT (target_event))); @@ -2038,35 +2089,29 @@ DEBUG_PRINT_EMACS_EVENT ("real, timeout", target_event); } - /* If we read a ^G, then set quit-flag but do not discard the ^G. - The callers of next_event_internal() will do one of two things: - - -- set Vquit_flag to Qnil. (next-event does this.) This will - cause the ^G to be treated as a normal keystroke. - -- not change Vquit_flag but attempt to enqueue the ^G, at - which point it will be discarded. The next time QUIT is - called, it will notice that Vquit_flag was set. - + /* If we read a ^G, then set quit-flag and try to QUIT. + This may be blocked (see above). */ if (e->event_type == key_press_event && event_matches_key_specifier_p (e, make_char (CONSOLE_QUIT_CHAR (XCONSOLE (EVENT_CHANNEL (e)))))) { Vquit_flag = Qt; + QUIT; } } UNGCPRO; } -static void +void run_pre_idle_hook (void) { if (!NILP (Vpre_idle_hook) && !detect_input_pending ()) - safe_run_hook_trapping_errors + safe_run_hook_trapping_problems ("Error in `pre-idle-hook' (setting hook to nil)", - Qpre_idle_hook, 1); + Qpre_idle_hook, INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); } static void push_this_command_keys (Lisp_Object event); @@ -2129,10 +2174,11 @@ XCOMMAND_BUILDER (con->command_builder); int store_this_key = 0; struct gcpro gcpro1; + int depth; GCPRO1 (event); - /* DO NOT do QUIT anywhere within this function or the functions it calls. - We want to read the ^G as an event. */ + + depth = begin_dont_check_for_quit (); #ifdef LWLIB_MENUBARS_LUCID /* @@ -2195,7 +2241,7 @@ if (!EVENTP (e) || !command_event_p (e)) signal_error_1 (Qwrong_type_argument, list3 (Qcommand_event_p, e, Qunread_command_events)); - redisplay (); + redisplay_no_pre_idle_hook (); if (!EQ (e, event)) Fcopy_event (e, event); DEBUG_PRINT_EMACS_EVENT ("unread-command-events", event); @@ -2215,7 +2261,7 @@ } if (!EQ (e, event)) Fcopy_event (e, event); - redisplay (); + redisplay_no_pre_idle_hook (); DEBUG_PRINT_EMACS_EVENT ("unread-command-event", event); } @@ -2227,7 +2273,7 @@ { if (!NILP (Vexecuting_macro)) { - redisplay (); + redisplay_no_pre_idle_hook (); pop_kbd_macro_event (event); /* This throws past us at end-of-macro. */ store_this_key = 1; @@ -2238,22 +2284,24 @@ recent-keys. */ else { - run_pre_idle_hook (); redisplay (); next_event_internal (event, 1); - Vquit_flag = Qnil; /* Read C-g as an event. */ store_this_key = 1; } } + /* temporarily reenable quit checking here, because arbitrary lisp + is executed */ + Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ + unbind_to (depth); status_notify (); /* Notice process change */ + depth = begin_dont_check_for_quit (); -#ifdef C_ALLOCA - alloca (0); /* Cause a garbage collection now */ /* Since we can free the most stuff here * (since this is typically called from * the command-loop top-level). */ -#endif /* C_ALLOCA */ + if (need_to_check_c_alloca) + xemacs_c_alloca (0); /* Cause a garbage collection now */ if (object_dead_p (XEVENT (event)->channel)) /* event_console_or_selected may crash if the channel is dead. @@ -2280,7 +2328,12 @@ break; } + /* temporarily reenable quit checking here, because we could get stuck */ + Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ + unbind_to (depth); maybe_do_auto_save (); + depth = begin_dont_check_for_quit (); + num_input_chars++; STORE_AND_EXECUTE_KEY: if (store_this_key) @@ -2348,18 +2401,26 @@ store_kbd_macro_event (event); } } - /* If this is the help char and there is a help form, then execute the - help form and swallow this character. This is the only place where - calling Fnext_event() can cause arbitrary lisp code to run. Note - that execute_help_form() calls Fnext_command_event(), which calls - this function, as well as Fdispatch_event. - */ + /* If this is the help char and there is a help form, then execute + the help form and swallow this character. Note that + execute_help_form() calls Fnext_command_event(), which calls this + function, as well as Fdispatch_event. */ if (!NILP (Vhelp_form) && event_matches_key_specifier_p (XEVENT (event), Vhelp_char)) - execute_help_form (command_builder, event); + { + /* temporarily reenable quit checking here, because we could get stuck */ + Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ + unbind_to (depth); + execute_help_form (command_builder, event); + depth = begin_dont_check_for_quit (); + } RETURN: + Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ + unbind_to (depth); + UNGCPRO; + return event; } @@ -2392,9 +2453,11 @@ /* This function can GC */ struct gcpro gcpro1; GCPRO1 (event); + maybe_echo_keys (XCOMMAND_BUILDER (XCONSOLE (Vselected_console)-> command_builder), 0); /* #### This sucks bigtime */ + for (;;) { event = Fnext_event (event, prompt); @@ -2431,15 +2494,12 @@ while (event_stream_event_pending_p (0)) { - QUIT; /* next_event_internal() does not QUIT. */ - /* We're a generator of the command_event_queue, so we can't be a consumer as well. Also, we have no reason to consult the command_event_queue; there are only user and eval-events there, and we'd just have to put them back anyway. */ next_event_internal (event, 0); /* blocks */ - /* See the comment in accept-process-output about Vquit_flag */ if (XEVENT_TYPE (event) == magic_event || XEVENT_TYPE (event) == timeout_event || XEVENT_TYPE (event) == process_event || @@ -2479,16 +2539,14 @@ */ Lisp_Object event = Fmake_event (Qnil, Qnil); Lisp_Object head = Qnil, tail = Qnil; - Lisp_Object oiq = Vinhibit_quit; - struct gcpro gcpro1, gcpro2; + struct gcpro gcpro1; /* #### not correct here with Vselected_console? Should discard-input take a console argument, or maybe map over all consoles? */ struct console *con = XCONSOLE (Vselected_console); /* next_event_internal() can cause arbitrary Lisp code to be evalled */ - GCPRO2 (event, oiq); - Vinhibit_quit = Qt; + GCPRO1 (event); /* If a macro was being defined then we have to mark the modeline has changed to ensure that it gets updated correctly. */ if (!NILP (con->defining_kbd_macro)) @@ -2499,19 +2557,27 @@ while (!NILP (command_event_queue) || event_stream_event_pending_p (1)) { + /* We want to ignore C-g's along with all other keypresses. */ + int depth = begin_dont_check_for_quit (); /* This will take stuff off the command_event_queue, or read it from the event_stream, but it will not block. */ next_event_internal (event, 1); - Vquit_flag = Qnil; /* Treat C-g as a user event (ignore it). - It is vitally important that we reset - Vquit_flag here. Otherwise, if we're - reading from a TTY console, - maybe_read_quit_event() will notice - that C-g has been set and send us - another C-g. That will cause us - to get right back here, and read - another C-g, ad infinitum ... */ + /* The following comment used to be here: + + [[Treat C-g as a user event (ignore it). It is vitally + important that we reset Vquit_flag here. Otherwise, if we're + reading from a TTY console, maybe_read_quit_event() will + notice that C-g has been set and send us another C-g. That + will cause us to get right back here, and read another C-g, + ad infinitum ...]] + + but I don't think this is correct; maybe_read_quit_event() + checks and resets sigint_happened. It shouldn't matter if we + reset here or outside of the while loop. --ben */ + Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ + + unbind_to (depth); /* If the event is a user event, ignore it. */ if (!command_event_p (event)) @@ -2547,7 +2613,6 @@ Fdeallocate_event (event); UNGCPRO; - Vinhibit_quit = oiq; return Qnil; } @@ -2670,16 +2735,7 @@ continue; /* Don't call next_event_internal */ } - QUIT; /* next_event_internal() does not QUIT, so check for ^G - before reading output from the process - this makes it - less likely that the filter will actually be aborted. - */ - next_event_internal (event, 0); - /* If C-g was pressed while we were waiting, Vquit_flag got - set and next_event_internal() also returns C-g. When - we enqueue the C-g below, it will get discarded. The - next time through, QUIT will be called and will signal a quit. */ switch (XEVENT_TYPE (event)) { case process_event: @@ -2716,6 +2772,9 @@ unbind_to_1 (count, timeout_enabled ? make_int (timeout_id) : Qnil); Fdeallocate_event (event); + + status_notify (); + UNGCPRO; current_buffer = old_buffer; return result; @@ -2752,16 +2811,11 @@ if (!event_stream_wakeup_pending_p (id, 0)) goto DONE_LABEL; - QUIT; /* next_event_internal() does not QUIT, so check for ^G - before reading output from the process - this makes it - less likely that the filter will actually be aborted. - */ /* We're a generator of the command_event_queue, so we can't be a consumer as well. We don't care about command and eval-events anyway. */ next_event_internal (event, 0); /* blocks */ - /* See the comment in accept-process-output about Vquit_flag */ switch (XEVENT_TYPE (event)) { case timeout_event: @@ -2830,13 +2884,10 @@ return Qnil; /* Recursive call from a filter function or timeout handler. */ - if (!NILP(recursive_sit_for)) + if (!NILP (recursive_sit_for)) { if (!event_stream_event_pending_p (1) && NILP (nodisplay)) - { - run_pre_idle_hook (); redisplay (); - } return Qnil; } @@ -2865,10 +2916,7 @@ /* If there is no user input pending, then redisplay. */ if (!event_stream_event_pending_p (1) && NILP (nodisplay)) - { - run_pre_idle_hook (); redisplay (); - } /* If our timeout has arrived, we move along. */ if (!event_stream_wakeup_pending_p (id, 0)) @@ -2877,24 +2925,14 @@ goto DONE_LABEL; } - QUIT; /* next_event_internal() does not QUIT, so check for ^G - before reading output from the process - this makes it - less likely that the filter will actually be aborted. - */ /* We're a generator of the command_event_queue, so we can't be a consumer as well. In fact, we know there's nothing on the command_event_queue that we didn't just put there. */ next_event_internal (event, 0); /* blocks */ - /* See the comment in accept-process-output about Vquit_flag */ if (command_event_p (event)) { - QUIT; /* If the command was C-g check it here - so that we abort out of the sit-for, - not the next command. sleep-for and - accept-process-output continue looping - so they check QUIT again implicitly.*/ result = Qnil; goto DONE_LABEL; } @@ -2949,15 +2987,12 @@ while (!(*predicate) (predicate_arg)) { - QUIT; /* next_event_internal() does not QUIT. */ - /* We're a generator of the command_event_queue, so we can't be a consumer as well. Also, we have no reason to consult the command_event_queue; there are only user and eval-events there, and we'd just have to put them back anyway. */ next_event_internal (event, 0); - /* See the comment in accept-process-output about Vquit_flag */ if (command_event_p (event) || (XEVENT_TYPE (event) == eval_event) || (XEVENT_TYPE (event) == magic_eval_event)) @@ -3011,85 +3046,79 @@ { Lisp_Object p = XEVENT (event)->event.process.process; Charcount readstatus; + int iter; - assert (PROCESSP (p)); - while ((readstatus = read_process_output (p)) > 0) - ; - if (readstatus > 0) - ; /* this clauses never gets executed but allows the #ifdefs - to work cleanly. */ + assert (PROCESSP (p)); + for (iter = 0; iter < 2; iter++) + { + if (iter == 1 && !process_has_separate_stderr (p)) + break; + while ((readstatus = read_process_output (p, iter)) > 0) + ; + if (readstatus > 0) + ; /* this clauses never gets executed but + allows the #ifdefs to work cleanly. */ #ifdef EWOULDBLOCK - else if (readstatus == -1 && errno == EWOULDBLOCK) - ; + else if (readstatus == -1 && errno == EWOULDBLOCK) + ; #endif /* EWOULDBLOCK */ #ifdef EAGAIN - else if (readstatus == -1 && errno == EAGAIN) - ; + else if (readstatus == -1 && errno == EAGAIN) + ; #endif /* EAGAIN */ - else if ((readstatus == 0 && - /* Note that we cannot distinguish between no input - available now and a closed pipe. - With luck, a closed pipe will be accompanied by - subprocess termination and SIGCHLD. */ - (!network_connection_p (p) || - /* - When connected to ToolTalk (i.e. - connected_via_filedesc_p()), it's not possible to - reliably determine whether there is a message - waiting for ToolTalk to receive. ToolTalk expects - to have tt_message_receive() called exactly once - every time the file descriptor becomes active, so - the filter function forces this by returning 0. - Emacs must not interpret this as a closed pipe. */ - connected_via_filedesc_p (XPROCESS (p)))) - - /* On some OSs with ptys, when the process on one end of - a pty exits, the other end gets an error reading with - errno = EIO instead of getting an EOF (0 bytes read). - Therefore, if we get an error reading and errno = - EIO, just continue, because the child process has - exited and should clean itself up soon (e.g. when we - get a SIGCHLD). */ + else if ((readstatus == 0 && + /* Note that we cannot distinguish between no input + available now and a closed pipe. + With luck, a closed pipe will be accompanied by + subprocess termination and SIGCHLD. */ + (!network_connection_p (p) || + /* + When connected to ToolTalk (i.e. + connected_via_filedesc_p()), it's not possible to + reliably determine whether there is a message + waiting for ToolTalk to receive. ToolTalk expects + to have tt_message_receive() called exactly once + every time the file descriptor becomes active, so + the filter function forces this by returning 0. + Emacs must not interpret this as a closed pipe. */ + connected_via_filedesc_p (XPROCESS (p)))) + + /* On some OSs with ptys, when the process on one end of + a pty exits, the other end gets an error reading with + errno = EIO instead of getting an EOF (0 bytes read). + Therefore, if we get an error reading and errno = + EIO, just continue, because the child process has + exited and should clean itself up soon (e.g. when we + get a SIGCHLD). */ #ifdef EIO - || (readstatus == -1 && errno == EIO) + || (readstatus == -1 && errno == EIO) #endif - ) - { - /* Currently, we rely on SIGCHLD to indicate that the - process has terminated. Unfortunately, on some systems - the SIGCHLD gets missed some of the time. So we put an - additional check in status_notify() to see whether a - process has terminated. We must tell status_notify() - to enable that check, and we do so now. */ - kick_status_notify (); - } - else - { - /* Deactivate network connection */ - Lisp_Object status = Fprocess_status (p); - if (EQ (status, Qopen) - /* In case somebody changes the theory of whether to - return open as opposed to run for network connection - "processes"... */ - || EQ (status, Qrun)) - update_process_status (p, Qexit, 256, 0); - deactivate_process (p); + ) + { + /* Currently, we rely on SIGCHLD to indicate that the + process has terminated. Unfortunately, on some systems + the SIGCHLD gets missed some of the time. So we put an + additional check in status_notify() to see whether a + process has terminated. We must tell status_notify() + to enable that check, and we do so now. */ + kick_status_notify (); + } + + /* We must call status_notify here to allow the + event_stream->unselect_process_cb to be run if appropriate. + Otherwise, dead fds may be selected for, and we will get a + continuous stream of process events for them. Since we don't + return until all process events have been flushed, we would + get stuck here, processing events on a process whose status + was 'exit. Call this after dispatch-event, or the fds will + have been closed before we read the last data from them. + It's safe for the filter to signal an error because + status_notify() will be called on return to top-level. + */ + status_notify (); + return; } - - /* We must call status_notify here to allow the - event_stream->unselect_process_cb to be run if appropriate. - Otherwise, dead fds may be selected for, and we will get a - continuous stream of process events for them. Since we don't - return until all process events have been flushed, we would - get stuck here, processing events on a process whose status - was 'exit. Call this after dispatch-event, or the fds will - have been closed before we read the last data from them. - It's safe for the filter to signal an error because - status_notify() will be called on return to top-level. - */ - status_notify (); - return; } case timeout_event: @@ -3314,7 +3343,7 @@ { Lisp_Object terminal = builder->most_current_event; struct key_data *key = &XEVENT (terminal)->event.key; - Emchar c = 0; + Ichar c = 0; if ((key->modifiers & XEMACS_MOD_SHIFT) || (CHAR_OR_CHAR_INTP (key->keysym) && ((c = XCHAR_OR_CHAR_INT (key->keysym)), @@ -3403,7 +3432,7 @@ { Lisp_Object keysym = XEVENT (builder->most_current_event)->event.key.keysym; - if (CHARP (keysym) && !CHAR_ASCII_P (XCHAR (keysym))) + if (CHARP (keysym) && !ichar_ascii_p (XCHAR (keysym))) return Vcomposed_character_default_binding; } #endif @@ -3873,7 +3902,7 @@ if (len + buf_index + 1 <= command_builder->echo_buf_length) { - Intbyte *echo = command_builder->echo_buf + buf_index; + Ibyte *echo = command_builder->echo_buf + buf_index; memcpy (echo, XSTRING_DATA (prompt), len); echo[len] = 0; } @@ -3882,6 +3911,8 @@ else maybe_echo_keys (command_builder, 0); } + /* #### i don't trust this at all. --ben */ +#if 0 else if (!NILP (Vquit_flag)) { Lisp_Object quit_event = Fmake_event (Qnil, Qnil); @@ -3896,6 +3927,7 @@ enqueue_command_event (quit_event); Vquit_flag = Qnil; } +#endif } else if (!NILP (leaf)) { @@ -4117,9 +4149,9 @@ last_point_position = BUF_PT (current_buffer); last_point_position_buffer = wrap_buffer (current_buffer); /* This function can GC */ - safe_run_hook_trapping_errors + safe_run_hook_trapping_problems ("Error in `pre-command-hook' (setting hook to nil)", - Qpre_command_hook, 1); + Qpre_command_hook, INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); /* This is a kludge, but necessary; see simple.el */ call0 (Qhandle_pre_motion_command); @@ -4162,9 +4194,38 @@ else zmacs_update_region (); - safe_run_hook_trapping_errors + safe_run_hook_trapping_problems ("Error in `post-command-hook' (setting hook to nil)", - Qpost_command_hook, 1); + Qpost_command_hook, INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); + +#if 0 /* FSF Emacs crap */ + if (!NILP (Vdeferred_action_list)) + call0 (Vdeferred_action_function); + + if (NILP (Vunread_command_events) + && NILP (Vexecuting_macro) + && !NILP (Vpost_command_idle_hook) + && !NILP (Fsit_for (make_float ((double) post_command_idle_delay + / 1000000), Qnil))) + safe_run_hook_trapping_problems + ("Error in `post-command-idle-hook' (setting hook to nil)", + Qpost_command_idle_hook, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); +#endif /* FSF Emacs crap */ + +#if 0 /* FSF Emacs */ + if (!NILP (current_buffer->mark_active)) + { + if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode)) + { + current_buffer->mark_active = Qnil; + run_hook (intern ("deactivate-mark-hook")); + } + else if (current_buffer != prev_buffer || + BUF_MODIFF (current_buffer) != prev_modiff) + run_hook (intern ("activate-mark-hook")); + } +#endif /* FSF Emacs */ /* #### Kludge!!! This is necessary to make sure that things are properly positioned even if post-command-hook moves point. @@ -4469,8 +4530,6 @@ if (NILP (continue_echo)) reset_this_command_keys (wrap_console (con), 1); - specbind (Qinhibit_quit, Qt); - if (!NILP (dont_downcase_last)) specbind (Qretry_undefined_key_binding_unshifted, Qnil); @@ -4497,7 +4556,6 @@ } } - Vquit_flag = Qnil; /* In case we read a ^G; do not call check_quit() here */ Fdeallocate_event (event); RETURN_UNGCPRO (unbind_to_1 (speccount, result)); } @@ -4558,12 +4616,12 @@ Lisp_Object keysym = XEVENT (event)->event.key.keysym; if (CHARP (XEVENT (event)->event.key.keysym)) { - Emchar ch = XCHAR (keysym); - Intbyte str[MAX_EMCHAR_LEN]; - Bytecount len = set_charptr_emchar (str, ch); + Ichar ch = XCHAR (keysym); + Ibyte str[MAX_ICHAR_LEN]; + Bytecount len = set_itext_ichar (str, ch); Lstream_write (XLSTREAM (Vdribble_file), str, len); } - else if (XSTRING_CHAR_LENGTH (XSYMBOL (keysym)->name) == 1) + else if (string_char_length (XSYMBOL (keysym)->name) == 1) /* one-char key events are printed with just the key name */ Fprinc (keysym, Vdribble_file); else if (EQ (keysym, Qreturn)) @@ -4749,7 +4807,7 @@ Function or functions to run before every command. This may examine the `this-command' variable to find out what command is about to be run, or may change it to cause a different command to run. -Function on this hook must be careful to avoid signalling errors! +Errors while running the hook are caught and turned into warnings. */ ); Vpre_command_hook = Qnil; @@ -4765,8 +4823,8 @@ This occurs whenever it is going to block, waiting for an event. This generally happens as a result of a call to `next-event', `next-command-event', `sit-for', `sleep-for', `accept-process-output', -or `x-get-selection'. -Errors running the hook are caught and ignored. +or `get-selection'. Errors while running the hook are caught and +turned into warnings. */ ); Vpre_idle_hook = Qnil; @@ -5040,6 +5098,12 @@ void init_event_stream (void) { + /* Normally we don't initialize the event stream when running a bare + temacs (the check for initialized) because it may do various things + (e.g. under Xt) that we don't want any traces of in a dumped xemacs. + However, sometimes we need to process events in a bare temacs (in + particular, when make-docfile.el is executed); so we initialize as + necessary in check_event_stream_ok(). */ if (initialized) { #ifdef HAVE_UNIXOID_EVENT_LOOP @@ -5079,6 +5143,8 @@ /* +#### this comment is at least 8 years old and some may no longer apply. + useful testcases for v18/v19 compatibility: (defun foo () diff --text -u 'xemacs-21.5.6/src/event-tty.c' 'xemacs-21.5.7/src/event-tty.c' Index: ././src/event-tty.c --- ././src/event-tty.c Fri Mar 29 13:47:26 2002 +++ ././src/event-tty.c Fri Jun 21 06:18:29 2002 @@ -26,7 +26,7 @@ #include "lisp.h" #include "device.h" -#include "console-tty.h" +#include "console-tty-impl.h" #include "events.h" #include "frame.h" #include "process.h" @@ -212,15 +212,19 @@ static void -emacs_tty_select_process (Lisp_Process *process) +emacs_tty_select_process (Lisp_Process *process, int doin, int doerr) { - event_stream_unixoid_select_process (process); + int infd, errfd; + + event_stream_unixoid_select_process (process, doin, doerr, &infd, &errfd); } static void -emacs_tty_unselect_process (Lisp_Process *process) +emacs_tty_unselect_process (Lisp_Process *process, int doin, int doerr) { - event_stream_unixoid_unselect_process (process); + int infd, errfd; + + event_stream_unixoid_unselect_process (process, doin, doerr, &infd, &errfd); } static void @@ -242,18 +246,29 @@ This could change. */ } -static USID -emacs_tty_create_stream_pair (void* inhandle, void* outhandle, - Lisp_Object* instream, Lisp_Object* outstream, int flags) -{ - return event_stream_unixoid_create_stream_pair - (inhandle, outhandle, instream, outstream, flags); +static void +emacs_tty_create_io_streams (void* inhandle, void* outhandle, + void *errhandle, Lisp_Object* instream, + Lisp_Object* outstream, + Lisp_Object* errstream, + USID* in_usid, + USID* err_usid, + int flags) +{ + event_stream_unixoid_create_io_streams + (inhandle, outhandle, errhandle, instream, outstream, + errstream, in_usid, err_usid, flags); } -static USID -emacs_tty_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream) +static void +emacs_tty_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID* in_usid, + USID* err_usid) { - return event_stream_unixoid_delete_stream_pair (instream, outstream); + event_stream_unixoid_delete_io_streams + (instream, outstream, errstream, in_usid, err_usid); } @@ -280,8 +295,8 @@ tty_event_stream->select_process_cb = emacs_tty_select_process; tty_event_stream->unselect_process_cb = emacs_tty_unselect_process; tty_event_stream->quit_p_cb = emacs_tty_quit_p; - tty_event_stream->create_stream_pair_cb = emacs_tty_create_stream_pair; - tty_event_stream->delete_stream_pair_cb = emacs_tty_delete_stream_pair; + tty_event_stream->create_io_streams_cb = emacs_tty_create_io_streams; + tty_event_stream->delete_io_streams_cb = emacs_tty_delete_io_streams; } void diff --text -u 'xemacs-21.5.6/src/event-unixoid.c' 'xemacs-21.5.7/src/event-unixoid.c' Index: ././src/event-unixoid.c --- ././src/event-unixoid.c Wed Apr 3 19:47:49 2002 +++ ././src/event-unixoid.c Fri Jun 21 06:18:29 2002 @@ -29,8 +29,8 @@ #include #include "lisp.h" -#include "console-stream.h" -#include "console-tty.h" +#include "console-stream-impl.h" +#include "console-tty-impl.h" #include "device.h" #include "events.h" #include "lstream.h" @@ -73,11 +73,11 @@ int read_event_from_tty_or_stream_desc (Lisp_Event *event, struct console *con) { - Emchar ch; + Ichar ch; Lisp_Object console = wrap_console (con); if (CONSOLE_TTY_P (con)) - ch = Lstream_get_emchar (XLSTREAM (CONSOLE_TTY_DATA (con)->instream)); + ch = Lstream_get_ichar (XLSTREAM (CONSOLE_TTY_DATA (con)->instream)); else { /* #### Definitely something strange here. We should be setting @@ -183,32 +183,71 @@ static int get_process_infd (Lisp_Process *p) { - Lisp_Object instr, outstr; - get_process_streams (p, &instr, &outstr); + Lisp_Object instr, outstr, errstr; + get_process_streams (p, &instr, &outstr, &errstr); assert (!NILP (instr)); return filedesc_stream_fd (XLSTREAM (instr)); } -int -event_stream_unixoid_select_process (Lisp_Process *proc) +static int +get_process_errfd (Lisp_Process *p) { - int infd = get_process_infd (proc); + Lisp_Object instr, outstr, errstr; + get_process_streams (p, &instr, &outstr, &errstr); + if (!NILP (errstr)) + return filedesc_stream_fd (XLSTREAM (errstr)); + else + return -1; +} - FD_SET (infd, &input_wait_mask); - FD_SET (infd, &non_fake_input_wait_mask); - FD_SET (infd, &process_only_mask); - return infd; +void +event_stream_unixoid_select_process (Lisp_Process *proc, int doin, int doerr, + int *infd, int *errfd) +{ + if (doin) + { + *infd = get_process_infd (proc); + FD_SET (*infd, &input_wait_mask); + FD_SET (*infd, &non_fake_input_wait_mask); + FD_SET (*infd, &process_only_mask); + } + + if (doerr) + { + *errfd = get_process_errfd (proc); + + if (*errfd >= 0) + { + FD_SET (*errfd, &input_wait_mask); + FD_SET (*errfd, &non_fake_input_wait_mask); + FD_SET (*errfd, &process_only_mask); + } + } } -int -event_stream_unixoid_unselect_process (Lisp_Process *proc) +void +event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin, int doerr, + int *infd, int *errfd) { - int infd = get_process_infd (proc); + if (doin) + { + *infd = get_process_infd (proc); + FD_CLR (*infd, &input_wait_mask); + FD_CLR (*infd, &non_fake_input_wait_mask); + FD_CLR (*infd, &process_only_mask); + } - FD_CLR (infd, &input_wait_mask); - FD_CLR (infd, &non_fake_input_wait_mask); - FD_CLR (infd, &process_only_mask); - return infd; + if (doerr) + { + *errfd = get_process_errfd (proc); + + if (*errfd >= 0) + { + FD_CLR (*errfd, &input_wait_mask); + FD_CLR (*errfd, &non_fake_input_wait_mask); + FD_CLR (*errfd, &process_only_mask); + } + } } int @@ -245,47 +284,22 @@ /* Unixoid (file descriptors based) process I/O streams routines */ /****************************************************************************/ -USID -event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, - Lisp_Object* instream, - Lisp_Object* outstream, - int flags) +void +event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle, + void *errhandle, Lisp_Object* instream, + Lisp_Object* outstream, + Lisp_Object* errstream, + USID* in_usid, + USID* err_usid, + int flags) { - int infd, outfd; + int infd, outfd, errfd; /* Decode inhandle and outhandle. Their meaning depends on the process implementation being used. */ -#if defined (HAVE_WIN32_PROCESSES) - /* We're passed in Windows handles. Open new fds for them */ - if ((HANDLE)inhandle != INVALID_HANDLE_VALUE) - { - infd = open_osfhandle ((HANDLE)inhandle, 0); - if (infd < 0) - return USID_ERROR; - } - else - infd = -1; - - if ((HANDLE)outhandle != INVALID_HANDLE_VALUE) - { - outfd = open_osfhandle ((HANDLE)outhandle, 0); - if (outfd < 0) - { - if (infd >= 0) - retry_close (infd); - return USID_ERROR; - } - } - else - outfd = -1; - - flags = 0; -#elif defined (HAVE_UNIX_PROCESSES) /* We are passed plain old file descs */ - infd = (int)inhandle; - outfd = (int)outhandle; -#else -# error Which processes do you have? -#endif + infd = (int) inhandle; + outfd = (int) outhandle; + errfd = (int) errhandle; *instream = (infd >= 0 ? make_filedesc_input_stream (infd, 0, -1, 0) @@ -295,34 +309,46 @@ ? make_filedesc_output_stream (outfd, 0, -1, LSTR_BLOCKED_OK) : Qnil); -#if defined(HAVE_UNIX_PROCESSES) + *errstream = (errfd >= 0 + ? make_filedesc_input_stream (errfd, 0, -1, 0) + : Qnil); + /* FLAGS is process->pty_flag for UNIX_PROCESSES */ if ((flags & STREAM_PTY_FLUSHING) && outfd >= 0) { - Intbyte eof_char = get_eof_char (outfd); + Ibyte eof_char = get_eof_char (outfd); int pty_max_bytes = get_pty_max_bytes (outfd); - filedesc_stream_set_pty_flushing (XLSTREAM(*outstream), pty_max_bytes, eof_char); + filedesc_stream_set_pty_flushing (XLSTREAM (*outstream), pty_max_bytes, + eof_char); } -#endif - return FD_TO_USID (infd); + *in_usid = FD_TO_USID (infd); + *err_usid = FD_TO_USID (errfd); } -USID -event_stream_unixoid_delete_stream_pair (Lisp_Object instream, - Lisp_Object outstream) +void +event_stream_unixoid_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID *in_usid, + USID *err_usid) { - int in = (NILP(instream) ? -1 + int in = (NILP (instream) ? -1 : filedesc_stream_fd (XLSTREAM (instream))); - int out = (NILP(outstream) ? -1 + int out = (NILP (outstream) ? -1 : filedesc_stream_fd (XLSTREAM (outstream))); + int err = (NILP (errstream) ? -1 + : filedesc_stream_fd (XLSTREAM (errstream))); if (in >= 0) retry_close (in); if (out != in && out >= 0) retry_close (out); + if (err != in && err != out && err >= 0) + retry_close (err); - return FD_TO_USID (in); + *in_usid = FD_TO_USID (in); + *err_usid = FD_TO_USID (err); } diff --text -u 'xemacs-21.5.6/src/events.c' 'xemacs-21.5.7/src/events.c' Index: ././src/events.c --- ././src/events.c Sun Mar 31 17:28:11 2002 +++ ././src/events.c Fri Jun 21 06:18:30 2002 @@ -31,7 +31,7 @@ #include "device.h" #include "extents.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "keymap.h" /* for key_desc_list_to_event() */ #include "lstream.h" @@ -39,7 +39,7 @@ #include "toolbar.h" #include "window.h" -#include "console-tty.h" /* for stuff in character_to_event */ +#include "console-tty-impl.h" /* for stuff in character_to_event */ /* Where old events go when they are explicitly deallocated. The event chain here is cut loose before GC, so these will be freed @@ -138,9 +138,9 @@ print_event_1 (const char *str, Lisp_Object obj, Lisp_Object printcharfun) { DECLARE_EISTRING_MALLOC (ei); - write_c_string (str, printcharfun); + write_c_string (printcharfun, str); format_event_object (ei, XEVENT (obj), 0); - write_eistring (ei, printcharfun); + write_eistring (printcharfun, ei); eifree (ei); } @@ -183,7 +183,7 @@ write_fmt_string_lisp (printcharfun, "#event.timeout.object); break; case empty_event: - write_c_string ("#event.misc.function); @@ -194,13 +194,13 @@ write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.eval.object); break; case dead_event: - write_c_string ("#", printcharfun); + write_c_string (printcharfun, ">"); } static int @@ -959,7 +959,7 @@ void -character_to_event (Emchar c, Lisp_Event *event, struct console *con, +character_to_event (Ichar c, Lisp_Event *event, struct console *con, int use_console_meta_flag, int do_backspace_mapping) { Lisp_Object k = Qnil; @@ -1038,13 +1038,13 @@ */ Lisp_Object Vcharacter_set_property; -Emchar +Ichar event_to_character (Lisp_Event *event, int allow_extra_modifiers, int allow_meta, int allow_non_ascii) { - Emchar c = 0; + Ichar c = 0; Lisp_Object code; if (event->event_type != key_press_event) @@ -1122,7 +1122,7 @@ */ (event, allow_extra_modifiers, allow_meta, allow_non_ascii)) { - Emchar c; + Ichar c; CHECK_LIVE_EVENT (event); c = event_to_character (XEVENT (event), !NILP (allow_extra_modifiers), @@ -1187,7 +1187,7 @@ if (STRINGP (seq)) { - Emchar ch = XSTRING_CHAR (seq, n); + Ichar ch = string_ichar (seq, n); Fcharacter_to_event (make_char (ch), event, Qnil, Qnil); } else @@ -1344,7 +1344,7 @@ #if 0 /* debugging functions */ -xxDEFUN ("event-next", Fevent_next, 1, 1, 0, /* +DEFUN ("event-next", Fevent_next, 1, 1, 0, /* Return the event object's `next' event, or nil if it has none. The `next-event' field is changed by calling `set-next-event'. */ @@ -1356,7 +1356,7 @@ return XEVENT_NEXT (event); } -xxDEFUN ("set-event-next", Fset_event_next, 2, 2, 0, /* +DEFUN ("set-event-next", Fset_event_next, 2, 2, 0, /* Set the `next event' of EVENT to NEXT-EVENT. NEXT-EVENT must be an event object or nil. */ diff --text -u 'xemacs-21.5.6/src/events.h' 'xemacs-21.5.7/src/events.h' Index: ././src/events.h --- ././src/events.h Fri Mar 29 13:47:28 2002 +++ ././src/events.h Wed Jun 5 18:55:29 2002 @@ -124,9 +124,9 @@ unselect_device_cb (those that use select() and file descriptors and have a separate input fd per device). - create_stream_pair_cb These callbacks are called by process code to - delete_stream_pair_cb create and delete a pair of input and output lstreams - which are used for subprocess I/O. + create_io_streams_cb These callbacks are called by process code to + delete_io_streams_cb create the input and output lstreams which are used + for subprocess I/O. quitp_cb A handler function called from the `QUIT' macro which should check whether the quit character has been @@ -160,7 +160,7 @@ In this case, the handles passed are unix file descriptors, and the code may deal with these directly. Although, the same code may be used on Win32 system with X-Windows. In this case, Win32 process implementation passes - handles of type HANDLE, and the create_stream_pair function must call + handles of type HANDLE, and the create_io_streams function must call appropriate function to get file descriptors given HANDLEs, so that these descriptors may be passed to XtAddInput. @@ -203,20 +203,25 @@ void (*remove_timeout_cb) (int); void (*select_console_cb) (struct console *); void (*unselect_console_cb) (struct console *); - void (*select_process_cb) (Lisp_Process *); - void (*unselect_process_cb) (Lisp_Process *); + void (*select_process_cb) (Lisp_Process *, int doin, int doerr); + void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr); void (*quit_p_cb) (void); void (*force_event_pending) (struct frame* f); - USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ , + void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ , + void * /* errhandle*/, Lisp_Object* /* instream */, Lisp_Object* /* outstream */, + Lisp_Object* /* errstream */, + USID * /* in_usid */, USID * /* err_usid */, int /* flags */); - USID (*delete_stream_pair_cb) (Lisp_Object /* instream */, - Lisp_Object /* outstream */); + void (*delete_io_streams_cb) (Lisp_Object /* instream */, + Lisp_Object /* outstream */, + Lisp_Object /* errstream */, + USID * /* in_usid */, USID * /* err_usid */); int (*current_event_timestamp_cb) (struct console *); }; -/* Flags for create_stream_pair_cb() FLAGS parameter */ +/* Flags for create_io_streams_cb() FLAGS parameter */ #define STREAM_PTY_FLUSHING 0x0001 #define STREAM_NETWORK_CONNECTION 0x0002 @@ -283,7 +288,7 @@ *ONLY* in alt_keychars for all control keys. What about the English speaker who temporarily switches to the French layout and finds C-q mapped to C-a?) */ - Emchar alt_keychars[KEYCHAR_LAST]; + Ichar alt_keychars[KEYCHAR_LAST]; #endif /* MULE */ }; @@ -585,13 +590,12 @@ then Alt generates XEMACS_MOD_META instead. */ -#ifdef emacs /* Maybe this should be trickier */ #define KEYSYM(x) (intern (x)) /* from events.c */ void format_event_object (Eistring *buf, Lisp_Event *event, int brief); -void character_to_event (Emchar c, Lisp_Event *event, +void character_to_event (Ichar c, Lisp_Event *event, struct console *con, int use_console_meta_flag, int do_backspace_mapping); @@ -616,25 +620,34 @@ (keyboard press, menu, scrollbar, mouse button) */ int command_event_p (Lisp_Object event); void define_self_inserting_symbol (Lisp_Object, Lisp_Object); -Emchar event_to_character (Lisp_Event *, int, int, int); +Ichar event_to_character (Lisp_Event *, int, int, int); struct console *event_console_or_selected (Lisp_Object event); /* from event-stream.c */ Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf); void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); -void event_stream_next_event (Lisp_Event *event); void event_stream_handle_magic_event (Lisp_Event *event); void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream); int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2); Hashcode event_stream_hash_magic_event (Lisp_Event *e); void event_stream_select_console (struct console *con); void event_stream_unselect_console (struct console *con); -void event_stream_select_process (Lisp_Process *proc); -void event_stream_unselect_process (Lisp_Process *proc); -USID event_stream_create_stream_pair (void* inhandle, void* outhandle, - Lisp_Object* instream, Lisp_Object* outstream, int flags); -USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream); +void event_stream_select_process (Lisp_Process *proc, int doin, int doerr); +void event_stream_unselect_process (Lisp_Process *proc, int doin, int doerr); +void event_stream_create_io_streams (void* inhandle, void* outhandle, + void *errhandle, Lisp_Object* instream, + Lisp_Object* outstream, + Lisp_Object* errstream, + USID* in_usid, + USID* err_usid, + int flags); +void event_stream_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID* in_usid, + USID* err_usid); void event_stream_quit_p (void); +void run_pre_idle_hook (void); struct low_level_timeout { @@ -695,16 +708,25 @@ int event_stream_unixoid_select_console (struct console *con); int event_stream_unixoid_unselect_console (struct console *con); -int event_stream_unixoid_select_process (Lisp_Process *proc); -int event_stream_unixoid_unselect_process (Lisp_Process *proc); +void event_stream_unixoid_select_process (Lisp_Process *proc, int doin, + int doerr, int *infd, int *errfd); +void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin, + int doerr, int *infd, int *errfd); int read_event_from_tty_or_stream_desc (Lisp_Event *event, struct console *con); -USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, - Lisp_Object* instream, - Lisp_Object* outstream, - int flags); -USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream, - Lisp_Object outstream); +void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle, + void *errhandle, + Lisp_Object* instream, + Lisp_Object* outstream, + Lisp_Object* errstream, + USID* in_usid, + USID* err_usid, + int flags); +void event_stream_unixoid_delete_io_streams (Lisp_Object instream, + Lisp_Object outstream, + Lisp_Object errstream, + USID* in_usid, + USID* err_usid); /* Beware: this evil macro evaluates its arg many times */ #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd))) @@ -715,7 +737,6 @@ first console is tty, even if HAVE_X_WINDOWS is defined */ /* #define DEBUG_TTY_EVENT_STREAM */ -#endif /* emacs */ /* #### a hack, until accelerator shit is cleaned up */ @@ -763,7 +784,7 @@ Lisp_Object first_mungeable_event; } munge_me[2]; - Intbyte *echo_buf; + Ibyte *echo_buf; Bytecount echo_buf_length; /* size of echo_buf */ Bytecount echo_buf_index; /* index into echo_buf * -1 before doing echoing for new cmd */ diff --text -u /dev/null 'xemacs-21.5.7/src/extents-impl.h' Index: ././src/extents-impl.h --- ././src/extents-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/extents-impl.h Fri Jun 21 06:18:30 2002 @@ -0,0 +1,293 @@ +/* Copyright (c) 1994, 1995 Free Software Foundation. + Copyright (c) 1995, 1996, 2002 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +#ifndef INCLUDED_extents_impl_h_ +#define INCLUDED_extents_impl_h_ + +#include "extents.h" + +struct extent +{ + struct lrecord_header lheader; + + Memxpos start; + Memxpos end; + Lisp_Object object; /* A buffer, string, Qnil (extent detached from no + buffer), Qt (destroyed extent) */ + + /* Extent properties are conceptually a plist, but the most common + props are implemented as bits instead of conses. */ + struct + { + Lisp_Object face; + + /* These flags are simply an optimization for common boolean properties + which go onto the extent's property list. Any of them would work if + done in the normal way, but the space savings of doing these in this + way is significant. Note that if you add a flag, there are numerous + places in extents.c that need to know about it. + + Another consideration is that some of these properties are accessed + during redisplay, so it's good for access to them to be fast (a bit + reference instead of a search down a plist). + + `begin_glyph_layout' and `end_glyph_layout' are unusual in that + they have 4 states instead of 2. + + Other special extent properties are stored in an auxiliary + structure that sits at the beginning of the plist. The has_aux + flag indicates whether this structure exists. The has_parent + flag is an optimization indicating whether the extent has a parent + (this could also be determined by looking in the aux structure). */ + + enum_field (glyph_layout) begin_glyph_layout :2; + /* 2 text, margins, or whitespace */ + enum_field (glyph_layout) end_glyph_layout :2; + /* 4 text, margins, or whitespace */ + unsigned int has_parent :1; /* 5 extent has a parent */ + unsigned int has_aux :1; /* 6 extent has an aux. structure */ + unsigned int start_open :1; /* 7 insertion behavior at start */ + unsigned int end_open :1; /* 8 insertion behavior at end */ + unsigned int unique :1; /* 9 there may be only one attached */ + unsigned int duplicable :1; /* 10 copied to strings by kill/undo */ + unsigned int detachable :1; /* 11 extent detaches if text deleted */ + unsigned int internal :1; /* 12 used by map-extents etc. */ + unsigned int in_red_event :1; /* 13 An event has been spawned for + initial redisplay. + (not exported to lisp) */ + unsigned int unused16 :1; /* 16 unused bits */ + /* --- Adding more flags will cause the extent struct to grow by another + word. It's not clear that this would make a difference, however, + because on 32-bit machines things tend to get allocated in chunks + of 4 bytes. */ + } flags; + /* The plist may have an auxiliary structure as its first element */ + Lisp_Object plist; +}; + +/* Basic properties of an extent (not affected by the extent's parent) */ +#define extent_object(e) ((e)->object) +#define extent_start(e) ((e)->start + 0) +#define extent_end(e) ((e)->end + 0) +#define set_extent_start(e, val) ((void) ((e)->start = (val))) +#define set_extent_end(e, val) ((void) ((e)->end = (val))) +#define extent_endpoint(e, endp) ((endp) ? extent_end (e) : extent_start (e)) +#define set_extent_endpoint(e, val, endp) \ + ((endp) ? set_extent_end (e, val) : set_extent_start (e, val)) +#define extent_detached_p(e) (extent_start (e) < 0) + +/* Additional information that may be present in an extent. The idea is + that fast access is provided to this information, but since (hopefully) + most extents won't have this set on them, we usually don't need to + have this structure around and thus the size of an extent is smaller. */ + +typedef struct extent_auxiliary extent_auxiliary; +struct extent_auxiliary +{ + struct lcrecord_header header; + + Lisp_Object begin_glyph; + Lisp_Object end_glyph; + Lisp_Object parent; + /* We use a weak list here. Originally I didn't do this and + depended on having the extent's finalization method remove + itself from its parent's children list. This runs into + lots and lots of problems though because everything is in + a really really bizarre state when an extent's finalization + method is called (it happens in sweep_extents() by way of + ADDITIONAL_FREE_extent()) and it's extremely difficult to + avoid getting hosed by just-freed objects. */ + Lisp_Object children; + Lisp_Object invisible; + Lisp_Object read_only; + Lisp_Object mouse_face; + Lisp_Object initial_redisplay_function; + Lisp_Object before_change_functions, after_change_functions; + int priority; +}; + +extern struct extent_auxiliary extent_auxiliary_defaults; + +struct extent_info +{ + struct lcrecord_header header; + + struct extent_list *extents; + struct stack_of_extents *soe; +}; + +/* A "normal" field is one that is stored in the `struct flags' structure + in an extent. an "aux" field is one that is stored in the extent's + auxiliary structure. + + The functions below that have `extent_no_chase' in their name operate + on an extent directly (ignoring its parent), and should normally + only be used on extents known not to have a parent. The other + versions chase down any parent links. */ + +#define extent_no_chase_normal_field(e, field) ((e)->flags.field) + +DECLARE_INLINE_HEADER ( +struct extent_auxiliary * +extent_aux_or_default (EXTENT e) +) +{ + return e->flags.has_aux ? + XEXTENT_AUXILIARY (XCAR (e->plist)) : + & extent_auxiliary_defaults; +} + +#define extent_no_chase_aux_field(e, field) (extent_aux_or_default(e)->field) + +#define extent_normal_field(e, field) \ + extent_no_chase_normal_field (extent_ancestor (e), field) + +#define extent_aux_field(e, field) \ + extent_no_chase_aux_field (extent_ancestor (e), field) + +#define set_extent_no_chase_aux_field(e, field, value) do { \ + EXTENT sencaf_e = (e); \ + if (! sencaf_e->flags.has_aux) \ + allocate_extent_auxiliary (sencaf_e); \ + XEXTENT_AUXILIARY (XCAR (sencaf_e->plist))->field = (value);\ +} while (0) + +#define set_extent_no_chase_normal_field(e, field, value) \ + extent_no_chase_normal_field (e, field) = (value) + +#define set_extent_aux_field(e, field, value) \ + set_extent_no_chase_aux_field (extent_ancestor (e), field, value) + +#define set_extent_normal_field(e, field, value) \ + set_extent_no_chase_normal_field (extent_ancestor (e), field, value) + +/* The `parent' and `children' fields are not affected by any + parent links. We don't provide any settors for these fields + because they need special handling and it's cleaner just to + do this in the particular functions that need to do this. */ + +#define extent_parent(e) extent_no_chase_aux_field (e, parent) +#define extent_children(e) extent_no_chase_aux_field (e, children) + +EXTENT extent_ancestor_1 (EXTENT e); + +/* extent_ancestor() chases all the parent links until there aren't any + more. extent_ancestor_1() does the same thing but it a function; + the following optimizes the most common case. */ +DECLARE_INLINE_HEADER ( +EXTENT +extent_ancestor (EXTENT e) +) +{ + return e->flags.has_parent ? extent_ancestor_1 (e) : e; +} + +#define extent_begin_glyph(e) extent_aux_field (e, begin_glyph) +#define extent_end_glyph(e) extent_aux_field (e, end_glyph) +#define extent_priority(e) extent_aux_field (e, priority) +#define extent_invisible(e) extent_aux_field (e, invisible) +#define extent_read_only(e) extent_aux_field (e, read_only) +#define extent_mouse_face(e) extent_aux_field (e, mouse_face) +#define extent_initial_redisplay_function(e) extent_aux_field (e, initial_redisplay_function) +#define extent_before_change_functions(e) extent_aux_field (e, before_change_functions) +#define extent_after_change_functions(e) extent_aux_field (e, after_change_functions) + +#define set_extent_begin_glyph(e, value) \ + set_extent_aux_field (e, begin_glyph, value) +#define set_extent_end_glyph(e, value) \ + set_extent_aux_field (e, end_glyph, value) +#define set_extent_priority(e, value) \ + set_extent_aux_field (e, priority, value) +#define set_extent_invisible_1(e, value) \ + set_extent_aux_field (e, invisible, value) +#define set_extent_read_only(e, value) \ + set_extent_aux_field (e, read_only, value) +#define set_extent_mouse_face(e, value) \ + set_extent_aux_field (e, mouse_face, value) +/* Use Fset_extent_initial_redisplay_function unless you know what you're doing */ +#define set_extent_initial_redisplay_function(e, value) \ + set_extent_aux_field (e, initial_redisplay_function, value) +#define set_extent_before_change_functions(e, value) \ + set_extent_aux_field (e, before_change_functions, value) +#define set_extent_after_change_functions(e, value) \ + set_extent_aux_field (e, after_change_functions, value) + +#define extent_face(e) extent_normal_field (e, face) +#define extent_begin_glyph_layout(e) ((enum glyph_layout) extent_normal_field (e, begin_glyph_layout)) +#define extent_end_glyph_layout(e) ((enum glyph_layout) extent_normal_field (e, end_glyph_layout)) +#define extent_start_open_p(e) extent_normal_field (e, start_open) +#define extent_end_open_p(e) extent_normal_field (e, end_open) +#define extent_unique_p(e) extent_normal_field (e, unique) +#define extent_duplicable_p(e) extent_normal_field (e, duplicable) +#define extent_detachable_p(e) extent_normal_field (e, detachable) +#define extent_internal_p(e) extent_normal_field (e, internal) +#define extent_in_red_event_p(e) extent_normal_field (e, in_red_event) + +#define set_extent_face(e, val) \ + set_extent_normal_field (e, face, val) +#define set_extent_begin_glyph_layout(e, val) \ + set_extent_normal_field (e, begin_glyph_layout, val) +#define set_extent_end_glyph_layout(e, val) \ + set_extent_normal_field (e, end_glyph_layout, val) +#define set_extent_start_open_p(e, val) \ + set_extent_normal_field (e, start_open, val) +#define set_extent_end_open_p(e, val) \ + set_extent_normal_field (e, end_open, val) +#define set_extent_unique_p(e, val) \ + set_extent_normal_field (e, unique, val) +#define set_extent_duplicable_p(e, val) \ + set_extent_normal_field (e, duplicable, val) +#define set_extent_detachable_p(e, val) \ + set_extent_normal_field (e, detachable, val) +#define set_extent_internal_p(e, val) \ + set_extent_normal_field (e, internal, val) +#define set_extent_in_red_event_p(e, val) \ + set_extent_normal_field (e, in_red_event, val) + +DECLARE_INLINE_HEADER ( +Lisp_Object * +extent_no_chase_plist_addr (EXTENT e) +) +{ + return e->flags.has_aux ? &XCDR (e->plist) : &e->plist; +} + +#define extent_no_chase_plist(e) (*extent_no_chase_plist_addr (e)) + +#define extent_plist_addr(e) extent_no_chase_plist_addr (extent_ancestor (e)) +#define extent_plist_slot(e) extent_no_chase_plist (extent_ancestor (e)) + + +#define EXTENT_LIVE_P(e) (!EQ (extent_object (e), Qt)) + +#define CHECK_LIVE_EXTENT(x) do { \ + CHECK_EXTENT (x); \ + if (!EXTENT_LIVE_P (XEXTENT (x))) \ + dead_wrong_type_argument (Qextent_live_p, (x)); \ +} while (0) +#define CONCHECK_LIVE_EXTENT(x) do { \ + CONCHECK_EXTENT (x); \ + if (!EXTENT_LIVE_P (XEXTENT (x))) \ + x = wrong_type_argument (Qextent_live_p, (x)); \ +} while (0) + +#endif /* INCLUDED_extents_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/extents.c' 'xemacs-21.5.7/src/extents.c' Index: ././src/extents.c --- ././src/extents.c Mon Apr 1 12:58:33 2002 +++ ././src/extents.c Fri Jun 21 06:18:30 2002 @@ -218,7 +218,7 @@ #include "debug.h" #include "device.h" #include "elhash.h" -#include "extents.h" +#include "extents-impl.h" #include "faces.h" #include "frame.h" #include "glyphs.h" @@ -265,7 +265,7 @@ /* Convert a "memory position" (i.e. taking the gap into account) into the address of the element at (i.e. after) that position. "Memory - positions" are only used internally and are of type Membpos. + positions" are only used internally and are of type Memxpos. "Array positions" are used externally and are of type int. */ #define GAP_ARRAY_MEMEL_ADDR(ga, memel) ((ga)->array + (ga)->elsize*(memel)) @@ -358,7 +358,7 @@ typedef struct stack_of_extents { Extent_List *extents; - Membpos pos; /* Position of stack of extents. EXTENTS is the list of + Memxpos pos; /* Position of stack of extents. EXTENTS is the list of all extents that overlap this position. This position can be -1 if the stack of extents is invalid (this happens when a buffer is first created or a string's @@ -370,31 +370,27 @@ /* map-extents */ /* ------------------------------- */ +typedef int (*map_extents_fun) (EXTENT extent, void *arg); + typedef int Endpoint_Index; -#define membpos_to_startind(x, start_open) \ +#define memxpos_to_startind(x, start_open) \ ((Endpoint_Index) (((x) << 1) + !!(start_open))) -#define membpos_to_endind(x, end_open) \ +#define memxpos_to_endind(x, end_open) \ ((Endpoint_Index) (((x) << 1) - !!(end_open))) -/* Combination macros */ -#define bytebpos_to_startind(buf, x, start_open) \ - membpos_to_startind (bytebpos_to_membpos (buf, x), start_open) -#define bytebpos_to_endind(buf, x, end_open) \ - membpos_to_endind (bytebpos_to_membpos (buf, x), end_open) - /* ------------------------------- */ /* buffer-or-string primitives */ /* ------------------------------- */ -/* Similar for Bytebposs and start/end indices. */ +/* Similar for Bytebpos's and start/end indices. */ -#define buffer_or_string_bytebpos_to_startind(obj, ind, start_open) \ - membpos_to_startind (buffer_or_string_bytebpos_to_membpos (obj, ind), \ +#define buffer_or_string_bytexpos_to_startind(obj, ind, start_open) \ + memxpos_to_startind (buffer_or_string_bytexpos_to_memxpos (obj, ind), \ start_open) -#define buffer_or_string_bytebpos_to_endind(obj, ind, end_open) \ - membpos_to_endind (buffer_or_string_bytebpos_to_membpos (obj, ind), \ +#define buffer_or_string_bytexpos_to_endind(obj, ind, end_open) \ + memxpos_to_endind (buffer_or_string_bytexpos_to_memxpos (obj, ind), \ end_open) /* ------------------------------- */ @@ -448,23 +444,26 @@ Lisp_Object Qcopy_function; Lisp_Object Qpaste_function; -/* The idea here is that if we're given a list of faces, we - need to "memoize" this so that two lists of faces that are `equal' - turn into the same object. When `set-extent-face' is called, we - "memoize" into a list of actual faces; when `extent-face' is called, - we do a reverse lookup to get the list of symbols. */ - static Lisp_Object canonicalize_extent_property (Lisp_Object prop, Lisp_Object value); + +typedef struct +{ + Lisp_Object key, value; +} Lisp_Object_pair; +typedef struct +{ + Dynarr_declare (Lisp_Object_pair); +} Lisp_Object_pair_dynarr; + +static void extent_properties (EXTENT e, Lisp_Object_pair_dynarr *props); + Lisp_Object Vextent_face_memoize_hash_table; Lisp_Object Vextent_face_reverse_memoize_hash_table; Lisp_Object Vextent_face_reusable_list; /* FSFmacs bogosity */ Lisp_Object Vdefault_text_properties; -EXFUN (Fextent_properties, 1); -EXFUN (Fset_extent_property, 3); - /* if true, we don't want to set any redisplay flags on modeline extent changes */ int in_modeline_generation; @@ -487,8 +486,8 @@ adjust_markers() in insdel.c. */ static void -gap_array_adjust_markers (Gap_Array *ga, Membpos from, - Membpos to, int amount) +gap_array_adjust_markers (Gap_Array *ga, Memxpos from, + Memxpos to, int amount) { Gap_Array_Marker *m; @@ -511,7 +510,7 @@ memmove (GAP_ARRAY_MEMEL_ADDR (ga, pos + gapsize), GAP_ARRAY_MEMEL_ADDR (ga, pos), (gap - pos)*ga->elsize); - gap_array_adjust_markers (ga, (Membpos) pos, (Membpos) gap, + gap_array_adjust_markers (ga, (Memxpos) pos, (Memxpos) gap, gapsize); } else if (pos > gap) @@ -519,8 +518,8 @@ memmove (GAP_ARRAY_MEMEL_ADDR (ga, gap), GAP_ARRAY_MEMEL_ADDR (ga, gap + gapsize), (pos - gap)*ga->elsize); - gap_array_adjust_markers (ga, (Membpos) (gap + gapsize), - (Membpos) (pos + gapsize), - gapsize); + gap_array_adjust_markers (ga, (Memxpos) (gap + gapsize), + (Memxpos) (pos + gapsize), - gapsize); } ga->gap = pos; } @@ -775,7 +774,7 @@ position at the beginning or end of the extent list is returned. */ static int -extent_list_locate_from_pos (Extent_List *el, Membpos pos, int endp) +extent_list_locate_from_pos (Extent_List *el, Memxpos pos, int endp) { struct extent fake_extent; /* @@ -799,7 +798,7 @@ /* Return the extent at POS. */ static EXTENT -extent_list_at (Extent_List *el, Membpos pos, int endp) +extent_list_at (Extent_List *el, Memxpos pos, int endp) { Gap_Array *ga = endp ? el->end : el->start; @@ -1299,9 +1298,9 @@ return; } sel = soe->extents; - printf ("SOE pos is %d (membpos %d)\n", + printf ("SOE pos is %d (memxpos %d)\n", soe->pos < 0 ? soe->pos : - buffer_or_string_membpos_to_bytebpos (obj, soe->pos), + buffer_or_string_memxpos_to_bytexpos (obj, soe->pos), soe->pos); for (endp = 0; endp < 2; endp++) { @@ -1376,7 +1375,7 @@ /* Move OBJ's stack of extents to lie over the specified position. */ static void -soe_move (Lisp_Object obj, Membpos pos) +soe_move (Lisp_Object obj, Memxpos pos) { Stack_Of_Extents *soe = buffer_or_string_stack_of_extents_force (obj); Extent_List *sel = soe->extents; @@ -1390,10 +1389,10 @@ #endif #ifdef SOE_DEBUG - printf ("Moving SOE from %d (membpos %d) to %d (membpos %d)\n", + printf ("Moving SOE from %d (memxpos %d) to %d (memxpos %d)\n", soe->pos < 0 ? soe->pos : - buffer_or_string_membpos_to_bytebpos (obj, soe->pos), soe->pos, - buffer_or_string_membpos_to_bytebpos (obj, pos), pos); + buffer_or_string_memxpos_to_bytexpos (obj, soe->pos), soe->pos, + buffer_or_string_memxpos_to_bytexpos (obj, pos), pos); #endif if (soe->pos < pos) { @@ -1534,43 +1533,126 @@ /* Return the start (endp == 0) or end (endp == 1) of an extent as a byte index. If you want the value as a memory index, use extent_endpoint(). If you want the value as a buffer position, - use extent_endpoint_charbpos(). */ + use extent_endpoint_char(). */ -static Bytebpos -extent_endpoint_bytebpos (EXTENT extent, int endp) +Bytexpos +extent_endpoint_byte (EXTENT extent, int endp) { assert (EXTENT_LIVE_P (extent)); assert (!extent_detached_p (extent)); { - Membpos i = endp ? extent_end (extent) : extent_start (extent); + Memxpos i = endp ? extent_end (extent) : extent_start (extent); Lisp_Object obj = extent_object (extent); - return buffer_or_string_membpos_to_bytebpos (obj, i); + return buffer_or_string_memxpos_to_bytexpos (obj, i); } } -static Charbpos -extent_endpoint_charbpos (EXTENT extent, int endp) +Charxpos +extent_endpoint_char (EXTENT extent, int endp) { assert (EXTENT_LIVE_P (extent)); assert (!extent_detached_p (extent)); { - Membpos i = endp ? extent_end (extent) : extent_start (extent); + Memxpos i = endp ? extent_end (extent) : extent_start (extent); Lisp_Object obj = extent_object (extent); - return buffer_or_string_membpos_to_charbpos (obj, i); + return buffer_or_string_memxpos_to_charxpos (obj, i); } } -/* A change to an extent occurred that will change the display, so - notify redisplay. Maybe also recurse over all the extent's - descendants. */ - static void -extent_changed_for_redisplay (EXTENT extent, int descendants_too, - int invisibility_change) +signal_single_extent_changed (EXTENT extent, Lisp_Object property, + Bytexpos old_start, Bytexpos old_end) { - Lisp_Object object; - Lisp_Object rest; + EXTENT anc = extent_ancestor (extent); + /* Redisplay checks */ + if (NILP (property) ? + (!NILP (extent_face (anc)) || + !NILP (extent_begin_glyph (anc)) || + !NILP (extent_end_glyph (anc)) || + !NILP (extent_mouse_face (anc)) || + !NILP (extent_invisible (anc)) || + !NILP (extent_initial_redisplay_function (anc))) : + EQ (property, Qface) || + EQ (property, Qmouse_face) || + EQ (property, Qbegin_glyph) || + EQ (property, Qend_glyph) || + EQ (property, Qbegin_glyph_layout) || + EQ (property, Qend_glyph_layout) || + EQ (property, Qinvisible) || + EQ (property, Qinitial_redisplay_function) || + EQ (property, Qpriority)) + { + Lisp_Object object = extent_object (extent); + + if (extent_detached_p (extent)) + return; + + else if (STRINGP (object)) + { + /* #### Changes to string extents can affect redisplay if they are + in the modeline or in the gutters. + + If the extent is in some generated-modeline-string: when we + change an extent in generated-modeline-string, this changes its + parent, which is in `modeline-format', so we should force the + modeline to be updated. But how to determine whether a string + is a `generated-modeline-string'? Looping through all buffers + is not very efficient. Should we add all + `generated-modeline-string' strings to a hash table? Maybe + efficiency is not the greatest concern here and there's no big + loss in looping over the buffers. + + If the extent is in a gutter we mark the gutter as + changed. This means (a) we can update extents in the gutters + when we need it. (b) we don't have to update the gutters when + only extents attached to buffers have changed. */ + + if (!in_modeline_generation) + MARK_EXTENTS_CHANGED; + gutter_extent_signal_changed_region_maybe + (object, extent_endpoint_char (extent, 0), + extent_endpoint_char (extent, 1)); + } + else if (BUFFERP (object)) + { + struct buffer *b; + b = XBUFFER (object); + BUF_FACECHANGE (b)++; + MARK_EXTENTS_CHANGED; + if (NILP (property) ? !NILP (extent_invisible (anc)) : + EQ (property, Qinvisible)) + MARK_CLIP_CHANGED; + buffer_extent_signal_changed_region + (b, extent_endpoint_char (extent, 0), + extent_endpoint_char (extent, 1)); + } + } + /* Check for syntax table property change */ + if (NILP (property) ? !NILP (Fextent_property (wrap_extent (extent), + Qsyntax_table, Qnil)) : + EQ (property, Qsyntax_table)) + signal_syntax_table_extent_changed (extent); +} + +/* Make note that a change has happened in EXTENT. The change was either + to a property or to the endpoints (but not both at once). If PROPERTY + is non-nil, the change happened to that property; otherwise, the change + happened to the endpoints, and the old ones are given. Currently, all + endpoints changes are in the form of two signals, a detach followed by + an attach, and when detaching, we are signalled before the extent is + detached. (You can distinguish a detach from an attach because the + latter has old_start == -1 and old_end == -1.) (#### We don't currently + give the old property. If someone needs that, this will have to + change.) KLUDGE: If PROPERTY is Qt, all properties may have changed + because the parent was changed. #### We need to handle this properly, by + mapping over properties. */ + +static void +signal_extent_changed (EXTENT extent, Lisp_Object property, + Bytexpos old_start, Bytexpos old_end, + int descendants_too) +{ /* we could easily encounter a detached extent while traversing the children, but we should never be able to encounter a dead extent. */ assert (EXTENT_LIVE_P (extent)); @@ -1581,82 +1663,24 @@ if (!NILP (children)) { - /* first mark all of the extent's children. We will lose big-time - if there are any circularities here, so we sure as hell better - ensure that there aren't. */ - LIST_LOOP (rest, XWEAK_LIST_LIST (children)) - extent_changed_for_redisplay (XEXTENT (XCAR (rest)), 1, - invisibility_change); + /* first process all of the extent's children. We will lose + big-time if there are any circularities here, so we sure as + hell better ensure that there aren't. */ + LIST_LOOP_2 (child, XWEAK_LIST_LIST (children)) + signal_extent_changed (XEXTENT (child), property, old_start, + old_end, descendants_too); } } - /* now mark the extent itself. */ - - object = extent_object (extent); - - if (extent_detached_p (extent)) - return; - - else if (STRINGP (object)) - { - /* #### Changes to string extents can affect redisplay if they are - in the modeline or in the gutters. - - If the extent is in some generated-modeline-string: when we - change an extent in generated-modeline-string, this changes its - parent, which is in `modeline-format', so we should force the - modeline to be updated. But how to determine whether a string - is a `generated-modeline-string'? Looping through all buffers - is not very efficient. Should we add all - `generated-modeline-string' strings to a hash table? Maybe - efficiency is not the greatest concern here and there's no big - loss in looping over the buffers. - - If the extent is in a gutter we mark the gutter as - changed. This means (a) we can update extents in the gutters - when we need it. (b) we don't have to update the gutters when - only extents attached to buffers have changed. */ - - if (!in_modeline_generation) - MARK_EXTENTS_CHANGED; - gutter_extent_signal_changed_region_maybe (object, - extent_endpoint_charbpos (extent, 0), - extent_endpoint_charbpos (extent, 1)); - } - else if (BUFFERP (object)) - { - struct buffer *b; - b = XBUFFER (object); - BUF_FACECHANGE (b)++; - MARK_EXTENTS_CHANGED; - if (invisibility_change) - MARK_CLIP_CHANGED; - buffer_extent_signal_changed_region (b, - extent_endpoint_charbpos (extent, 0), - extent_endpoint_charbpos (extent, 1)); - } + /* now process the extent itself. */ + signal_single_extent_changed (extent, property, old_start, old_end); } -/* A change to an extent occurred that might affect redisplay. - This is called when properties such as the endpoints, the layout, - or the priority changes. Redisplay will be affected only if - the extent has any displayable attributes. */ - static void -extent_maybe_changed_for_redisplay (EXTENT extent, int descendants_too, - int invisibility_change) +signal_extent_property_changed (EXTENT extent, Lisp_Object property, + int descendants_too) { - /* Retrieve the ancestor for efficiency */ - EXTENT anc = extent_ancestor (extent); - if (!NILP (extent_face (anc)) || - !NILP (extent_begin_glyph (anc)) || - !NILP (extent_end_glyph (anc)) || - !NILP (extent_mouse_face (anc)) || - !NILP (extent_invisible (anc)) || - !NILP (extent_initial_redisplay_function (anc)) || - invisibility_change) - extent_changed_for_redisplay (extent, descendants_too, - invisibility_change); + signal_extent_changed (extent, property, 0, 0, descendants_too); } static EXTENT @@ -1796,8 +1820,7 @@ extent_list_insert (el, extent); soe_insert (extent_object (extent), extent); /* only this extent changed */ - extent_maybe_changed_for_redisplay (extent, 0, - !NILP (extent_invisible (extent))); + signal_extent_changed (extent, Qnil, -1, -1, 0); } static void @@ -1810,8 +1833,10 @@ el = extent_extent_list (extent); /* call this before messing with the extent. */ - extent_maybe_changed_for_redisplay (extent, 0, - !NILP (extent_invisible (extent))); + signal_extent_changed (extent, Qnil, + extent_endpoint_byte (extent, 0), + extent_endpoint_char (extent, 0), + 0); extent_list_delete (el, extent); soe_delete (extent_object (extent), extent); set_extent_start (extent, -1); @@ -1828,7 +1853,7 @@ already been performed (see Fextent_in_region_p ()). */ static int -extent_in_region_p (EXTENT extent, Bytebpos from, Bytebpos to, +extent_in_region_p (EXTENT extent, Bytexpos from, Bytexpos to, unsigned int flags) { Lisp_Object obj = extent_object (extent); @@ -1864,11 +1889,12 @@ default: abort(); return 0; } - start = buffer_or_string_bytebpos_to_startind (obj, from, + start = buffer_or_string_bytexpos_to_startind (obj, from, flags & ME_START_OPEN); - end = buffer_or_string_bytebpos_to_endind (obj, to, ! (flags & ME_END_CLOSED)); - exs = membpos_to_startind (extent_start (extent), start_open); - exe = membpos_to_endind (extent_end (extent), end_open); + end = buffer_or_string_bytexpos_to_endind (obj, to, + ! (flags & ME_END_CLOSED)); + exs = memxpos_to_startind (extent_start (extent), start_open); + exe = memxpos_to_endind (extent_end (extent), end_open); /* It's easy to determine whether an extent lies *outside* the region -- just determine whether it's completely before @@ -1948,10 +1974,11 @@ static void -map_extents_bytebpos (Bytebpos from, Bytebpos to, map_extents_fun fn, void *arg, - Lisp_Object obj, EXTENT after, unsigned int flags) +map_extents (Bytexpos from, Bytexpos to, map_extents_fun fn, + void *arg, Lisp_Object obj, EXTENT after, + unsigned int flags) { - Membpos st, en; /* range we're mapping over */ + Memxpos st, en; /* range we're mapping over */ EXTENT range = 0; /* extent for this, if ME_MIGHT_MODIFY_TEXT */ Extent_List *el = 0; /* extent list we're iterating over */ Extent_List_Marker *posm = 0; /* marker for extent list, @@ -1979,8 +2006,8 @@ return; el = 0; - st = buffer_or_string_bytebpos_to_membpos (obj, from); - en = buffer_or_string_bytebpos_to_membpos (obj, to); + st = buffer_or_string_bytexpos_to_memxpos (obj, from); + en = buffer_or_string_bytexpos_to_memxpos (obj, to); if (flags & ME_MIGHT_MODIFY_TEXT) { @@ -2249,10 +2276,10 @@ obj2 = extent_object (e); if (extent_in_region_p (e, - buffer_or_string_membpos_to_bytebpos (obj2, - st), - buffer_or_string_membpos_to_bytebpos (obj2, - en), + buffer_or_string_memxpos_to_bytexpos (obj2, + st), + buffer_or_string_memxpos_to_bytexpos (obj2, + en), flags)) { if ((*fn)(e, arg)) @@ -2280,15 +2307,6 @@ } } -void -map_extents (Charbpos from, Charbpos to, map_extents_fun fn, - void *arg, Lisp_Object obj, EXTENT after, unsigned int flags) -{ - map_extents_bytebpos (buffer_or_string_charbpos_to_bytebpos (obj, from), - buffer_or_string_charbpos_to_bytebpos (obj, to), fn, arg, - obj, after, flags); -} - /* ------------------------------- */ /* adjust_extents() */ /* ------------------------------- */ @@ -2310,7 +2328,7 @@ so for safety we make it just look at the extent lists directly. */ void -adjust_extents (Lisp_Object obj, Membpos from, Membpos to, int amount) +adjust_extents (Lisp_Object obj, Memxpos from, Memxpos to, int amount) { int endp; int pos; @@ -2386,15 +2404,15 @@ */ void -adjust_extents_for_deletion (Lisp_Object object, Bytebpos from, - Bytebpos to, int gapsize, int numdel, +adjust_extents_for_deletion (Lisp_Object object, Bytexpos from, + Bytexpos to, int gapsize, int numdel, int movegapsize) { struct adjust_extents_for_deletion_arg closure; int i; - Membpos adjust_to = (Membpos) (to + gapsize); + Memxpos adjust_to = (Memxpos) (to + gapsize); Bytecount amount = - numdel - movegapsize; - Membpos oldsoe = 0, newsoe = 0; + Memxpos oldsoe = 0, newsoe = 0; Stack_Of_Extents *soe = buffer_or_string_stack_of_extents (object); #ifdef ERROR_CHECK_EXTENTS @@ -2407,12 +2425,12 @@ to muck with. If we do the mapping and adjusting together, things can get all screwed up. */ - map_extents_bytebpos (from, to, adjust_extents_for_deletion_mapper, - (void *) &closure, object, 0, - /* extent endpoints move like markers regardless - of their open/closeness. */ - ME_ALL_EXTENTS_CLOSED | ME_END_CLOSED | - ME_START_OR_END_IN_REGION | ME_INCLUDE_INTERNAL); + map_extents (from, to, adjust_extents_for_deletion_mapper, + (void *) &closure, object, 0, + /* extent endpoints move like markers regardless + of their open/closeness. */ + ME_ALL_EXTENTS_CLOSED | ME_END_CLOSED | + ME_START_OR_END_IN_REGION | ME_INCLUDE_INTERNAL); /* Old and new values for the SOE's position. (It gets adjusted @@ -2433,8 +2451,8 @@ for (i = 0; i < Dynarr_length (closure.list); i++) { EXTENT extent = Dynarr_at (closure.list, i); - Membpos new_start = extent_start (extent); - Membpos new_end = extent_end (extent); + Memxpos new_start = extent_start (extent); + Memxpos new_end = extent_end (extent); /* do_marker_adjustment() will not adjust values that should not be adjusted. We're passing the same funky arguments to @@ -2514,19 +2532,19 @@ the first run that begins after POS, or returns POS if there are no such runs. */ -static Bytebpos -extent_find_end_of_run (Lisp_Object obj, Bytebpos pos, int outside_accessible) +static Bytexpos +extent_find_end_of_run (Lisp_Object obj, Bytexpos pos, int outside_accessible) { Extent_List *sel; Extent_List *bel = buffer_or_string_extent_list (obj); - Bytebpos pos1, pos2; + Bytexpos pos1, pos2; int elind1, elind2; - Membpos mempos = buffer_or_string_bytebpos_to_membpos (obj, pos); - Bytebpos limit = outside_accessible ? + Memxpos mempos = buffer_or_string_bytexpos_to_memxpos (obj, pos); + Bytexpos limit = outside_accessible ? buffer_or_string_absolute_end_byte (obj) : - buffer_or_string_accessible_end_byte (obj); + buffer_or_string_accessible_end_byte (obj); - if (!bel || !extent_list_num_els(bel)) + if (!bel || !extent_list_num_els (bel)) return limit; sel = buffer_or_string_stack_of_extents_force (obj)->extents; @@ -2535,7 +2553,7 @@ /* Find the first start position after POS. */ elind1 = extent_list_locate_from_pos (bel, mempos+1, 0); if (elind1 < extent_list_num_els (bel)) - pos1 = buffer_or_string_membpos_to_bytebpos + pos1 = buffer_or_string_memxpos_to_bytexpos (obj, extent_start (extent_list_at (bel, elind1, 0))); else pos1 = limit; @@ -2545,7 +2563,7 @@ equal to POS1, so we just have to look in the SOE. */ elind2 = extent_list_locate_from_pos (sel, mempos+1, 1); if (elind2 < extent_list_num_els (sel)) - pos2 = buffer_or_string_membpos_to_bytebpos + pos2 = buffer_or_string_memxpos_to_bytexpos (obj, extent_end (extent_list_at (sel, elind2, 1))); else pos2 = limit; @@ -2553,18 +2571,18 @@ return min (min (pos1, pos2), limit); } -static Bytebpos -extent_find_beginning_of_run (Lisp_Object obj, Bytebpos pos, +static Bytexpos +extent_find_beginning_of_run (Lisp_Object obj, Bytexpos pos, int outside_accessible) { Extent_List *sel; Extent_List *bel = buffer_or_string_extent_list (obj); - Bytebpos pos1, pos2; + Bytexpos pos1, pos2; int elind1, elind2; - Membpos mempos = buffer_or_string_bytebpos_to_membpos (obj, pos); - Bytebpos limit = outside_accessible ? + Memxpos mempos = buffer_or_string_bytexpos_to_memxpos (obj, pos); + Bytexpos limit = outside_accessible ? buffer_or_string_absolute_begin_byte (obj) : - buffer_or_string_accessible_begin_byte (obj); + buffer_or_string_accessible_begin_byte (obj); if (!bel || !extent_list_num_els(bel)) return limit; @@ -2575,7 +2593,7 @@ /* Find the first end position before POS. */ elind1 = extent_list_locate_from_pos (bel, mempos, 1); if (elind1 > 0) - pos1 = buffer_or_string_membpos_to_bytebpos + pos1 = buffer_or_string_memxpos_to_bytexpos (obj, extent_end (extent_list_at (bel, elind1 - 1, 1))); else pos1 = limit; @@ -2585,7 +2603,7 @@ equal to POS1, so we just have to look in the SOE. */ elind2 = extent_list_locate_from_pos (sel, mempos, 0); if (elind2 > 0) - pos2 = buffer_or_string_membpos_to_bytebpos + pos2 = buffer_or_string_memxpos_to_bytexpos (obj, extent_start (extent_list_at (sel, elind2 - 1, 0))); else pos2 = limit; @@ -2754,14 +2772,15 @@ face_index extent_fragment_update (struct window *w, struct extent_fragment *ef, - Bytebpos pos) + Bytexpos pos, Lisp_Object last_glyph) { int i; + int seen_glyph = NILP (last_glyph) ? 1 : 0; Extent_List *sel = buffer_or_string_stack_of_extents_force (ef->object)->extents; EXTENT lhe = 0; struct extent dummy_lhe_extent; - Membpos mempos = buffer_or_string_bytebpos_to_membpos (ef->object, pos); + Memxpos mempos = buffer_or_string_bytexpos_to_memxpos (ef->object, pos); #ifdef ERROR_CHECK_EXTENTS assert (pos >= buffer_or_string_accessible_begin_byte (ef->object) @@ -2797,11 +2816,15 @@ if (extent_start (e) == mempos && !NILP (extent_begin_glyph (e))) { Lisp_Object glyph = extent_begin_glyph (e); - struct glyph_block gb; - - gb.glyph = glyph; - gb.extent = wrap_extent (e); - Dynarr_add (ef->begin_glyphs, gb); + if (seen_glyph) { + struct glyph_block gb; + + gb.glyph = glyph; + gb.extent = wrap_extent (e); + Dynarr_add (ef->begin_glyphs, gb); + } + else if (EQ (glyph, last_glyph)) + seen_glyph = 1; } } @@ -2812,11 +2835,15 @@ if (extent_end (e) == mempos && !NILP (extent_end_glyph (e))) { Lisp_Object glyph = extent_end_glyph (e); - struct glyph_block gb; + if (seen_glyph) { + struct glyph_block gb; - gb.glyph = glyph; - gb.extent = wrap_extent (e); - Dynarr_add (ef->end_glyphs, gb); + gb.glyph = glyph; + gb.extent = wrap_extent (e); + Dynarr_add (ef->end_glyphs, gb); + } + else if (EQ (glyph, last_glyph)) + seen_glyph = 1; } } @@ -2952,8 +2979,8 @@ strcpy (bp, "detached"); else sprintf (bp, "%ld, %ld", - (long) XINT (Fextent_start_position (obj)), - (long) XINT (Fextent_end_position (obj))); + XINT (Fextent_start_position (obj)), + XINT (Fextent_end_position (obj))); bp += strlen (bp); *bp++ = (extent_end_open_p (anc) ? ')': ']'); if (!NILP (extent_end_glyph (anc))) *bp++ = '*'; @@ -2970,7 +2997,7 @@ extent_duplicable_p (anc) || !NILP (extent_invisible (anc))) *bp++ = ' '; *bp = '\0'; - write_c_string (buf, printcharfun); + write_c_string (printcharfun, buf); tail = extent_plist_slot (anc); @@ -3032,13 +3059,13 @@ } if (!EXTENT_LIVE_P (XEXTENT (obj))) - write_c_string ("#"); - write_c_string ("#", printcharfun); + write_c_string (printcharfun, ">"); } static int @@ -3133,40 +3160,13 @@ static int extent_remprop (Lisp_Object obj, Lisp_Object prop) { - EXTENT ext = XEXTENT (obj); - - /* This list is taken from Fset_extent_property, and should be kept - in synch. */ - if (EQ (prop, Qread_only) - || EQ (prop, Qunique) - || EQ (prop, Qduplicable) - || EQ (prop, Qinvisible) - || EQ (prop, Qdetachable) - || EQ (prop, Qdetached) - || EQ (prop, Qdestroyed) - || EQ (prop, Qpriority) - || EQ (prop, Qface) - || EQ (prop, Qinitial_redisplay_function) - || EQ (prop, Qafter_change_functions) - || EQ (prop, Qbefore_change_functions) - || EQ (prop, Qmouse_face) - || EQ (prop, Qhighlight) - || EQ (prop, Qbegin_glyph_layout) - || EQ (prop, Qend_glyph_layout) - || EQ (prop, Qglyph_layout) - || EQ (prop, Qbegin_glyph) - || EQ (prop, Qend_glyph) - || EQ (prop, Qstart_open) - || EQ (prop, Qend_open) - || EQ (prop, Qstart_closed) - || EQ (prop, Qend_closed) - || EQ (prop, Qkeymap)) - { - /* #### Is this correct, anyway? */ - return -1; - } - - return external_remprop (extent_plist_addr (ext), prop, 0, ERROR_ME); + Lisp_Object retval = Fset_extent_property (obj, prop, Qunbound); + if (UNBOUNDP (retval)) + return -1; + else if (!NILP (retval)) + return 1; + else + return 0; } static Lisp_Object @@ -3248,7 +3248,7 @@ return extent; } -/* Note that the returned value is a buffer position, not a byte index. */ +/* Note that the returned value is a char position, not a byte position. */ static Lisp_Object extent_endpoint_external (Lisp_Object extent_obj, int endp) @@ -3258,7 +3258,7 @@ if (extent_detached_p (extent)) return Qnil; else - return make_int (extent_endpoint_charbpos (extent, endp)); + return make_int (extent_endpoint_char (extent, endp)); } DEFUN ("extentp", Fextentp, 1, 1, 0, /* @@ -3315,8 +3315,8 @@ (extent)) { EXTENT e = decode_extent (extent, DE_MUST_BE_ATTACHED); - return make_int (extent_endpoint_charbpos (e, 1) - - extent_endpoint_charbpos (e, 0)); + return make_int (extent_endpoint_char (e, 1) + - extent_endpoint_char (e, 0)); } DEFUN ("next-extent", Fnext_extent, 1, 1, 0, /* @@ -3419,11 +3419,11 @@ (pos, object)) { Lisp_Object obj = decode_buffer_or_string (object); - Bytebpos bpos; + Bytexpos xpos; - bpos = get_buffer_or_string_pos_byte (obj, pos, GB_ALLOW_PAST_ACCESSIBLE); - bpos = extent_find_end_of_run (obj, bpos, 1); - return make_int (buffer_or_string_bytebpos_to_charbpos (obj, bpos)); + xpos = get_buffer_or_string_pos_byte (obj, pos, GB_ALLOW_PAST_ACCESSIBLE); + xpos = extent_find_end_of_run (obj, xpos, 1); + return make_int (buffer_or_string_bytexpos_to_charxpos (obj, xpos)); } DEFUN ("previous-extent-change", Fprevious_extent_change, 1, 2, 0, /* @@ -3435,11 +3435,11 @@ (pos, object)) { Lisp_Object obj = decode_buffer_or_string (object); - Bytebpos bpos; + Bytexpos xpos; - bpos = get_buffer_or_string_pos_byte (obj, pos, GB_ALLOW_PAST_ACCESSIBLE); - bpos = extent_find_beginning_of_run (obj, bpos, 1); - return make_int (buffer_or_string_bytebpos_to_charbpos (obj, bpos)); + xpos = get_buffer_or_string_pos_byte (obj, pos, GB_ALLOW_PAST_ACCESSIBLE); + xpos = extent_find_beginning_of_run (obj, xpos, 1); + return make_int (buffer_or_string_bytexpos_to_charxpos (obj, xpos)); } @@ -3507,6 +3507,17 @@ XWEAK_LIST_LIST (children) = Fcons (child, XWEAK_LIST_LIST (children)); } + +static int +compare_key_value_pairs (const void *humpty, const void *dumpty) +{ + Lisp_Object_pair *foo = (Lisp_Object_pair *) humpty; + Lisp_Object_pair *bar = (Lisp_Object_pair *) dumpty; + if (EQ (foo->key, bar->key)) + return 0; + return !NILP (Fstring_lessp (foo->key, bar->key)) ? -1 : 1; +} + DEFUN ("set-extent-parent", Fset_extent_parent, 2, 2, 0, /* Set the parent of EXTENT to PARENT (may be nil). See `extent-parent'. @@ -3541,6 +3552,80 @@ } /* changing the parent also changes the properties of all children. */ { + Lisp_Object_pair_dynarr *oldprops, *newprops; + int i, orignewlength; + + /* perhaps there's a smarter way, but the following will work, + and it's O(N*log N): + + (1) get the old props. + (2) get the new props. + (3) sort both. + (4) loop through old props; if key not in new, add it, with value + Qunbound. + (5) vice-versa for new props. + (6) sort both again. + (7) now we have identical lists of keys; we run through and compare + the values. + + Of course in reality the number of properties will be low, so + an N^2 algorithm wouldn't be a problem, but the stuff below is just + as easy to write given the existence of qsort and bsearch. + */ + + oldprops = Dynarr_new (Lisp_Object_pair); + newprops = Dynarr_new (Lisp_Object_pair); + if (!NILP (cur_parent)) + extent_properties (XEXTENT (cur_parent), oldprops); + if (!NILP (parent)) + extent_properties (XEXTENT (parent), newprops); + + qsort (Dynarr_atp (oldprops, 0), Dynarr_length (oldprops), + sizeof (Lisp_Object_pair), compare_key_value_pairs); + qsort (Dynarr_atp (newprops, 0), Dynarr_length (newprops), + sizeof (Lisp_Object_pair), compare_key_value_pairs); + orignewlength = Dynarr_length (newprops); + for (i = 0; i < Dynarr_length (oldprops); i++) + { + if (!bsearch (Dynarr_atp (oldprops, i), Dynarr_atp (newprops, 0), + Dynarr_length (newprops), sizeof (Lisp_Object_pair), + compare_key_value_pairs)) + { + Lisp_Object_pair new; + new.key = Dynarr_at (oldprops, i).key; + new.value = Qunbound; + Dynarr_add (newprops, new); + } + } + for (i = 0; i < orignewlength; i++) + { + if (!Dynarr_length (oldprops) || !bsearch (Dynarr_atp (newprops, i), + Dynarr_atp (oldprops, 0), + Dynarr_length (oldprops), + sizeof (Lisp_Object_pair), + compare_key_value_pairs)) + { + Lisp_Object_pair new; + new.key = Dynarr_at (newprops, i).key; + new.value = Qunbound; + Dynarr_add (oldprops, new); + } + } + qsort (Dynarr_atp (oldprops, 0), Dynarr_length (oldprops), + sizeof (Lisp_Object_pair), compare_key_value_pairs); + qsort (Dynarr_atp (newprops, 0), Dynarr_length (newprops), + sizeof (Lisp_Object_pair), compare_key_value_pairs); + for (i = 0; i < Dynarr_length (oldprops); i++) + { + assert (EQ (Dynarr_at (oldprops, i).key, Dynarr_at (newprops, i).key)); + if (!EQ (Dynarr_at (oldprops, i).value, Dynarr_at (newprops, i).value)) + signal_extent_property_changed (e, Dynarr_at (oldprops, i).key, 1); + } + + Dynarr_free (oldprops); + Dynarr_free (newprops); +#if 0 + { int old_invis = (!NILP (cur_parent) && !NILP (extent_invisible (XEXTENT (cur_parent)))); int new_invis = (!NILP (parent) && @@ -3548,7 +3633,8 @@ extent_maybe_changed_for_redisplay (e, 1, new_invis != old_invis); } - +#endif /* 0 */ + } return Qnil; } @@ -3563,7 +3649,7 @@ */ static void -set_extent_endpoints_1 (EXTENT extent, Membpos start, Membpos end) +set_extent_endpoints_1 (EXTENT extent, Memxpos start, Memxpos end) { #ifdef ERROR_CHECK_EXTENTS Lisp_Object obj = extent_object (extent); @@ -3603,9 +3689,10 @@ OBJECT. (If OBJECT is nil, do not change the extent's object.) */ void -set_extent_endpoints (EXTENT extent, Bytebpos s, Bytebpos e, Lisp_Object object) +set_extent_endpoints (EXTENT extent, Bytexpos s, Bytexpos e, + Lisp_Object object) { - Membpos start, end; + Memxpos start, end; if (NILP (object)) { @@ -3619,9 +3706,9 @@ } start = s < 0 ? extent_start (extent) : - buffer_or_string_bytebpos_to_membpos (object, s); + buffer_or_string_bytexpos_to_memxpos (object, s); end = e < 0 ? extent_end (extent) : - buffer_or_string_bytebpos_to_membpos (object, e); + buffer_or_string_bytexpos_to_memxpos (object, e); set_extent_endpoints_1 (extent, start, end); } @@ -3629,15 +3716,19 @@ set_extent_openness (EXTENT extent, int start_open, int end_open) { if (start_open != -1) - extent_start_open_p (extent) = start_open; + { + extent_start_open_p (extent) = start_open; + signal_extent_property_changed (extent, Qstart_open, 1); + } if (end_open != -1) - extent_end_open_p (extent) = end_open; - /* changing the open/closedness of an extent does not affect - redisplay. */ + { + extent_end_open_p (extent) = end_open; + signal_extent_property_changed (extent, Qend_open, 1); + } } static EXTENT -make_extent_internal (Lisp_Object object, Bytebpos from, Bytebpos to) +make_extent (Lisp_Object object, Bytexpos from, Bytexpos to) { EXTENT extent; @@ -3646,8 +3737,10 @@ return extent; } +/* Copy ORIGINAL, changing it to span FROM,TO in OBJECT. */ + static EXTENT -copy_extent (EXTENT original, Bytebpos from, Bytebpos to, Lisp_Object object) +copy_extent (EXTENT original, Bytexpos from, Bytexpos to, Lisp_Object object) { EXTENT e; @@ -3729,11 +3822,11 @@ } else { - Bytebpos start, end; + Bytexpos start, end; get_buffer_or_string_range_byte (obj, from, to, &start, &end, GB_ALLOW_PAST_ACCESSIBLE); - extent_obj = wrap_extent (make_extent_internal (obj, start, end)); + extent_obj = wrap_extent (make_extent (obj, start, end)); } return extent_obj; } @@ -3811,7 +3904,7 @@ (extent, start, end, buffer_or_string)) { EXTENT ext; - Bytebpos s, e; + Bytexpos s, e; ext = decode_extent (extent, 0); @@ -3903,7 +3996,7 @@ */ (extent, from, to, flags)) { - Bytebpos start, end; + Bytexpos start, end; EXTENT ext = decode_extent (extent, DE_MUST_BE_ATTACHED); Lisp_Object obj = extent_object (ext); @@ -4026,7 +4119,7 @@ /* This function can GC */ struct slow_map_extents_arg closure; unsigned int me_flags; - Bytebpos start, end; + Bytexpos start, end; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; EXTENT after = 0; @@ -4061,10 +4154,10 @@ closure.property = property; closure.value = value; - map_extents_bytebpos (start, end, slow_map_extents_function, - (void *) &closure, object, after, - /* You never know what the user might do ... */ - me_flags | ME_MIGHT_CALL_ELISP); + map_extents (start, end, slow_map_extents_function, + (void *) &closure, object, after, + /* You never know what the user might do ... */ + me_flags | ME_MIGHT_CALL_ELISP); UNGCPRO; return closure.result; @@ -4086,9 +4179,9 @@ Lisp_Object result; Lisp_Object property; Lisp_Object value; - Bytebpos start_min; - Bytebpos prev_start; - Bytebpos prev_end; + Bytexpos start_min; + Bytexpos prev_start; + Bytexpos prev_end; }; static int @@ -4098,8 +4191,8 @@ struct slow_map_extent_children_arg *closure = (struct slow_map_extent_children_arg *) arg; Lisp_Object extent_obj; - Bytebpos start = extent_endpoint_bytebpos (extent, 0); - Bytebpos end = extent_endpoint_bytebpos (extent, 1); + Bytexpos start = extent_endpoint_byte (extent, 0); + Bytexpos end = extent_endpoint_byte (extent, 1); /* Make sure the extent starts inside the region of interest, rather than just overlaps it. */ @@ -4142,8 +4235,8 @@ buffer positions here. */ closure->start_min = -1; /* no need for this any more */ - closure->prev_start = extent_endpoint_bytebpos (extent, 0); - closure->prev_end = extent_endpoint_bytebpos (extent, 1); + closure->prev_start = extent_endpoint_byte (extent, 0); + closure->prev_end = extent_endpoint_byte (extent, 1); return !NILP (closure->result); } @@ -4167,7 +4260,7 @@ /* This function can GC */ struct slow_map_extent_children_arg closure; unsigned int me_flags; - Bytebpos start, end; + Bytexpos start, end; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; EXTENT after = 0; @@ -4204,10 +4297,10 @@ closure.start_min = start; closure.prev_start = -1; closure.prev_end = -1; - map_extents_bytebpos (start, end, slow_map_extent_children_function, - (void *) &closure, object, after, - /* You never know what the user might do ... */ - me_flags | ME_MIGHT_CALL_ELISP); + map_extents (start, end, slow_map_extent_children_function, + (void *) &closure, object, after, + /* You never know what the user might do ... */ + me_flags | ME_MIGHT_CALL_ELISP); UNGCPRO; return closure.result; @@ -4227,20 +4320,13 @@ struct extent_at_arg { Lisp_Object best_match; /* or list of extents */ - Membpos best_start; - Membpos best_end; + Memxpos best_start; + Memxpos best_end; Lisp_Object prop; EXTENT before; int all_extents; }; -enum extent_at_flag -{ - EXTENT_AT_AFTER, - EXTENT_AT_BEFORE, - EXTENT_AT_AT -}; - static enum extent_at_flag decode_extent_at_flag (Lisp_Object at_flag) { @@ -4309,9 +4395,10 @@ return 0; } -static Lisp_Object -extent_at_bytebpos (Bytebpos position, Lisp_Object object, Lisp_Object property, - EXTENT before, enum extent_at_flag at_flag, int all_extents) +Lisp_Object +extent_at (Bytexpos position, Lisp_Object object, + Lisp_Object property, EXTENT before, + enum extent_at_flag at_flag, int all_extents) { struct extent_at_arg closure; struct gcpro gcpro1; @@ -4338,10 +4425,12 @@ closure.all_extents = all_extents; GCPRO1 (closure.best_match); - map_extents_bytebpos (at_flag == EXTENT_AT_BEFORE ? position - 1 : position, - at_flag == EXTENT_AT_AFTER ? position + 1 : position, - extent_at_mapper, (void *) &closure, object, 0, - ME_START_OPEN | ME_ALL_EXTENTS_CLOSED); + map_extents (at_flag == EXTENT_AT_BEFORE ? prev_bytexpos (object, position) : + position, + at_flag == EXTENT_AT_AFTER ? next_bytexpos (object, position) : + position, + extent_at_mapper, (void *) &closure, object, 0, + ME_START_OPEN | ME_ALL_EXTENTS_CLOSED); if (all_extents) closure.best_match = Fnreverse (closure.best_match); UNGCPRO; @@ -4379,7 +4468,7 @@ */ (pos, object, property, before, at_flag)) { - Bytebpos position; + Bytexpos position; EXTENT before_extent; enum extent_at_flag fl; @@ -4393,7 +4482,7 @@ invalid_argument ("extent not in specified buffer or string", object); fl = decode_extent_at_flag (at_flag); - return extent_at_bytebpos (position, object, property, before_extent, fl, 0); + return extent_at (position, object, property, before_extent, fl, 0); } DEFUN ("extents-at", Fextents_at, 1, 5, 0, /* @@ -4429,7 +4518,7 @@ */ (pos, object, property, before, at_flag)) { - Bytebpos position; + Bytexpos position; EXTENT before_extent; enum extent_at_flag fl; @@ -4443,7 +4532,7 @@ invalid_argument ("extent not in specified buffer or string", object); fl = decode_extent_at_flag (at_flag); - return extent_at_bytebpos (position, object, property, before_extent, fl, 1); + return extent_at (position, object, property, before_extent, fl, 1); } /* ------------------------------- */ @@ -4458,8 +4547,8 @@ struct verify_extents_arg { Lisp_Object object; - Membpos start; - Membpos end; + Memxpos start; + Memxpos end; Lisp_Object iro; /* value of inhibit-read-only */ }; @@ -4499,7 +4588,7 @@ efficiency */ void -verify_extent_modification (Lisp_Object object, Bytebpos from, Bytebpos to, +verify_extent_modification (Lisp_Object object, Bytexpos from, Bytexpos to, Lisp_Object inhibit_read_only_value) { int closed; @@ -4514,12 +4603,12 @@ As far as I know, this doesn't currently occur in XEmacs. --ben */ closed = (from==to); closure.object = object; - closure.start = buffer_or_string_bytebpos_to_membpos (object, from); - closure.end = buffer_or_string_bytebpos_to_membpos (object, to); + closure.start = buffer_or_string_bytexpos_to_memxpos (object, from); + closure.end = buffer_or_string_bytexpos_to_memxpos (object, to); closure.iro = inhibit_read_only_value; - map_extents_bytebpos (from, to, verify_extent_mapper, (void *) &closure, - object, 0, closed ? ME_END_CLOSED : ME_START_OPEN); + map_extents (from, to, verify_extent_mapper, (void *) &closure, + object, 0, closed ? ME_END_CLOSED : ME_START_OPEN); } /* ------------------------------------ */ @@ -4528,7 +4617,7 @@ struct process_extents_for_insertion_arg { - Bytebpos opoint; + Bytexpos opoint; int length; Lisp_Object object; }; @@ -4543,8 +4632,8 @@ { struct process_extents_for_insertion_arg *closure = (struct process_extents_for_insertion_arg *) arg; - Membpos indice = buffer_or_string_bytebpos_to_membpos (closure->object, - closure->opoint); + Memxpos indice = buffer_or_string_bytexpos_to_memxpos (closure->object, + closure->opoint); /* When this function is called, one end of the newly-inserted text should be adjacent to some endpoint of the extent, or disjoint from it. If @@ -4579,8 +4668,8 @@ it. */ { - Membpos new_start = extent_start (extent); - Membpos new_end = extent_end (extent); + Memxpos new_start = extent_start (extent); + Memxpos new_end = extent_end (extent); if (indice == extent_start (extent) && extent_start_open_p (extent) /* zero-length () extents are exempt; see comment above. */ @@ -4597,7 +4686,7 @@ } void -process_extents_for_insertion (Lisp_Object object, Bytebpos opoint, +process_extents_for_insertion (Lisp_Object object, Bytexpos opoint, Bytecount length) { struct process_extents_for_insertion_arg closure; @@ -4606,11 +4695,11 @@ closure.length = length; closure.object = object; - map_extents_bytebpos (opoint, opoint + length, - process_extents_for_insertion_mapper, - (void *) &closure, object, 0, - ME_END_CLOSED | ME_MIGHT_MODIFY_EXTENTS | - ME_INCLUDE_INTERNAL); + map_extents (opoint, opoint + length, + process_extents_for_insertion_mapper, + (void *) &closure, object, 0, + ME_END_CLOSED | ME_MIGHT_MODIFY_EXTENTS | + ME_INCLUDE_INTERNAL); } /* ------------------------------------ */ @@ -4619,7 +4708,7 @@ struct process_extents_for_deletion_arg { - Membpos start, end; + Memxpos start, end; int destroy_included_extents; }; @@ -4657,26 +4746,28 @@ be a function process_extents_for_destruction(), #if 0'd out, that did the equivalent). */ void -process_extents_for_deletion (Lisp_Object object, Bytebpos from, - Bytebpos to, int destroy_them) +process_extents_for_deletion (Lisp_Object object, Bytexpos from, + Bytexpos to, int destroy_them) { struct process_extents_for_deletion_arg closure; - closure.start = buffer_or_string_bytebpos_to_membpos (object, from); - closure.end = buffer_or_string_bytebpos_to_membpos (object, to); + closure.start = buffer_or_string_bytexpos_to_memxpos (object, from); + closure.end = buffer_or_string_bytexpos_to_memxpos (object, to); closure.destroy_included_extents = destroy_them; - map_extents_bytebpos (from, to, process_extents_for_deletion_mapper, - (void *) &closure, object, 0, - ME_END_CLOSED | ME_MIGHT_MODIFY_EXTENTS); + map_extents (from, to, process_extents_for_deletion_mapper, + (void *) &closure, object, 0, + ME_END_CLOSED | ME_MIGHT_MODIFY_EXTENTS); } /* ------------------------------- */ /* report_extent_modification() */ /* ------------------------------- */ -struct report_extent_modification_closure { + +struct report_extent_modification_closure +{ Lisp_Object buffer; - Charbpos start, end; + Charxpos start, end; int afterp; int speccount; }; @@ -4712,7 +4803,7 @@ One confusing thing here is that our caller never actually calls unbind_to (closure.speccount). This is because - map_extents_bytebpos() unbinds before, and with a smaller + map_extents() unbinds before, and with a smaller speccount. The additional unbind_to_1() in report_extent_modification() would cause XEmacs to abort. */ if (closure->speccount == -1) @@ -4760,7 +4851,9 @@ closure.afterp = afterp; closure.speccount = -1; - map_extents (start, end, report_extent_modification_mapper, (void *)&closure, + map_extents (charbpos_to_bytebpos (XBUFFER (buffer), start), + charbpos_to_bytebpos (XBUFFER (buffer), end), + report_extent_modification_mapper, (void *)&closure, buffer, NULL, ME_MIGHT_CALL_ELISP); } @@ -4775,7 +4868,7 @@ if (!EQ (extent_invisible (extent), value)) { set_extent_invisible_1 (extent, value); - extent_changed_for_redisplay (extent, 1, 1); + signal_extent_property_changed (extent, Qinvisible, 1); } } @@ -4900,6 +4993,12 @@ } } +/* The idea here is that if we're given a list of faces, we + need to "memoize" this so that two lists of faces that are `equal' + turn into the same object. When `set-extent-face' is called, we + "memoize" into a list of actual faces; when `extent-face' is called, + we do a reverse lookup to get the list of symbols. */ + static Lisp_Object canonicalize_extent_property (Lisp_Object prop, Lisp_Object value) { @@ -4910,7 +5009,8 @@ } /* Do we need a lisp-level function ? */ -DEFUN ("set-extent-initial-redisplay-function", Fset_extent_initial_redisplay_function, +DEFUN ("set-extent-initial-redisplay-function", + Fset_extent_initial_redisplay_function, 2,2,0, /* Note: This feature is experimental! @@ -4922,14 +5022,14 @@ */ (extent, function)) { - EXTENT e = decode_extent(extent, DE_MUST_BE_ATTACHED); + /* #### This is totally broken. */ + EXTENT e = decode_extent (extent, DE_MUST_BE_ATTACHED); e = extent_ancestor (e); /* Is this needed? Macro also does chasing!*/ - set_extent_initial_redisplay_function(e,function); - extent_in_red_event_p(e) = 0; /* If the function changed we can spawn + set_extent_initial_redisplay_function (e, function); + extent_in_red_event_p (e) = 0; /* If the function changed we can spawn new events */ - extent_changed_for_redisplay(e,1,0); /* Do we need to mark children too ?*/ - + signal_extent_property_changed (e, Qinitial_redisplay_function, 1); return function; } @@ -4965,7 +5065,7 @@ face = memoize_extent_face_internal (face); extent_face (e) = face; - extent_changed_for_redisplay (e, 1, 0); + signal_extent_property_changed (e, Qface, 1); return orig_face; } @@ -5005,7 +5105,7 @@ face = memoize_extent_face_internal (face); set_extent_mouse_face (e, face); - extent_changed_for_redisplay (e, 1, 0); + signal_extent_property_changed (e, Qmouse_face, 1); return orig_face; } @@ -5020,14 +5120,16 @@ { set_extent_begin_glyph (extent, glyph); set_extent_begin_glyph_layout (extent, layout); + signal_extent_property_changed (extent, Qbegin_glyph, 1); + signal_extent_property_changed (extent, Qbegin_glyph_layout, 1); } else { set_extent_end_glyph (extent, glyph); set_extent_end_glyph_layout (extent, layout); + signal_extent_property_changed (extent, Qend_glyph, 1); + signal_extent_property_changed (extent, Qend_glyph_layout, 1); } - - extent_changed_for_redisplay (extent, 1, 0); } static Lisp_Object @@ -5122,7 +5224,7 @@ EXTENT e = decode_extent (extent, 0); e = extent_ancestor (e); set_extent_begin_glyph_layout (e, symbol_to_glyph_layout (layout)); - extent_maybe_changed_for_redisplay (e, 1, 0); + signal_extent_property_changed (e, Qbegin_glyph_layout, 1); return layout; } @@ -5135,7 +5237,7 @@ EXTENT e = decode_extent (extent, 0); e = extent_ancestor (e); set_extent_end_glyph_layout (e, symbol_to_glyph_layout (layout)); - extent_maybe_changed_for_redisplay (e, 1, 0); + signal_extent_property_changed (e, Qend_glyph_layout, 1); return layout; } @@ -5174,7 +5276,7 @@ CHECK_INT (priority); e = extent_ancestor (e); set_extent_priority (e, XINT (priority)); - extent_maybe_changed_for_redisplay (e, 1, 0); + signal_extent_property_changed (e, Qpriority, 1); return priority; } @@ -5333,28 +5435,82 @@ { /* This function can GC if property is `keymap' */ EXTENT e = decode_extent (extent, 0); + int signal_change = 0; + + /* If VALUE is unbound, the property is being removed through `remprop'. + Return Qunbound if removal disallowed, Qt if anything removed, + Qnil otherwise. */ + + /* Keep in synch with stuff below. */ + if (UNBOUNDP (value)) + { + int retval; + + if (EQ (property, Qread_only) + || EQ (property, Qunique) + || EQ (property, Qduplicable) + || EQ (property, Qinvisible) + || EQ (property, Qdetachable) + || EQ (property, Qdetached) + || EQ (property, Qdestroyed) + || EQ (property, Qpriority) + || EQ (property, Qface) + || EQ (property, Qinitial_redisplay_function) + || EQ (property, Qafter_change_functions) + || EQ (property, Qbefore_change_functions) + || EQ (property, Qmouse_face) + || EQ (property, Qhighlight) + || EQ (property, Qbegin_glyph_layout) + || EQ (property, Qend_glyph_layout) + || EQ (property, Qglyph_layout) + || EQ (property, Qbegin_glyph) + || EQ (property, Qend_glyph) + || EQ (property, Qstart_open) + || EQ (property, Qend_open) + || EQ (property, Qstart_closed) + || EQ (property, Qend_closed) + || EQ (property, Qkeymap)) + return Qunbound; + + retval = external_remprop (extent_plist_addr (e), property, 0, + ERROR_ME); + if (retval) + signal_extent_property_changed (e, property, 1); + return retval ? Qt : Qnil; + } if (EQ (property, Qread_only)) - set_extent_read_only (e, value); + { + set_extent_read_only (e, value); + signal_change = 1; + } else if (EQ (property, Qunique)) - extent_unique_p (e) = !NILP (value); + { + extent_unique_p (e) = !NILP (value); + signal_change = 1; + } else if (EQ (property, Qduplicable)) - extent_duplicable_p (e) = !NILP (value); + { + extent_duplicable_p (e) = !NILP (value); + signal_change = 1; + } else if (EQ (property, Qinvisible)) set_extent_invisible (e, value); else if (EQ (property, Qdetachable)) - extent_detachable_p (e) = !NILP (value); - + { + extent_detachable_p (e) = !NILP (value); + signal_change = 1; + } else if (EQ (property, Qdetached)) { if (NILP (value)) - invalid_operation ("can only set `detached' to t", Qunbound); + invalid_operation ("can only set `detached' to t", Qunbound); Fdetach_extent (extent); } else if (EQ (property, Qdestroyed)) { if (NILP (value)) - invalid_operation ("can only set `destroyed' to t", Qunbound); + invalid_operation ("can only set `destroyed' to t", Qunbound); Fdelete_extent (extent); } else if (EQ (property, Qpriority)) @@ -5364,9 +5520,15 @@ else if (EQ (property, Qinitial_redisplay_function)) Fset_extent_initial_redisplay_function (extent, value); else if (EQ (property, Qbefore_change_functions)) - set_extent_before_change_functions (e, value); + { + set_extent_before_change_functions (e, value); + signal_change = 1; + } else if (EQ (property, Qafter_change_functions)) - set_extent_after_change_functions (e, value); + { + set_extent_after_change_functions (e, value); + signal_change = 1; + } else if (EQ (property, Qmouse_face)) Fset_extent_mouse_face (extent, value); /* Obsolete: */ @@ -5400,8 +5562,11 @@ value = wrong_type_argument (Qkeymapp, value); external_plist_put (extent_plist_addr (e), property, value, 0, ERROR_ME); + signal_change = 1; } + if (signal_change) + signal_extent_property_changed (e, property, 1); return value; } @@ -5497,90 +5662,120 @@ } } -DEFUN ("extent-properties", Fextent_properties, 1, 1, 0, /* -Return a property list of the attributes of EXTENT. -Do not modify this list; use `set-extent-property' instead. -*/ - (extent)) +static void +extent_properties (EXTENT e, Lisp_Object_pair_dynarr *props) { - EXTENT e, anc; - Lisp_Object result, face, anc_obj; + Lisp_Object face, anc_obj; glyph_layout layout; + EXTENT anc; - CHECK_EXTENT (extent); - e = XEXTENT (extent); +#define ADD_PROP(miftaaH, maal) \ +do { \ + Lisp_Object_pair p; \ + p.key = miftaaH; \ + p.value = maal; \ + Dynarr_add (props, p); \ +} while (0) + if (!EXTENT_LIVE_P (e)) - return cons3 (Qdestroyed, Qt, Qnil); + { + ADD_PROP (Qdestroyed, Qt); + return; + } anc = extent_ancestor (e); anc_obj = wrap_extent (anc); /* For efficiency, use the ancestor for all properties except detached */ - - result = extent_plist_slot (anc); + { + EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, extent_plist_slot (anc)) + ADD_PROP (key, value); + } if (!NILP (face = Fextent_face (anc_obj))) - result = cons3 (Qface, face, result); + ADD_PROP (Qface, face); if (!NILP (face = Fextent_mouse_face (anc_obj))) - result = cons3 (Qmouse_face, face, result); + ADD_PROP (Qmouse_face, face); if ((layout = (glyph_layout) extent_begin_glyph_layout (anc)) != GL_TEXT) { Lisp_Object sym = glyph_layout_to_symbol (layout); - result = cons3 (Qglyph_layout, sym, result); /* compatibility */ - result = cons3 (Qbegin_glyph_layout, sym, result); + ADD_PROP (Qglyph_layout, sym); /* compatibility */ + ADD_PROP (Qbegin_glyph_layout, sym); } if ((layout = (glyph_layout) extent_end_glyph_layout (anc)) != GL_TEXT) - result = cons3 (Qend_glyph_layout, glyph_layout_to_symbol (layout), result); + ADD_PROP (Qend_glyph_layout, glyph_layout_to_symbol (layout)); if (!NILP (extent_end_glyph (anc))) - result = cons3 (Qend_glyph, extent_end_glyph (anc), result); + ADD_PROP (Qend_glyph, extent_end_glyph (anc)); if (!NILP (extent_begin_glyph (anc))) - result = cons3 (Qbegin_glyph, extent_begin_glyph (anc), result); + ADD_PROP (Qbegin_glyph, extent_begin_glyph (anc)); if (extent_priority (anc) != 0) - result = cons3 (Qpriority, make_int (extent_priority (anc)), result); + ADD_PROP (Qpriority, make_int (extent_priority (anc))); if (!NILP (extent_initial_redisplay_function (anc))) - result = cons3 (Qinitial_redisplay_function, - extent_initial_redisplay_function (anc), result); + ADD_PROP (Qinitial_redisplay_function, + extent_initial_redisplay_function (anc)); if (!NILP (extent_before_change_functions (anc))) - result = cons3 (Qbefore_change_functions, - extent_before_change_functions (anc), result); + ADD_PROP (Qbefore_change_functions, extent_before_change_functions (anc)); if (!NILP (extent_after_change_functions (anc))) - result = cons3 (Qafter_change_functions, - extent_after_change_functions (anc), result); + ADD_PROP (Qafter_change_functions, extent_after_change_functions (anc)); if (!NILP (extent_invisible (anc))) - result = cons3 (Qinvisible, extent_invisible (anc), result); + ADD_PROP (Qinvisible, extent_invisible (anc)); if (!NILP (extent_read_only (anc))) - result = cons3 (Qread_only, extent_read_only (anc), result); + ADD_PROP (Qread_only, extent_read_only (anc)); if (extent_normal_field (anc, end_open)) - result = cons3 (Qend_open, Qt, result); + ADD_PROP (Qend_open, Qt); if (extent_normal_field (anc, start_open)) - result = cons3 (Qstart_open, Qt, result); + ADD_PROP (Qstart_open, Qt); if (extent_normal_field (anc, detachable)) - result = cons3 (Qdetachable, Qt, result); + ADD_PROP (Qdetachable, Qt); if (extent_normal_field (anc, duplicable)) - result = cons3 (Qduplicable, Qt, result); + ADD_PROP (Qduplicable, Qt); if (extent_normal_field (anc, unique)) - result = cons3 (Qunique, Qt, result); + ADD_PROP (Qunique, Qt); /* detached is not an inherited property */ if (extent_detached_p (e)) - result = cons3 (Qdetached, Qt, result); + ADD_PROP (Qdetached, Qt); +#undef ADD_PROP +} + +DEFUN ("extent-properties", Fextent_properties, 1, 1, 0, /* +Return a property list of the attributes of EXTENT. +Do not modify this list; use `set-extent-property' instead. +*/ + (extent)) +{ + EXTENT e; + Lisp_Object result = Qnil; + Lisp_Object_pair_dynarr *props; + int i; + + CHECK_EXTENT (extent); + e = XEXTENT (extent); + props = Dynarr_new (Lisp_Object_pair); + extent_properties (e, props); + + for (i = 0; i < Dynarr_length (props); i++) + result = cons3 (Dynarr_at (props, i).key, Dynarr_at (props, i).value, + result); + + Dynarr_free (props); return result; } @@ -5604,14 +5799,16 @@ { /* do not recurse on descendants. Only one extent is highlighted at a time. */ - extent_changed_for_redisplay (XEXTENT (Vlast_highlighted_extent), 0, 0); + /* A bit of a lie. */ + signal_extent_property_changed (XEXTENT (Vlast_highlighted_extent), + Qface, 0); } Vlast_highlighted_extent = Qnil; if (!NILP (extent_obj) && BUFFERP (extent_object (XEXTENT (extent_obj))) && highlight_p) { - extent_changed_for_redisplay (XEXTENT (extent_obj), 0, 0); + signal_extent_property_changed (XEXTENT (extent_obj), Qface, 0); Vlast_highlighted_extent = extent_obj; } } @@ -5655,7 +5852,7 @@ /* copy/paste hooks */ static int -run_extent_copy_paste_internal (EXTENT e, Charbpos from, Charbpos to, +run_extent_copy_paste_internal (EXTENT e, Charxpos from, Charxpos to, Lisp_Object object, Lisp_Object prop) { @@ -5682,39 +5879,37 @@ } static int -run_extent_copy_function (EXTENT e, Bytebpos from, Bytebpos to) +run_extent_copy_function (EXTENT e, Bytexpos from, Bytexpos to) { Lisp_Object object = extent_object (e); /* This function can GC */ return run_extent_copy_paste_internal - (e, buffer_or_string_bytebpos_to_charbpos (object, from), - buffer_or_string_bytebpos_to_charbpos (object, to), object, + (e, buffer_or_string_bytexpos_to_charxpos (object, from), + buffer_or_string_bytexpos_to_charxpos (object, to), object, Qcopy_function); } static int -run_extent_paste_function (EXTENT e, Bytebpos from, Bytebpos to, +run_extent_paste_function (EXTENT e, Bytexpos from, Bytexpos to, Lisp_Object object) { /* This function can GC */ return run_extent_copy_paste_internal - (e, buffer_or_string_bytebpos_to_charbpos (object, from), - buffer_or_string_bytebpos_to_charbpos (object, to), object, + (e, buffer_or_string_bytexpos_to_charxpos (object, from), + buffer_or_string_bytexpos_to_charxpos (object, to), object, Qpaste_function); } -static void -update_extent (EXTENT extent, Bytebpos from, Bytebpos to) +static int +run_extent_paste_function_char (EXTENT e, Charxpos from, Charxpos to, + Lisp_Object object) { - set_extent_endpoints (extent, from, to, Qnil); + /* This function can GC */ + return run_extent_copy_paste_internal (e, from, to, object, Qpaste_function); } -/* Insert an extent, usually from the dup_list of a string which - has just been inserted. - This code does not handle the case of undo. - */ static Lisp_Object -insert_extent (EXTENT extent, Bytebpos new_start, Bytebpos new_end, +insert_extent (EXTENT extent, Bytexpos new_start, Bytexpos new_end, Lisp_Object object, int run_hooks) { /* This function can GC */ @@ -5728,12 +5923,12 @@ /* The paste-function said don't re-attach this extent here. */ return Qnil; else - update_extent (extent, new_start, new_end); + set_extent_endpoints (extent, new_start, new_end, Qnil); } else { - Bytebpos exstart = extent_endpoint_bytebpos (extent, 0); - Bytebpos exend = extent_endpoint_bytebpos (extent, 1); + Bytexpos exstart = extent_endpoint_byte (extent, 0); + Bytexpos exend = extent_endpoint_byte (extent, 1); if (exend < new_start || exstart > new_end) goto copy_it; @@ -5742,7 +5937,7 @@ new_start = min (exstart, new_start); new_end = max (exend, new_end); if (exstart != new_start || exend != new_end) - update_extent (extent, new_start, new_end); + set_extent_endpoints (extent, new_start, new_end, Qnil); } } @@ -5760,19 +5955,26 @@ DEFUN ("insert-extent", Finsert_extent, 1, 5, 0, /* Insert EXTENT from START to END in BUFFER-OR-STRING. BUFFER-OR-STRING defaults to the current buffer if omitted. -This operation does not insert any characters, -but otherwise acts as if there were a replicating extent whose -parent is EXTENT in some string that was just inserted. -Returns the newly-inserted extent. +If EXTENT is already on the same object, and overlaps or is adjacent to +the given range, its range is merely extended to include the new range. +Otherwise, a copy is made of the extent at the new position and object. +When a copy is made, the new extent is returned, copy/paste hooks are run, +and the change is noted for undo recording. When no copy is made, nil is +returned. See documentation on `detach-extent' for a discussion of undo +recording. + The fourth arg, NO-HOOKS, can be used to inhibit the running of the - extent's `paste-function' property if it has one. -See documentation on `detach-extent' for a discussion of undo recording. +extent's `paste-function' property if it has one. + +It's not really clear why this function exists any more. It was a holdover +from a much older implementation of extents, before extents could really +exist on strings. */ (extent, start, end, no_hooks, buffer_or_string)) { EXTENT ext = decode_extent (extent, 0); Lisp_Object copy; - Bytebpos s, e; + Bytexpos s, e; buffer_or_string = decode_buffer_or_string (buffer_or_string); get_buffer_or_string_range_byte (buffer_or_string, start, end, &s, &e, @@ -5792,7 +5994,7 @@ struct add_string_extents_arg { - Bytebpos from; + Bytexpos from; Bytecount length; Lisp_Object string; }; @@ -5803,8 +6005,8 @@ /* This function can GC */ struct add_string_extents_arg *closure = (struct add_string_extents_arg *) arg; - Bytecount start = extent_endpoint_bytebpos (extent, 0) - closure->from; - Bytecount end = extent_endpoint_bytebpos (extent, 1) - closure->from; + Bytecount start = extent_endpoint_byte (extent, 0) - closure->from; + Bytecount end = extent_endpoint_byte (extent, 1) - closure->from; if (extent_duplicable_p (extent)) { @@ -5824,29 +6026,94 @@ return 0; } +struct add_string_extents_the_hard_way_arg +{ + Charxpos from; + Charcount length; + Lisp_Object string; +}; + +static int +add_string_extents_the_hard_way_mapper (EXTENT extent, void *arg) +{ + /* This function can GC */ + struct add_string_extents_arg *closure = + (struct add_string_extents_arg *) arg; + Charcount start = extent_endpoint_char (extent, 0) - closure->from; + Charcount end = extent_endpoint_char (extent, 1) - closure->from; + + if (extent_duplicable_p (extent)) + { + start = max (start, 0); + end = min (end, closure->length); + + /* Run the copy-function to give an extent the option of + not being copied into the string (or kill ring). + */ + if (extent_duplicable_p (extent) && + !run_extent_copy_function (extent, start + closure->from, + end + closure->from)) + return 0; + copy_extent (extent, + string_index_char_to_byte (closure->string, start), + string_index_char_to_byte (closure->string, end), + closure->string); + } + + return 0; +} + /* Add the extents in buffer BUF from OPOINT to OPOINT+LENGTH to the string STRING. */ void -add_string_extents (Lisp_Object string, struct buffer *buf, Bytebpos opoint, +add_string_extents (Lisp_Object string, struct buffer *buf, Bytexpos opoint, Bytecount length) { /* This function can GC */ - struct add_string_extents_arg closure; struct gcpro gcpro1, gcpro2; Lisp_Object buffer; - closure.from = opoint; - closure.length = length; - closure.string = string; buffer = wrap_buffer (buf); GCPRO2 (buffer, string); - map_extents_bytebpos (opoint, opoint + length, add_string_extents_mapper, - (void *) &closure, buffer, 0, - /* ignore extents that just abut the region */ - ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | - /* we are calling E-Lisp (the extent's copy function) - so anything might happen */ - ME_MIGHT_CALL_ELISP); + + if (XSTRING_FORMAT (string) == BUF_FORMAT (buf)) + { + struct add_string_extents_arg closure; + closure.from = opoint; + closure.length = length; + closure.string = string; + map_extents (opoint, opoint + length, add_string_extents_mapper, + (void *) &closure, buffer, 0, + /* ignore extents that just abut the region */ + ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | + /* we are calling E-Lisp (the extent's copy function) + so anything might happen */ + ME_MIGHT_CALL_ELISP); + } + else + { + struct add_string_extents_the_hard_way_arg closure; + closure.from = bytebpos_to_charbpos (buf, opoint); + closure.length = (bytebpos_to_charbpos (buf, opoint + length) - + closure.from); + closure.string = string; + + /* If the string and buffer are in different formats, things get + tricky; the only reasonable way to do the operation is entirely in + char offsets, which are invariant to format changes. In practice, + this won't be time-consuming because the byte/char conversions are + mostly in the buffer, which will be in a fixed-width format. */ + map_extents (opoint, opoint + length, + add_string_extents_the_hard_way_mapper, + (void *) &closure, buffer, 0, + /* ignore extents that just abut the region */ + ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | + /* we are calling E-Lisp (the extent's copy function) + so anything might happen */ + ME_MIGHT_CALL_ELISP); + + } + UNGCPRO; } @@ -5854,7 +6121,7 @@ { Bytecount pos; Bytecount length; - Bytebpos opoint; + Bytexpos opoint; Lisp_Object buffer; }; @@ -5866,15 +6133,15 @@ (struct splice_in_string_extents_arg *) arg; /* BASE_START and BASE_END are the limits in the buffer of the string that was just inserted. - + NEW_START and NEW_END are the prospective buffer positions of the extent that is going into the buffer. */ - Bytebpos base_start = closure->opoint; - Bytebpos base_end = base_start + closure->length; - Bytebpos new_start = (base_start + extent_endpoint_bytebpos (extent, 0) - + Bytexpos base_start = closure->opoint; + Bytexpos base_end = base_start + closure->length; + Bytexpos new_start = (base_start + extent_endpoint_byte (extent, 0) - + closure->pos); + Bytexpos new_end = (base_start + extent_endpoint_byte (extent, 1) - closure->pos); - Bytebpos new_end = (base_start + extent_endpoint_bytebpos (extent, 1) - - closure->pos); if (new_start < base_start) new_start = base_start; @@ -5895,31 +6162,105 @@ return 0; } +struct splice_in_string_extents_the_hard_way_arg +{ + Charcount pos; + Charcount length; + Charxpos opoint; + Lisp_Object buffer; +}; + +static int +splice_in_string_extents_the_hard_way_mapper (EXTENT extent, void *arg) +{ + /* This function can GC */ + struct splice_in_string_extents_arg *closure = + (struct splice_in_string_extents_arg *) arg; + /* BASE_START and BASE_END are the limits in the buffer of the string + that was just inserted. + + NEW_START and NEW_END are the prospective buffer positions of the + extent that is going into the buffer. */ + Charxpos base_start = closure->opoint; + Charxpos base_end = base_start + closure->length; + Charxpos new_start = (base_start + extent_endpoint_char (extent, 0) - + closure->pos); + Charxpos new_end = (base_start + extent_endpoint_char (extent, 1) - + closure->pos); + + if (new_start < base_start) + new_start = base_start; + if (new_end > base_end) + new_end = base_end; + if (new_end <= new_start) + return 0; + + if (!extent_duplicable_p (extent)) + return 0; + + if (!inside_undo && + !run_extent_paste_function_char (extent, new_start, new_end, + closure->buffer)) + return 0; + copy_extent (extent, + charbpos_to_bytebpos (XBUFFER (closure->buffer), new_start), + charbpos_to_bytebpos (XBUFFER (closure->buffer), new_end), + closure->buffer); + + return 0; +} + /* We have just inserted a section of STRING (starting at POS, of length LENGTH) into buffer BUF at OPOINT. Do whatever is necessary to get the string's extents into the buffer. */ void splice_in_string_extents (Lisp_Object string, struct buffer *buf, - Bytebpos opoint, Bytecount length, Bytecount pos) + Bytexpos opoint, Bytecount length, Bytecount pos) { - struct splice_in_string_extents_arg closure; struct gcpro gcpro1, gcpro2; Lisp_Object buffer = wrap_buffer (buf); - closure.opoint = opoint; - closure.pos = pos; - closure.length = length; - closure.buffer = buffer; GCPRO2 (buffer, string); - map_extents_bytebpos (pos, pos + length, - splice_in_string_extents_mapper, - (void *) &closure, string, 0, - /* ignore extents that just abut the region */ - ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | - /* we are calling E-Lisp (the extent's copy function) - so anything might happen */ - ME_MIGHT_CALL_ELISP); + if (XSTRING_FORMAT (string) == BUF_FORMAT (buf)) + { + struct splice_in_string_extents_arg closure; + closure.opoint = opoint; + closure.pos = pos; + closure.length = length; + closure.buffer = buffer; + map_extents (pos, pos + length, + splice_in_string_extents_mapper, + (void *) &closure, string, 0, + /* ignore extents that just abut the region */ + ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | + /* we are calling E-Lisp (the extent's copy function) + so anything might happen */ + ME_MIGHT_CALL_ELISP); + } + else + { + struct splice_in_string_extents_the_hard_way_arg closure; + closure.opoint = bytebpos_to_charbpos (buf, opoint); + closure.pos = string_index_byte_to_char (string, pos); + closure.length = string_offset_byte_to_char_len (string, pos, length); + closure.buffer = buffer; + + /* If the string and buffer are in different formats, things get + tricky; the only reasonable way to do the operation is entirely in + char offsets, which are invariant to format changes. In practice, + this won't be time-consuming because the byte/char conversions are + mostly in the buffer, which will be in a fixed-width format. */ + map_extents (pos, pos + length, + splice_in_string_extents_the_hard_way_mapper, + (void *) &closure, string, 0, + /* ignore extents that just abut the region */ + ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | + /* we are calling E-Lisp (the extent's copy function) + so anything might happen */ + ME_MIGHT_CALL_ELISP); + + } UNGCPRO; } @@ -5944,8 +6285,8 @@ (struct copy_string_extents_arg *) arg; Bytecount old_start, old_end, new_start, new_end; - old_start = extent_endpoint_bytebpos (extent, 0); - old_end = extent_endpoint_bytebpos (extent, 1); + old_start = extent_endpoint_byte (extent, 0); + old_end = extent_endpoint_byte (extent, 1); old_start = max (closure->old_pos, old_start); old_end = min (closure->old_pos + closure->length, old_end); @@ -5978,14 +6319,14 @@ closure.new_string = new_string; closure.length = length; GCPRO2 (new_string, old_string); - map_extents_bytebpos (old_pos, old_pos + length, - copy_string_extents_mapper, - (void *) &closure, old_string, 0, - /* ignore extents that just abut the region */ - ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | - /* we are calling E-Lisp (the extent's copy function) - so anything might happen */ - ME_MIGHT_CALL_ELISP); + map_extents (old_pos, old_pos + length, + copy_string_extents_mapper, + (void *) &closure, old_string, 0, + /* ignore extents that just abut the region */ + ME_END_CLOSED | ME_ALL_EXTENTS_OPEN | + /* we are calling E-Lisp (the extent's copy function) + so anything might happen */ + ME_MIGHT_CALL_ELISP); UNGCPRO; } @@ -6007,24 +6348,29 @@ Lisp_Object Qtext_prop; Lisp_Object Qtext_prop_extent_paste_function; -static Lisp_Object -get_text_property_bytebpos (Bytebpos position, Lisp_Object prop, - Lisp_Object object, enum extent_at_flag fl, - int text_props_only) +/* Retrieve the value of the property PROP of the text at position POSITION + in OBJECT. TEXT-PROPS-ONLY means only look at extents with the + `text-prop' property, i.e. extents created by the text property + routines. Otherwise, all extents are examined. &&#### finish Note that + the default extent_at_flag is EXTENT_AT_DEFAULT (same as + EXTENT_AT_AFTER). */ +Lisp_Object +get_char_property (Bytexpos position, Lisp_Object prop, + Lisp_Object object, enum extent_at_flag fl, + int text_props_only) { Lisp_Object extent; /* text_props_only specifies whether we only consider text-property extents (those with the 'text-prop property set) or all extents. */ if (!text_props_only) - extent = extent_at_bytebpos (position, object, prop, 0, fl, 0); + extent = extent_at (position, object, prop, 0, fl, 0); else { EXTENT prior = 0; while (1) { - extent = extent_at_bytebpos (position, object, Qtext_prop, prior, - fl, 0); + extent = extent_at (position, object, Qtext_prop, prior, fl, 0); if (NILP (extent)) return Qnil; if (EQ (prop, Fextent_property (extent, Qtext_prop, Qnil))) @@ -6041,10 +6387,10 @@ } static Lisp_Object -get_text_property_1 (Lisp_Object pos, Lisp_Object prop, Lisp_Object object, - Lisp_Object at_flag, int text_props_only) +get_char_property_char (Lisp_Object pos, Lisp_Object prop, Lisp_Object object, + Lisp_Object at_flag, int text_props_only) { - Bytebpos position; + Bytexpos position; int invert = 0; object = decode_buffer_or_string (object); @@ -6068,9 +6414,9 @@ { Lisp_Object val = - get_text_property_bytebpos (position, prop, object, - decode_extent_at_flag (at_flag), - text_props_only); + get_char_property (position, prop, object, + decode_extent_at_flag (at_flag), + text_props_only); if (invert) val = NILP (val) ? Qt : Qnil; return val; @@ -6088,7 +6434,7 @@ */ (pos, prop, object, at_flag)) { - return get_text_property_1 (pos, prop, object, at_flag, 1); + return get_char_property_char (pos, prop, object, at_flag, 1); } DEFUN ("get-char-property", Fget_char_property, 2, 4, 0, /* @@ -6102,7 +6448,7 @@ */ (pos, prop, object, at_flag)) { - return get_text_property_1 (pos, prop, object, at_flag, 0); + return get_char_property_char (pos, prop, object, at_flag, 0); } /* About start/end-open/closed: @@ -6134,7 +6480,7 @@ struct put_text_prop_arg { Lisp_Object prop, value; /* The property and value we are storing */ - Bytebpos start, end; /* The region into which we are storing it */ + Bytexpos start, end; /* The region into which we are storing it */ Lisp_Object object; Lisp_Object the_extent; /* Our chosen extent; this is used for communication between subsequent passes. */ @@ -6148,9 +6494,9 @@ Lisp_Object object = closure->object; Lisp_Object value = closure->value; - Bytebpos e_start, e_end; - Bytebpos start = closure->start; - Bytebpos end = closure->end; + Bytexpos e_start, e_end; + Bytexpos start = closure->start; + Bytexpos end = closure->end; Lisp_Object extent, e_val; int is_eq; @@ -6164,8 +6510,8 @@ /* It's not for this property; do nothing. */ return 0; - e_start = extent_endpoint_bytebpos (e, 0); - e_end = extent_endpoint_bytebpos (e, 1); + e_start = extent_endpoint_byte (e, 0); + e_end = extent_endpoint_byte (e, 1); e_val = Fextent_property (extent, closure->prop, Qnil); is_eq = EQ (value, e_val); @@ -6179,18 +6525,19 @@ */ if (e_start != start || e_end != end) { - Bytebpos new_start = min (e_start, start); - Bytebpos new_end = max (e_end, end); + Bytexpos new_start = min (e_start, start); + Bytexpos new_end = max (e_end, end); set_extent_endpoints (e, new_start, new_end, Qnil); /* If we changed the endpoint, then we need to set its openness. */ set_extent_openness (e, new_start != e_start - ? !NILP (get_text_property_bytebpos + ? !NILP (get_char_property (start, Qstart_open, object, EXTENT_AT_AFTER, 1)) : -1, new_end != e_end - ? NILP (get_text_property_bytebpos - (end - 1, Qend_closed, object, + ? NILP (get_char_property + (prev_bytexpos (object, end), + Qend_closed, object, EXTENT_AT_AFTER, 1)) : -1); closure->changed_p = 1; @@ -6231,8 +6578,8 @@ the-extent to cover it, resulting in the minimum number of extents in the buffer. */ - Bytebpos the_start = extent_endpoint_bytebpos (te, 0); - Bytebpos the_end = extent_endpoint_bytebpos (te, 1); + Bytexpos the_start = extent_endpoint_byte (te, 0); + Bytexpos the_end = extent_endpoint_byte (te, 1); if (e_start != the_start && /* note AND not OR -- hmm, why is this the case? I think it's because the assumption that the text-property @@ -6242,8 +6589,8 @@ falsely marked. Is this bad? */ e_end != the_end) { - Bytebpos new_start = min (e_start, the_start); - Bytebpos new_end = max (e_end, the_end); + Bytexpos new_start = min (e_start, the_start); + Bytexpos new_end = max (e_end, the_end); set_extent_endpoints (te, new_start, new_end, Qnil); /* If we changed the endpoint, then we need to set its openness. We are setting the endpoint to be the same as @@ -6266,9 +6613,11 @@ if (e_end != start) { set_extent_endpoints (e, e_start, start, Qnil); - set_extent_openness (e, -1, NILP (get_text_property_bytebpos - (start - 1, Qend_closed, object, - EXTENT_AT_AFTER, 1))); + set_extent_openness (e, -1, + NILP (get_char_property + (prev_bytexpos (object, start), + Qend_closed, object, + EXTENT_AT_AFTER, 1))); closure->changed_p = 1; } } @@ -6280,7 +6629,7 @@ if (e_start != end) { set_extent_endpoints (e, end, e_end, Qnil); - set_extent_openness (e, !NILP (get_text_property_bytebpos + set_extent_openness (e, !NILP (get_char_property (end, Qstart_open, object, EXTENT_AT_AFTER, 1)), -1); closure->changed_p = 1; @@ -6291,11 +6640,12 @@ /* Otherwise, `extent' straddles the region. We need to split it. */ set_extent_endpoints (e, e_start, start, Qnil); - set_extent_openness (e, -1, NILP (get_text_property_bytebpos - (start - 1, Qend_closed, object, + set_extent_openness (e, -1, NILP (get_char_property + (prev_bytexpos (object, start), + Qend_closed, object, EXTENT_AT_AFTER, 1))); set_extent_openness (copy_extent (e, end, e_end, extent_object (e)), - !NILP (get_text_property_bytebpos + !NILP (get_char_property (end, Qstart_open, object, EXTENT_AT_AFTER, 1)), -1); closure->changed_p = 1; @@ -6308,13 +6658,13 @@ put_text_prop_openness_mapper (EXTENT e, void *arg) { struct put_text_prop_arg *closure = (struct put_text_prop_arg *) arg; - Bytebpos e_start, e_end; - Bytebpos start = closure->start; - Bytebpos end = closure->end; + Bytexpos e_start, e_end; + Bytexpos start = closure->start; + Bytexpos end = closure->end; Lisp_Object extent = wrap_extent (e); - e_start = extent_endpoint_bytebpos (e, 0); - e_end = extent_endpoint_bytebpos (e, 1); + e_start = extent_endpoint_byte (e, 0); + e_end = extent_endpoint_byte (e, 1); if (NILP (Fextent_property (extent, Qtext_prop, Qnil))) { @@ -6333,7 +6683,7 @@ } static int -put_text_prop (Bytebpos start, Bytebpos end, Lisp_Object object, +put_text_prop (Bytexpos start, Bytexpos end, Lisp_Object object, Lisp_Object prop, Lisp_Object value, int duplicable_p) { @@ -6366,25 +6716,36 @@ closure.changed_p = 0; closure.the_extent = Qnil; - map_extents_bytebpos (start, end, - put_text_prop_mapper, - (void *) &closure, object, 0, - /* get all extents that abut the region */ - ME_ALL_EXTENTS_CLOSED | ME_END_CLOSED | - /* it might QUIT or error if the user has - fucked with the extent plist. */ - /* #### dmoore - I think this should include - ME_MIGHT_MOVE_SOE, since the callback function - might recurse back into map_extents_bytebpos. */ - ME_MIGHT_THROW | - ME_MIGHT_MODIFY_EXTENTS); + map_extents (start, end, + put_text_prop_mapper, + (void *) &closure, object, 0, + /* get all extents that abut the region */ + ME_ALL_EXTENTS_CLOSED | ME_END_CLOSED | +#if 0 + /* it might move the SOE because the callback function calls + get_char_property(), which calls extent_at(), which calls + map_extents() + + #### this was comment out before, and nothing seemed broken; + #### but when I added the above comment and uncommented it, + #### text property operations (e.g. font-lock) suddenly + #### became *WAY* slow, and dominated font-lock, when a + #### single extent spanning the entire buffer + #### existed. --ben */ + ME_MIGHT_MOVE_SOE | +#endif + /* it might QUIT or error if the user has + fucked with the extent plist. */ + ME_MIGHT_THROW | + ME_MIGHT_MODIFY_EXTENTS); /* If we made it through the loop without reusing an extent (and we want there to be one) make it now. */ if (!NILP (value) && NILP (closure.the_extent)) { - Lisp_Object extent = wrap_extent (make_extent_internal (object, start, end)); + Lisp_Object extent = + wrap_extent (make_extent (object, start, end)); closure.changed_p = 1; Fset_extent_property (extent, Qtext_prop, prop); @@ -6396,22 +6757,22 @@ Qtext_prop_extent_paste_function); } set_extent_openness (XEXTENT (extent), - !NILP (get_text_property_bytebpos + !NILP (get_char_property (start, Qstart_open, object, EXTENT_AT_AFTER, 1)), - NILP (get_text_property_bytebpos - (end - 1, Qend_closed, object, + NILP (get_char_property + (prev_bytexpos (object, end), + Qend_closed, object, EXTENT_AT_AFTER, 1))); } if (EQ (prop, Qstart_open) || EQ (prop, Qend_closed)) { - map_extents_bytebpos (start, end, - put_text_prop_openness_mapper, - (void *) &closure, object, 0, - /* get all extents that abut the region */ - ME_ALL_EXTENTS_CLOSED | ME_END_CLOSED | - ME_MIGHT_MODIFY_EXTENTS); + map_extents (start, end, put_text_prop_openness_mapper, + (void *) &closure, object, 0, + /* get all extents that abut the region */ + ME_ALL_EXTENTS_CLOSED | ME_END_CLOSED | + ME_MIGHT_MODIFY_EXTENTS); } return closure.changed_p; @@ -6427,7 +6788,7 @@ (start, end, prop, value, object)) { /* This function can GC */ - Bytebpos s, e; + Bytexpos s, e; object = decode_buffer_or_string (object); get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); @@ -6447,7 +6808,7 @@ (start, end, prop, value, object)) { /* This function can GC */ - Bytebpos s, e; + Bytexpos s, e; object = decode_buffer_or_string (object); get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); @@ -6466,7 +6827,7 @@ { /* This function can GC */ int changed = 0; - Bytebpos s, e; + Bytexpos s, e; object = decode_buffer_or_string (object); get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); @@ -6494,7 +6855,7 @@ { /* This function can GC */ int changed = 0; - Bytebpos s, e; + Bytexpos s, e; object = decode_buffer_or_string (object); get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); @@ -6519,7 +6880,7 @@ { /* This function can GC */ int changed = 0; - Bytebpos s, e; + Bytexpos s, e; object = decode_buffer_or_string (object); get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); @@ -6572,49 +6933,61 @@ return Qnil; /* important! */ } -/* This function could easily be written in Lisp but the C code wants - to use it in connection with invisible extents (at least currently). - If this changes, consider moving this back into Lisp. */ - -DEFUN ("next-single-property-change", Fnext_single_property_change, - 2, 4, 0, /* -Return the position of next property change for a specific property. -Scans characters forward from POS till it finds a change in the PROP - property, then returns the position of the change. The optional third - argument OBJECT is the buffer or string to scan (defaults to the current - buffer). -The property values are compared with `eq'. -Return nil if the property is constant all the way to the end of OBJECT. -If the value is non-nil, it is a position greater than POS, never equal. - -If the optional fourth argument LIMIT is non-nil, don't search - past position LIMIT; return LIMIT if nothing is found before LIMIT. -If two or more extents with conflicting non-nil values for PROP overlap - a particular character, it is undefined which value is considered to be - the value of PROP. (Note that this situation will not happen if you always - use the text-property primitives.) -*/ - (pos, prop, object, limit)) +Bytexpos +next_single_property_change (Bytexpos pos, Lisp_Object prop, + Lisp_Object object, Bytexpos limit) { - Charbpos bpos; - Charbpos blim; Lisp_Object extent, value; int limit_was_nil; - object = decode_buffer_or_string (object); - bpos = get_buffer_or_string_pos_char (object, pos, 0); - if (NILP (limit)) + if (limit < 0) { - blim = buffer_or_string_accessible_end_char (object); + limit = buffer_or_string_accessible_end_byte (object); limit_was_nil = 1; } else + limit_was_nil = 0; + + extent = extent_at (pos, object, prop, 0, EXTENT_AT_AFTER, 0); + if (!NILP (extent)) + value = Fextent_property (extent, prop, Qnil); + else + value = Qnil; + + while (1) { - blim = get_buffer_or_string_pos_char (object, limit, 0); - limit_was_nil = 0; + pos = extent_find_end_of_run (object, pos, 1); + if (pos >= limit) + break; /* property is the same all the way to the end */ + extent = extent_at (pos, object, prop, 0, EXTENT_AT_AFTER, 0); + if ((NILP (extent) && !NILP (value)) || + (!NILP (extent) && !EQ (value, + Fextent_property (extent, prop, Qnil)))) + return pos; } - extent = Fextent_at (make_int (bpos), object, prop, Qnil, Qnil); + if (limit_was_nil) + return -1; + else + return limit; +} + +Bytexpos +previous_single_property_change (Bytexpos pos, Lisp_Object prop, + Lisp_Object object, Bytexpos limit) +{ + Lisp_Object extent, value; + int limit_was_nil; + + if (limit < 0) + { + limit = buffer_or_string_accessible_begin_byte (object); + limit_was_nil = 1; + } + else + limit_was_nil = 0; + + extent = extent_at (pos, object, prop, 0, EXTENT_AT_BEFORE, 0); if (!NILP (extent)) value = Fextent_property (extent, prop, Qnil); else @@ -6622,26 +6995,56 @@ while (1) { - bpos = XINT (Fnext_extent_change (make_int (bpos), object)); - if (bpos >= blim) + pos = extent_find_beginning_of_run (object, pos, 1); + if (pos <= limit) break; /* property is the same all the way to the end */ - extent = Fextent_at (make_int (bpos), object, prop, Qnil, Qnil); + extent = extent_at (pos, object, prop, 0, EXTENT_AT_BEFORE, 0); if ((NILP (extent) && !NILP (value)) || (!NILP (extent) && !EQ (value, Fextent_property (extent, prop, Qnil)))) - return make_int (bpos); + return pos; } - /* I think it's more sensible for this function to return nil always - in this situation and it used to do it this way, but it's been changed - for FSF compatibility. */ if (limit_was_nil) - return Qnil; + return -1; else - return make_int (blim); + return limit; } -/* See comment on previous function about why this is written in C. */ +DEFUN ("next-single-property-change", Fnext_single_property_change, + 2, 4, 0, /* +Return the position of next property change for a specific property. +Scans characters forward from POS till it finds a change in the PROP + property, then returns the position of the change. The optional third + argument OBJECT is the buffer or string to scan (defaults to the current + buffer). +The property values are compared with `eq'. +Return nil if the property is constant all the way to the end of OBJECT. +If the value is non-nil, it is a position greater than POS, never equal. + +If the optional fourth argument LIMIT is non-nil, don't search + past position LIMIT; return LIMIT if nothing is found before LIMIT. +If two or more extents with conflicting non-nil values for PROP overlap + a particular character, it is undefined which value is considered to be + the value of PROP. (Note that this situation will not happen if you always + use the text-property primitives.) +*/ + (pos, prop, object, limit)) +{ + Bytexpos xpos; + Bytexpos blim; + + object = decode_buffer_or_string (object); + xpos = get_buffer_or_string_pos_byte (object, pos, 0); + blim = !NILP (limit) ? get_buffer_or_string_pos_byte (object, limit, 0) : -1; + + blim = next_single_property_change (xpos, prop, object, blim); + + if (blim < 0) + return Qnil; + else + return make_int (buffer_or_string_bytexpos_to_charxpos (object, blim)); +} DEFUN ("previous-single-property-change", Fprevious_single_property_change, 2, 4, 0, /* @@ -6663,52 +7066,19 @@ */ (pos, prop, object, limit)) { - Charbpos bpos; - Charbpos blim; - Lisp_Object extent, value; - int limit_was_nil; + Bytexpos xpos; + Bytexpos blim; object = decode_buffer_or_string (object); - bpos = get_buffer_or_string_pos_char (object, pos, 0); - if (NILP (limit)) - { - blim = buffer_or_string_accessible_begin_char (object); - limit_was_nil = 1; - } - else - { - blim = get_buffer_or_string_pos_char (object, limit, 0); - limit_was_nil = 0; - } - - /* extent-at refers to the character AFTER bpos, but we want the - character before bpos. Thus the - 1. extent-at simply - returns nil on bogus positions, so not to worry. */ - extent = Fextent_at (make_int (bpos - 1), object, prop, Qnil, Qnil); - if (!NILP (extent)) - value = Fextent_property (extent, prop, Qnil); - else - value = Qnil; + xpos = get_buffer_or_string_pos_byte (object, pos, 0); + blim = !NILP (limit) ? get_buffer_or_string_pos_byte (object, limit, 0) : -1; - while (1) - { - bpos = XINT (Fprevious_extent_change (make_int (bpos), object)); - if (bpos <= blim) - break; /* property is the same all the way to the beginning */ - extent = Fextent_at (make_int (bpos - 1), object, prop, Qnil, Qnil); - if ((NILP (extent) && !NILP (value)) || - (!NILP (extent) && !EQ (value, - Fextent_property (extent, prop, Qnil)))) - return make_int (bpos); - } + blim = previous_single_property_change (xpos, prop, object, blim); - /* I think it's more sensible for this function to return nil always - in this situation and it used to do it this way, but it's been changed - for FSF compatibility. */ - if (limit_was_nil) + if (blim < 0) return Qnil; else - return make_int (blim); + return make_int (buffer_or_string_bytexpos_to_charxpos (object, blim)); } #ifdef MEMORY_USAGE_STATS diff --text -u 'xemacs-21.5.6/src/extents.h' 'xemacs-21.5.7/src/extents.h' Index: ././src/extents.h --- ././src/extents.h Fri Mar 29 13:47:30 2002 +++ ././src/extents.h Fri Jun 21 06:18:30 2002 @@ -1,5 +1,5 @@ /* Copyright (c) 1994, 1995 Free Software Foundation. - Copyright (c) 1995 Ben Wing. + Copyright (c) 1995, 1996, 2002 Ben Wing. This file is part of XEmacs. @@ -30,116 +30,7 @@ #define CHECK_EXTENT(x) CHECK_RECORD (x, extent) #define CONCHECK_EXTENT(x) CONCHECK_RECORD (x, extent) -/* the layouts for glyphs (extent->flags.glyph_layout). Must fit in 2 bits. */ -typedef enum glyph_layout -{ - GL_TEXT, - GL_OUTSIDE_MARGIN, - GL_INSIDE_MARGIN, - GL_WHITESPACE -} glyph_layout; - -struct extent -{ - struct lrecord_header lheader; - - Membpos start; - Membpos end; - Lisp_Object object; /* A buffer, string, Qnil (extent detached from no - buffer), Qt (destroyed extent) */ - - /* Extent properties are conceptually a plist, but the most common - props are implemented as bits instead of conses. */ - struct - { - Lisp_Object face; - - /* These flags are simply an optimization for common boolean properties - which go onto the extent's property list. Any of them would work if - done in the normal way, but the space savings of doing these in this - way is significant. Note that if you add a flag, there are numerous - places in extents.c that need to know about it. - - Another consideration is that some of these properties are accessed - during redisplay, so it's good for access to them to be fast (a bit - reference instead of a search down a plist). - - `begin_glyph_layout' and `end_glyph_layout' are unusual in that - they have 4 states instead of 2. - - Other special extent properties are stored in an auxiliary - structure that sits at the beginning of the plist. The has_aux - flag indicates whether this structure exists. The has_parent - flag is an optimization indicating whether the extent has a parent - (this could also be determined by looking in the aux structure). */ - - enum_field (glyph_layout) begin_glyph_layout :2; - /* 2 text, margins, or whitespace */ - enum_field (glyph_layout) end_glyph_layout :2; - /* 4 text, margins, or whitespace */ - unsigned int has_parent :1; /* 5 extent has a parent */ - unsigned int has_aux :1; /* 6 extent has an aux. structure */ - unsigned int start_open :1; /* 7 insertion behavior at start */ - unsigned int end_open :1; /* 8 insertion behavior at end */ - unsigned int unique :1; /* 9 there may be only one attached */ - unsigned int duplicable :1; /* 10 copied to strings by kill/undo */ - unsigned int detachable :1; /* 11 extent detaches if text deleted */ - unsigned int internal :1; /* 12 used by map-extents etc. */ - unsigned int in_red_event :1; /* 13 An event has been spawned for - initial redisplay. - (not exported to lisp) */ - unsigned int unused16 :1; /* 16 unused bits */ - /* --- Adding more flags will cause the extent struct to grow by another - word. It's not clear that this would make a difference, however, - because on 32-bit machines things tend to get allocated in chunks - of 4 bytes. */ - } flags; - /* The plist may have an auxiliary structure as its first element */ - Lisp_Object plist; -}; - -/* Basic properties of an extent (not affected by the extent's parent) */ -#define extent_object(e) ((e)->object) -#define extent_start(e) ((e)->start + 0) -#define extent_end(e) ((e)->end + 0) -#define set_extent_start(e, val) ((void) ((e)->start = (val))) -#define set_extent_end(e, val) ((void) ((e)->end = (val))) -#define extent_endpoint(e, endp) ((endp) ? extent_end (e) : extent_start (e)) -#define set_extent_endpoint(e, val, endp) \ - ((endp) ? set_extent_end (e, val) : set_extent_start (e, val)) -#define extent_detached_p(e) (extent_start (e) < 0) - -/* Additional information that may be present in an extent. The idea is - that fast access is provided to this information, but since (hopefully) - most extents won't have this set on them, we usually don't need to - have this structure around and thus the size of an extent is smaller. */ - -typedef struct extent_auxiliary extent_auxiliary; -struct extent_auxiliary -{ - struct lcrecord_header header; - - Lisp_Object begin_glyph; - Lisp_Object end_glyph; - Lisp_Object parent; - /* We use a weak list here. Originally I didn't do this and - depended on having the extent's finalization method remove - itself from its parent's children list. This runs into - lots and lots of problems though because everything is in - a really really bizarre state when an extent's finalization - method is called (it happens in sweep_extents() by way of - ADDITIONAL_FREE_extent()) and it's extremely difficult to - avoid getting hosed by just-freed objects. */ - Lisp_Object children; - Lisp_Object invisible; - Lisp_Object read_only; - Lisp_Object mouse_face; - Lisp_Object initial_redisplay_function; - Lisp_Object before_change_functions, after_change_functions; - int priority; -}; - -extern struct extent_auxiliary extent_auxiliary_defaults; +struct extent_auxiliary; DECLARE_LRECORD (extent_auxiliary, struct extent_auxiliary); #define XEXTENT_AUXILIARY(x) \ @@ -149,13 +40,7 @@ #define CHECK_EXTENT_AUXILIARY(x) CHECK_RECORD (x, extent_auxiliary) #define CONCHECK_EXTENT_AUXILIARY(x) CONCHECK_RECORD (x, extent_auxiliary) -struct extent_info -{ - struct lcrecord_header header; - - struct extent_list *extents; - struct stack_of_extents *soe; -}; +struct extent_info; DECLARE_LRECORD (extent_info, struct extent_info); #define XEXTENT_INFO(x) XRECORD (x, extent_info, struct extent_info) @@ -164,133 +49,26 @@ #define CHECK_EXTENT_INFO(x) CHECK_RECORD (x, extent_info) #define CONCHECK_EXTENT_INFO(x) CONCHECK_RECORD (x, extent_info) -void flush_cached_extent_info (Lisp_Object extent_info); - -/* A "normal" field is one that is stored in the `struct flags' structure - in an extent. an "aux" field is one that is stored in the extent's - auxiliary structure. - - The functions below that have `extent_no_chase' in their name operate - on an extent directly (ignoring its parent), and should normally - only be used on extents known not to have a parent. The other - versions chase down any parent links. */ - -#define extent_no_chase_normal_field(e, field) ((e)->flags.field) - -INLINE_HEADER struct extent_auxiliary *extent_aux_or_default (EXTENT e); -INLINE_HEADER struct extent_auxiliary * -extent_aux_or_default (EXTENT e) -{ - return e->flags.has_aux ? - XEXTENT_AUXILIARY (XCAR (e->plist)) : - & extent_auxiliary_defaults; -} - -#define extent_no_chase_aux_field(e, field) (extent_aux_or_default(e)->field) - -#define extent_normal_field(e, field) \ - extent_no_chase_normal_field (extent_ancestor (e), field) - -#define extent_aux_field(e, field) \ - extent_no_chase_aux_field (extent_ancestor (e), field) - -#define set_extent_no_chase_aux_field(e, field, value) do { \ - EXTENT sencaf_e = (e); \ - if (! sencaf_e->flags.has_aux) \ - allocate_extent_auxiliary (sencaf_e); \ - XEXTENT_AUXILIARY (XCAR (sencaf_e->plist))->field = (value);\ -} while (0) - -#define set_extent_no_chase_normal_field(e, field, value) \ - extent_no_chase_normal_field (e, field) = (value) - -#define set_extent_aux_field(e, field, value) \ - set_extent_no_chase_aux_field (extent_ancestor (e), field, value) - -#define set_extent_normal_field(e, field, value) \ - set_extent_no_chase_normal_field (extent_ancestor (e), field, value) - -/* The `parent' and `children' fields are not affected by any - parent links. We don't provide any settors for these fields - because they need special handling and it's cleaner just to - do this in the particular functions that need to do this. */ - -#define extent_parent(e) extent_no_chase_aux_field (e, parent) -#define extent_children(e) extent_no_chase_aux_field (e, children) - -#define extent_begin_glyph(e) extent_aux_field (e, begin_glyph) -#define extent_end_glyph(e) extent_aux_field (e, end_glyph) -#define extent_priority(e) extent_aux_field (e, priority) -#define extent_invisible(e) extent_aux_field (e, invisible) -#define extent_read_only(e) extent_aux_field (e, read_only) -#define extent_mouse_face(e) extent_aux_field (e, mouse_face) -#define extent_initial_redisplay_function(e) extent_aux_field (e, initial_redisplay_function) -#define extent_before_change_functions(e) extent_aux_field (e, before_change_functions) -#define extent_after_change_functions(e) extent_aux_field (e, after_change_functions) - -#define set_extent_begin_glyph(e, value) \ - set_extent_aux_field (e, begin_glyph, value) -#define set_extent_end_glyph(e, value) \ - set_extent_aux_field (e, end_glyph, value) -#define set_extent_priority(e, value) \ - set_extent_aux_field (e, priority, value) -#define set_extent_invisible_1(e, value) \ - set_extent_aux_field (e, invisible, value) -#define set_extent_read_only(e, value) \ - set_extent_aux_field (e, read_only, value) -#define set_extent_mouse_face(e, value) \ - set_extent_aux_field (e, mouse_face, value) -/* Use Fset_extent_initial_redisplay_function unless you know what you're doing */ -#define set_extent_initial_redisplay_function(e, value) \ - set_extent_aux_field (e, initial_redisplay_function, value) -#define set_extent_before_change_functions(e, value) \ - set_extent_aux_field (e, before_change_functions, value) -#define set_extent_after_change_functions(e, value) \ - set_extent_aux_field (e, after_change_functions, value) - -#define extent_face(e) extent_normal_field (e, face) -#define extent_begin_glyph_layout(e) ((enum glyph_layout) extent_normal_field (e, begin_glyph_layout)) -#define extent_end_glyph_layout(e) ((enum glyph_layout) extent_normal_field (e, end_glyph_layout)) -#define extent_start_open_p(e) extent_normal_field (e, start_open) -#define extent_end_open_p(e) extent_normal_field (e, end_open) -#define extent_unique_p(e) extent_normal_field (e, unique) -#define extent_duplicable_p(e) extent_normal_field (e, duplicable) -#define extent_detachable_p(e) extent_normal_field (e, detachable) -#define extent_internal_p(e) extent_normal_field (e, internal) -#define extent_in_red_event_p(e) extent_normal_field (e, in_red_event) - -#define set_extent_face(e, val) \ - set_extent_normal_field (e, face, val) -#define set_extent_begin_glyph_layout(e, val) \ - set_extent_normal_field (e, begin_glyph_layout, val) -#define set_extent_end_glyph_layout(e, val) \ - set_extent_normal_field (e, end_glyph_layout, val) -#define set_extent_start_open_p(e, val) \ - set_extent_normal_field (e, start_open, val) -#define set_extent_end_open_p(e, val) \ - set_extent_normal_field (e, end_open, val) -#define set_extent_unique_p(e, val) \ - set_extent_normal_field (e, unique, val) -#define set_extent_duplicable_p(e, val) \ - set_extent_normal_field (e, duplicable, val) -#define set_extent_detachable_p(e, val) \ - set_extent_normal_field (e, detachable, val) -#define set_extent_internal_p(e, val) \ - set_extent_normal_field (e, internal, val) -#define set_extent_in_red_event_p(e, val) \ - set_extent_normal_field (e, in_red_event, val) - -INLINE_HEADER Lisp_Object * extent_no_chase_plist_addr (EXTENT e); -INLINE_HEADER Lisp_Object * -extent_no_chase_plist_addr (EXTENT e) +/* the layouts for glyphs (extent->flags.glyph_layout). Must fit in 2 bits. */ +typedef enum glyph_layout { - return e->flags.has_aux ? &XCDR (e->plist) : &e->plist; -} + GL_TEXT, + GL_OUTSIDE_MARGIN, + GL_INSIDE_MARGIN, + GL_WHITESPACE +} glyph_layout; + +struct extent; + +void set_extent_endpoints (EXTENT extent, Bytexpos s, Bytexpos e, + Lisp_Object object); + + +void flush_cached_extent_info (Lisp_Object extent_info); -#define extent_no_chase_plist(e) (*extent_no_chase_plist_addr (e)) +void set_extent_glyph (EXTENT extent, Lisp_Object glyph, int endp, + glyph_layout layout); -#define extent_plist_addr(e) extent_no_chase_plist_addr (extent_ancestor (e)) -#define extent_plist_slot(e) extent_no_chase_plist (extent_ancestor (e)) /* flags for map_extents() and friends */ #define ME_END_CLOSED (1 << 0) @@ -316,100 +94,87 @@ ME_MIGHT_MODIFY_EXTENTS | ME_MIGHT_MOVE_SOE) -#define EXTENT_LIVE_P(e) (!EQ (extent_object (e), Qt)) +extern int inside_undo; +extern int in_modeline_generation; -#define CHECK_LIVE_EXTENT(x) do { \ - CHECK_EXTENT (x); \ - if (!EXTENT_LIVE_P (XEXTENT (x))) \ - dead_wrong_type_argument (Qextent_live_p, (x)); \ -} while (0) -#define CONCHECK_LIVE_EXTENT(x) do { \ - CONCHECK_EXTENT (x); \ - if (!EXTENT_LIVE_P (XEXTENT (x))) \ - x = wrong_type_argument (Qextent_live_p, (x)); \ -} while (0) +EXFUN (Fextent_at, 5); +EXFUN (Fextent_property, 3); +EXFUN (Fput_text_property, 5); EXFUN (Fdetach_extent, 1); EXFUN (Fextent_end_position, 1); EXFUN (Fextent_object, 1); +EXFUN (Fextent_properties, 1); EXFUN (Fextent_start_position, 1); +EXFUN (Fget_char_property, 4); EXFUN (Fmake_extent, 3); -EXFUN (Fprevious_single_property_change, 4); -EXFUN (Fset_extent_endpoints, 4); EXFUN (Fnext_extent_change, 2); EXFUN (Fprevious_extent_change, 2); +EXFUN (Fprevious_single_property_change, 4); +EXFUN (Fset_extent_endpoints, 4); EXFUN (Fset_extent_parent, 2); -EXFUN (Fget_char_property, 4); - -extern int inside_undo; -extern int in_modeline_generation; - -struct extent_fragment *extent_fragment_new (Lisp_Object buffer_or_string, - struct frame *frm); -face_index extent_fragment_update (struct window *w, - struct extent_fragment *ef, - /* Note this is in Bytebposs */ - Bytebpos pos); -void extent_fragment_delete (struct extent_fragment *ef); - - -#ifdef emacs /* things other than emacs want the structs */ - -/* from alloc.c */ -struct extent *allocate_extent (void); +EXFUN (Fset_extent_property, 3); -/* from extents.c */ -EXTENT extent_ancestor_1 (EXTENT e); - -/* extent_ancestor() chases all the parent links until there aren't any - more. extent_ancestor_1() does the same thing but it a function; - the following optimizes the most common case. */ -INLINE_HEADER EXTENT extent_ancestor (EXTENT e); -INLINE_HEADER EXTENT -extent_ancestor (EXTENT e) +enum extent_at_flag { - return e->flags.has_parent ? extent_ancestor_1 (e) : e; -} + EXTENT_AT_DEFAULT = 0, + EXTENT_AT_AFTER = 0, + EXTENT_AT_BEFORE, + EXTENT_AT_AT +}; -void allocate_extent_auxiliary (EXTENT ext); -void init_buffer_extents (struct buffer *b); -void uninit_buffer_extents (struct buffer *b); -typedef int (*map_extents_fun) (EXTENT extent, void *arg); -void map_extents (Charbpos from, Charbpos to, map_extents_fun fn, - void *arg, Lisp_Object obj, EXTENT after, - unsigned int flags); - -/* Note the following five functions are NOT in Charbpos's */ -void adjust_extents (Lisp_Object object, Membpos from, - Membpos to, int amount); -void adjust_extents_for_deletion (Lisp_Object object, Bytebpos from, - Bytebpos to, int gapsize, +Bytexpos extent_endpoint_byte (EXTENT extent, int endp); +Charxpos extent_endpoint_char (EXTENT extent, int endp); +Bytexpos next_single_property_change (Bytexpos pos, Lisp_Object prop, + Lisp_Object object, Bytexpos limit); +Bytexpos previous_single_property_change (Bytexpos pos, Lisp_Object prop, + Lisp_Object object, Bytexpos limit); +Lisp_Object get_char_property (Bytexpos position, Lisp_Object prop, + Lisp_Object object, enum extent_at_flag fl, + int text_props_only); +void adjust_extents (Lisp_Object object, Memxpos from, + Memxpos to, int amount); +void adjust_extents_for_deletion (Lisp_Object object, Bytexpos from, + Bytexpos to, int gapsize, int numdel, int movegapsize); -void verify_extent_modification (Lisp_Object object, Bytebpos from, - Bytebpos to, +void verify_extent_modification (Lisp_Object object, Bytexpos from, + Bytexpos to, Lisp_Object inhibit_read_only_value); void process_extents_for_insertion (Lisp_Object object, - Bytebpos opoint, Bytecount length); -void process_extents_for_deletion (Lisp_Object object, Bytebpos from, - Bytebpos to, int destroy_them); -void report_extent_modification (Lisp_Object, Charbpos, Charbpos, int); - -void set_extent_glyph (EXTENT extent, Lisp_Object glyph, int endp, - glyph_layout layout); - + Bytexpos opoint, Bytecount length); +void process_extents_for_deletion (Lisp_Object object, Bytexpos from, + Bytexpos to, int destroy_them); +/* Note the following function is in Charbpos's */ +void report_extent_modification (Lisp_Object buffer, Charbpos start, + Charbpos end, int afterp); void add_string_extents (Lisp_Object string, struct buffer *buf, - Bytebpos opoint, Bytecount length); + Bytexpos opoint, Bytecount length); void splice_in_string_extents (Lisp_Object string, struct buffer *buf, - Bytebpos opoint, Bytecount length, + Bytexpos opoint, Bytecount length, Bytecount pos); void copy_string_extents (Lisp_Object new_string, Lisp_Object old_string, Bytecount new_pos, Bytecount old_pos, Bytecount length); - void detach_all_extents (Lisp_Object object); -void set_extent_endpoints (EXTENT extent, Bytebpos s, Bytebpos e, - Lisp_Object object); +Lisp_Object extent_at (Bytexpos position, Lisp_Object object, + Lisp_Object property, EXTENT before, + enum extent_at_flag at_flag, int all_extents); + + +struct extent_fragment *extent_fragment_new (Lisp_Object buffer_or_string, + struct frame *frm); +face_index extent_fragment_update (struct window *w, + struct extent_fragment *ef, + Bytexpos pos, Lisp_Object last_glyph); +void extent_fragment_delete (struct extent_fragment *ef); + +/* from alloc.c */ +struct extent *allocate_extent (void); + +void allocate_extent_auxiliary (EXTENT ext); +void init_buffer_extents (struct buffer *b); +void uninit_buffer_extents (struct buffer *b); #ifdef ERROR_CHECK_EXTENTS void sledgehammer_extent_check (Lisp_Object obj); @@ -419,7 +184,5 @@ int compute_buffer_extent_usage (struct buffer *b, struct overhead_stats *ovstats); #endif - -#endif /* emacs */ #endif /* INCLUDED_extents_h_ */ diff --text -u 'xemacs-21.5.6/src/faces.c' 'xemacs-21.5.7/src/faces.c' Index: ././src/faces.c --- ././src/faces.c Sun Mar 31 17:28:13 2002 +++ ././src/faces.c Sun Jun 23 02:14:45 2002 @@ -30,13 +30,13 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" -#include "extents.h" +#include "extents-impl.h" /* for extent_face */ #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" -#include "objects.h" +#include "objects-impl.h" #include "specifier.h" #include "window.h" @@ -110,7 +110,7 @@ write_fmt_string_lisp (printcharfun, "#name); if (!NILP (face->doc_string)) write_fmt_string_lisp (printcharfun, " %S", 1, face->doc_string); - write_c_string (">", printcharfun); + write_c_string (printcharfun, ">"); } } @@ -497,8 +497,8 @@ struct face_inheritance_closure *fcl = (struct face_inheritance_closure *) face_inheritance_closure; - CVOID_TO_LISP (key, hash_key); - VOID_TO_LISP (contents, hash_contents); + key = VOID_TO_LISP (hash_key); + contents = VOID_TO_LISP (hash_contents); if (EQ (fcl->property, Qfont)) { @@ -553,9 +553,25 @@ Lisp_Object depth) { Lisp_Object retval; + Lisp_Object matchspec = Qunbound; + struct gcpro gcpro1; - retval = specifier_instance_no_quit (Fget (face, property, Qnil), charset, + if (!NILP (charset)) + matchspec = noseeum_cons (charset, Qnil); + GCPRO1 (matchspec); + retval = specifier_instance_no_quit (Fget (face, property, Qnil), matchspec, domain, errb, no_fallback, depth); + if (UNBOUNDP (retval)) + { + if (CONSP (matchspec)) + Fsetcdr (matchspec, Qt); + retval = specifier_instance_no_quit (Fget (face, property, Qnil), + matchspec, domain, errb, + no_fallback, depth); + } + UNGCPRO; + if (CONSP (matchspec)) + free_cons (matchspec); if (UNBOUNDP (retval) && !no_fallback) { @@ -866,9 +882,7 @@ /* When making the initial terminal device, there is no Lisp code loaded, so we can't do this. */ if (initialized && !noninteractive) - { - call_critical_lisp_code (d, Qinit_global_faces, Qnil); - } + call_critical_lisp_code (d, Qinit_global_faces, wrap_device (d)); } void @@ -879,11 +893,7 @@ /* When making the initial terminal device, there is no Lisp code loaded, so we can't do this. */ if (initialized) - { - Lisp_Object tdevice = wrap_device (d); - - call_critical_lisp_code (d, Qinit_device_faces, tdevice); - } + call_critical_lisp_code (d, Qinit_device_faces, wrap_device (d)); } void @@ -988,6 +998,7 @@ keep them in a chain, and use them to allocate new elements when possible instead of increasing the Dynarr. +--ben (?? At least I think I wrote this!) */ /* mark for GC a dynarr of face cachels. */ @@ -1110,7 +1121,7 @@ for (i = 0; i < NUM_LEADING_BYTES; i++) if (charsets[i]) { - Lisp_Object charset = CHARSET_BY_LEADING_BYTE (i + MIN_LEADING_BYTE); + Lisp_Object charset = charset_by_leading_byte (i + MIN_LEADING_BYTE); assert (CHARSETP (charset)); ensure_face_cachel_contains_charset (cachel, domain, charset); } @@ -1132,7 +1143,7 @@ { if (charsets[i]) { - Lisp_Object charset = CHARSET_BY_LEADING_BYTE (i + MIN_LEADING_BYTE); + Lisp_Object charset = charset_by_leading_byte (i + MIN_LEADING_BYTE); Lisp_Object font_instance = FACE_CACHEL_FONT (cachel, charset); Lisp_Font_Instance *fi = XFONT_INSTANCE (font_instance); @@ -1959,34 +1970,136 @@ { Lisp_Object inst_list = Qnil; -#if defined(HAVE_X_WINDOWS) || defined(HAVE_GTK) - /* This is kind of ugly because stephen wanted this to be CPP - ** identical to the old version, at least for the initial - ** checkin - ** - ** WMP March 9, 2001 - */ +#if defined (HAVE_X_WINDOWS) || defined (HAVE_GTK) - /* The same gory list from x-faces.el. - (#### Perhaps we should remove the stuff from x-faces.el - and only depend on this stuff here? That should work.) - */ const Char_ASCII *fonts[] = { + /************** ISO-8859 fonts *************/ + "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", - "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", + "-*-fixed-medium-r-*-*-*-120-*-*-*-*-iso8859-*" "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*", + "-*-fixed-*-r-*-*-*-120-*-*-*-*-iso8859-*" + /* Next try for any "medium" charcell or monospaced iso8859 font. */ "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*", "-*-*-medium-r-*-*-*-120-*-*-c-*-iso8859-*", + /* Next try for any charcell or monospaced iso8859 font. */ "-*-*-*-r-*-*-*-120-*-*-m-*-iso8859-*", "-*-*-*-r-*-*-*-120-*-*-c-*-iso8859-*", + + /* Repeat, any size */ + "-*-courier-medium-r-*-*-*-*-*-*-*-*-iso8859-*", + "-*-fixed-medium-r-*-*-*-*-*-*-*-*-iso8859-*" + "-*-courier-*-r-*-*-*-*-*-*-*-*-iso8859-*", + "-*-fixed-*-r-*-*-*-*-*-*-*-*-iso8859-*" + /* Next try for any "medium" charcell or monospaced iso8859 font. */ + "-*-*-medium-r-*-*-*-*-*-*-m-*-iso8859-*", + "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-*", + /* Next try for any charcell or monospaced iso8859 font. */ + "-*-*-*-r-*-*-*-*-*-*-m-*-iso8859-*", + "-*-*-*-r-*-*-*-*-*-*-c-*-iso8859-*", + + /* Non-proportional fonts -- last resort. */ "-*-*-*-r-*-*-*-120-*-*-*-*-iso8859-*", + "-*-*-*-r-*-*-*-*-*-*-*-*-iso8859-*", + "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-*", + + /************* Japanese fonts ************/ + + /* Following 3 fonts proposed by Teruhiko.Kurosaka@Japan.eng.sun */ + "-sun-gothic-medium-r-normal--14-120-75-75-c-60-jisx0201.1976-0", + "-sun-gothic-medium-r-normal--14-120-75-75-c-120-jisx0208.1983-0", + "-wadalab-gothic-medium-r-normal--14-120-75-75-c-120-jisx0212.1990-0", + + /* Other Japanese fonts */ + "-*-fixed-medium-r-*--*-jisx0201.1976-*", + "-*-fixed-medium-r-*--*-jisx0208.1983-*", + "-*-fixed-medium-r-*--*-jisx0212*-*", + "-*-*-*-r-*--*-jisx0201.1976-*", + "-*-*-*-r-*--*-jisx0208.1983-*", + "-*-*-*-r-*--*-jisx0212*-*", + + /************* Chinese fonts ************/ + + "-*-*-medium-r-*--*-gb2312.1980-*", + "-*-fixed-medium-r-*--*-cns11643*-*", + + "-*-fixed-medium-r-*--*-big5*-*," + "-*-fixed-medium-r-*--*-sisheng_cwnn-0", + + /************* Korean fonts *************/ + + "-*-mincho-medium-r-*--*-ksc5601.1987-*", + + /************* Thai fonts **************/ + + "-*-fixed-medium-r-*--*-tis620.2529-1", + + /************* Other fonts (nonstandard) *************/ + + "-*-fixed-medium-r-*--*-viscii1.1-1", + "-*-fixed-medium-r-*--*-mulearabic-*", + "-*-fixed-medium-r-*--*-muleipa-*", + "-*-fixed-medium-r-*--*-ethio-*", + + /************* Unicode fonts **************/ + + /* #### We don't yet support Unicode fonts, but doing so would not be + hard because all the machinery has already been added for Windows + support. We need to do this: + + (1) Add "stage 2" support in find_charset_font()/etc.; this finds + an appropriate Unicode font after all the charset-specific fonts + have been checked. This should look at the per-char font info and + check whether we have support for some of the chars in the + charset. (#### Bogus, but that's the way it currently works) + + (2) Record in the font instance a flag indicating when we're + dealing with a Unicode font. + + (3) Notice this flag in separate_textual_runs() and translate the + text into Unicode if so. + */ + + "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso10646-1", + "-*-fixed-medium-r-*-*-*-120-*-*-*-*-iso10646-1" + "-*-courier-*-r-*-*-*-120-*-*-*-*-iso10646-1", + "-*-fixed-*-r-*-*-*-120-*-*-*-*-iso10646-1" + /* Next try for any "medium" charcell or monospaced iso8859 font. */ + "-*-*-medium-r-*-*-*-120-*-*-m-*-iso10646-1", + "-*-*-medium-r-*-*-*-120-*-*-c-*-iso10646-1", + /* Next try for any charcell or monospaced iso8859 font. */ + "-*-*-*-r-*-*-*-120-*-*-m-*-iso10646-1", + "-*-*-*-r-*-*-*-120-*-*-c-*-iso10646-1", + + /* Repeat, any size */ + "-*-courier-medium-r-*-*-*-*-*-*-*-*-iso10646-1", + "-*-fixed-medium-r-*-*-*-*-*-*-*-*-iso10646-1" + "-*-courier-*-r-*-*-*-*-*-*-*-*-iso10646-1", + "-*-fixed-*-r-*-*-*-*-*-*-*-*-iso10646-1" + /* Next try for any "medium" charcell or monospaced iso8859 font. */ + "-*-*-medium-r-*-*-*-*-*-*-m-*-iso10646-1", + "-*-*-medium-r-*-*-*-*-*-*-c-*-iso10646-1", + /* Next try for any charcell or monospaced iso8859 font. */ + "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1", + "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1", + + /* Non-proportional fonts -- last resort. */ + "-*-*-*-r-*-*-*-120-*-*-*-*-iso10646-1", + "-*-*-*-r-*-*-*-*-*-*-*-*-iso10646-1", + "-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1", + + /*********** Last resort ***********/ + + /* Boy, we sure are losing now. Try the above, but in any encoding. */ "-*-*-medium-r-*-*-*-120-*-*-m-*-*-*", "-*-*-medium-r-*-*-*-120-*-*-c-*-*-*", "-*-*-*-r-*-*-*-120-*-*-m-*-*-*", "-*-*-*-r-*-*-*-120-*-*-c-*-*-*", + /* Hello? Please? */ "-*-*-*-r-*-*-*-120-*-*-*-*-*-*", "-*-*-*-*-*-*-*-120-*-*-*-*-*-*", + "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", "*" }; const Char_ASCII **fontptr; @@ -2013,8 +2126,6 @@ { const Char_ASCII *mswfonts[] = { - "Courier New:Regular:10::Western", - "Courier:Regular:10::Western", "Courier New:Regular:10::", "Courier:Regular:10::", ":Regular:10::" diff --text -u 'xemacs-21.5.6/src/file-coding.c' 'xemacs-21.5.7/src/file-coding.c' Index: ././src/file-coding.c --- ././src/file-coding.c Wed Apr 3 19:47:49 2002 +++ ././src/file-coding.c Wed Jun 5 18:55:30 2002 @@ -550,7 +550,7 @@ write_fmt_string_lisp (printcharfun, "#name); print_coding_system_properties (obj, printcharfun); - write_c_string (">", printcharfun); + write_c_string (printcharfun, ">"); } /* Print an abbreviated version of a coding system (but still containing @@ -562,7 +562,7 @@ { write_fmt_string_lisp (printcharfun, "%s[", 1, XCODING_SYSTEM_NAME (cs)); print_coding_system_properties (cs, printcharfun); - write_c_string ("]", printcharfun); + write_c_string (printcharfun, "]"); } static void @@ -1018,9 +1018,9 @@ setup_eol_coding_systems (Lisp_Object codesys) { int len = XSTRING_LENGTH (XSYMBOL (XCODING_SYSTEM_NAME (codesys))->name); - Intbyte *codesys_name = (Intbyte *) alloca (len + 7); + Ibyte *codesys_name = (Ibyte *) ALLOCA (len + 7); int mlen = -1; - Intbyte *codesys_mnemonic = 0; + Ibyte *codesys_mnemonic = 0; Lisp_Object codesys_name_sym, sub_codesys; int i; @@ -1030,7 +1030,7 @@ if (STRINGP (XCODING_SYSTEM_MNEMONIC (codesys))) { mlen = XSTRING_LENGTH (XCODING_SYSTEM_MNEMONIC (codesys)); - codesys_mnemonic = (Intbyte *) alloca (mlen + 7); + codesys_mnemonic = (Ibyte *) ALLOCA (mlen + 7); memcpy (codesys_mnemonic, XSTRING_DATA (XCODING_SYSTEM_MNEMONIC (codesys)), mlen); } @@ -1144,10 +1144,10 @@ if (prefix) { - Intbyte *newname = + Ibyte *newname = emacs_sprintf_malloc (NULL, "%s-%s-%d", prefix, - NILP (name_or_existing) ? (Intbyte *) "nil" : + NILP (name_or_existing) ? (Ibyte *) "nil" : XSTRING_DATA (Fsymbol_name (XCODING_SYSTEM_NAME (name_or_existing))), ++coding_system_tick); @@ -1262,7 +1262,7 @@ creating will have canonicalization expansion done on it, leading to infinite recursion. So we have to generate a new, internal coding system with the previous value of CANONICAL. */ - Intbyte *newname = + Ibyte *newname = emacs_sprintf_malloc (NULL, "internal-eol-copy-%s-%d", XSTRING_DATA (Fsymbol_name (name_or_existing)), @@ -2037,7 +2037,9 @@ and when we get 0, keep taking more data until we don't get 0 -- we don't know how much data the conversion routine might need before it can generate any data of its own */ - Bytecount readmore = max (size, str->one_byte_at_a_time ? 1 : 1024); + Bytecount readmore = + str->one_byte_at_a_time ? (Bytecount) 1 : + max (size, (Bytecount) 1024); Dynarr_add_many (str->convert_from, 0, readmore); read_size = Lstream_read (str->other_end, @@ -2129,10 +2131,11 @@ Lstream_set_character_mode(), which lays out rules for who is allowed to modify the character type mode on a stream. - NOTE: We could potentially implement the full-character checking stuff - ourselves, which might be a bit safer in case people mess up the - character mode themselves. But people shouldn't be doing that -- don't - hide bugs -- and there's no sense duplicating code. */ + If we're a read stream, we're always setting character mode on the + source, but we also set it on ourselves consistent with the flag that + can disable this (see again the comment above + Lstream_set_character_mode()). + */ static void set_coding_character_mode (Lstream *stream) @@ -2145,6 +2148,15 @@ Lstream_set_character_mode (stream_to_set); else Lstream_unset_character_mode (stream_to_set); + if (str->set_char_mode_on_us_when_reading && + (stream->flags & LSTREAM_FL_READ)) + { + if (encode_decode_source_sink_type_is_char + (str->codesys, CODING_SINK, str->direction)) + Lstream_set_character_mode (stream); + else + Lstream_unset_character_mode (stream); + } } static Lisp_Object @@ -2319,17 +2331,37 @@ str->convert_to = Dynarr_new (unsigned_char); str->convert_from = Dynarr_new (unsigned_char); str->direction = direction; - if (flags & CODE_FL_NO_CLOSE_OTHER) + if (flags & LSTREAM_FL_NO_CLOSE_OTHER) str->no_close_other = 1; - else if (flags & CODE_FL_READ_ONE_BYTE_AT_A_TIME) + if (flags & LSTREAM_FL_READ_ONE_BYTE_AT_A_TIME) str->one_byte_at_a_time = 1; + if (!(flags & LSTREAM_FL_NO_INIT_CHAR_MODE_WHEN_READING)) + str->set_char_mode_on_us_when_reading = 1; set_coding_stream_coding_system (lstr, codesys); return wrap_lstream (lstr); } -/* FLAGS -- #### document me. If NO_CLOSE_OTHER is non-zero, don't close - STREAM (the stream at the other end) when this stream is closed. */ +/* FLAGS: + + LSTREAM_FL_NO_CLOSE_OTHER + Don't close STREAM (the stream at the other end) when this stream is + closed. + + LSTREAM_FL_READ_ONE_BYTE_AT_A_TIME + When reading from STREAM, read and process one byte at a time rather + than in large chunks. This is for reading from TTY's, so we don't + block. #### We should instead create a non-blocking filedesc stream + that emulates the behavior as necessary using select(), when the + fcntls don't work. (As seems to be the case on Cygwin.) + + LSTREAM_FL_NO_INIT_CHAR_MODE_WHEN_READING + When reading from STREAM, read and process one byte at a time rather + than in large chunks. This is for reading from TTY's, so we don't + block. #### We should instead create a non-blocking filedesc stream + that emulates the behavior as necessary using select(), when the + fcntls don't work. (As seems to be the case on Cygwin.) +*/ Lisp_Object make_coding_input_stream (Lstream *stream, Lisp_Object codesys, enum encode_decode direction, int flags) @@ -2338,8 +2370,12 @@ flags); } -/* FLAGS -- #### document me. If NO_CLOSE_OTHER is non-zero, don't close - STREAM (the stream at the other end) when this stream is closed. */ +/* FLAGS: + + LSTREAM_FL_NO_CLOSE_OTHER + Don't close STREAM (the stream at the other end) when this stream is + closed. + */ Lisp_Object make_coding_output_stream (Lstream *stream, Lisp_Object codesys, enum encode_decode direction, int flags) @@ -2648,10 +2684,10 @@ { int i; - write_c_string ("(", printcharfun); + write_c_string (printcharfun, "("); for (i = 0; i < XCODING_SYSTEM_CHAIN_COUNT (cs); i++) { - write_c_string (i == 0 ? "" : "->", printcharfun); + write_c_string (printcharfun, i == 0 ? "" : "->"); print_coding_system_in_print_method (XCODING_SYSTEM_CHAIN_CHAIN (cs)[i], printcharfun, escapeflag); } @@ -2660,13 +2696,13 @@ if (!NILP (cac)) { if (i > 0) - write_c_string (" ", printcharfun); - write_c_string ("canonicalize-after-coding=", printcharfun); + write_c_string (printcharfun, " "); + write_c_string (printcharfun, "canonicalize-after-coding="); print_coding_system_in_print_method (cac, printcharfun, escapeflag); } } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); } static void @@ -2908,13 +2944,13 @@ while (n--) { c = *src++; - if (BYTE_ASCII_P (c)) + if (byte_ascii_p (c)) { assert (ch == 0); Dynarr_add (dst, c); } #ifdef MULE - else if (INTBYTE_LEADING_BYTE_P (c)) + else if (ibyte_leading_byte_p (c)) { assert (ch == 0); if (c == LEADING_BYTE_LATIN_ISO8859_1 || @@ -3074,7 +3110,7 @@ } static Bytecount -convert_eol_convert (struct coding_stream *str, const Intbyte *src, +convert_eol_convert (struct coding_stream *str, const Ibyte *src, unsigned_char_dynarr *dst, Bytecount n) { if (str->direction == CODING_DECODE) @@ -3085,11 +3121,11 @@ if (data->actual == EOL_AUTODETECT) { Bytecount n2 = n; - const Intbyte *src2 = src; + const Ibyte *src2 = src; for (; n2; n2--) { - Intbyte c = *src2++; + Ibyte c = *src2++; if (c == '\n') { data->actual = EOL_LF; @@ -3128,12 +3164,12 @@ Dynarr_add_many (dst, src, n); else { - const Intbyte *end = src + n; + const Ibyte *end = src + n; while (1) { /* Find the next section with no \r and add it. */ - const Intbyte *runstart = src; - src = (Intbyte *) memchr (src, '\r', end - src); + const Ibyte *runstart = src; + src = (Ibyte *) memchr (src, '\r', end - src); if (!src) src = end; Dynarr_add_many (dst, runstart, src - runstart); @@ -3165,7 +3201,7 @@ { enum eol_type subtype = XCODING_SYSTEM_CONVERT_EOL_SUBTYPE (str->codesys); - const Intbyte *end = src + n; + const Ibyte *end = src + n; /* We try to be relatively efficient here. */ if (subtype == EOL_LF) @@ -3175,8 +3211,8 @@ while (1) { /* Find the next section with no \n and add it. */ - const Intbyte *runstart = src; - src = (Intbyte *) memchr (src, '\n', end - src); + const Ibyte *runstart = src; + src = (Ibyte *) memchr (src, '\n', end - src); if (!src) src = end; Dynarr_add_many (dst, runstart, src - runstart); @@ -3286,27 +3322,27 @@ XCODING_SYSTEM_TYPE_DATA (cs, undecided); int need_space = 0; - write_c_string ("(", printcharfun); + write_c_string (printcharfun, "("); if (data->do_eol) { - write_c_string ("do-eol", printcharfun); + write_c_string (printcharfun, "do-eol"); need_space = 1; } if (data->do_coding) { if (need_space) - write_c_string (" ", printcharfun); - write_c_string ("do-coding", printcharfun); + write_c_string (printcharfun, " "); + write_c_string (printcharfun, "do-coding"); need_space = 1; } if (!NILP (data->cs)) { if (need_space) - write_c_string (" ", printcharfun); - write_c_string ("coding-system=", printcharfun); + write_c_string (printcharfun, " "); + write_c_string (printcharfun, "coding-system="); print_coding_system_in_print_method (data->cs, printcharfun, escapeflag); } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); } static void @@ -3753,11 +3789,11 @@ *(p-1) == ';'))) { Bytecount n; - Intbyte *name; + Ibyte *name; p += LENGTH ("coding:"); while (*p == ' ' || *p == '\t') p++; - name = alloca_intbytes (suffix - p + 1); + name = alloca_ibytes (suffix - p + 1); memcpy (name, p, suffix - p); name[suffix - p] = '\0'; @@ -4151,7 +4187,7 @@ Lisp_Object binary_instream = make_coding_input_stream (XLSTREAM (stream), Qbinary, - CODING_ENCODE, CODE_FL_NO_CLOSE_OTHER); + CODING_ENCODE, LSTREAM_FL_NO_CLOSE_OTHER); Lisp_Object decstream = make_coding_input_stream (XLSTREAM (binary_instream), @@ -4267,12 +4303,12 @@ { struct gzip_coding_system *data = XCODING_SYSTEM_TYPE_DATA (cs, gzip); - write_c_string ("(", printcharfun); + write_c_string (printcharfun, "("); if (data->level == -1) - write_c_string ("default", printcharfun); + write_c_string (printcharfun, "default"); else print_internal (make_int (data->level), printcharfun, 0); - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); } static int diff --text -u 'xemacs-21.5.6/src/file-coding.h' 'xemacs-21.5.7/src/file-coding.h' Index: ././src/file-coding.h --- ././src/file-coding.h Wed Apr 3 19:47:50 2002 +++ ././src/file-coding.h Wed Jun 5 18:55:35 2002 @@ -452,10 +452,10 @@ #define DECLARE_CODING_SYSTEM_TYPE(type) \ \ extern struct coding_system_methods * type##_coding_system_methods; \ -INLINE_HEADER struct type##_coding_system * \ -error_check_##type##_coding_system_data (Lisp_Coding_System *cs); \ -INLINE_HEADER struct type##_coding_system * \ +DECLARE_INLINE_HEADER ( \ +struct type##_coding_system * \ error_check_##type##_coding_system_data (Lisp_Coding_System *cs) \ +) \ { \ assert (CODING_SYSTEM_TYPE_P (cs, type)); \ /* Catch accidental use of INITIALIZE_CODING_SYSTEM_TYPE in place \ @@ -464,19 +464,19 @@ return (struct type##_coding_system *) cs->data; \ } \ \ -INLINE_HEADER struct type##_coding_stream * \ -error_check_##type##_coding_stream_data (struct coding_stream *s); \ -INLINE_HEADER struct type##_coding_stream * \ +DECLARE_INLINE_HEADER ( \ +struct type##_coding_stream * \ error_check_##type##_coding_stream_data (struct coding_stream *s) \ +) \ { \ assert (XCODING_SYSTEM_TYPE_P (s->codesys, type)); \ return (struct type##_coding_stream *) s->data; \ } \ \ -INLINE_HEADER Lisp_Coding_System * \ -error_check_##type##_coding_system_type (Lisp_Object obj); \ -INLINE_HEADER Lisp_Coding_System * \ +DECLARE_INLINE_HEADER ( \ +Lisp_Coding_System * \ error_check_##type##_coding_system_type (Lisp_Object obj) \ +) \ { \ Lisp_Coding_System *cs = XCODING_SYSTEM (obj); \ assert (CODING_SYSTEM_TYPE_P (cs, type)); \ @@ -933,6 +933,10 @@ /* If set, read only one byte at a time from other end to avoid any possible blocking. */ unsigned int one_byte_at_a_time:1; + /* If set, and we're a read stream, we init char mode on ourselves as + necessary to prevent the caller from getting partial characters. (the + default) */ + unsigned int set_char_mode_on_us_when_reading:1; /* #### Temporary test */ unsigned int finalized:1; @@ -955,9 +959,9 @@ #define DECODE_ADD_BINARY_CHAR(c, dst) \ do { \ - if (BYTE_ASCII_P (c)) \ + if (byte_ascii_p (c)) \ Dynarr_add (dst, c); \ - else if (BYTE_C1_P (c)) \ + else if (byte_c1_p (c)) \ { \ Dynarr_add (dst, LEADING_BYTE_CONTROL_1); \ Dynarr_add (dst, c + 0x20); \ @@ -1053,7 +1057,7 @@ void set_coding_stream_coding_system (Lstream *stream, Lisp_Object codesys); Lisp_Object detect_coding_stream (Lisp_Object stream); -Emchar decode_big5_char (int o1, int o2); +Ichar decode_big5_char (int o1, int o2); void add_entry_to_coding_system_type_list (struct coding_system_methods *m); Lisp_Object make_internal_coding_system (Lisp_Object existing, Char_ASCII *prefix, @@ -1061,8 +1065,10 @@ Lisp_Object description, Lisp_Object props); -#define CODE_FL_NO_CLOSE_OTHER (1 << 0) -#define CODE_FL_READ_ONE_BYTE_AT_A_TIME (1 << 1) +#define LSTREAM_FL_NO_CLOSE_OTHER (1 << 16) +#define LSTREAM_FL_READ_ONE_BYTE_AT_A_TIME (1 << 17) +#define LSTREAM_FL_NO_INIT_CHAR_MODE_WHEN_READING (1 << 18) + Lisp_Object make_coding_input_stream (Lstream *stream, Lisp_Object codesys, enum encode_decode direction, int flags); diff --text -u 'xemacs-21.5.6/src/fileio.c' 'xemacs-21.5.7/src/fileio.c' Index: ././src/fileio.c --- ././src/fileio.c Mon Apr 1 12:58:37 2002 +++ ././src/fileio.c Fri Jun 21 06:18:31 2002 @@ -37,9 +37,10 @@ #include "frame.h" #include "insdel.h" #include "lstream.h" +#include "process.h" #include "redisplay.h" #include "sysdep.h" -#include "window.h" /* minibuf_level */ +#include "window-impl.h" #include "sysfile.h" #include "sysproc.h" @@ -134,7 +135,7 @@ DOESNT_RETURN report_file_type_error (Lisp_Object errtype, Lisp_Object oserrmess, - const CIntbyte *string, Lisp_Object data) + const CIbyte *string, Lisp_Object data) { struct gcpro gcpro1; Lisp_Object errdata = build_error_data (NULL, data); @@ -148,7 +149,7 @@ DOESNT_RETURN report_error_with_errno (Lisp_Object errtype, - const CIntbyte *string, Lisp_Object data) + const CIbyte *string, Lisp_Object data) { report_file_type_error (errtype, lisp_strerror (errno), string, data); } @@ -156,7 +157,7 @@ /* signal a file error when errno contains a meaningful value. */ DOESNT_RETURN -report_file_error (const CIntbyte *string, Lisp_Object data) +report_file_error (const CIbyte *string, Lisp_Object data) { report_error_with_errno (Qfile_error, string, data); } @@ -171,7 +172,7 @@ Extbyte *ret = strerror (errnum); if (!ret) { - Intbyte ffff[99]; + Ibyte ffff[99]; qxesprintf (ffff, "Unknown error %d", errnum); return build_intstring (ffff); } @@ -186,7 +187,7 @@ if (INTP (XCAR (fd))) retry_close (XINT (XCAR (fd))); - free_cons (XCONS (fd)); + free_cons (fd); } else retry_close (XINT (fd)); @@ -226,6 +227,7 @@ Lisp_Object Qrename_file; Lisp_Object Qadd_name_to_file; Lisp_Object Qmake_symbolic_link; +Lisp_Object Qmake_temp_name; Lisp_Object Qfile_exists_p; Lisp_Object Qfile_executable_p; Lisp_Object Qfile_readable_p; @@ -331,8 +333,8 @@ { /* This function can GC. GC checked 2000-07-28 ben */ /* This function synched with Emacs 21.0.103. */ - Intbyte *beg; - Intbyte *p; + Ibyte *beg; + Ibyte *p; Lisp_Object handler; CHECK_STRING (filename); @@ -366,10 +368,10 @@ /* Expansion of "c:" to drive and default directory. */ if (p[-1] == ':') { - Intbyte *res; - Intbyte *wd = mswindows_getdcwd (toupper (*beg) - 'A' + 1); + Ibyte *res; + Ibyte *wd = mswindows_getdcwd (toupper (*beg) - 'A' + 1); - res = alloca_array (Intbyte, + res = alloca_array (Ibyte, (wd ? qxestrlen (wd) : 0) + 10); /* go overboard */ if (p == beg + 4 && IS_DIRECTORY_SEP (*beg) && beg[1] == ':') { @@ -381,7 +383,7 @@ { qxestrcat (res, wd); if (!IS_DIRECTORY_SEP (res[qxestrlen (res) - 1])) - qxestrcat (res, (Intbyte *) "/"); + qxestrcat (res, (Ibyte *) "/"); beg = res; p = beg + qxestrlen (beg); } @@ -394,7 +396,7 @@ an analogous call in FSF 21. */ { Bytecount len = p - beg; - Intbyte *newbeg = alloca_intbytes (len + 1); + Ibyte *newbeg = alloca_ibytes (len + 1); Lisp_Object return_me; qxestrncpy (newbeg, beg, len); @@ -419,7 +421,7 @@ { /* This function can GC. GC checked 2000-07-28 ben */ /* This function synched with Emacs 21.0.103. */ - Intbyte *beg, *p, *end; + Ibyte *beg, *p, *end; Lisp_Object handler; CHECK_STRING (filename); @@ -471,8 +473,8 @@ } -static Intbyte * -file_name_as_directory (Intbyte *out, Intbyte *in) +static Ibyte * +file_name_as_directory (Ibyte *out, Ibyte *in) { /* This function cannot GC */ int size = qxestrlen (in); @@ -508,7 +510,7 @@ (filename)) { /* This function can GC. GC checked 2000-07-28 ben */ - Intbyte *buf; + Ibyte *buf; Lisp_Object handler; CHECK_STRING (filename); @@ -519,7 +521,7 @@ if (!NILP (handler)) return call2_check_string (handler, Qfile_name_as_directory, filename); - buf = alloca_intbytes (XSTRING_LENGTH (filename) + 10); + buf = alloca_ibytes (XSTRING_LENGTH (filename) + 10); return build_intstring (file_name_as_directory (buf, XSTRING_DATA (filename))); } @@ -531,7 +533,7 @@ */ static int -directory_file_name (const Intbyte *src, Intbyte *dst) +directory_file_name (const Ibyte *src, Ibyte *dst) { /* This function cannot GC */ long slen = qxestrlen (src); @@ -558,7 +560,7 @@ (directory)) { /* This function can GC. GC checked 2000-07-28 ben */ - Intbyte *buf; + Ibyte *buf; Lisp_Object handler; CHECK_STRING (directory); @@ -573,7 +575,7 @@ handler = Ffind_file_name_handler (directory, Qdirectory_file_name); if (!NILP (handler)) return call2_check_string (handler, Qdirectory_file_name, directory); - buf = (Intbyte *) alloca (XSTRING_LENGTH (directory) + 20); + buf = (Ibyte *) ALLOCA (XSTRING_LENGTH (directory) + 20); directory_file_name (XSTRING_DATA (directory), buf); return build_intstring (buf); } @@ -595,7 +597,11 @@ In addition, this function makes an attempt to choose a name that does not specify an existing file. To make this work, PREFIX should -be an absolute file name. +be an absolute file name. A reasonable idiom is + +\(make-temp-name (expand-file-name "myprefix" (temp-directory))) + +which puts the file in the OS-specified temporary directory. */ (prefix)) { @@ -612,9 +618,13 @@ }; Bytecount len; - Intbyte *p, *data; + Ibyte *p, *data; + Lisp_Object handler; CHECK_STRING (prefix); + handler = Ffind_file_name_handler (prefix, Qmake_temp_name); + if (!NILP (handler)) + return call2_check_string (handler, Qmake_temp_name, prefix); /* I was tempted to apply Fexpand_file_name on PREFIX here, but it's a bad idea because: @@ -627,11 +637,12 @@ the code that uses (make-temp-name "") instead of (make-temp-name "./"). - 3) It might yield unexpected (to stat(2)) results in the presence - of EFS and file name handlers. */ + [[ 3) It might yield unexpected (to stat(2)) results in the presence + of EFS and file name handlers.]] Now that we check for a handler, + that's less of a concern. --ben */ len = XSTRING_LENGTH (prefix); - data = alloca_intbytes (len + 7); + data = alloca_ibytes (len + 7); memcpy (data, XSTRING_DATA (prefix), len); p = data + len; p[6] = '\0'; @@ -705,11 +716,11 @@ { /* This function can GC. GC-checked 2000-11-18. This function synched with Emacs 21.0.103. */ - Intbyte *nm; + Ibyte *nm; - Intbyte *newdir, *p, *o; + Ibyte *newdir, *p, *o; int tlen; - Intbyte *target; + Ibyte *target; #ifdef WIN32_FILENAMES int drive = 0; int collapse_newdir = 1; @@ -797,7 +808,7 @@ #ifdef WIN32_FILENAMES /* We will force directory separators to be either all \ or /, so make a local copy to modify, even if there ends up being no change. */ - nm = qxestrcpy (alloca_intbytes (qxestrlen (nm) + 1), nm); + nm = qxestrcpy (alloca_ibytes (qxestrlen (nm) + 1), nm); /* Note if special escape prefix is present, but remove for now. */ if (nm[0] == '/' && nm[1] == ':') @@ -809,7 +820,7 @@ /* Find and remove drive specifier if present; this makes nm absolute even if the rest of the name appears to be relative. */ { - Intbyte *colon = qxestrrchr (nm, ':'); + Ibyte *colon = qxestrrchr (nm, ':'); if (colon) { @@ -896,7 +907,7 @@ #ifdef WIN32_FILENAMES if (drive || IS_DIRECTORY_SEP (nm[1])) { - Intbyte *newnm; + Ibyte *newnm; if (IS_DIRECTORY_SEP (nm[1])) { @@ -950,10 +961,10 @@ if (IS_DIRECTORY_SEP (nm[1]) || nm[1] == 0) /* ~ by itself */ { - Intbyte *homedir = get_home_directory (); + Ibyte *homedir = get_home_directory (); if (!homedir) - newdir = (Intbyte *) ""; + newdir = (Ibyte *) ""; else newdir = homedir; @@ -966,7 +977,7 @@ { for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++) DO_NOTHING; - o = (Intbyte *) alloca (p - nm + 1); + o = (Ibyte *) ALLOCA (p - nm + 1); memcpy (o, nm, p - nm); o [p - nm] = 0; @@ -977,7 +988,7 @@ #ifndef WIN32_NATIVE #ifdef CYGWIN { - Intbyte *user; + Ibyte *user; if ((user = user_login_name (NULL)) != NULL) { @@ -999,7 +1010,7 @@ speed_up_interrupts (); if (pw) { - newdir = (Intbyte *) pw->pw_dir; + newdir = (Ibyte *) pw->pw_dir; nm = p; /* FSF: if WIN32_NATIVE, collapse_newdir = 0; not possible here. */ @@ -1023,10 +1034,10 @@ /* Get default directory if needed to make nm absolute. */ if (!IS_DIRECTORY_SEP (nm[0])) { - Intbyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1); + Ibyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1); if (newcwd) { - INTBYTE_STRING_TO_ALLOCA (newcwd, newdir); + IBYTE_STRING_TO_ALLOCA (newcwd, newdir); xfree (newcwd); } else @@ -1036,7 +1047,7 @@ if (!newdir) { /* Either nm starts with /, or drive isn't mounted. */ - newdir = (Intbyte *) alloca (4); + newdir = (Ibyte *) ALLOCA (4); newdir[0] = DRIVE_LETTER (drive); newdir[1] = ':'; newdir[2] = '/'; @@ -1100,7 +1111,7 @@ } if (!IS_DIRECTORY_SEP (nm[0])) { - Intbyte *tmp = (Intbyte *) alloca (qxestrlen (newdir) + + Ibyte *tmp = (Ibyte *) ALLOCA (qxestrlen (newdir) + qxestrlen (nm) + 2); file_name_as_directory (tmp, newdir); qxestrcat (tmp, nm); @@ -1109,18 +1120,18 @@ if (drive) { #ifdef WIN32_NATIVE - Intbyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1); + Ibyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1); if (newcwd) { - INTBYTE_STRING_TO_ALLOCA (newcwd, newdir); + IBYTE_STRING_TO_ALLOCA (newcwd, newdir); xfree (newcwd); } else #endif - INTBYTE_STRING_TO_ALLOCA ((Intbyte *) "/", newdir); + IBYTE_STRING_TO_ALLOCA ((Ibyte *) "/", newdir); } else - INTBYTE_STRING_TO_ALLOCA (get_initial_directory (0, 0), newdir); + IBYTE_STRING_TO_ALLOCA (get_initial_directory (0, 0), newdir); } /* Strip off drive name from prefix, if present. */ @@ -1141,8 +1152,8 @@ if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])) { newdir = - (Intbyte *) - qxestrcpy ((Intbyte *) alloca (qxestrlen (newdir) + 1), + (Ibyte *) + qxestrcpy ((Ibyte *) ALLOCA (qxestrlen (newdir) + 1), newdir); p = newdir + 2; while (*p && !IS_DIRECTORY_SEP (*p)) p++; @@ -1151,7 +1162,7 @@ *p = 0; } else - newdir = (Intbyte *) ""; + newdir = (Ibyte *) ""; } } #endif /* WIN32_FILENAMES */ @@ -1167,7 +1178,7 @@ #endif ) { - Intbyte *temp = (Intbyte *) alloca (length); + Ibyte *temp = (Ibyte *) ALLOCA (length); memcpy (temp, newdir, length - 1); temp[length - 1] = 0; newdir = temp; @@ -1183,10 +1194,10 @@ /* Reserve space for drive specifier and escape prefix, since either or both may need to be inserted. (The Microsoft x86 compiler produces incorrect code if the following two lines are combined.) */ - target = (Intbyte *) alloca (tlen + 4); + target = (Ibyte *) ALLOCA (tlen + 4); target += 4; #else /* not WIN32_FILENAMES */ - target = (Intbyte *) alloca (tlen); + target = (Ibyte *) ALLOCA (tlen); #endif /* not WIN32_FILENAMES */ *target = 0; @@ -1287,7 +1298,7 @@ *o = '\0'; { - Intbyte *newtarget = mswindows_canonicalize_filename (target); + Ibyte *newtarget = mswindows_canonicalize_filename (target); Lisp_Object result = build_intstring (newtarget); xfree (newtarget); @@ -1331,10 +1342,10 @@ } { - Intbyte resolved_path[PATH_MAX]; + Ibyte resolved_path[PATH_MAX]; Bytecount elen = XSTRING_LENGTH (expanded_name); - Intbyte *path; - Intbyte *p; + Ibyte *path; + Ibyte *p; LISP_STRING_TO_ALLOCA (expanded_name, path); p = path; @@ -1362,7 +1373,7 @@ realpath()s, we just use our own version in realpath.c. */ for (;;) { - Intbyte *pos; + Ibyte *pos; #ifdef WIN32_FILENAMES if (IS_DRIVE (p[0]) && IS_DEVICE_SEP (p[1]) @@ -1423,7 +1434,7 @@ { Lisp_Object resolved_name; int rlen = qxestrlen (resolved_path); - if (elen > 0 && IS_DIRECTORY_SEP (XSTRING_BYTE (expanded_name, elen - 1)) + if (elen > 0 && IS_DIRECTORY_SEP (string_byte (expanded_name, elen - 1)) && !(rlen > 0 && IS_DIRECTORY_SEP (resolved_path[rlen - 1]))) { if (rlen + 1 > countof (resolved_path)) @@ -1456,13 +1467,13 @@ (filename)) { /* This function can GC. GC checked 2000-07-28 ben. */ - Intbyte *nm; + Ibyte *nm; - Intbyte *s, *p, *o, *x, *endp; - Intbyte *target = 0; + Ibyte *s, *p, *o, *x, *endp; + Ibyte *target = 0; int total = 0; int substituted = 0; - Intbyte *xnm; + Ibyte *xnm; Lisp_Object handler; CHECK_STRING (filename); @@ -1540,7 +1551,7 @@ } /* Copy out the variable name */ - target = (Intbyte *) alloca (s - o + 1); + target = (Ibyte *) ALLOCA (s - o + 1); qxestrncpy (target, o, s - o); target[s - o] = 0; #ifdef WIN32_NATIVE @@ -1548,7 +1559,7 @@ #endif /* WIN32_NATIVE */ /* Get variable value */ - o = egetenv ((CIntbyte *) target); + o = egetenv ((CIbyte *) target); if (!o) goto badvar; total += qxestrlen (o); substituted = 1; @@ -1559,7 +1570,7 @@ /* If substitution required, recopy the filename and do it */ /* Make space in stack frame for the new copy */ - xnm = (Intbyte *) alloca (XSTRING_LENGTH (filename) + total + 1); + xnm = (Ibyte *) ALLOCA (XSTRING_LENGTH (filename) + total + 1); x = xnm; /* Copy the rest of the name through, replacing $ constructs with values */ @@ -1591,7 +1602,7 @@ } /* Copy out the variable name */ - target = (Intbyte *) alloca (s - o + 1); + target = (Ibyte *) ALLOCA (s - o + 1); qxestrncpy (target, o, s - o); target[s - o] = 0; #ifdef WIN32_NATIVE @@ -1599,7 +1610,7 @@ #endif /* WIN32_NATIVE */ /* Get variable value */ - o = egetenv ((CIntbyte *) target); + o = egetenv ((CIbyte *) target); if (!o) goto badvar; @@ -1657,8 +1668,8 @@ /* Remove final slash, if any (unless path is root). stat behaves differently depending! */ if (XSTRING_LENGTH (abspath) > 1 - && IS_DIRECTORY_SEP (XSTRING_BYTE (abspath, XSTRING_LENGTH (abspath) - 1)) - && !IS_DEVICE_SEP (XSTRING_BYTE (abspath, XSTRING_LENGTH (abspath) - 2))) + && IS_DIRECTORY_SEP (string_byte (abspath, XSTRING_LENGTH (abspath) - 1)) + && !IS_DEVICE_SEP (string_byte (abspath, XSTRING_LENGTH (abspath) - 2))) /* We cannot take shortcuts; they might be wrong for magic file names. */ abspath = Fdirectory_file_name (abspath); UNGCPRO; @@ -1773,7 +1784,7 @@ args[1] = Qnil; args[2] = Qnil; NGCPRO1 (*args); ngcpro1.nvars = 3; - if (!IS_DIRECTORY_SEP (XSTRING_BYTE (newname, + if (!IS_DIRECTORY_SEP (string_byte (newname, XSTRING_LENGTH (newname) - 1))) args[i++] = Fchar_to_string (Vdirectory_sep_char); @@ -2014,7 +2025,7 @@ args[1] = Qnil; args[2] = Qnil; NGCPRO1 (*args); ngcpro1.nvars = 3; - if (XSTRING_BYTE (newname, XSTRING_LENGTH (newname) - 1) != '/') + if (string_byte (newname, XSTRING_LENGTH (newname) - 1) != '/') args[i++] = build_string ("/"); args[i++] = Ffile_name_nondirectory (filename); newname = Fconcat (i, args); @@ -2124,7 +2135,7 @@ /* If the link target has a ~, we must expand it to get a truly valid file name. Otherwise, do not expand; we want to permit links to relative file names. */ - if (XSTRING_BYTE (filename, 0) == '~') + if (string_byte (filename, 0) == '~') filename = Fexpand_file_name (filename, Qnil); linkname = Fexpand_file_name (linkname, Qnil); @@ -2194,7 +2205,7 @@ (filename)) { /* This function does not GC */ - Intbyte *ptr; + Ibyte *ptr; CHECK_STRING (filename); ptr = XSTRING_DATA (filename); @@ -2230,7 +2241,7 @@ /* Return nonzero if file FILENAME exists and can be written. */ static int -check_writable (const Intbyte *filename) +check_writable (const Ibyte *filename) { #ifdef HAVE_EACCESS return (qxe_eaccess (filename, W_OK) >= 0); @@ -2369,7 +2380,7 @@ GCPRO1 (abspath); dir = Ffile_name_directory (abspath); UNGCPRO; - return (check_writable (!NILP (dir) ? XSTRING_DATA (dir) : (Intbyte *) "") + return (check_writable (!NILP (dir) ? XSTRING_DATA (dir) : (Ibyte *) "") ? Qt : Qnil); } @@ -2383,7 +2394,7 @@ /* This function can GC. GC checked 1997.04.10. */ /* XEmacs change: run handlers even if local machine doesn't have symlinks */ #ifdef HAVE_READLINK - Intbyte *buf; + Ibyte *buf; int bufsize; int valsize; Lisp_Object val; @@ -2406,7 +2417,7 @@ bufsize = 100; while (1) { - buf = xnew_array_and_zero (Intbyte, bufsize); + buf = xnew_array_and_zero (Ibyte, bufsize); valsize = qxe_readlink (XSTRING_DATA (filename), buf, bufsize); if (valsize < bufsize) break; @@ -2720,7 +2731,7 @@ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; Lisp_Object handler = Qnil, val; int total; - Intbyte read_buf[READ_BUF_SIZE]; + Ibyte read_buf[READ_BUF_SIZE]; int mc_count; struct buffer *buf = current_buffer; Lisp_Object curbuf; @@ -2893,7 +2904,8 @@ break; charbpos = 0; while (charbpos < nread && same_at_start < BUF_ZV (buf) - && BUF_FETCH_CHAR (buf, same_at_start) == buffer[charbpos]) + && BUF_FETCH_CHAR (buf, same_at_start) == + buffer[charbpos]) same_at_start++, charbpos++; /* If we found a discrepancy, stop the scan. Otherwise loop around and scan the next bufferful. */ @@ -2916,7 +2928,7 @@ while (1) { int total_read, nread; - Charbpos charbpos, curpos, trial; + Charcount charbpos, curpos, trial; /* At what file position are we now scanning? */ curpos = st.st_size - (BUF_ZV (buf) - same_at_end); @@ -3008,7 +3020,6 @@ stream = make_coding_input_stream (XLSTREAM (stream), get_coding_system_for_text_file (codesys, 1), CODING_DECODE, 0); - Lstream_set_character_mode (XLSTREAM (stream)); Lstream_set_buffering (XLSTREAM (stream), LSTREAM_BLOCKN_BUFFERED, 65536); record_unwind_protect (delete_stream_unwind, stream); @@ -3584,14 +3595,14 @@ nextpos = INT_MAX; #ifdef MULE /* If there are annotations left and we have Mule, then we - have to do the I/O one emchar at a time so we can + have to do the I/O one ichar at a time so we can determine when to insert the annotation. */ if (!NILP (*annot)) { - Emchar ch; - while (pos != nextpos && (ch = Lstream_get_emchar (instr)) != EOF) + Ichar ch; + while (pos != nextpos && (ch = Lstream_get_ichar (instr)) != EOF) { - if (Lstream_put_emchar (outstr, ch) < 0) + if (Lstream_put_ichar (outstr, ch) < 0) return -1; pos++; } @@ -3653,13 +3664,13 @@ extra = XSTRING_LENGTH (string) % CRYPT_BLOCK_SIZE; rounded_size = XSTRING_LENGTH (string) + extra; - encrypted_string = alloca (rounded_size + 1); + encrypted_string = ALLOCA (rounded_size + 1); memcpy (encrypted_string, XSTRING_DATA (string), XSTRING_LENGTH (string)); memset (encrypted_string + rounded_size - extra, 0, extra + 1); key_size = min (CRYPT_KEY_SIZE, XSTRING_LENGTH (key)) - raw_key = alloca (CRYPT_KEY_SIZE + 1); + raw_key = ALLOCA (CRYPT_KEY_SIZE + 1); memcpy (raw_key, XSTRING_DATA (key), key_size); memset (raw_key + key_size, 0, (CRYPT_KEY_SIZE + 1) - key_size); @@ -3681,13 +3692,13 @@ CHECK_STRING (key); string_size = XSTRING_LENGTH (string) + 1; - decrypted_string = alloca (string_size); + decrypted_string = ALLOCA (string_size); memcpy (decrypted_string, XSTRING_DATA (string), string_size); decrypted_string[string_size - 1] = '\0'; key_size = min (CRYPT_KEY_SIZE, XSTRING_LENGTH (key)) - raw_key = alloca (CRYPT_KEY_SIZE + 1); + raw_key = ALLOCA (CRYPT_KEY_SIZE + 1); memcpy (raw_key, XSTRING_DATA (key), key_size); memset (raw_key + key_size, 0, (CRYPT_KEY_SIZE + 1) - key_size); @@ -3886,13 +3897,6 @@ return (fd); } -static Lisp_Object -do_auto_save_unwind_2 (Lisp_Object old_auto_saving) -{ - auto_saving = XINT (old_auto_saving); - return Qnil; -} - /* Fdo_auto_save() checks whether a GC is in progress when it is called, and if so, tries to avoid touching lisp objects. @@ -3949,10 +3953,7 @@ Vauto_save_list_file_name, auto_save_expand_name_error, Qnil); - /* Make sure auto_saving is reset. */ - record_unwind_protect (do_auto_save_unwind_2, make_int (auto_saving)); - - auto_saving = 1; + internal_bind_int (&auto_saving, 1); /* First, save all files which don't have handlers. If Emacs is crashing, the handlers may tweak what is causing Emacs to crash @@ -4201,6 +4202,7 @@ DEFSYMBOL (Qrename_file); DEFSYMBOL (Qadd_name_to_file); DEFSYMBOL (Qmake_symbolic_link); + DEFSYMBOL (Qmake_temp_name); DEFSYMBOL (Qfile_exists_p); DEFSYMBOL (Qfile_executable_p); DEFSYMBOL (Qfile_readable_p); diff --text -u 'xemacs-21.5.6/src/filelock.c' 'xemacs-21.5.7/src/filelock.c' Index: ././src/filelock.c --- ././src/filelock.c Fri Mar 29 13:47:37 2002 +++ ././src/filelock.c Wed Jun 5 18:55:40 2002 @@ -26,11 +26,11 @@ #include "buffer.h" #include -#include "sysfile.h" #include "sysdir.h" -#include "syspwd.h" -#include "syssignal.h" /* for kill */ +#include "sysfile.h" #include "sysproc.h" /* for qxe_getpid() */ +#include "syspwd.h" +#include "syssignal.h" /* for kill. */ Lisp_Object Qask_user_about_supersession_threat; Lisp_Object Qask_user_about_lock; @@ -78,8 +78,8 @@ typedef struct { - Intbyte *user; - Intbyte *host; + Ibyte *user; + Ibyte *host; pid_t pid; } lock_info_type; @@ -93,14 +93,14 @@ /* Write the name of the lock file for FN into LFNAME. Length will be that of FN plus two more for the leading `.#' plus one for the null. */ #define MAKE_LOCK_NAME(lock, file) \ - (lock = (Intbyte *) alloca (XSTRING_LENGTH (file) + 2 + 1), \ + (lock = (Ibyte *) ALLOCA (XSTRING_LENGTH (file) + 2 + 1), \ fill_in_lock_file_name (lock, file)) static void -fill_in_lock_file_name (Intbyte *lockfile, Lisp_Object fn) +fill_in_lock_file_name (Ibyte *lockfile, Lisp_Object fn) { - Intbyte *file_name = XSTRING_DATA (fn); - Intbyte *p; + Ibyte *file_name = XSTRING_DATA (fn); + Ibyte *p; Bytecount dirlen; for (p = file_name + XSTRING_LENGTH (fn) - 1; @@ -121,24 +121,24 @@ Return 1 if successful, 0 if not. */ static int -lock_file_1 (Intbyte *lfname, int force) +lock_file_1 (Ibyte *lfname, int force) { /* Does not GC. */ int err; - Intbyte *lock_info_str; - Intbyte *host_name; - Intbyte *user_name = user_login_name (NULL); + Ibyte *lock_info_str; + Ibyte *host_name; + Ibyte *user_name = user_login_name (NULL); if (user_name == NULL) - user_name = (Intbyte *) ""; + user_name = (Ibyte *) ""; if (STRINGP (Vsystem_name)) host_name = XSTRING_DATA (Vsystem_name); else - host_name = (Intbyte *) ""; + host_name = (Ibyte *) ""; lock_info_str = - (Intbyte *) alloca (qxestrlen (user_name) + qxestrlen (host_name) + (Ibyte *) ALLOCA (qxestrlen (user_name) + qxestrlen (host_name) + LOCK_PID_MAX + 5); qxesprintf (lock_info_str, "%s@%s.%d", user_name, host_name, qxe_getpid ()); @@ -159,20 +159,20 @@ or -1 if something is wrong with the locking mechanism. */ static int -current_lock_owner (lock_info_type *owner, Intbyte *lfname) +current_lock_owner (lock_info_type *owner, Ibyte *lfname) { /* Does not GC. */ int len, ret; int local_owner = 0; - Intbyte *at, *dot; - Intbyte *lfinfo = 0; + Ibyte *at, *dot; + Ibyte *lfinfo = 0; int bufsize = 50; /* Read arbitrarily-long contents of symlink. Similar code in file-symlink-p in fileio.c. */ do { bufsize *= 2; - lfinfo = (Intbyte *) xrealloc (lfinfo, bufsize); + lfinfo = (Ibyte *) xrealloc (lfinfo, bufsize); len = qxe_readlink (lfname, lfinfo, bufsize); } while (len >= bufsize); @@ -191,7 +191,7 @@ read it to determine return value, so allocate it. */ if (!owner) { - owner = (lock_info_type *) alloca (sizeof (lock_info_type)); + owner = (lock_info_type *) ALLOCA (sizeof (lock_info_type)); local_owner = 1; } @@ -204,16 +204,16 @@ return -1; } len = at - lfinfo; - owner->user = (Intbyte *) xmalloc (len + 1); + owner->user = (Ibyte *) xmalloc (len + 1); qxestrncpy (owner->user, lfinfo, len); owner->user[len] = 0; /* The PID is everything after the last `.'. */ - owner->pid = atoi ((CIntbyte *) dot + 1); + owner->pid = atoi ((CIbyte *) dot + 1); /* The host is everything in between. */ len = dot - at - 1; - owner->host = (Intbyte *) xmalloc (len + 1); + owner->host = (Ibyte *) xmalloc (len + 1); qxestrncpy (owner->host, at + 1, len); owner->host[len] = 0; @@ -257,10 +257,10 @@ Return -1 if cannot lock for any other reason. */ static int -lock_if_free (lock_info_type *clasher, Intbyte *lfname) +lock_if_free (lock_info_type *clasher, Ibyte *lfname) { /* Does not GC. */ - if (lock_file_1 ((Intbyte *) lfname, 0) == 0) + if (lock_file_1 ((Ibyte *) lfname, 0) == 0) { int locker; @@ -309,7 +309,7 @@ comment. -slb */ register Lisp_Object attack, orig_fn; - register Intbyte *lfname, *locker; + register Ibyte *lfname, *locker; lock_info_type lock_info; struct gcpro gcpro1, gcpro2, gcpro3; Lisp_Object old_current_buffer; @@ -346,7 +346,7 @@ goto done; /* Else consider breaking the lock */ - locker = (Intbyte *) alloca (qxestrlen (lock_info.user) + locker = (Ibyte *) ALLOCA (qxestrlen (lock_info.user) + qxestrlen (lock_info.host) + LOCK_PID_MAX + 9); qxesprintf (locker, "%s@%s (pid %d)", lock_info.user, lock_info.host, @@ -371,7 +371,7 @@ unlock_file (Lisp_Object fn) { /* This can GC */ - register Intbyte *lfname; + register Ibyte *lfname; struct gcpro gcpro1; GCPRO1 (fn); @@ -454,7 +454,7 @@ (filename)) { Lisp_Object ret; - register Intbyte *lfname; + register Ibyte *lfname; int owner; lock_info_type locker; struct gcpro gcpro1; diff --text -u 'xemacs-21.5.6/src/fns.c' 'xemacs-21.5.7/src/fns.c' Index: ././src/fns.c --- ././src/fns.c Mon Apr 1 12:58:38 2002 +++ ././src/fns.c Fri Jun 21 06:18:31 2002 @@ -45,6 +45,7 @@ #include "events.h" #include "extents.h" #include "frame.h" +#include "process.h" #include "systime.h" #include "insdel.h" #include "lstream.h" @@ -81,17 +82,17 @@ if (INTP (Vprint_length)) last = min (len, XINT (Vprint_length)); - write_c_string ("#*", printcharfun); + write_c_string (printcharfun, "#*"); for (i = 0; i < last; i++) { if (bit_vector_bit (v, i)) - write_c_string ("1", printcharfun); + write_c_string (printcharfun, "1"); else - write_c_string ("0", printcharfun); + write_c_string (printcharfun, "0"); } if (last != len) - write_c_string ("...", printcharfun); + write_c_string (printcharfun, "..."); } static int @@ -222,7 +223,7 @@ { retry: if (STRINGP (sequence)) - return make_int (XSTRING_CHAR_LENGTH (sequence)); + return make_int (string_char_length (sequence)); else if (CONSP (sequence)) { Elemcount len; @@ -381,14 +382,14 @@ p2 = string2; } - end = XSTRING_CHAR_LENGTH (p1); - len2 = XSTRING_CHAR_LENGTH (p2); + end = string_char_length (p1); + len2 = string_char_length (p2); if (end > len2) end = len2; { - Intbyte *ptr1 = XSTRING_DATA (p1); - Intbyte *ptr2 = XSTRING_DATA (p2); + Ibyte *ptr1 = XSTRING_DATA (p1); + Ibyte *ptr2 = XSTRING_DATA (p2); /* #### It is not really necessary to do this: We could compare byte-by-byte and still get a reasonable comparison, since this @@ -399,10 +400,10 @@ aren't really well-defined anyway. */ for (i = 0; i < end; i++) { - if (charptr_emchar (ptr1) != charptr_emchar (ptr2)) - return charptr_emchar (ptr1) < charptr_emchar (ptr2) ? Qt : Qnil; - INC_CHARPTR (ptr1); - INC_CHARPTR (ptr2); + if (itext_ichar (ptr1) != itext_ichar (ptr2)) + return itext_ichar (ptr1) < itext_ichar (ptr2) ? Qt : Qnil; + INC_IBYTEPTR (ptr1); + INC_IBYTEPTR (ptr2); } } /* Can't do i < len2 because then comparison between "foo" and "foo^@" @@ -614,9 +615,10 @@ Lisp_Object last_tail; Lisp_Object prev; struct merge_string_extents_struct *args_mse = 0; - Intbyte *string_result = 0; - Intbyte *string_result_ptr = 0; + Ibyte *string_result = 0; + Ibyte *string_result_ptr = 0; struct gcpro gcpro1; + int sdep = specpdl_depth (); /* The modus operandi in Emacs is "caller gc-protects args". However, concat is called many times in Emacs on freshly @@ -699,8 +701,11 @@ { case c_cons: if (total_length == 0) - /* In append, if all but last arg are nil, return last arg */ - RETURN_UNGCPRO (last_tail); + { + unbind_to (sdep); + /* In append, if all but last arg are nil, return last arg */ + RETURN_UNGCPRO (last_tail); + } val = Fmake_list (make_int (total_length), Qnil); break; case c_vector: @@ -720,7 +725,8 @@ realloc()ing in order to make the char fit properly. O(N^2) yuckage. */ val = Qnil; - string_result = (Intbyte *) alloca (total_length * MAX_EMCHAR_LEN); + string_result = + (Ibyte *) MALLOC_OR_ALLOCA (total_length * MAX_ICHAR_LEN); string_result_ptr = string_result; break; default: @@ -743,8 +749,8 @@ Charcount thisleni = 0; Charcount thisindex = 0; Lisp_Object seq = args[argnum]; - Intbyte *string_source_ptr = 0; - Intbyte *string_prev_result_ptr = string_result_ptr; + Ibyte *string_source_ptr = 0; + Ibyte *string_prev_result_ptr = string_result_ptr; if (!CONSP (seq)) { @@ -778,8 +784,8 @@ if (STRINGP (seq)) { - elt = make_char (charptr_emchar (string_source_ptr)); - INC_CHARPTR (string_source_ptr); + elt = make_char (itext_ichar (string_source_ptr)); + INC_IBYTEPTR (string_source_ptr); } else if (VECTORP (seq)) elt = XVECTOR_DATA (seq)[thisindex]; @@ -809,7 +815,7 @@ else { CHECK_CHAR_COERCE_INT (elt); - string_result_ptr += set_charptr_emchar (string_result_ptr, + string_result_ptr += set_itext_ichar (string_result_ptr, XCHAR (elt)); } } @@ -838,6 +844,7 @@ if (!NILP (prev)) XCDR (prev) = last_tail; + unbind_to (sdep); RETURN_UNGCPRO (val); } @@ -1023,26 +1030,26 @@ /* Split STRING into a list of substrings. The substrings are the parts of original STRING separated by SEPCHAR. */ static Lisp_Object -split_string_by_emchar_1 (const Intbyte *string, Bytecount size, - Emchar sepchar) +split_string_by_ichar_1 (const Ibyte *string, Bytecount size, + Ichar sepchar) { Lisp_Object result = Qnil; - const Intbyte *end = string + size; + const Ibyte *end = string + size; while (1) { - const Intbyte *p = string; + const Ibyte *p = string; while (p < end) { - if (charptr_emchar (p) == sepchar) + if (itext_ichar (p) == sepchar) break; - INC_CHARPTR (p); + INC_IBYTEPTR (p); } result = Fcons (make_string (string, p - string), result); if (p < end) { string = p; - INC_CHARPTR (string); /* skip sepchar */ + INC_IBYTEPTR (string); /* skip sepchar */ } else break; @@ -1057,7 +1064,7 @@ split_external_path (const Extbyte *path) { Bytecount newlen; - Intbyte *newpath; + Ibyte *newpath; if (!path) return Qnil; @@ -1070,20 +1077,20 @@ if (!newlen) return Qnil; - return split_string_by_emchar_1 (newpath, newlen, SEPCHAR); + return split_string_by_ichar_1 (newpath, newlen, SEPCHAR); } Lisp_Object -split_env_path (const CIntbyte *evarname, const Intbyte *default_) +split_env_path (const CIbyte *evarname, const Ibyte *default_) { - const Intbyte *path = 0; + const Ibyte *path = 0; if (evarname) path = egetenv (evarname); if (!path) path = default_; if (!path) return Qnil; - return split_string_by_emchar_1 (path, qxestrlen (path), SEPCHAR); + return split_string_by_ichar_1 (path, qxestrlen (path), SEPCHAR); } /* Ben thinks this function should not exist or be exported to Lisp. @@ -1096,7 +1103,7 @@ { CHECK_STRING (string); CHECK_CHAR (sepchar); - return split_string_by_emchar_1 (XSTRING_DATA (string), + return split_string_by_ichar_1 (XSTRING_DATA (string), XSTRING_LENGTH (string), XCHAR (sepchar)); } @@ -1114,15 +1121,15 @@ CHECK_STRING (path); while (!STRINGP (Vpath_separator) - || (XSTRING_CHAR_LENGTH (Vpath_separator) != 1)) + || (string_char_length (Vpath_separator) != 1)) Vpath_separator = signal_continuable_error (Qinvalid_state, "`path-separator' should be set to a single-character string", Vpath_separator); - return (split_string_by_emchar_1 + return (split_string_by_ichar_1 (XSTRING_DATA (path), XSTRING_LENGTH (path), - charptr_emchar (XSTRING_DATA (Vpath_separator)))); + itext_ichar (XSTRING_DATA (Vpath_separator)))); } @@ -1662,7 +1669,7 @@ else XCDR (prev) = XCDR (tail); tail = XCDR (tail); - free_cons (XCONS (cons_to_free)); + free_cons (cons_to_free); } else { @@ -1807,10 +1814,13 @@ int (*pred_fn) (Lisp_Object, Lisp_Object, Lisp_Object lisp_arg)); +/* The sort function should return > 0 if OBJ1 < OBJ2, < 0 otherwise. + NOTE: This is backwards from the way qsort() works. */ + Lisp_Object list_sort (Lisp_Object list, Lisp_Object lisp_arg, - int (*pred_fn) (Lisp_Object, Lisp_Object, + int (*pred_fn) (Lisp_Object obj1, Lisp_Object obj2, Lisp_Object lisp_arg)) { struct gcpro gcpro1, gcpro2, gcpro3; @@ -1841,8 +1851,8 @@ Lisp_Object tmp; /* prevents the GC from happening in call2 */ -/* Emacs' GC doesn't actually relocate pointers, so this probably - isn't strictly necessary */ + /* Emacs' GC doesn't actually relocate pointers, so this probably + isn't strictly necessary */ int speccount = begin_gc_forbidden (); tmp = call2 (pred, obj1, obj2); unbind_to (speccount); @@ -2764,6 +2774,33 @@ } +static Lisp_Object +tweaked_internal_equal (Lisp_Object obj1, Lisp_Object obj2, + Lisp_Object depth) +{ + return make_int (internal_equal (obj1, obj2, XINT (depth))); +} + +int +internal_equal_trapping_problems (Lisp_Object warning_class, + const char *warning_string, + int flags, + struct call_trapping_problems_result *p, + int retval, + Lisp_Object obj1, Lisp_Object obj2, + int depth) +{ + Lisp_Object glorp = + va_call_trapping_problems (warning_class, warning_string, + flags, p, + (lisp_fn_t) tweaked_internal_equal, + 3, obj1, obj2, make_int (depth)); + if (UNBOUNDP (glorp)) + return retval; + else + return XINT (glorp); +} + int internal_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) { @@ -2878,16 +2915,16 @@ Bytecount old_bytecount = XSTRING_LENGTH (array); Bytecount new_bytecount; Bytecount item_bytecount; - Intbyte item_buf[MAX_EMCHAR_LEN]; - Intbyte *p; - Intbyte *end; + Ibyte item_buf[MAX_ICHAR_LEN]; + Ibyte *p; + Ibyte *end; CHECK_CHAR_COERCE_INT (item); CHECK_LISP_WRITEABLE (array); sledgehammer_check_ascii_begin (array); - item_bytecount = set_charptr_emchar (item_buf, XCHAR (item)); - new_bytecount = item_bytecount * XSTRING_CHAR_LENGTH (array); + item_bytecount = set_itext_ichar (item_buf, XCHAR (item)); + new_bytecount = item_bytecount * (Bytecount) string_char_length (array); resize_string (array, -1, new_bytecount - old_bytecount); @@ -3100,7 +3137,7 @@ results computed so far. if (vals == 0) we don't have any free space available and - don't want to eat up any more stack with alloca(). + don't want to eat up any more stack with ALLOCA (). So we use EXTERNAL_LIST_LOOP_3_NO_DECLARE and GCPRO the tail. */ if (vals) @@ -3153,15 +3190,15 @@ { /* The string data of `sequence' might be relocated during GC. */ Bytecount slen = XSTRING_LENGTH (sequence); - Intbyte *p = alloca_array (Intbyte, slen); - Intbyte *end = p + slen; + Ibyte *p = alloca_array (Ibyte, slen); + Ibyte *end = p + slen; memcpy (p, XSTRING_DATA (sequence), slen); while (p < end) { - args[1] = make_char (charptr_emchar (p)); - INC_CHARPTR (p); + args[1] = make_char (itext_ichar (p)); + INC_IBYTEPTR (p); result = Ffuncall (2, args); if (vals) vals[gcpro1.nvars++] = result; } @@ -3602,23 +3639,23 @@ } #define ADVANCE_INPUT(c, stream) \ - ((ec = Lstream_get_emchar (stream)) == -1 ? 0 : \ + ((ec = Lstream_get_ichar (stream)) == -1 ? 0 : \ ((ec > 255) ? \ (base64_conversion_error ("Non-ascii character in base64 input", \ make_char (ec)), 0) \ - : (c = (Intbyte)ec), 1)) + : (c = (Ibyte)ec), 1)) static Bytebpos -base64_encode_1 (Lstream *istream, Intbyte *to, int line_break) +base64_encode_1 (Lstream *istream, Ibyte *to, int line_break) { EMACS_INT counter = 0; - Intbyte *e = to; - Emchar ec; + Ibyte *e = to; + Ichar ec; unsigned int value; while (1) { - Intbyte c; + Ibyte c; if (!ADVANCE_INPUT (c, istream)) break; @@ -3668,9 +3705,9 @@ /* Get next character from the stream, except that non-base64 characters are ignored. This is in accordance with rfc2045. EC - should be an Emchar, so that it can hold -1 as the value for EOF. */ + should be an Ichar, so that it can hold -1 as the value for EOF. */ #define ADVANCE_INPUT_IGNORE_NONBASE64(ec, stream, streampos) do { \ - ec = Lstream_get_emchar (stream); \ + ec = Lstream_get_ichar (stream); \ ++streampos; \ /* IS_BASE64 may not be called with negative arguments so check for \ EOF first. */ \ @@ -3679,20 +3716,20 @@ } while (1) #define STORE_BYTE(pos, val, ccnt) do { \ - pos += set_charptr_emchar (pos, (Emchar)((unsigned char)(val))); \ + pos += set_itext_ichar (pos, (Ichar)((unsigned char)(val))); \ ++ccnt; \ } while (0) static Bytebpos -base64_decode_1 (Lstream *istream, Intbyte *to, Charcount *ccptr) +base64_decode_1 (Lstream *istream, Ibyte *to, Charcount *ccptr) { Charcount ccnt = 0; - Intbyte *e = to; + Ibyte *e = to; EMACS_INT streampos = 0; while (1) { - Emchar ec; + Ichar ec; unsigned long value; /* Process first byte of a quadruplet. */ @@ -3756,39 +3793,6 @@ #undef ADVANCE_INPUT_IGNORE_NONBASE64 #undef STORE_BYTE -static Lisp_Object -free_malloced_ptr (Lisp_Object unwind_obj) -{ - void *ptr = (void *)get_opaque_ptr (unwind_obj); - xfree (ptr); - free_opaque_ptr (unwind_obj); - return Qnil; -} - -/* Don't use alloca for regions larger than this, lest we overflow - the stack. */ -#define MAX_ALLOCA 65536 - -/* We need to setup proper unwinding, because there is a number of - ways these functions can blow up, and we don't want to have memory - leaks in those cases. */ -#define XMALLOC_OR_ALLOCA(ptr, len, type) do { \ - Elemcount XOA_len = (len); \ - if (XOA_len > MAX_ALLOCA) \ - { \ - ptr = xnew_array (type, XOA_len); \ - record_unwind_protect (free_malloced_ptr, \ - make_opaque_ptr ((void *)ptr)); \ - } \ - else \ - ptr = alloca_array (type, XOA_len); \ -} while (0) - -#define XMALLOC_UNBIND(ptr, len, speccount) do { \ - if ((len) > MAX_ALLOCA) \ - unbind_to (speccount); \ -} while (0) - DEFUN ("base64-encode-region", Fbase64_encode_region, 2, 3, "r", /* Base64-encode the region between START and END. Return the length of the encoded text. @@ -3797,13 +3801,13 @@ */ (start, end, no_line_break)) { - Intbyte *encoded; + Ibyte *encoded; Bytebpos encoded_length; Charcount allength, length; struct buffer *buf = current_buffer; Charbpos begv, zv, old_pt = BUF_PT (buf); Lisp_Object input; - int speccount = specpdl_depth(); + int speccount = specpdl_depth (); get_buffer_range_char (buf, start, end, &begv, &zv, 0); barf_if_buffer_read_only (buf, begv, zv); @@ -3816,9 +3820,9 @@ allength += allength / MIME_LINE_LENGTH + 1 + 6; input = make_lisp_buffer_input_stream (buf, begv, zv, 0); - /* We needn't multiply allength with MAX_EMCHAR_LEN because all the + /* We needn't multiply allength with MAX_ICHAR_LEN because all the base64 characters will be single-byte. */ - XMALLOC_OR_ALLOCA (encoded, allength, Intbyte); + encoded = (Ibyte *) MALLOC_OR_ALLOCA (allength); encoded_length = base64_encode_1 (XLSTREAM (input), encoded, NILP (no_line_break)); if (encoded_length > allength) @@ -3828,7 +3832,7 @@ /* Now we have encoded the region, so we insert the new contents and delete the old. (Insert first in order to preserve markers.) */ buffer_insert_raw_string_1 (buf, begv, encoded, encoded_length, 0); - XMALLOC_UNBIND (encoded, allength, speccount); + unbind_to (speccount); buffer_delete_range (buf, begv + encoded_length, zv + encoded_length, 0); /* Simulate FSF Emacs implementation of this function: if point was @@ -3849,25 +3853,25 @@ { Charcount allength, length; Bytebpos encoded_length; - Intbyte *encoded; + Ibyte *encoded; Lisp_Object input, result; int speccount = specpdl_depth(); CHECK_STRING (string); - length = XSTRING_CHAR_LENGTH (string); + length = string_char_length (string); allength = length + length/3 + 1; allength += allength / MIME_LINE_LENGTH + 1 + 6; input = make_lisp_string_input_stream (string, 0, -1); - XMALLOC_OR_ALLOCA (encoded, allength, Intbyte); + encoded = (Ibyte *) MALLOC_OR_ALLOCA (allength); encoded_length = base64_encode_1 (XLSTREAM (input), encoded, NILP (no_line_break)); if (encoded_length > allength) abort (); Lstream_delete (XLSTREAM (input)); result = make_string (encoded, encoded_length); - XMALLOC_UNBIND (encoded, allength, speccount); + unbind_to (speccount); return result; } @@ -3881,7 +3885,7 @@ { struct buffer *buf = current_buffer; Charbpos begv, zv, old_pt = BUF_PT (buf); - Intbyte *decoded; + Ibyte *decoded; Bytebpos decoded_length; Charcount length, cc_decoded_length; Lisp_Object input; @@ -3894,9 +3898,9 @@ input = make_lisp_buffer_input_stream (buf, begv, zv, 0); /* We need to allocate enough room for decoding the text. */ - XMALLOC_OR_ALLOCA (decoded, length * MAX_EMCHAR_LEN, Intbyte); + decoded = (Ibyte *) MALLOC_OR_ALLOCA (length * MAX_ICHAR_LEN); decoded_length = base64_decode_1 (XLSTREAM (input), decoded, &cc_decoded_length); - if (decoded_length > length * MAX_EMCHAR_LEN) + if (decoded_length > length * MAX_ICHAR_LEN) abort (); Lstream_delete (XLSTREAM (input)); @@ -3904,7 +3908,7 @@ and delete the old. (Insert first in order to preserve markers.) */ BUF_SET_PT (buf, begv); buffer_insert_raw_string_1 (buf, begv, decoded, decoded_length, 0); - XMALLOC_UNBIND (decoded, length * MAX_EMCHAR_LEN, speccount); + unbind_to (speccount); buffer_delete_range (buf, begv + cc_decoded_length, zv + cc_decoded_length, 0); @@ -3922,7 +3926,7 @@ */ (string)) { - Intbyte *decoded; + Ibyte *decoded; Bytebpos decoded_length; Charcount length, cc_decoded_length; Lisp_Object input, result; @@ -3930,19 +3934,19 @@ CHECK_STRING (string); - length = XSTRING_CHAR_LENGTH (string); + length = string_char_length (string); /* We need to allocate enough room for decoding the text. */ - XMALLOC_OR_ALLOCA (decoded, length * MAX_EMCHAR_LEN, Intbyte); + decoded = (Ibyte *) MALLOC_OR_ALLOCA (length * MAX_ICHAR_LEN); input = make_lisp_string_input_stream (string, 0, -1); decoded_length = base64_decode_1 (XLSTREAM (input), decoded, &cc_decoded_length); - if (decoded_length > length * MAX_EMCHAR_LEN) + if (decoded_length > length * MAX_ICHAR_LEN) abort (); Lstream_delete (XLSTREAM (input)); result = make_string (decoded, decoded_length); - XMALLOC_UNBIND (decoded, length * MAX_EMCHAR_LEN, speccount); + unbind_to (speccount); return result; } @@ -4057,7 +4061,7 @@ */ ); { char c = SEPCHAR; - Vpath_separator = make_string ((Intbyte *) &c, 1); + Vpath_separator = make_string ((Ibyte *) &c, 1); } DEFVAR_BOOL ("require-prints-loading-message", diff --text -u 'xemacs-21.5.6/src/font-lock.c' 'xemacs-21.5.7/src/font-lock.c' Index: ././src/font-lock.c --- ././src/font-lock.c Thu Sep 20 15:28:59 2001 +++ ././src/font-lock.c Wed Jun 5 18:55:43 2002 @@ -1,6 +1,7 @@ /* Routines to compute the current syntactic context, for font-lock mode. Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -44,6 +45,9 @@ */ #include + +#ifdef USE_C_FONT_LOCK + #include "lisp.h" #include "buffer.h" @@ -88,7 +92,7 @@ enum syntactic_context context; /* single-char-syntax state */ enum block_comment_context ccontext; /* block-comment state */ enum comment_style style; /* which comment group */ - Emchar scontext; /* active string delimiter */ + Ichar scontext; /* active string delimiter */ int depth; /* depth in parens */ int backslash_p; /* just read a backslash */ int needs_its_head_reexamined; /* we're apparently outside of @@ -424,21 +428,30 @@ find_context (struct buffer *buf, Charbpos pt) { /* This function can GC */ -#ifndef emacs - Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); - Lisp_Object syntaxtab = buf->syntax_table; -#endif - Emchar prev_c, c; + Ichar prev_c, c; int prev_syncode, syncode; Charbpos target = pt; + struct syntax_cache *scache; + int spec = specpdl_depth (); + + /* If we are narrowed, we will get confused. In fact, we are quite often + narrowed when this function is called. */ + if (BUF_BEGV (buf) != BUF_BEG (buf) || BUF_ZV (buf) != BUF_Z (buf)) + { + record_unwind_protect (save_restriction_restore, + save_restriction_save (buf)); + Fwiden (wrap_buffer (buf)); + } + setup_context_cache (buf, pt); pt = context_cache.cur_point; - SETUP_SYNTAX_CACHE (pt - 1, 1); + scache = setup_buffer_syntax_cache (buf, pt > BUF_BEGV (buf) ? pt - 1 : pt, + 1); if (pt > BUF_BEGV (buf)) { c = BUF_FETCH_CHAR (buf, pt - 1); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); } else { @@ -479,11 +492,11 @@ } } - UPDATE_SYNTAX_CACHE_FORWARD (pt); + UPDATE_SYNTAX_CACHE_FORWARD (scache, pt); prev_c = c; prev_syncode = syncode; c = BUF_FETCH_CHAR (buf, pt); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); if (prev_c == '\n') bol_context_cache = context_cache; @@ -494,7 +507,7 @@ continue; } - switch (SYNTAX_FROM_CACHE (mirrortab, c)) + switch (SYNTAX_FROM_CODE (syncode)) { case Sescape: context_cache.backslash_p = 1; @@ -549,8 +562,8 @@ else if (context_cache.context == context_none) { Lisp_Object stringtermobj = - syntax_match (syntax_cache.current_syntax_table, c); - Emchar stringterm; + syntax_match (scache->current_syntax_table, c); + Ichar stringterm; if (CHARP (stringtermobj)) stringterm = XCHAR (stringtermobj); @@ -676,6 +689,7 @@ } context_cache.needs_its_head_reexamined = 0; + unbind_to (spec); } static Lisp_Object @@ -841,3 +855,5 @@ { reinit_vars_of_font_lock (); } + +#endif /* USE_C_FONT_LOCK */ diff --text -u 'xemacs-21.5.6/src/frame-gtk.c' 'xemacs-21.5.7/src/frame-gtk.c' Index: ././src/frame-gtk.c --- ././src/frame-gtk.c Fri Mar 29 13:47:39 2002 +++ ././src/frame-gtk.c Fri Jun 21 06:18:31 2002 @@ -27,29 +27,30 @@ #include #include "lisp.h" -#include "console-gtk.h" -#include "ui-gtk.h" -#include "glyphs-gtk.h" -#include "objects-gtk.h" -#include "scrollbar-gtk.h" - -#include "gtk-xemacs.h" - #include "buffer.h" +#include "device-impl.h" #include "events.h" #include "extents.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "window.h" -#ifdef HAVE_GNOME -#include -#endif - #ifdef HAVE_DRAGNDROP #include "dragdrop.h" #endif +#include "console-gtk-impl.h" +#include "glyphs-gtk.h" +#include "objects-gtk-impl.h" +#include "scrollbar-gtk.h" +#include "ui-gtk.h" + +#include "gtk-xemacs.h" + +#ifdef HAVE_GNOME +#include +#endif + #define BORDER_WIDTH 0 #define INTERNAL_BORDER_WIDTH 0 @@ -275,7 +276,7 @@ individual properties. */ static void -gtk_set_frame_text_value (struct frame *f, Intbyte *value, +gtk_set_frame_text_value (struct frame *f, Ibyte *value, void (*func) (gpointer, gchar *), gpointer arg) { @@ -286,11 +287,11 @@ #ifdef MULE { - Intbyte *ptr; + Ibyte *ptr; /* Optimize for common ASCII case */ for (ptr = value; *ptr; ptr++) - if (!BYTE_ASCII_P (*ptr)) + if (!byte_ascii_p (*ptr)) { char *tmp; C_STRING_TO_EXTERNAL (value, tmp, Qctext); @@ -304,7 +305,7 @@ } static void -gtk_set_title_from_intbyte (struct frame *f, Intbyte *name) +gtk_set_title_from_ibyte (struct frame *f, Ibyte *name) { if (GTK_IS_WINDOW (FRAME_GTK_SHELL_WIDGET (f))) gtk_set_frame_text_value (f, name, @@ -313,7 +314,7 @@ } static void -gtk_set_icon_name_from_intbyte (struct frame *f, Intbyte *name) +gtk_set_icon_name_from_ibyte (struct frame *f, Ibyte *name) { gtk_set_frame_text_value (f, name, (void (*)(gpointer, gchar *)) @@ -1429,8 +1430,8 @@ CONSOLE_HAS_METHOD (gtk, internal_frame_property_p); CONSOLE_HAS_METHOD (gtk, frame_properties); CONSOLE_HAS_METHOD (gtk, set_frame_properties); - CONSOLE_HAS_METHOD (gtk, set_title_from_intbyte); - CONSOLE_HAS_METHOD (gtk, set_icon_name_from_intbyte); + CONSOLE_HAS_METHOD (gtk, set_title_from_ibyte); + CONSOLE_HAS_METHOD (gtk, set_icon_name_from_ibyte); CONSOLE_HAS_METHOD (gtk, frame_visible_p); CONSOLE_HAS_METHOD (gtk, frame_totally_visible_p); CONSOLE_HAS_METHOD (gtk, frame_iconified_p); diff --text -u /dev/null 'xemacs-21.5.7/src/frame-impl.h' Index: ././src/frame-impl.h --- ././src/frame-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/frame-impl.h Tue Jul 2 21:32:37 2002 @@ -0,0 +1,696 @@ +/* Define frame-object for XEmacs. + Copyright (C) 1988, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1995 Ben Wing. + +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 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. */ + +/* Synched up with: FSF 19.30. */ + +#ifndef INCLUDED_frame_impl_h_ +#define INCLUDED_frame_impl_h_ + +#include "console-impl.h" /* for error_check_frame_type */ +#include "frame.h" + +#define FRAME_TYPE_NAME(f) ((f)->framemeths->name) +#define FRAME_TYPE(f) ((f)->framemeths->symbol) + +/******** Accessing / calling a frame method *********/ + +#define HAS_FRAMEMETH_P(f, m) HAS_CONTYPE_METH_P ((f)->framemeths, m) +#define FRAMEMETH(f, m, args) CONTYPE_METH ((f)->framemeths, m, args) +#define MAYBE_FRAMEMETH(f, m, args) \ + MAYBE_CONTYPE_METH ((f)->framemeths, m, args) +#define FRAMEMETH_OR_GIVEN(f, m, args, given) \ + CONTYPE_METH_OR_GIVEN((f)->framemeths, m, args, given) + +struct frame +{ + struct lcrecord_header header; + + /* Methods for this frame's console. This can also be retrieved + through frame->device->console, but it's faster this way. */ + struct console_methods *framemeths; + + /* Size of text only area of this frame, excluding scrollbars, + toolbars and end of line glyphs. The size can be in characters + or pixels, depending on units in which window system resizes + its windows */ + int height, width; + + /* New height and width for pending size change, in the same units + as above. 0 if no change pending. */ + int new_height, new_width; + + /* Size of text-only are of the frame, in default font characters. + This may be inaccurate due to rounding error */ + int char_height, char_width; + + /* Size of the whole frame, including scrollbars, toolbars and end + of line glyphs, in pixels */ + int pixheight, pixwidth; + +#ifdef HAVE_TTY + /* The count of frame number. This applies to TTY frames only. */ + int order_count; +#endif + + /* Current page number for a printer frame. */ + int page_number; + + /* Width of the internal border. This is a line of background color + just inside the window's border. It is normally only non-zero on + X frames, but we put it here to avoid introducing window system + dependencies. */ + int internal_border_width; + + int modiff; + + struct expose_ignore *subwindow_exposures; + struct expose_ignore *subwindow_exposures_tail; + +#ifdef HAVE_SCROLLBARS + /* frame-local scrollbar information. See scrollbar.c. */ + int scrollbar_y_offset; + + /* cache of created scrollbars */ + struct scrollbar_instance *sb_vcache; + struct scrollbar_instance *sb_hcache; +#endif + +#ifdef HAVE_TOOLBARS + /* Size of toolbars as seen by redisplay. This is used to determine + whether to re-layout windows by a call to change_frame_size early + in redisplay_frame. */ + int current_toolbar_size[4]; +#endif + + /* Size of gutters as seen by redisplay. This is used to determine + whether to re-layout windows by a call to change_frame_size early + in redisplay_frame. */ + int current_gutter_bounds[4]; + + /* Dynamic arrays of display lines for gutters */ + display_line_dynarr *current_display_lines[4]; + display_line_dynarr *desired_display_lines[4]; + + /* A structure of auxiliary data specific to the device type. + struct x_frame is for X window frames; defined in console-x-impl.h */ + void *frame_data; + +#define FRAME_SLOT_DECLARATION +#define MARKED_SLOT(x) Lisp_Object x +#include "frameslots.h" + + /* Nonzero if frame is currently displayed. + Mutually exclusive with iconified + JV: This now a tristate flag: +Value : Emacs meaning :f-v-p : X meaning +0 : not displayed : nil : unmapped +>0 : user can access it,needs repainting : t : mapped and visible +<0 : user can access it,needs no repainting : hidden :mapped and invisible + where f-v-p is the return value of frame-visible-p */ + int visible; + + /* one-bit flags: */ + + /* Is focusing onto this frame disabled? (Modal dialog boxes) */ + unsigned int disabled :1; + + /* Are we finished initializing? */ + unsigned int init_finished :1; + + /* Is frame marked for deletion? This is used in XSetErrorHandler(). */ + unsigned int being_deleted :1; + + /* Nonzero if last attempt at redisplay on this frame was preempted. */ + unsigned int display_preempted :1; + + /* Nonzero if window is currently iconified. + This and visible are mutually exclusive. */ + unsigned int iconified :1; + + /* Nonzero if this frame should be cleared and then redrawn. + Setting this will also effectively set frame_changed. */ + unsigned int clear :1; + + /* True if frame actually has a minibuffer window on it. + 0 if using a minibuffer window that isn't on this frame. */ + unsigned int has_minibuffer :1; + + /* True if frame's root window can't be split. */ + unsigned int no_split :1; + + unsigned int top_toolbar_was_visible :1; + unsigned int bottom_toolbar_was_visible :1; + unsigned int left_toolbar_was_visible :1; + unsigned int right_toolbar_was_visible :1; + /* gutter visibility */ + unsigned int top_gutter_was_visible :1; + unsigned int bottom_gutter_was_visible :1; + unsigned int left_gutter_was_visible :1; + unsigned int right_gutter_was_visible :1; + + /* redisplay flags */ + unsigned int buffers_changed :1; + unsigned int clip_changed :1; + unsigned int extents_changed :1; + unsigned int faces_changed :1; + unsigned int frame_changed :1; + unsigned int subwindows_changed :1; + unsigned int subwindows_state_changed :1; + unsigned int glyphs_changed :1; + unsigned int icon_changed :1; + unsigned int menubar_changed :1; + unsigned int modeline_changed :1; + unsigned int point_changed :1; + unsigned int size_changed :1; + unsigned int toolbar_changed :1; + unsigned int gutter_changed :1; + unsigned int windows_changed :1; + unsigned int windows_structure_changed :1; + unsigned int window_face_cache_reset :1; /* used by expose handler */ + unsigned int echo_area_garbaged :1; /* used by Fredisplay_echo_area */ + unsigned int size_slipped :1; + + unsigned int size_change_pending :1; + unsigned int mirror_dirty :1; + + /* flag indicating if any window on this frame is displaying a subwindow */ + unsigned int subwindows_being_displayed :1; +}; + +/* Redefine basic properties more efficiently */ + +#undef FRAME_LIVE_P +#define FRAME_LIVE_P(f) (!EQ (FRAME_TYPE (f), Qdead)) +#undef FRAME_DEVICE +#define FRAME_DEVICE(f) ((f)->device) + +#define FRAME_TYPE_P(f, type) EQ (FRAME_TYPE (f), Q##type) + +#ifdef ERROR_CHECK_TYPES +DECLARE_INLINE_HEADER ( +struct frame * +error_check_frame_type (struct frame * f, Lisp_Object sym) +) +{ + assert (EQ (FRAME_TYPE (f), sym)); + return f; +} +# define FRAME_TYPE_DATA(f, type) \ + ((struct type##_frame *) error_check_frame_type (f, Q##type)->frame_data) +#else +# define FRAME_TYPE_DATA(f, type) \ + ((struct type##_frame *) (f)->frame_data) +#endif + +#define CHECK_FRAME_TYPE(x, type) \ + do { \ + CHECK_FRAME (x); \ + if (!FRAME_TYPE_P (XFRAME (x), type)) \ + dead_wrong_type_argument \ + (type##_console_methods->predicate_symbol, x); \ + } while (0) +#define CONCHECK_FRAME_TYPE(x, type) \ + do { \ + CONCHECK_FRAME (x); \ + if (!FRAME_TYPE_P (XFRAME (x), type)) \ + x = wrong_type_argument \ + (type##_console_methods->predicate_symbol, x); \ + } while (0) + +#define FRAME_DISPLAY_P(frm) \ + (DEVICE_DISPLAY_P (XDEVICE (FRAME_DEVICE (frm)))) + +#define CHECK_DISPLAY_FRAME(frm) \ + do { \ + CHECK_FRAME (frm); \ + CHECK_LIVE_FRAME (frm); \ + CHECK_DISPLAY_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ + } while (0) + +#define CONCHECK_DISPLAY_FRAME(frm) \ + do { \ + CONCHECK_FRAME (frm); \ + CONCHECK_LIVE_FRAME (frm); \ + CONCHECK_DISPLAY_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ + } while (0) + +#define FRAME_PRINTER_P(frm) \ + (DEVICE_PRINTER_P (XDEVICE (FRAME_DEVICE (frm)))) + +#define CHECK_PRINTER_FRAME(frm) \ + do { \ + CHECK_FRAME (frm); \ + CHECK_LIVE_FRAME (frm); \ + CHECK_PRINTER_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ + } while (0) + +#define CONCHECK_PRINTER_FRAME(frm) \ + do { \ + CONCHECK_FRAME (frm); \ + CONCHECK_LIVE_FRAME (frm); \ + CONCHECK_PRINTER_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ + } while (0) + +/* #### These should be in the frame-*.h files but there are + too many places where the abstraction is broken. Need to + fix. */ + +#define FRAME_X_P(frm) CONSOLE_TYPESYM_X_P (FRAME_TYPE (frm)) +#define CHECK_X_FRAME(z) CHECK_FRAME_TYPE (z, x) +#define CONCHECK_X_FRAME(z) CONCHECK_FRAME_TYPE (z, x) + +#define FRAME_GTK_P(frm) CONSOLE_TYPESYM_GTK_P (FRAME_TYPE (frm)) +#define CHECK_GTK_FRAME(z) CHECK_FRAME_TYPE (z, gtk) +#define CONCHECK_GTK_FRAME(z) CONCHECK_FRAME_TYPE (z, gtk) + +#define FRAME_TTY_P(frm) CONSOLE_TYPESYM_TTY_P (FRAME_TYPE (frm)) +#define CHECK_TTY_FRAME(z) CHECK_FRAME_TYPE (z, tty) +#define CONCHECK_TTY_FRAME(z) CONCHECK_FRAME_TYPE (z, tty) + +#define FRAME_STREAM_P(frm) CONSOLE_TYPESYM_STREAM_P (FRAME_TYPE (frm)) +#define CHECK_STREAM_FRAME(z) CHECK_FRAME_TYPE (z, stream) +#define CONCHECK_STREAM_FRAME(z) CONCHECK_FRAME_TYPE (z, stream) + +#define FRAME_WIN_P(frm) CONSOLE_TYPESYM_WIN_P (FRAME_TYPE (frm)) + +extern int frame_changed; + +#define MARK_FRAME_FACES_CHANGED(f) do { \ + struct frame *mffc_f = (f); \ + mffc_f->faces_changed = 1; \ + mffc_f->modiff++; \ + if (!NILP (mffc_f->device)) \ + { \ + struct device *mffc_d = XDEVICE (mffc_f->device); \ + MARK_DEVICE_FACES_CHANGED (mffc_d); \ + } \ + else \ + faces_changed = 1; \ +} while (0) + +#define MARK_FRAME_GLYPHS_CHANGED(f) do { \ + struct frame *mfgc_f = (f); \ + mfgc_f->glyphs_changed = 1; \ + mfgc_f->modiff++; \ + if (!NILP (mfgc_f->device)) \ + { \ + struct device *mfgc_d = XDEVICE (mfgc_f->device); \ + MARK_DEVICE_GLYPHS_CHANGED (mfgc_d); \ + } \ + else \ + glyphs_changed = 1; \ +} while (0) + +#define MARK_FRAME_SUBWINDOWS_CHANGED(f) do { \ + struct frame *mfgc_f = (f); \ + mfgc_f->subwindows_changed = 1; \ + mfgc_f->modiff++; \ + if (!NILP (mfgc_f->device)) \ + { \ + struct device *mfgc_d = XDEVICE (mfgc_f->device); \ + MARK_DEVICE_SUBWINDOWS_CHANGED (mfgc_d); \ + } \ + else \ + subwindows_changed = 1; \ +} while (0) + +#define MARK_FRAME_SUBWINDOWS_STATE_CHANGED(f) do { \ + struct frame *mfgc_f = (f); \ + mfgc_f->subwindows_state_changed = 1; \ + mfgc_f->modiff++; \ + if (!NILP (mfgc_f->device)) \ + { \ + struct device *mfgc_d = XDEVICE (mfgc_f->device); \ + MARK_DEVICE_SUBWINDOWS_STATE_CHANGED (mfgc_d); \ + } \ + else \ + subwindows_state_changed = 1; \ +} while (0) + +#define MARK_FRAME_TOOLBARS_CHANGED(f) do { \ + struct frame *mftc_f = (f); \ + mftc_f->toolbar_changed = 1; \ + mftc_f->modiff++; \ + if (!NILP (mftc_f->device)) \ + { \ + struct device *mftc_d = XDEVICE (mftc_f->device); \ + MARK_DEVICE_TOOLBARS_CHANGED (mftc_d); \ + } \ + else \ + toolbar_changed = 1; \ +} while (0) + +#define MARK_FRAME_GUTTERS_CHANGED(f) do { \ + struct frame *mftc_f = (f); \ + mftc_f->gutter_changed = 1; \ + mftc_f->modiff++; \ + if (!NILP (mftc_f->device)) \ + { \ + struct device *mftc_d = XDEVICE (mftc_f->device); \ + MARK_DEVICE_GUTTERS_CHANGED (mftc_d); \ + } \ + else \ + gutter_changed = 1; \ +} while (0) + +#define MARK_FRAME_SIZE_CHANGED(f) do { \ + struct frame *mfsc_f = (f); \ + mfsc_f->size_changed = 1; \ + mfsc_f->size_change_pending = 1; \ + mfsc_f->modiff++; \ + if (!NILP (mfsc_f->device)) \ + { \ + struct device *mfsc_d = XDEVICE (mfsc_f->device); \ + MARK_DEVICE_SIZE_CHANGED (mfsc_d); \ + } \ + else \ + size_changed = 1; \ +} while (0) + +#define MARK_FRAME_CHANGED(f) do { \ + struct frame *mfc_f = (f); \ + mfc_f->frame_changed = 1; \ + mfc_f->modiff++; \ + if (!NILP (mfc_f->device)) \ + { \ + struct device *mfc_d = XDEVICE (mfc_f->device); \ + MARK_DEVICE_FRAME_CHANGED (mfc_d); \ + } \ + else \ + frame_changed = 1; \ +} while (0) + +#define MARK_FRAME_WINDOWS_CHANGED(f) do { \ + struct frame *mfwc_f = (f); \ + mfwc_f->windows_changed = 1; \ + mfwc_f->modiff++; \ + if (!NILP (mfwc_f->device)) \ + { \ + struct device *mfwc_d = XDEVICE (mfwc_f->device); \ + MARK_DEVICE_WINDOWS_CHANGED (mfwc_d); \ + } \ + else \ + windows_changed = 1; \ +} while (0) + +#define MARK_FRAME_WINDOWS_STRUCTURE_CHANGED(f) do { \ + struct frame *fwsc_f = (f); \ + fwsc_f->windows_structure_changed = 1; \ + fwsc_f->modiff++; \ + if (!NILP (fwsc_f->device)) \ + { \ + struct device *fwsc_d = XDEVICE (fwsc_f->device); \ + MARK_DEVICE_WINDOWS_STRUCTURE_CHANGED (fwsc_d); \ + } \ + else \ + windows_structure_changed = 1; \ + invalidate_vertical_divider_cache_in_frame (fwsc_f); \ +} while (0) + +#define MARK_FRAME_SIZE_SLIPPED(f) do { \ + struct frame *fwsc_f = (f); \ + fwsc_f->size_slipped = 1; \ + fwsc_f->modiff++; \ + if (!NILP (fwsc_f->device)) \ + { \ + struct device *fwsc_d = XDEVICE (fwsc_f->device); \ + MARK_DEVICE_FRAME_CHANGED (fwsc_d); \ + } \ + else \ + frame_changed = 1; \ +} while (0) + +#define CLEAR_FRAME_SIZE_SLIPPED(f) do { \ + struct frame *fwsc_f = (f); \ + fwsc_f->size_slipped = 0; \ +} while (0) + +#define SET_FRAME_CLEAR(f) MARK_FRAME_CHANGED (f); (f)->clear = 1 + +#define FRAME_MINIBUF_ONLY_P(f) \ + EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f)) +#define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer) +#define FRAME_HEIGHT(f) ((f)->height) +#define FRAME_WIDTH(f) ((f)->width) +#define FRAME_CHARHEIGHT(f) ((f)->char_height) +#define FRAME_CHARWIDTH(f) ((f)->char_width) +#define FRAME_PIXHEIGHT(f) ((f)->pixheight) +#define FRAME_PIXWIDTH(f) ((f)->pixwidth) +#define FRAME_PAGENUMBER(f) ((f)->page_number + 0) +#define FRAME_SET_PAGENUMBER(f,x) (f)->page_number = (x); +#ifdef HAVE_SCROLLBARS +#define FRAME_SCROLLBAR_WIDTH(f) \ + (NILP ((f)->vertical_scrollbar_visible_p) ? \ + 0 : XINT ((f)->scrollbar_width)) +#define FRAME_SCROLLBAR_HEIGHT(f) \ + (NILP ((f)->horizontal_scrollbar_visible_p) ? \ + 0 : XINT ((f)->scrollbar_height)) +#else +#define FRAME_SCROLLBAR_WIDTH(f) 0 +#define FRAME_SCROLLBAR_HEIGHT(f) 0 +#endif + +#define FRAME_NEW_HEIGHT(f) ((f)->new_height) +#define FRAME_NEW_WIDTH(f) ((f)->new_width) +#define FRAME_CURSOR_X(f) ((f)->cursor_x) +#define FRAME_CURSOR_Y(f) ((f)->cursor_y) +#define FRAME_VISIBLE_P(f) ((f)->visible) +#define FRAME_REPAINT_P(f) ((f)->visible>0) +#define FRAME_NO_SPLIT_P(f) ((f)->no_split) +#define FRAME_ICONIFIED_P(f) ((f)->iconified) +#define FRAME_FOCUS_FRAME(f) ((f)->focus_frame) +#define FRAME_MINIBUF_WINDOW(f) ((f)->minibuffer_window) +#define FRAME_ROOT_WINDOW(f) ((f)->root_window) +/* Catch people attempting to set this. */ +#define FRAME_SELECTED_WINDOW(f) NON_LVALUE ((f)->selected_window) +#define FRAME_SELECTED_XWINDOW(f) XWINDOW (FRAME_SELECTED_WINDOW (f)) +#define FRAME_LAST_NONMINIBUF_WINDOW(f) \ + NON_LVALUE ((f)->last_nonminibuf_window) +#define FRAME_SB_VCACHE(f) ((f)->sb_vcache) +#define FRAME_SB_HCACHE(f) ((f)->sb_hcache) +#define FRAME_SUBWINDOW_CACHE(f) ((f)->subwindow_instance_cache) + +#if 0 /* FSFmacs */ + +#define FRAME_VISIBLE_P(f) ((f)->visible != 0) +#define FRAME_SET_VISIBLE(f,p) \ + ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f)) + +/* Emacs's redisplay code could become confused if a frame's + visibility changes at arbitrary times. For example, if a frame is + visible while the desired glyphs are being built, but becomes + invisible before they are updated, then some rows of the + desired_glyphs will be left marked as enabled after redisplay is + complete, which should never happen. The next time the frame + becomes visible, redisplay will probably barf. + + Currently, there are no similar situations involving iconified, but + the principle is the same. + + So instead of having asynchronous input handlers directly set and + clear the frame's visibility and iconification flags, they just set + the async_visible and async_iconified flags; the redisplay code + calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay, + which sets visible and iconified from their asynchronous + counterparts. + + Synchronous code must use the FRAME_SET_VISIBLE macro. + + Also, if a frame used to be invisible, but has just become visible, + it must be marked as garbaged, since redisplay hasn't been keeping + up its contents. */ +#define FRAME_SAMPLE_VISIBILITY(f) \ + (((f)->async_visible && ! (f)->visible) ? SET_FRAME_GARBAGED (f) : 0, \ + (f)->visible = (f)->async_visible, \ + (f)->iconified = (f)->async_iconified) + +#endif /* FSFmacs */ + +#define FRAME_BORDER_WIDTH(f) ((f)->internal_border_width) +#define FRAME_BORDER_HEIGHT(f) ((f)->internal_border_width) + +/* This returns the frame-local value; that tells you what you should + use when computing the frame size. It is *not* the actual toolbar + size because that depends on the selected window. Use the macros + below for that. +*/ + +#ifdef HAVE_TOOLBARS +#define FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE(f, pos) \ + (!NILP((f)->toolbar_buttons[pos]) && !NILP ((f)->toolbar_visible_p[pos])) +#define FRAME_RAW_THEORETICAL_TOOLBAR_SIZE(f, pos) \ + (!NILP ((f)->toolbar_buttons[pos]) && INTP((f)->toolbar_size[pos]) ? \ + (XINT ((f)->toolbar_size[pos])) : 0) +#define FRAME_RAW_THEORETICAL_TOOLBAR_BORDER_WIDTH(f, pos) \ + (!NILP ((f)->toolbar_buttons[pos]) && INTP((f)->toolbar_border_width[pos]) ? \ + (XINT ((f)->toolbar_border_width[pos])) : 0) +#else +#define FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE(f, pos) 0 +#define FRAME_RAW_THEORETICAL_TOOLBAR_SIZE(f, pos) 0 +#define FRAME_RAW_THEORETICAL_TOOLBAR_BORDER_WIDTH(f, pos) 0 +#endif + +#define FRAME_THEORETICAL_TOOLBAR_SIZE(f, pos) \ + (FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE (f, pos) \ + ? FRAME_RAW_THEORETICAL_TOOLBAR_SIZE (f, pos) \ + : 0) + +#define FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT(f) \ + FRAME_THEORETICAL_TOOLBAR_SIZE (f, TOP_TOOLBAR) +#define FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT(f) \ + FRAME_THEORETICAL_TOOLBAR_SIZE (f, BOTTOM_TOOLBAR) +#define FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH(f) \ + FRAME_THEORETICAL_TOOLBAR_SIZE (f, LEFT_TOOLBAR) +#define FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH(f) \ + FRAME_THEORETICAL_TOOLBAR_SIZE (f, RIGHT_TOOLBAR) + +#define FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH(f, pos) \ + (FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE (f, pos) \ + ? FRAME_RAW_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, pos) \ + : 0) + +#define FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, TOP_TOOLBAR) +#define FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_TOOLBAR) +#define FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, LEFT_TOOLBAR) +#define FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_TOOLBAR) + +/* This returns the window-local value rather than the frame-local value; + that tells you about what's actually visible rather than what should + be used when computing the frame size. */ + +#ifdef HAVE_TOOLBARS +#define FRAME_RAW_REAL_TOOLBAR_VISIBLE(f, pos) \ + (HAS_FRAMEMETH_P (f, initialize_frame_toolbars) \ + && !NILP (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_visible_p[pos])) +#define FRAME_RAW_REAL_TOOLBAR_BORDER_WIDTH(f, pos) \ + ((INTP (XWINDOW \ + (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_border_width[pos])) ? \ + (XINT (XWINDOW \ + (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_border_width[pos])) \ + : 0) +#define FRAME_RAW_REAL_TOOLBAR_SIZE(f, pos) \ + ((INTP (XWINDOW \ + (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_size[pos])) ? \ + (XINT (XWINDOW \ + (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_size[pos])) : 0) +#define FRAME_REAL_TOOLBAR(f, pos) \ + (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar[pos]) +#else +#define FRAME_RAW_REAL_TOOLBAR_VISIBLE(f, pos) 0 +#define FRAME_RAW_REAL_TOOLBAR_BORDER_WIDTH(f, pos) 0 +#define FRAME_RAW_REAL_TOOLBAR_SIZE(f, pos) 0 +#define FRAME_REAL_TOOLBAR(f, pos) Qnil +#endif + +/* Note to Chuck + Note to Chuck + Note to Chuck: + + The former definitions of FRAME_REAL_FOO_TOOLBAR_VISIBLE + looked at the toolbar data to see what was there. The + current ones look at the current values of the specifiers. + This is a semantic change; the former definition returned + what was *actually* there right at the moment, while the + current one returns what *ought* to be there once redisplay + has run to completion. I think this new definition is more + correct in almost all circumstances and is much less likely + to lead to strange race conditions. I'm not completely + sure that there aren't some places in the redisplay code + that use these macros and expect the former semantics, so + if you encounter some odd toolbar behavior, you might want + to look into this. --ben */ + +#define FRAME_REAL_TOOLBAR_VISIBLE(f, pos) \ + ((!NILP (FRAME_REAL_TOOLBAR (f, pos)) \ + && FRAME_RAW_REAL_TOOLBAR_SIZE (f, pos) > 0) \ + ? FRAME_RAW_REAL_TOOLBAR_VISIBLE (f, pos) \ + : 0) +#define FRAME_REAL_TOOLBAR_SIZE(f, pos) \ + ((!NILP (FRAME_REAL_TOOLBAR (f, pos)) \ + && FRAME_RAW_REAL_TOOLBAR_VISIBLE (f, pos)) \ + ? FRAME_RAW_REAL_TOOLBAR_SIZE (f, pos) \ + : 0) +#define FRAME_REAL_TOOLBAR_BORDER_WIDTH(f, pos) \ + ((!NILP (FRAME_REAL_TOOLBAR (f, pos)) \ + && FRAME_RAW_REAL_TOOLBAR_VISIBLE (f, pos)) \ + ? FRAME_RAW_REAL_TOOLBAR_BORDER_WIDTH (f, pos) \ + : 0) + +#define FRAME_REAL_TOP_TOOLBAR_HEIGHT(f) \ + FRAME_REAL_TOOLBAR_SIZE (f, TOP_TOOLBAR) +#define FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT(f) \ + FRAME_REAL_TOOLBAR_SIZE (f, BOTTOM_TOOLBAR) +#define FRAME_REAL_LEFT_TOOLBAR_WIDTH(f) \ + FRAME_REAL_TOOLBAR_SIZE (f, LEFT_TOOLBAR) +#define FRAME_REAL_RIGHT_TOOLBAR_WIDTH(f) \ + FRAME_REAL_TOOLBAR_SIZE (f, RIGHT_TOOLBAR) + +#define FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, TOP_TOOLBAR) +#define FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_TOOLBAR) +#define FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, LEFT_TOOLBAR) +#define FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH(f) \ + FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_TOOLBAR) + +#define FRAME_REAL_TOP_TOOLBAR_VISIBLE(f) \ + FRAME_REAL_TOOLBAR_VISIBLE (f, TOP_TOOLBAR) +#define FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE(f) \ + FRAME_REAL_TOOLBAR_VISIBLE (f, BOTTOM_TOOLBAR) +#define FRAME_REAL_LEFT_TOOLBAR_VISIBLE(f) \ + FRAME_REAL_TOOLBAR_VISIBLE (f, LEFT_TOOLBAR) +#define FRAME_REAL_RIGHT_TOOLBAR_VISIBLE(f) \ + FRAME_REAL_TOOLBAR_VISIBLE (f, RIGHT_TOOLBAR) + +#define FRAME_TOP_BORDER_START(f) \ + (FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) + \ + 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f)) +#define FRAME_TOP_BORDER_END(f) \ + (FRAME_TOP_BORDER_START (f) + FRAME_BORDER_HEIGHT (f)) + +#define FRAME_BOTTOM_BORDER_START(f) \ + (FRAME_PIXHEIGHT (f) - FRAME_BORDER_HEIGHT (f) - \ + FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) - \ + 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) +#define FRAME_BOTTOM_BORDER_END(f) \ + (FRAME_PIXHEIGHT (f) - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) - \ + 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + +#define FRAME_LEFT_BORDER_START(f) \ + (FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) + \ + 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f)) +#define FRAME_LEFT_BORDER_END(f) \ + (FRAME_LEFT_BORDER_START (f) + FRAME_BORDER_WIDTH (f)) + +#define FRAME_RIGHT_BORDER_START(f) \ + (FRAME_PIXWIDTH (f) - FRAME_BORDER_WIDTH (f) - \ + FRAME_REAL_RIGHT_TOOLBAR_WIDTH(f) - \ + 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f)) +#define FRAME_RIGHT_BORDER_END(f) \ + (FRAME_PIXWIDTH (f) - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) - \ + 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH(f)) + +#endif /* INCLUDED_frame_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/frame-msw.c' 'xemacs-21.5.7/src/frame-msw.c' Index: ././src/frame-msw.c --- ././src/frame-msw.c Sun Mar 31 17:28:19 2002 +++ ././src/frame-msw.c Fri Jun 21 06:18:32 2002 @@ -35,15 +35,15 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "events.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "redisplay.h" #include "window.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "glyphs-msw.h" #define MSWINDOWS_FRAME_STYLE (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW) @@ -152,13 +152,16 @@ FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f) = make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); #endif - /* hashtable of instantiated glyphs on the frame. */ + /* hashtable of instantiated glyphs on the frame. + make them EQ because we only use ints as keys. + otherwise we run into stickiness in redisplay because + internal_equal() can QUIT. */ FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f) = - make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQUAL); + make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f) = - make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQUAL); + make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f) = - make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQUAL); + make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); /* Will initialize these in WM_SIZE handler. We cannot do it now, because we do not know what is CW_USEDEFAULT height and width */ FRAME_WIDTH (f) = 0; @@ -258,12 +261,7 @@ static void mswindows_init_frame_3 (struct frame *f) { - /* Don't do this earlier or we get a WM_PAINT before the frame is ready. - * The SW_x parameter in the first call that an app makes to ShowWindow is - * ignored, and the parameter specified in the caller's STARTUPINFO is - * substituted instead. That parameter is SW_HIDE if we were started by - * runemacs, so call this twice. #### runemacs is evil */ - ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_SHOWNORMAL); + /* Don't do this earlier or we get a WM_PAINT before the frame is ready */ ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_SHOWNORMAL); SetForegroundWindow (FRAME_MSWINDOWS_HANDLE (f)); DragAcceptFiles (FRAME_MSWINDOWS_HANDLE (f), TRUE); @@ -494,7 +492,7 @@ /* Yippie! */ ScreenToClient (hwnd, &pt); - VOID_TO_LISP (*frame, qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); + *frame = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); *x = pt.x; *y = pt.y; return 1; @@ -526,7 +524,7 @@ } static void -mswindows_set_title_from_intbyte (struct frame *f, Intbyte *title) +mswindows_set_title_from_ibyte (struct frame *f, Ibyte *title) { unsigned int new_checksum = hash_string (title, qxestrlen (title)); if (new_checksum != FRAME_MSWINDOWS_TITLE_CHECKSUM (f)) @@ -746,7 +744,7 @@ if (hwnd) { Lisp_Object parent; - VOID_TO_LISP (parent, qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); + parent = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); assert (FRAME_MSWINDOWS_P (XFRAME (parent))); return parent; } @@ -1103,8 +1101,8 @@ CONSOLE_HAS_METHOD (mswindows, internal_frame_property_p); CONSOLE_HAS_METHOD (mswindows, frame_properties); CONSOLE_HAS_METHOD (mswindows, set_frame_properties); - CONSOLE_HAS_METHOD (mswindows, set_title_from_intbyte); -/* CONSOLE_HAS_METHOD (mswindows, set_icon_name_from_intbyte); */ + CONSOLE_HAS_METHOD (mswindows, set_title_from_ibyte); +/* CONSOLE_HAS_METHOD (mswindows, set_icon_name_from_ibyte); */ CONSOLE_HAS_METHOD (mswindows, frame_visible_p); CONSOLE_HAS_METHOD (mswindows, frame_totally_visible_p); CONSOLE_HAS_METHOD (mswindows, frame_iconified_p); diff --text -u 'xemacs-21.5.6/src/frame-tty.c' 'xemacs-21.5.7/src/frame-tty.c' Index: ././src/frame-tty.c --- ././src/frame-tty.c Sun Mar 31 17:28:20 2002 +++ ././src/frame-tty.c Fri Jun 21 06:18:32 2002 @@ -27,11 +27,11 @@ #include #include "lisp.h" -#include "device.h" +#include "device-impl.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" -#include "console-tty.h" +#include "console-tty-impl.h" /* Default properties to use when creating frames. */ diff --text -u 'xemacs-21.5.6/src/frame-x.c' 'xemacs-21.5.7/src/frame-x.c' Index: ././src/frame-x.c --- ././src/frame-x.c Sun Mar 31 17:28:20 2002 +++ ././src/frame-x.c Fri Jun 21 06:18:32 2002 @@ -1,6 +1,6 @@ /* Functions for the X window system. Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 2001 Ben Wing. + Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -29,17 +29,17 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "extents.h" #include "faces.h" -#include "frame.h" -#include "window.h" +#include "frame-impl.h" #include "gutter.h" +#include "window.h" -#include "console-x.h" +#include "console-x-impl.h" #include "glyphs-x.h" -#include "objects-x.h" +#include "objects-x-impl.h" #include "scrollbar-x.h" #include "xintrinsicp.h" /* CoreP.h needs this */ @@ -453,14 +453,6 @@ def (Qunsplittable, XtNunsplittable); #endif defi(Qinternal_border_width, XtNinternalBorderWidth); -#ifdef HAVE_TOOLBARS - def (Qtop_toolbar_shadow_color, XtNtopToolBarShadowColor); - def (Qbottom_toolbar_shadow_color, XtNbottomToolBarShadowColor); - def (Qbackground_toolbar_color, XtNbackgroundToolBarColor); - def (Qtop_toolbar_shadow_pixmap, XtNtopToolBarShadowPixmap); - def (Qbottom_toolbar_shadow_pixmap, XtNbottomToolBarShadowPixmap); - defi(Qtoolbar_shadow_thickness, XtNtoolBarShadowThickness); -#endif def (Qscrollbar_placement, XtNscrollBarPlacement); defi(Qinter_line_space, XtNinterline); /* font, foreground */ @@ -494,7 +486,7 @@ static Lisp_Object color_to_string (Widget w, unsigned long pixel) { - Intbyte buf[255]; + Ibyte buf[255]; XColor color; color.pixel = pixel; @@ -567,16 +559,6 @@ return make_int (w->emacs_frame.internal_border_width); if (EQ (Qborder_color, property)) return color_to_string (gw, w->core.border_pixel); -#ifdef HAVE_TOOLBARS - if (EQ (Qtop_toolbar_shadow_color, property)) - return color_to_string (gw, w->emacs_frame.top_toolbar_shadow_pixel); - if (EQ (Qbottom_toolbar_shadow_color, property)) - return color_to_string (gw, w->emacs_frame.bottom_toolbar_shadow_pixel); - if (EQ (Qbackground_toolbar_color, property)) - return color_to_string (gw, w->emacs_frame.background_toolbar_pixel); - if (EQ (Qtoolbar_shadow_thickness, property)) - return make_int (w->emacs_frame.toolbar_shadow_thickness); -#endif /* HAVE_TOOLBARS */ if (EQ (Qinter_line_space, property)) return make_int (w->emacs_frame.interline); if (EQ (Qwindow_id, property)) @@ -593,12 +575,6 @@ || EQ (property, Qborder_width) || EQ (property, Qinternal_border_width) || EQ (property, Qborder_color) -#ifdef HAVE_TOOLBARS - || EQ (property, Qtop_toolbar_shadow_color) - || EQ (property, Qbottom_toolbar_shadow_color) - || EQ (property, Qbackground_toolbar_color) - || EQ (property, Qtoolbar_shadow_thickness) -#endif /* HAVE_TOOLBARS */ || EQ (property, Qinter_line_space) || EQ (property, Qwindow_id) || STRINGP (property); @@ -616,21 +592,6 @@ props = cons3 (Qwindow_id, Fx_window_id (wrap_frame (f)), props); props = cons3 (Qinter_line_space, make_int (w->emacs_frame.interline), props); -#ifdef HAVE_TOOLBARS - props = cons3 (Qtoolbar_shadow_thickness, - make_int (w->emacs_frame.toolbar_shadow_thickness), - props); - props = cons3 (Qbackground_toolbar_color, - color_to_string (gw, w->emacs_frame.background_toolbar_pixel), - props); - props = cons3 (Qbottom_toolbar_shadow_color, - color_to_string (gw, w->emacs_frame.bottom_toolbar_shadow_pixel), - props); - props = cons3 (Qtop_toolbar_shadow_color, - color_to_string (gw, w->emacs_frame.top_toolbar_shadow_pixel), - props); -#endif /* HAVE_TOOLBARS */ - props = cons3 (Qborder_color, color_to_string (gw, w->core.border_pixel), props); props = cons3 (Qinternal_border_width, @@ -653,7 +614,7 @@ individual properties. */ static void -x_set_frame_text_value (struct frame *f, Intbyte *value, +x_set_frame_text_value (struct frame *f, Ibyte *value, String Xt_resource_name, String Xt_resource_encoding_name) { @@ -662,10 +623,10 @@ String old_XtValue = NULL; #ifdef MULE - Intbyte *ptr; + Ibyte *ptr; /* Optimize for common ASCII case */ for (ptr = value; *ptr; ptr++) - if (!BYTE_ASCII_P (*ptr)) + if (!byte_ascii_p (*ptr)) { const char * tmp; encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); @@ -687,13 +648,13 @@ } static void -x_set_title_from_intbyte (struct frame *f, Intbyte *name) +x_set_title_from_ibyte (struct frame *f, Ibyte *name) { x_set_frame_text_value (f, name, XtNtitle, XtNtitleEncoding); } static void -x_set_icon_name_from_intbyte (struct frame *f, Intbyte *name) +x_set_icon_name_from_ibyte (struct frame *f, Ibyte *name) { x_set_frame_text_value (f, name, XtNiconName, XtNiconNameEncoding); } @@ -1266,7 +1227,7 @@ filePath = transferInfo->dropData->data.files[ii]; hurl = dnd_url_hexify_string ((char *)filePath, "file:"); /* #### Mule-izing required */ - l_data = Fcons (make_string ((Intbyte* )hurl, + l_data = Fcons (make_string ((Ibyte* )hurl, strlen (hurl)), l_data); xfree (hurl); @@ -1288,11 +1249,11 @@ /* let us forget this name thing for now... */ /* filePath = transferInfo->dropData->data.buffers[ii].name; path = (filePath == NULL) ? Qnil - : make_string ((Intbyte *)filePath, strlen (filePath)); */ + : make_string ((Ibyte *)filePath, strlen (filePath)); */ /* what, if the data is no text, and how can I tell it? */ - l_data = Fcons ( list3 ( list1 ( make_string ((Intbyte *)"text/plain", 10) ), - make_string ((Intbyte *)"8bit", 4), - make_string ((Intbyte *)transferInfo->dropData->data.buffers[ii].bp, + l_data = Fcons ( list3 ( list1 ( make_string ((Ibyte *)"text/plain", 10) ), + make_string ((Ibyte *)"8bit", 4), + make_string ((Ibyte *)transferInfo->dropData->data.buffers[ii].bp, transferInfo->dropData->data.buffers[ii].size) ), l_data ); } @@ -2289,7 +2250,7 @@ */ (frame)) { - Intbyte str[255]; + Ibyte str[255]; struct frame *f = decode_x_frame (frame); qxesprintf (str, "%lu", XtWindow (FRAME_X_TEXT_WIDGET (f))); @@ -2821,8 +2782,8 @@ CONSOLE_HAS_METHOD (x, internal_frame_property_p); CONSOLE_HAS_METHOD (x, frame_properties); CONSOLE_HAS_METHOD (x, set_frame_properties); - CONSOLE_HAS_METHOD (x, set_title_from_intbyte); - CONSOLE_HAS_METHOD (x, set_icon_name_from_intbyte); + CONSOLE_HAS_METHOD (x, set_title_from_ibyte); + CONSOLE_HAS_METHOD (x, set_icon_name_from_ibyte); CONSOLE_HAS_METHOD (x, frame_visible_p); CONSOLE_HAS_METHOD (x, frame_totally_visible_p); CONSOLE_HAS_METHOD (x, frame_iconified_p); diff --text -u 'xemacs-21.5.6/src/frame.c' 'xemacs-21.5.7/src/frame.c' Index: ././src/frame.c --- ././src/frame.c Sun Mar 31 17:28:20 2002 +++ ././src/frame.c Fri Jun 21 06:18:32 2002 @@ -29,11 +29,11 @@ #include "buffer.h" /* for Vbuffer_alist */ #include "console.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "extents.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "gutter.h" #include "menubar.h" @@ -118,10 +118,14 @@ Lisp_Object Qframe_being_created; static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val); +static void frame_conversion_internal (struct frame *f, int pixel_to_char, + int *pixel_width, int *pixel_height, + int *char_width, int *char_height, + int real_face); static struct display_line title_string_display_line; /* Used by generate_title_string. Global because they get used so much that the dynamic allocation time adds up. */ -static Emchar_dynarr *title_string_emchar_dynarr; +static Ichar_dynarr *title_string_ichar_dynarr; static Lisp_Object @@ -220,6 +224,8 @@ FRAME_SET_PAGENUMBER (f, 1); + note_object_created (root_window); + /* Choose a buffer for the frame's root window. */ XWINDOW (root_window)->buffer = Qt; { @@ -228,7 +234,7 @@ buf = Fcurrent_buffer (); /* If buf is a 'hidden' buffer (i.e. one whose name starts with a space), try to find another one. */ - if (XSTRING_CHAR (Fbuffer_name (buf), 0) == ' ') + if (string_ichar (Fbuffer_name (buf), 0) == ' ') buf = Fother_buffer (buf, Qnil, Qnil); Fset_window_buffer (root_window, buf, Qnil); } @@ -251,6 +257,8 @@ f->minibuffer_window = mini_window; f->has_minibuffer = 1; + note_object_created (mini_window); + XWINDOW (mini_window)->buffer = Qt; Fset_window_buffer (mini_window, Vminibuffer_zero, Qt); } @@ -403,7 +411,7 @@ else name = build_string ("emacs"); - if (!NILP (Fstring_match (make_string ((const Intbyte *) "\\.", 2), name, + if (!NILP (Fstring_match (make_string ((const Ibyte *) "\\.", 2), name, Qnil, Qnil))) syntax_error (". not allowed in frame names", name); @@ -473,6 +481,8 @@ DEVICE_FRAME_LIST (d) = Fcons (frame, DEVICE_FRAME_LIST (d)); RESET_CHANGED_SET_FLAGS; + note_object_created (frame); + /* Now make sure that the initial cached values are set correctly. Do this after the init_frame method is called because that may do things (e.g. create widgets) that are necessary for the @@ -597,33 +607,74 @@ return decode_frame (cdf); } +Lisp_Object +frame_device (struct frame *f) +{ + return FRAME_DEVICE (f); +} + +int +frame_live_p (struct frame *f) +{ + return FRAME_LIVE_P (f); +} + +#ifdef ERROR_CHECK_TRAPPING_PROBLEMS + +static Lisp_Object +commit_ritual_suicide (Lisp_Object ceci_nest_pas_une_pipe) +{ + assert (!in_display); + return Qnil; +} + +#endif + /* * window size changes are held up during critical regions. Afterwards, * we want to deal with any delayed changes. */ -void -hold_frame_size_changes (void) +int +enter_redisplay_critical_section (void) { + int depth = specpdl_depth (); + +#ifdef ERROR_CHECK_TRAPPING_PROBLEMS + /* force every call to QUIT to check for in_displayness */ + something_happened++; + record_unwind_protect (commit_ritual_suicide, Qnil); +#endif in_display = 1; + + return depth; } void -unhold_one_frame_size_changes (struct frame *f) +exit_redisplay_critical_section (int depth) { + Lisp_Object frmcons, devcons, concons; + in_display = 0; - if (f->size_change_pending) - change_frame_size (f, f->new_height, f->new_width, 0); -} +#ifdef ERROR_CHECK_TRAPPING_PROBLEMS + unbind_to (depth); + something_happened--; +#endif -void -unhold_frame_size_changes (void) -{ - Lisp_Object frmcons, devcons, concons; + /* we used to have a function to do this for only one frame, and + it was typical to call it at the end of a critical section + (which occurs once per frame); but what then happens if multiple + frames have frame changes held up? + this means we are O(N^2) over frames. i seriously doubt it matters. + --ben */ FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) - unhold_one_frame_size_changes (XFRAME (XCAR (frmcons))); + { + struct frame *f = XFRAME (XCAR (frmcons)); + if (f->size_change_pending) + change_frame_size (f, f->new_height, f->new_width, 0); + } } void @@ -670,8 +721,9 @@ keep_char_size = 0; else keep_char_size = - NILP (call1_trapping_errors ("Error in adjust-frame-function", - Vadjust_frame_function, frame)); + NILP (call1_trapping_problems ("Error in adjust-frame-function", + Vadjust_frame_function, frame, + 0)); if (keep_char_size) Fset_frame_size (frame, make_int (FRAME_CHARWIDTH(f)), @@ -818,7 +870,7 @@ #if 0 /* FSFmacs */ -xxDEFUN ("handle-switch-frame", Fhandle_switch_frame, 1, 2, "e", /* +DEFUN ("handle-switch-frame", Fhandle_switch_frame, 1, 2, "e", /* Handle a switch-frame event EVENT. Switch-frame events are usually bound to this function. A switch-frame event tells Emacs that the window manager has requested @@ -839,7 +891,7 @@ } /* A load of garbage. */ -xxDEFUN ("ignore-event", Fignore_event, 0, 0, "", /* +DEFUN ("ignore-event", Fignore_event, 0, 0, "", /* Do nothing, but preserve any prefix argument already specified. This is a suitable binding for iconify-frame and make-frame-visible. */ @@ -1317,10 +1369,14 @@ struct gcpro gcpro1; /* OK to delete an already deleted frame. */ - if (! FRAME_LIVE_P (f)) + if (!FRAME_LIVE_P (f)) return; frame = wrap_frame (f); + + if (!force) + check_allowed_operation (OPERATION_DELETE_OBJECT, frame, Qnil); + GCPRO1 (frame); device = FRAME_DEVICE (f); @@ -1575,6 +1631,7 @@ f->visible = 0; free_window_mirror (XWINDOW_MIRROR (f->root_mirror)); + /* free_line_insertion_deletion_costs (f); */ /* If we've deleted the last non-minibuf frame, then try to find @@ -1670,6 +1727,8 @@ nuke_all_frame_slots (f); f->framemeths = dead_console_methods; + note_object_deleted (frame); + UNGCPRO; } @@ -2649,6 +2708,37 @@ return frame; } +DEFUN ("set-frame-pixel-height", Fset_frame_pixel_height, 2, 3, 0, /* +Specify that the frame FRAME is HEIGHT pixels tall. +Optional third arg non-nil means that redisplay should be HEIGHT pixels tall +but that the idea of the actual height of the frame should not be changed. +*/ + (frame, height, pretend)) +{ + struct frame *f = decode_frame (frame); + int pheight, width; + frame = wrap_frame (f); + CHECK_INT (height); + + if (!window_system_pixelated_geometry (frame)) + { + int h = XINT (height); + width = FRAME_WIDTH (f); + /* Simply using pixel_to_real_char_size here is not good + enough since we end up with a total frame size of HEIGHT + rather than a displayable height of HEIGHT. */ + frame_conversion_internal (f, 2, 0, &h, 0, &pheight, 0); + } + else + { + width = FRAME_PIXWIDTH (f); + pheight = XINT (height); + } + + internal_set_frame_size (f, width, pheight, !NILP (pretend)); + return frame; +} + DEFUN ("set-frame-width", Fset_frame_width, 2, 3, 0, /* Specify that the frame FRAME has COLS columns. Optional third arg non-nil means that redisplay should use COLS columns @@ -2676,6 +2766,37 @@ return frame; } +DEFUN ("set-frame-pixel-width", Fset_frame_pixel_width, 2, 3, 0, /* +Specify that the frame FRAME is WIDTH pixels wide. +Optional third arg non-nil means that redisplay should be WIDTH wide +but that the idea of the actual height of the frame should not be changed. +*/ + (frame, width, pretend)) +{ + struct frame *f = decode_frame (frame); + int height, pwidth; + frame = wrap_frame (f); + CHECK_INT (width); + + if (!window_system_pixelated_geometry (frame)) + { + int w = XINT (width); + height = FRAME_HEIGHT (f); + /* Simply using pixel_to_real_char_size here is not good + enough since we end up with a total frame size of WIDTH + rather than a displayable height of WIDTH. */ + frame_conversion_internal (f, 2, &w, 0, &pwidth, 0, 0); + } + else + { + height = FRAME_PIXHEIGHT (f); + pwidth = XINT (width); + } + + internal_set_frame_size (f, pwidth, height, !NILP (pretend)); + return frame; +} + DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /* Set the size of FRAME to COLS by ROWS, measured in characters. Optional fourth arg non-nil means that redisplay should use COLS by ROWS @@ -2701,6 +2822,38 @@ return frame; } +DEFUN ("set-frame-pixel-size", Fset_frame_pixel_size, 3, 4, 0, /* +Set the size of FRAME to WIDTH by HEIGHT, measured in pixels. +Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT +but that the idea of the actual size of the frame should not be changed. +*/ + (frame, width, height, pretend)) +{ + struct frame *f = decode_frame (frame); + int pheight, pwidth; + frame = wrap_frame (f); + CHECK_INT (width); + CHECK_INT (height); + + if (!window_system_pixelated_geometry (frame)) + { + int w = XINT (width); + int h = XINT (height); + /* Simply using pixel_to_real_char_size here is not good enough + since we end up with a total frame size of WIDTH x HEIGHT + rather than a displayable height of WIDTH x HEIGHT. */ + frame_conversion_internal (f, 2, &w, &h, &pwidth, &pheight, 0); + } + else + { + pheight = XINT (height); + pwidth = XINT (width); + } + + internal_set_frame_size (f, pwidth, pheight, !NILP (pretend)); + return frame; +} + DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /* Set position of FRAME in pixels to XOFFSET by YOFFSET. This is actually the position of the upper left corner of the frame. @@ -2757,7 +2910,21 @@ 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f) + 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f); - if (pixel_to_char) + /* Convert to chars so that the displayable area is pixel_width x + pixel_height. + + #### Consider rounding up to 0.5 characters to avoid adding too + much space. */ + if (pixel_to_char > 1) + { + if (char_width) + *char_width = ROUND_UP (*pixel_width, cpw) / cpw; + if (char_height) + *char_height = ROUND_UP (*pixel_height, cph) / cph; + } + /* Convert to chars so that the total frame size is pixel_width x + pixel_height. */ + else if (pixel_to_char) { if (char_width) *char_width = 1 + ((*pixel_width - egw) - bdr - obw) / cpw; @@ -3062,7 +3229,7 @@ /* The caller is responsible for freeing the returned string. */ -static Intbyte * +static Ibyte * generate_title_string (struct window *w, Lisp_Object format_str, face_index findex, int type) { @@ -3077,19 +3244,19 @@ generate_formatted_string_db (format_str, Qnil, w, dl, db, findex, 0, -1, type); - Dynarr_reset (title_string_emchar_dynarr); + Dynarr_reset (title_string_ichar_dynarr); while (elt < Dynarr_length (db->runes)) { if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) - Dynarr_add (title_string_emchar_dynarr, + Dynarr_add (title_string_ichar_dynarr, Dynarr_atp (db->runes, elt)->object.chr.ch); elt++; } return - convert_emchar_string_into_malloced_string - (Dynarr_atp (title_string_emchar_dynarr, 0), - Dynarr_length (title_string_emchar_dynarr), 0); + convert_ichar_string_into_malloced_string + (Dynarr_atp (title_string_ichar_dynarr, 0), + Dynarr_length (title_string_ichar_dynarr), 0); } void @@ -3098,7 +3265,7 @@ struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); Lisp_Object title_format; Lisp_Object icon_format; - Intbyte *title; + Ibyte *title; /* We don't change the title for the minibuffer unless the frame only has a minibuffer. */ @@ -3113,14 +3280,14 @@ title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer); icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer); - if (HAS_FRAMEMETH_P (f, set_title_from_intbyte)) + if (HAS_FRAMEMETH_P (f, set_title_from_ibyte)) { title = generate_title_string (w, title_format, DEFAULT_INDEX, CURRENT_DISP); - FRAMEMETH (f, set_title_from_intbyte, (f, title)); + FRAMEMETH (f, set_title_from_ibyte, (f, title)); } - if (HAS_FRAMEMETH_P (f, set_icon_name_from_intbyte)) + if (HAS_FRAMEMETH_P (f, set_icon_name_from_ibyte)) { if (!EQ (icon_format, title_format) || !title) { @@ -3130,7 +3297,7 @@ title = generate_title_string (w, icon_format, DEFAULT_INDEX, CURRENT_DISP); } - FRAMEMETH (f, set_icon_name_from_intbyte, (f, title)); + FRAMEMETH (f, set_icon_name_from_ibyte, (f, title)); } if (title) @@ -3200,7 +3367,7 @@ if (!initialized) #endif { - title_string_emchar_dynarr = Dynarr_new (Emchar); + title_string_ichar_dynarr = Dynarr_new (Ichar); xzero (title_string_display_line); } } @@ -3319,6 +3486,9 @@ DEFSUBR (Fset_frame_height); DEFSUBR (Fset_frame_width); DEFSUBR (Fset_frame_size); + DEFSUBR (Fset_frame_pixel_height); + DEFSUBR (Fset_frame_pixel_width); + DEFSUBR (Fset_frame_pixel_size); DEFSUBR (Fset_frame_position); DEFSUBR (Fset_frame_pointer); DEFSUBR (Fprint_job_page_number); diff --text -u 'xemacs-21.5.6/src/frame.h' 'xemacs-21.5.7/src/frame.h' Index: ././src/frame.h --- ././src/frame.h Sun Mar 31 17:28:21 2002 +++ ././src/frame.h Fri Jun 21 06:18:33 2002 @@ -1,5 +1,6 @@ /* Define frame-object for XEmacs. Copyright (C) 1988, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1995, 2002 Ben Wing. This file is part of XEmacs. @@ -26,174 +27,9 @@ #include "redisplay.h" #include "console.h" /* for error_check_frame_type */ -#define FRAME_TYPE_NAME(f) ((f)->framemeths->name) -#define FRAME_TYPE(f) ((f)->framemeths->symbol) - -/******** Accessing / calling a frame method *********/ - -#define HAS_FRAMEMETH_P(f, m) HAS_CONTYPE_METH_P ((f)->framemeths, m) -#define FRAMEMETH(f, m, args) CONTYPE_METH ((f)->framemeths, m, args) -#define MAYBE_FRAMEMETH(f, m, args) \ - MAYBE_CONTYPE_METH ((f)->framemeths, m, args) -#define FRAMEMETH_OR_GIVEN(f, m, args, given) \ - CONTYPE_METH_OR_GIVEN((f)->framemeths, m, args, given) - -struct frame -{ - struct lcrecord_header header; - - /* Methods for this frame's console. This can also be retrieved - through frame->device->console, but it's faster this way. */ - struct console_methods *framemeths; - - /* Size of text only area of this frame, excluding scrollbars, - toolbars and end of line glyphs. The size can be in characters - or pixels, depending on units in which window system resizes - its windows */ - int height, width; - - /* New height and width for pending size change, in the same units - as above. 0 if no change pending. */ - int new_height, new_width; - - /* Size of text-only are of the frame, in default font characters. - This may be inaccurate due to rounding error */ - int char_height, char_width; - - /* Size of the whole frame, including scrollbars, toolbars and end - of line glyphs, in pixels */ - int pixheight, pixwidth; - -#ifdef HAVE_TTY - /* The count of frame number. This applies to TTY frames only. */ - int order_count; -#endif - - /* Current page number for a printer frame. */ - int page_number; - - /* Width of the internal border. This is a line of background color - just inside the window's border. It is normally only non-zero on - X frames, but we put it here to avoid introducing window system - dependencies. */ - int internal_border_width; - - int modiff; - - struct expose_ignore *subwindow_exposures; - struct expose_ignore *subwindow_exposures_tail; - -#ifdef HAVE_SCROLLBARS - /* frame-local scrollbar information. See scrollbar.c. */ - int scrollbar_y_offset; - - /* cache of created scrollbars */ - struct scrollbar_instance *sb_vcache; - struct scrollbar_instance *sb_hcache; -#endif - -#ifdef HAVE_TOOLBARS - /* Size of toolbars as seen by redisplay. This is used to determine - whether to re-layout windows by a call to change_frame_size early - in redisplay_frame. */ - int current_toolbar_size[4]; -#endif - - /* Size of gutters as seen by redisplay. This is used to determine - whether to re-layout windows by a call to change_frame_size early - in redisplay_frame. */ - int current_gutter_bounds[4]; - - /* Dynamic arrays of display lines for gutters */ - display_line_dynarr *current_display_lines[4]; - display_line_dynarr *desired_display_lines[4]; - - /* A structure of auxiliary data specific to the device type. - struct x_frame is used for X window frames; defined in console-x.h */ - void *frame_data; - -#define FRAME_SLOT_DECLARATION -#define MARKED_SLOT(x) Lisp_Object x -#include "frameslots.h" - - /* Nonzero if frame is currently displayed. - Mutually exclusive with iconified - JV: This now a tristate flag: -Value : Emacs meaning :f-v-p : X meaning -0 : not displayed : nil : unmapped ->0 : user can access it,needs repainting : t : mapped and visible -<0 : user can access it,needs no repainting : hidden :mapped and invisible - where f-v-p is the return value of frame-visible-p */ - int visible; - - /* one-bit flags: */ - - /* Is focusing onto this frame disabled? (Modal dialog boxes) */ - unsigned int disabled :1; - - /* Are we finished initializing? */ - unsigned int init_finished :1; - - /* Is frame marked for deletion? This is used in XSetErrorHandler(). */ - unsigned int being_deleted :1; - - /* Nonzero if last attempt at redisplay on this frame was preempted. */ - unsigned int display_preempted :1; - - /* Nonzero if window is currently iconified. - This and visible are mutually exclusive. */ - unsigned int iconified :1; - - /* Nonzero if this frame should be cleared and then redrawn. - Setting this will also effectively set frame_changed. */ - unsigned int clear :1; - - /* True if frame actually has a minibuffer window on it. - 0 if using a minibuffer window that isn't on this frame. */ - unsigned int has_minibuffer :1; - - /* True if frame's root window can't be split. */ - unsigned int no_split :1; - - unsigned int top_toolbar_was_visible :1; - unsigned int bottom_toolbar_was_visible :1; - unsigned int left_toolbar_was_visible :1; - unsigned int right_toolbar_was_visible :1; - /* gutter visibility */ - unsigned int top_gutter_was_visible :1; - unsigned int bottom_gutter_was_visible :1; - unsigned int left_gutter_was_visible :1; - unsigned int right_gutter_was_visible :1; - - /* redisplay flags */ - unsigned int buffers_changed :1; - unsigned int clip_changed :1; - unsigned int extents_changed :1; - unsigned int faces_changed :1; - unsigned int frame_changed :1; - unsigned int subwindows_changed :1; - unsigned int subwindows_state_changed :1; - unsigned int glyphs_changed :1; - unsigned int icon_changed :1; - unsigned int menubar_changed :1; - unsigned int modeline_changed :1; - unsigned int point_changed :1; - unsigned int size_changed :1; - unsigned int toolbar_changed :1; - unsigned int gutter_changed :1; - unsigned int windows_changed :1; - unsigned int windows_structure_changed :1; - unsigned int window_face_cache_reset :1; /* used by expose handler */ - unsigned int echo_area_garbaged :1; /* used by Fredisplay_echo_area */ - unsigned int size_slipped :1; - - unsigned int size_change_pending :1; - unsigned int mirror_dirty :1; - - /* flag indicating if any window on this frame is displaying a subwindow */ - unsigned int subwindows_being_displayed :1; -}; +struct frame; +EXFUN (Fselected_frame, 1); EXFUN (Fdelete_frame, 2); EXFUN (Fframe_iconified_p, 1); EXFUN (Fframe_name, 1); @@ -224,7 +60,6 @@ extern Lisp_Object Vframe_icon_title_format, Vframe_title_format; extern Lisp_Object Vmouse_motion_handler; - DECLARE_LRECORD (frame, struct frame); #define XFRAME(x) XRECORD (x, frame, struct frame) #define wrap_frame(p) wrap_record (p, frame) @@ -232,6 +67,24 @@ #define CHECK_FRAME(x) CHECK_RECORD (x, frame) #define CONCHECK_FRAME(x) CONCHECK_RECORD (x, frame) +/* Basic properties available to non-privileged users; redefined in + frame-impl.h */ + +int frame_live_p (struct frame *f); +Lisp_Object frame_device (struct frame *f); + +#define FRAME_LIVE_P(f) frame_live_p (f) +#define FRAME_DEVICE(f) frame_device (f) + +#define FRAME_XDEVICE(f) XDEVICE (FRAME_DEVICE (f)) +#define FRAME_CONSOLE(f) XDEVICE_CONSOLE (FRAME_DEVICE (f)) +#define FRAME_XCONSOLE(f) XCONSOLE (FRAME_CONSOLE (f)) + +#define XFRAME_DEVICE(f) FRAME_DEVICE (XFRAME (f)) +#define XFRAME_XDEVICE(f) XDEVICE (XFRAME_DEVICE (f)) +#define XFRAME_CONSOLE(f) XDEVICE_CONSOLE (XFRAME_DEVICE (f)) +#define XFRAME_XCONSOLE(f) XCONSOLE (XFRAME_CONSOLE (f)) + #define CHECK_LIVE_FRAME(x) do { \ CHECK_FRAME (x); \ if (! FRAME_LIVE_P (XFRAME (x))) \ @@ -243,505 +96,11 @@ x = wrong_type_argument (Qframe_live_p, (x)); \ } while (0) -#define FRAME_TYPE_P(f, type) EQ (FRAME_TYPE (f), Q##type) - -#ifdef ERROR_CHECK_TYPES -INLINE_HEADER struct frame * -error_check_frame_type (struct frame * f, Lisp_Object sym); -INLINE_HEADER struct frame * -error_check_frame_type (struct frame * f, Lisp_Object sym) -{ - assert (EQ (FRAME_TYPE (f), sym)); - return f; -} -# define FRAME_TYPE_DATA(f, type) \ - ((struct type##_frame *) error_check_frame_type (f, Q##type)->frame_data) -#else -# define FRAME_TYPE_DATA(f, type) \ - ((struct type##_frame *) (f)->frame_data) -#endif - -#define CHECK_FRAME_TYPE(x, type) \ - do { \ - CHECK_FRAME (x); \ - if (!FRAME_TYPE_P (XFRAME (x), type)) \ - dead_wrong_type_argument \ - (type##_console_methods->predicate_symbol, x); \ - } while (0) -#define CONCHECK_FRAME_TYPE(x, type) \ - do { \ - CONCHECK_FRAME (x); \ - if (!FRAME_TYPE_P (XFRAME (x), type)) \ - x = wrong_type_argument \ - (type##_console_methods->predicate_symbol, x); \ - } while (0) - -#define FRAME_DISPLAY_P(frm) \ - (DEVICE_DISPLAY_P (XDEVICE (FRAME_DEVICE (frm)))) - -#define CHECK_DISPLAY_FRAME(frm) \ - do { \ - CHECK_FRAME (frm); \ - CHECK_LIVE_FRAME (frm); \ - CHECK_DISPLAY_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ - } while (0) - -#define CONCHECK_DISPLAY_FRAME(frm) \ - do { \ - CONCHECK_FRAME (frm); \ - CONCHECK_LIVE_FRAME (frm); \ - CONCHECK_DISPLAY_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ - } while (0) - -#define FRAME_PRINTER_P(frm) \ - (DEVICE_PRINTER_P (XDEVICE (FRAME_DEVICE (frm)))) - -#define CHECK_PRINTER_FRAME(frm) \ - do { \ - CHECK_FRAME (frm); \ - CHECK_LIVE_FRAME (frm); \ - CHECK_PRINTER_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ - } while (0) - -#define CONCHECK_PRINTER_FRAME(frm) \ - do { \ - CONCHECK_FRAME (frm); \ - CONCHECK_LIVE_FRAME (frm); \ - CONCHECK_PRINTER_DEVICE (FRAME_DEVICE (XFRAME (frm))); \ - } while (0) - -/* #### These should be in the frame-*.h files but there are - too many places where the abstraction is broken. Need to - fix. */ - -#define FRAME_X_P(frm) CONSOLE_TYPESYM_X_P (FRAME_TYPE (frm)) -#define CHECK_X_FRAME(z) CHECK_FRAME_TYPE (z, x) -#define CONCHECK_X_FRAME(z) CONCHECK_FRAME_TYPE (z, x) - -#define FRAME_GTK_P(frm) CONSOLE_TYPESYM_GTK_P (FRAME_TYPE (frm)) -#define CHECK_GTK_FRAME(z) CHECK_FRAME_TYPE (z, gtk) -#define CONCHECK_GTK_FRAME(z) CONCHECK_FRAME_TYPE (z, gtk) - -#define FRAME_TTY_P(frm) CONSOLE_TYPESYM_TTY_P (FRAME_TYPE (frm)) -#define CHECK_TTY_FRAME(z) CHECK_FRAME_TYPE (z, tty) -#define CONCHECK_TTY_FRAME(z) CONCHECK_FRAME_TYPE (z, tty) - -#define FRAME_STREAM_P(frm) CONSOLE_TYPESYM_STREAM_P (FRAME_TYPE (frm)) -#define CHECK_STREAM_FRAME(z) CHECK_FRAME_TYPE (z, stream) -#define CONCHECK_STREAM_FRAME(z) CONCHECK_FRAME_TYPE (z, stream) - -#define FRAME_WIN_P(frm) CONSOLE_TYPESYM_WIN_P (FRAME_TYPE (frm)) - -extern int frame_changed; - -#define MARK_FRAME_FACES_CHANGED(f) do { \ - struct frame *mffc_f = (f); \ - mffc_f->faces_changed = 1; \ - mffc_f->modiff++; \ - if (!NILP (mffc_f->device)) \ - { \ - struct device *mffc_d = XDEVICE (mffc_f->device); \ - MARK_DEVICE_FACES_CHANGED (mffc_d); \ - } \ - else \ - faces_changed = 1; \ -} while (0) - -#define MARK_FRAME_GLYPHS_CHANGED(f) do { \ - struct frame *mfgc_f = (f); \ - mfgc_f->glyphs_changed = 1; \ - mfgc_f->modiff++; \ - if (!NILP (mfgc_f->device)) \ - { \ - struct device *mfgc_d = XDEVICE (mfgc_f->device); \ - MARK_DEVICE_GLYPHS_CHANGED (mfgc_d); \ - } \ - else \ - glyphs_changed = 1; \ -} while (0) - -#define MARK_FRAME_SUBWINDOWS_CHANGED(f) do { \ - struct frame *mfgc_f = (f); \ - mfgc_f->subwindows_changed = 1; \ - mfgc_f->modiff++; \ - if (!NILP (mfgc_f->device)) \ - { \ - struct device *mfgc_d = XDEVICE (mfgc_f->device); \ - MARK_DEVICE_SUBWINDOWS_CHANGED (mfgc_d); \ - } \ - else \ - subwindows_changed = 1; \ -} while (0) - -#define MARK_FRAME_SUBWINDOWS_STATE_CHANGED(f) do { \ - struct frame *mfgc_f = (f); \ - mfgc_f->subwindows_state_changed = 1; \ - mfgc_f->modiff++; \ - if (!NILP (mfgc_f->device)) \ - { \ - struct device *mfgc_d = XDEVICE (mfgc_f->device); \ - MARK_DEVICE_SUBWINDOWS_STATE_CHANGED (mfgc_d); \ - } \ - else \ - subwindows_state_changed = 1; \ -} while (0) - -#define MARK_FRAME_TOOLBARS_CHANGED(f) do { \ - struct frame *mftc_f = (f); \ - mftc_f->toolbar_changed = 1; \ - mftc_f->modiff++; \ - if (!NILP (mftc_f->device)) \ - { \ - struct device *mftc_d = XDEVICE (mftc_f->device); \ - MARK_DEVICE_TOOLBARS_CHANGED (mftc_d); \ - } \ - else \ - toolbar_changed = 1; \ -} while (0) - -#define MARK_FRAME_GUTTERS_CHANGED(f) do { \ - struct frame *mftc_f = (f); \ - mftc_f->gutter_changed = 1; \ - mftc_f->modiff++; \ - if (!NILP (mftc_f->device)) \ - { \ - struct device *mftc_d = XDEVICE (mftc_f->device); \ - MARK_DEVICE_GUTTERS_CHANGED (mftc_d); \ - } \ - else \ - gutter_changed = 1; \ -} while (0) - -#define MARK_FRAME_SIZE_CHANGED(f) do { \ - struct frame *mfsc_f = (f); \ - mfsc_f->size_changed = 1; \ - mfsc_f->size_change_pending = 1; \ - mfsc_f->modiff++; \ - if (!NILP (mfsc_f->device)) \ - { \ - struct device *mfsc_d = XDEVICE (mfsc_f->device); \ - MARK_DEVICE_SIZE_CHANGED (mfsc_d); \ - } \ - else \ - size_changed = 1; \ -} while (0) - -#define MARK_FRAME_CHANGED(f) do { \ - struct frame *mfc_f = (f); \ - mfc_f->frame_changed = 1; \ - mfc_f->modiff++; \ - if (!NILP (mfc_f->device)) \ - { \ - struct device *mfc_d = XDEVICE (mfc_f->device); \ - MARK_DEVICE_FRAME_CHANGED (mfc_d); \ - } \ - else \ - frame_changed = 1; \ -} while (0) - -#define MARK_FRAME_WINDOWS_CHANGED(f) do { \ - struct frame *mfwc_f = (f); \ - mfwc_f->windows_changed = 1; \ - mfwc_f->modiff++; \ - if (!NILP (mfwc_f->device)) \ - { \ - struct device *mfwc_d = XDEVICE (mfwc_f->device); \ - MARK_DEVICE_WINDOWS_CHANGED (mfwc_d); \ - } \ - else \ - windows_changed = 1; \ -} while (0) - -#define MARK_FRAME_WINDOWS_STRUCTURE_CHANGED(f) do { \ - struct frame *fwsc_f = (f); \ - fwsc_f->windows_structure_changed = 1; \ - fwsc_f->modiff++; \ - if (!NILP (fwsc_f->device)) \ - { \ - struct device *fwsc_d = XDEVICE (fwsc_f->device); \ - MARK_DEVICE_WINDOWS_STRUCTURE_CHANGED (fwsc_d); \ - } \ - else \ - windows_structure_changed = 1; \ - invalidate_vertical_divider_cache_in_frame (fwsc_f); \ -} while (0) - -#define MARK_FRAME_SIZE_SLIPPED(f) do { \ - struct frame *fwsc_f = (f); \ - fwsc_f->size_slipped = 1; \ - fwsc_f->modiff++; \ - if (!NILP (fwsc_f->device)) \ - { \ - struct device *fwsc_d = XDEVICE (fwsc_f->device); \ - MARK_DEVICE_FRAME_CHANGED (fwsc_d); \ - } \ - else \ - frame_changed = 1; \ -} while (0) - -#define CLEAR_FRAME_SIZE_SLIPPED(f) do { \ - struct frame *fwsc_f = (f); \ - fwsc_f->size_slipped = 0; \ -} while (0) - -#define SET_FRAME_CLEAR(f) MARK_FRAME_CHANGED (f); (f)->clear = 1 -#define FRAME_DEVICE(f) ((f)->device) -#define FRAME_CONSOLE(f) DEVICE_CONSOLE (XDEVICE (FRAME_DEVICE (f))) -#define FRAME_LIVE_P(f) (!EQ (FRAME_TYPE (f), Qdead)) - -#define FRAME_MINIBUF_ONLY_P(f) \ - EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f)) -#define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer) -#define FRAME_HEIGHT(f) ((f)->height) -#define FRAME_WIDTH(f) ((f)->width) -#define FRAME_CHARHEIGHT(f) ((f)->char_height) -#define FRAME_CHARWIDTH(f) ((f)->char_width) -#define FRAME_PIXHEIGHT(f) ((f)->pixheight) -#define FRAME_PIXWIDTH(f) ((f)->pixwidth) -#define FRAME_PAGENUMBER(f) ((f)->page_number + 0) -#define FRAME_SET_PAGENUMBER(f,x) (f)->page_number = (x); -#ifdef HAVE_SCROLLBARS -#define FRAME_SCROLLBAR_WIDTH(f) \ - (NILP ((f)->vertical_scrollbar_visible_p) ? \ - 0 : XINT ((f)->scrollbar_width)) -#define FRAME_SCROLLBAR_HEIGHT(f) \ - (NILP ((f)->horizontal_scrollbar_visible_p) ? \ - 0 : XINT ((f)->scrollbar_height)) -#else -#define FRAME_SCROLLBAR_WIDTH(f) 0 -#define FRAME_SCROLLBAR_HEIGHT(f) 0 -#endif - #define FW_FRAME(obj) \ (WINDOWP (obj) ? WINDOW_FRAME (XWINDOW (obj)) \ : (FRAMEP (obj) ? obj \ : Qnil)) -#define FRAME_NEW_HEIGHT(f) ((f)->new_height) -#define FRAME_NEW_WIDTH(f) ((f)->new_width) -#define FRAME_CURSOR_X(f) ((f)->cursor_x) -#define FRAME_CURSOR_Y(f) ((f)->cursor_y) -#define FRAME_VISIBLE_P(f) ((f)->visible) -#define FRAME_REPAINT_P(f) ((f)->visible>0) -#define FRAME_NO_SPLIT_P(f) ((f)->no_split) -#define FRAME_ICONIFIED_P(f) ((f)->iconified) -#define FRAME_FOCUS_FRAME(f) ((f)->focus_frame) -#define FRAME_MINIBUF_WINDOW(f) ((f)->minibuffer_window) -#define FRAME_ROOT_WINDOW(f) ((f)->root_window) -/* Catch people attempting to set this. */ -#define FRAME_SELECTED_WINDOW(f) NON_LVALUE ((f)->selected_window) -#define FRAME_SELECTED_XWINDOW(f) XWINDOW (FRAME_SELECTED_WINDOW (f)) -#define FRAME_LAST_NONMINIBUF_WINDOW(f) \ - NON_LVALUE ((f)->last_nonminibuf_window) -#define FRAME_SB_VCACHE(f) ((f)->sb_vcache) -#define FRAME_SB_HCACHE(f) ((f)->sb_hcache) -#define FRAME_SUBWINDOW_CACHE(f) ((f)->subwindow_instance_cache) - -#if 0 /* FSFmacs */ - -#define FRAME_VISIBLE_P(f) ((f)->visible != 0) -#define FRAME_SET_VISIBLE(f,p) \ - ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f)) - -/* Emacs's redisplay code could become confused if a frame's - visibility changes at arbitrary times. For example, if a frame is - visible while the desired glyphs are being built, but becomes - invisible before they are updated, then some rows of the - desired_glyphs will be left marked as enabled after redisplay is - complete, which should never happen. The next time the frame - becomes visible, redisplay will probably barf. - - Currently, there are no similar situations involving iconified, but - the principle is the same. - - So instead of having asynchronous input handlers directly set and - clear the frame's visibility and iconification flags, they just set - the async_visible and async_iconified flags; the redisplay code - calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay, - which sets visible and iconified from their asynchronous - counterparts. - - Synchronous code must use the FRAME_SET_VISIBLE macro. - - Also, if a frame used to be invisible, but has just become visible, - it must be marked as garbaged, since redisplay hasn't been keeping - up its contents. */ -#define FRAME_SAMPLE_VISIBILITY(f) \ - (((f)->async_visible && ! (f)->visible) ? SET_FRAME_GARBAGED (f) : 0, \ - (f)->visible = (f)->async_visible, \ - (f)->iconified = (f)->async_iconified) - -#endif /* FSFmacs */ - -#define FRAME_BORDER_WIDTH(f) ((f)->internal_border_width) -#define FRAME_BORDER_HEIGHT(f) ((f)->internal_border_width) - -/* This returns the frame-local value; that tells you what you should - use when computing the frame size. It is *not* the actual toolbar - size because that depends on the selected window. Use the macros - below for that. -*/ - -#ifdef HAVE_TOOLBARS -#define FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE(f, pos) \ - (!NILP((f)->toolbar_buttons[pos]) && !NILP ((f)->toolbar_visible_p[pos])) -#define FRAME_RAW_THEORETICAL_TOOLBAR_SIZE(f, pos) \ - (!NILP ((f)->toolbar_buttons[pos]) && INTP((f)->toolbar_size[pos]) ? \ - (XINT ((f)->toolbar_size[pos])) : 0) -#define FRAME_RAW_THEORETICAL_TOOLBAR_BORDER_WIDTH(f, pos) \ - (!NILP ((f)->toolbar_buttons[pos]) && INTP((f)->toolbar_border_width[pos]) ? \ - (XINT ((f)->toolbar_border_width[pos])) : 0) -#else -#define FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE(f, pos) 0 -#define FRAME_RAW_THEORETICAL_TOOLBAR_SIZE(f, pos) 0 -#define FRAME_RAW_THEORETICAL_TOOLBAR_BORDER_WIDTH(f, pos) 0 -#endif - -#define FRAME_THEORETICAL_TOOLBAR_SIZE(f, pos) \ - (FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE (f, pos) \ - ? FRAME_RAW_THEORETICAL_TOOLBAR_SIZE (f, pos) \ - : 0) - -#define FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT(f) \ - FRAME_THEORETICAL_TOOLBAR_SIZE (f, TOP_TOOLBAR) -#define FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT(f) \ - FRAME_THEORETICAL_TOOLBAR_SIZE (f, BOTTOM_TOOLBAR) -#define FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH(f) \ - FRAME_THEORETICAL_TOOLBAR_SIZE (f, LEFT_TOOLBAR) -#define FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH(f) \ - FRAME_THEORETICAL_TOOLBAR_SIZE (f, RIGHT_TOOLBAR) - -#define FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH(f, pos) \ - (FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE (f, pos) \ - ? FRAME_RAW_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, pos) \ - : 0) - -#define FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, TOP_TOOLBAR) -#define FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_TOOLBAR) -#define FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, LEFT_TOOLBAR) -#define FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_TOOLBAR) - -/* This returns the window-local value rather than the frame-local value; - that tells you about what's actually visible rather than what should - be used when computing the frame size. */ - -#ifdef HAVE_TOOLBARS -#define FRAME_RAW_REAL_TOOLBAR_VISIBLE(f, pos) \ - (HAS_DEVMETH_P (XDEVICE (FRAME_DEVICE (f)), initialize_frame_toolbars) \ - && !NILP (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_visible_p[pos])) -#define FRAME_RAW_REAL_TOOLBAR_BORDER_WIDTH(f, pos) \ - ((INTP (XWINDOW \ - (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_border_width[pos])) ? \ - (XINT (XWINDOW \ - (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_border_width[pos])) \ - : 0) -#define FRAME_RAW_REAL_TOOLBAR_SIZE(f, pos) \ - ((INTP (XWINDOW \ - (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_size[pos])) ? \ - (XINT (XWINDOW \ - (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar_size[pos])) : 0) -#define FRAME_REAL_TOOLBAR(f, pos) \ - (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->toolbar[pos]) -#else -#define FRAME_RAW_REAL_TOOLBAR_VISIBLE(f, pos) 0 -#define FRAME_RAW_REAL_TOOLBAR_BORDER_WIDTH(f, pos) 0 -#define FRAME_RAW_REAL_TOOLBAR_SIZE(f, pos) 0 -#define FRAME_REAL_TOOLBAR(f, pos) Qnil -#endif - -/* Note to Chuck - Note to Chuck - Note to Chuck: - - The former definitions of FRAME_REAL_FOO_TOOLBAR_VISIBLE - looked at the toolbar data to see what was there. The - current ones look at the current values of the specifiers. - This is a semantic change; the former definition returned - what was *actually* there right at the moment, while the - current one returns what *ought* to be there once redisplay - has run to completion. I think this new definition is more - correct in almost all circumstances and is much less likely - to lead to strange race conditions. I'm not completely - sure that there aren't some places in the redisplay code - that use these macros and expect the former semantics, so - if you encounter some odd toolbar behavior, you might want - to look into this. --ben */ - -#define FRAME_REAL_TOOLBAR_VISIBLE(f, pos) \ - ((!NILP (FRAME_REAL_TOOLBAR (f, pos)) \ - && FRAME_RAW_REAL_TOOLBAR_SIZE (f, pos) > 0) \ - ? FRAME_RAW_REAL_TOOLBAR_VISIBLE (f, pos) \ - : 0) -#define FRAME_REAL_TOOLBAR_SIZE(f, pos) \ - ((!NILP (FRAME_REAL_TOOLBAR (f, pos)) \ - && FRAME_RAW_REAL_TOOLBAR_VISIBLE (f, pos)) \ - ? FRAME_RAW_REAL_TOOLBAR_SIZE (f, pos) \ - : 0) -#define FRAME_REAL_TOOLBAR_BORDER_WIDTH(f, pos) \ - ((!NILP (FRAME_REAL_TOOLBAR (f, pos)) \ - && FRAME_RAW_REAL_TOOLBAR_VISIBLE (f, pos)) \ - ? FRAME_RAW_REAL_TOOLBAR_BORDER_WIDTH (f, pos) \ - : 0) - -#define FRAME_REAL_TOP_TOOLBAR_HEIGHT(f) \ - FRAME_REAL_TOOLBAR_SIZE (f, TOP_TOOLBAR) -#define FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT(f) \ - FRAME_REAL_TOOLBAR_SIZE (f, BOTTOM_TOOLBAR) -#define FRAME_REAL_LEFT_TOOLBAR_WIDTH(f) \ - FRAME_REAL_TOOLBAR_SIZE (f, LEFT_TOOLBAR) -#define FRAME_REAL_RIGHT_TOOLBAR_WIDTH(f) \ - FRAME_REAL_TOOLBAR_SIZE (f, RIGHT_TOOLBAR) - -#define FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, TOP_TOOLBAR) -#define FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_TOOLBAR) -#define FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, LEFT_TOOLBAR) -#define FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH(f) \ - FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_TOOLBAR) - -#define FRAME_REAL_TOP_TOOLBAR_VISIBLE(f) \ - FRAME_REAL_TOOLBAR_VISIBLE (f, TOP_TOOLBAR) -#define FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE(f) \ - FRAME_REAL_TOOLBAR_VISIBLE (f, BOTTOM_TOOLBAR) -#define FRAME_REAL_LEFT_TOOLBAR_VISIBLE(f) \ - FRAME_REAL_TOOLBAR_VISIBLE (f, LEFT_TOOLBAR) -#define FRAME_REAL_RIGHT_TOOLBAR_VISIBLE(f) \ - FRAME_REAL_TOOLBAR_VISIBLE (f, RIGHT_TOOLBAR) - -#define FRAME_TOP_BORDER_START(f) \ - (FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) + \ - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f)) -#define FRAME_TOP_BORDER_END(f) \ - (FRAME_TOP_BORDER_START (f) + FRAME_BORDER_HEIGHT (f)) - -#define FRAME_BOTTOM_BORDER_START(f) \ - (FRAME_PIXHEIGHT (f) - FRAME_BORDER_HEIGHT (f) - \ - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) - \ - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) -#define FRAME_BOTTOM_BORDER_END(f) \ - (FRAME_PIXHEIGHT (f) - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) - \ - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) - -#define FRAME_LEFT_BORDER_START(f) \ - (FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) + \ - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f)) -#define FRAME_LEFT_BORDER_END(f) \ - (FRAME_LEFT_BORDER_START (f) + FRAME_BORDER_WIDTH (f)) - -#define FRAME_RIGHT_BORDER_START(f) \ - (FRAME_PIXWIDTH (f) - FRAME_BORDER_WIDTH (f) - \ - FRAME_REAL_RIGHT_TOOLBAR_WIDTH(f) - \ - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f)) -#define FRAME_RIGHT_BORDER_END(f) \ - (FRAME_PIXWIDTH (f) - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) - \ - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH(f)) - /* Equivalent in FSF Emacs: FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a @@ -779,9 +138,8 @@ void adjust_frame_size (struct frame *frame); void frame_size_slipped (Lisp_Object specifier, struct frame *f, Lisp_Object oldval); -void hold_frame_size_changes (void); -void unhold_one_frame_size_changes (struct frame *f); -void unhold_frame_size_changes (void); +int enter_redisplay_critical_section (void); +void exit_redisplay_critical_section (int); void select_frame_1 (Lisp_Object frame); void select_frame_2 (Lisp_Object frame); struct frame *selected_frame (void); diff --text -u 'xemacs-21.5.6/src/general-slots.h' 'xemacs-21.5.7/src/general-slots.h' Index: ././src/general-slots.h --- ././src/general-slots.h Fri Mar 29 13:47:43 2002 +++ ././src/general-slots.h Tue Jun 4 15:05:10 2002 @@ -113,6 +113,7 @@ SYMBOL (Qeql); SYMBOL (Qequal); SYMBOL (Qeval); +SYMBOL (Qevent); SYMBOL (Qextents); SYMBOL (Qexternal); SYMBOL (Qface); @@ -130,7 +131,9 @@ SYMBOL (Qgeneric); SYMBOL (Qgeometry); SYMBOL (Qglobal); +SYMBOL (Qglyph); SYMBOL (Qgtk); +SYMBOL (Qgui_item); SYMBOL (Qgutter); SYMBOL (Qheight); SYMBOL_KEYWORD (Q_height); @@ -151,6 +154,8 @@ SYMBOL (Qinternal); SYMBOL_KEYWORD (Q_items); SYMBOL_KEYWORD (Q_justify); +SYMBOL_KEYWORD (Q_vertically_justify); +SYMBOL_KEYWORD (Q_horizontally_justify); SYMBOL (Qkey); SYMBOL (Qkey_assoc); SYMBOL_KEYWORD (Q_key_sequence); diff --text -u 'xemacs-21.5.6/src/glade.c' 'xemacs-21.5.7/src/glade.c' Index: ././src/glade.c --- ././src/glade.c Thu May 24 16:51:16 2001 +++ ././src/glade.c Sun May 5 20:31:34 2002 @@ -32,7 +32,7 @@ Lisp_Object func; Lisp_Object lisp_data = Qnil; - VOID_TO_LISP (func, user_data); + func = VOID_TO_LISP (user_data); if (NILP (func)) { diff --text -u 'xemacs-21.5.6/src/glyphs-eimage.c' 'xemacs-21.5.7/src/glyphs-eimage.c' Index: ././src/glyphs-eimage.c --- ././src/glyphs-eimage.c Fri Mar 29 13:47:44 2002 +++ ././src/glyphs-eimage.c Fri Jun 21 06:18:33 2002 @@ -48,10 +48,10 @@ #include "lisp.h" #include "lstream.h" #include "console.h" -#include "device.h" +#include "device-impl.h" #include "faces.h" #include "glyphs.h" -#include "objects.h" +#include "objects-impl.h" #include "buffer.h" #include "frame.h" @@ -302,7 +302,7 @@ my_jpeg_output_message (j_common_ptr cinfo) { Extbyte buffer[JMSG_LENGTH_MAX]; - Intbyte *intbuf; + Ibyte *intbuf; /* Create the message */ (*cinfo->err->format_message) (cinfo, buffer); @@ -635,7 +635,7 @@ { /* An error was signaled. No clean up is needed, as unwind handles that for us. Just pass the error along. */ - Intbyte *interr; + Ibyte *interr; Lisp_Object errstring; EXTERNAL_TO_C_STRING (gif_err.err_str, interr, Qnative); errstring = build_msg_intstring (interr); diff --text -u 'xemacs-21.5.6/src/glyphs-gtk.c' 'xemacs-21.5.7/src/glyphs-gtk.c' Index: ././src/glyphs-gtk.c --- ././src/glyphs-gtk.c Sun Mar 31 17:28:22 2002 +++ ././src/glyphs-gtk.c Fri Jun 21 06:18:33 2002 @@ -49,39 +49,30 @@ #include #include "lisp.h" -#include "lstream.h" -#include "console-gtk.h" -#include "glyphs.h" -#include "glyphs-gtk.h" -#include "objects-gtk.h" -#include "gui-gtk.h" -#include "ui-gtk.h" #include "buffer.h" -#include "window.h" -#include "frame.h" +#include "device-impl.h" +#include "faces.h" +#include "file-coding.h" +#include "frame-impl.h" +#include "glyphs.h" +#include "gui.h" +#include "imgproc.h" #include "insdel.h" +#include "lstream.h" #include "opaque.h" -#include "faces.h" +#include "window.h" -#include "imgproc.h" +#include "console-gtk-impl.h" +#include "glyphs-gtk.h" +#include "gui-gtk.h" +#include "objects-gtk-impl.h" +#include "ui-gtk.h" #include "sysfile.h" #include -#include "file-coding.h" - -#if INTBITS == 32 -# define FOUR_BYTE_TYPE unsigned int -#elif LONGBITS == 32 -# define FOUR_BYTE_TYPE unsigned long -#elif SHORTBITS == 32 -# define FOUR_BYTE_TYPE unsigned short -#else -#error What kind of strange-ass system are we running on? -#endif - DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing); DECLARE_IMAGE_INSTANTIATOR_FORMAT (string); DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); @@ -179,7 +170,7 @@ unsigned char *data, *ip, *dp = NULL; quant_table *qtable = NULL; union { - FOUR_BYTE_TYPE val; + UINT_32_BIT val; char cp[4]; } conv; @@ -364,7 +355,7 @@ if (IMAGE_INSTANCE_GTK_MASK (p)) write_fmt_string (printcharfun, "/0x%lx", (unsigned long) IMAGE_INSTANCE_GTK_MASK (p)); - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); break; #if HAVE_SUBWINDOWS case IMAGE_SUBWINDOW: @@ -551,11 +542,11 @@ /* Check non-absolute pathnames with a directory component relative to the search path; that's the way Xt does it. */ /* #### Unix-specific */ - if (XSTRING_BYTE (name, 0) == '/' || - (XSTRING_BYTE (name, 0) == '.' && - (XSTRING_BYTE (name, 1) == '/' || - (XSTRING_BYTE (name, 1) == '.' && - (XSTRING_BYTE (name, 2) == '/'))))) + if (string_byte (name, 0) == '/' || + (string_byte (name, 0) == '.' && + (string_byte (name, 1) == '/' || + (string_byte (name, 1) == '.' && + (string_byte (name, 2) == '/'))))) { if (!NILP (Ffile_readable_p (name))) return name; @@ -563,10 +554,6 @@ return Qnil; } - if (NILP (Vdefault_gtk_device)) - /* This may occur during intialization. */ - return Qnil; - if (NILP (Vgtk_bitmap_file_path)) { Vgtk_bitmap_file_path = nconc2 (Vgtk_bitmap_file_path, @@ -1444,7 +1431,7 @@ if (emsg) gui_error_2 (emsg, data, Qimage); - bp = bits = (char *) alloca (PIXELS / 8); + bp = bits = (char *) ALLOCA (PIXELS / 8); /* the compface library exports char F[], which uses a single byte per pixel to represent a 48x48 bitmap. Yuck. */ diff --text -u 'xemacs-21.5.6/src/glyphs-msw.c' 'xemacs-21.5.7/src/glyphs-msw.c' Index: ././src/glyphs-msw.c --- ././src/glyphs-msw.c Sun Mar 31 17:28:24 2002 +++ ././src/glyphs-msw.c Fri Jun 21 06:18:33 2002 @@ -31,11 +31,11 @@ #include #include "lisp.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "faces.h" #include "file-coding.h" -#include "frame.h" +#include "frame-impl.h" #include "gui.h" #include "imgproc.h" #include "insdel.h" @@ -45,9 +45,9 @@ #include "sysfile.h" #include "window.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "glyphs-msw.h" -#include "objects-msw.h" +#include "objects-msw-impl.h" #define WIDGET_GLYPH_SLOT 0 @@ -304,11 +304,11 @@ /* Check non-absolute pathnames with a directory component relative to the search path; that's the way Xt does it. */ - if (IS_DIRECTORY_SEP(XSTRING_BYTE (name, 0)) || - (XSTRING_BYTE (name, 0) == '.' && - (IS_DIRECTORY_SEP(XSTRING_BYTE (name, 1)) || - (XSTRING_BYTE (name, 1) == '.' && - (IS_DIRECTORY_SEP(XSTRING_BYTE (name, 2))))))) + if (IS_DIRECTORY_SEP(string_byte (name, 0)) || + (string_byte (name, 0) == '.' && + (IS_DIRECTORY_SEP(string_byte (name, 1)) || + (string_byte (name, 1) == '.' && + (IS_DIRECTORY_SEP(string_byte (name, 2))))))) { if (!NILP (Ffile_readable_p (name))) return Fexpand_file_name (name, Qnil); @@ -720,7 +720,7 @@ struct color_symbol { - Intbyte * name; + Ibyte * name; COLORREF color; }; @@ -779,10 +779,10 @@ /* mustn't lose this when we return */ colortbl[j].name = qxestrdup (XSTRING_DATA (XCAR (cons))); - free_cons (XCONS (cons)); + free_cons (cons); cons = results; results = XCDR (results); - free_cons (XCONS (cons)); + free_cons (cons); } return colortbl; } @@ -899,7 +899,7 @@ if (xpmimage.colorTable[i].c_color) { colortbl[i]= - mswindows_string_to_color ((Intbyte *) + mswindows_string_to_color ((Ibyte *) xpmimage.colorTable[i].c_color); goto label_found_color; } @@ -1094,7 +1094,7 @@ typedef struct { - CIntbyte *name; + CIbyte *name; int resource_id; } resource_t; @@ -1175,7 +1175,7 @@ do { - if (!qxestrcasecmp_i18n ((Intbyte *) res->name, XSTRING_DATA (name))) + if (!qxestrcasecmp_i18n ((Ibyte *) res->name, XSTRING_DATA (name))) return res->resource_id; } while ((++res)->name); @@ -1637,7 +1637,7 @@ Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); int i, stattis; UChar_Binary *p, *bits, *bp; - const CIntbyte * volatile emsg = 0; + const CIbyte * volatile emsg = 0; const UChar_Binary * volatile dstring; assert (!NILP (data)); @@ -1674,11 +1674,11 @@ if (emsg) signal_image_error_2 (emsg, data, Qimage); - bp = bits = (UChar_Binary *) alloca (PIXELS / 8); + bp = bits = (UChar_Binary *) ALLOCA (PIXELS / 8); /* the compface library exports char F[], which uses a single byte per pixel to represent a 48x48 bitmap. Yuck. */ - for (i = 0, p = F; i < (PIXELS / 8); ++i) + for (i = 0, p = (UChar_Binary *) F; i < (PIXELS / 8); ++i) { int n, b; /* reverse the bit order of each byte... */ @@ -1716,7 +1716,7 @@ write_fmt_string (printcharfun, "/0x%lx", (unsigned long) IMAGE_INSTANCE_MSWINDOWS_MASK (p)); } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); break; default: @@ -1803,16 +1803,16 @@ charset_of_text (Lisp_Object text) { #ifdef MULE - Intbyte *p; + Ibyte *p; if (NILP (text)) return Vcharset_ascii; for (p = XSTRING_DATA (text); *p;) { - Emchar c = charptr_emchar (p); - if (!EQ (CHAR_CHARSET (c), Vcharset_ascii)) - return CHAR_CHARSET (c); - INC_CHARPTR (p); + Ichar c = itext_ichar (p); + if (!EQ (ichar_charset (c), Vcharset_ascii)) + return ichar_charset (c); + INC_IBYTEPTR (p); } #endif /* MULE */ @@ -1852,16 +1852,18 @@ return mswindows_get_hfont (XFONT_INSTANCE (font), under, strike); } +#ifdef DEFER_WINDOW_POS + static HDWP begin_defer_window_pos (struct frame *f) { -#ifdef DEFER_WINDOW_POS if (FRAME_MSWINDOWS_DATA (f)->hdwp == 0) FRAME_MSWINDOWS_DATA (f)->hdwp = BeginDeferWindowPos (10); -#endif return FRAME_MSWINDOWS_DATA (f)->hdwp; } +#endif + /* unmap the image if it is a widget. This is used by redisplay via redisplay_unmap_subwindows */ static void @@ -1954,6 +1956,16 @@ 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOACTIVATE); + + /* Doing this once does not seem to be enough, for instance when + mapping the search dialog this gets called four times. If we + only set on the first time through then the subwindow never + gets focus as intended. However, doing this everytime doesn't + seem so bad, after all we only need to redo this after the + focus changes - and if that happens resetting the initial + focus doesn't seem so bad. */ + if (IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (p)) + SetFocus (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p)); #endif } } @@ -2038,6 +2050,13 @@ #ifdef HAVE_WIDGETS +/* Account for some of the limitations with widget images. */ +static int +mswindows_widget_border_width (void) +{ + return DEFAULT_WIDGET_BORDER_WIDTH; +} + /* register widgets into our hashtable so that we can cope with the callbacks. The hashtable is weak so deregistration is handled automatically */ @@ -2196,7 +2215,7 @@ Lisp_Object instantiator, Lisp_Object pointer_fg, Lisp_Object pointer_bg, int dest_mask, Lisp_Object domain, - const CIntbyte *class, int flags, int exflags) + const CIbyte *class, int flags, int exflags) { /* this function can call lisp */ Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); @@ -2274,11 +2293,6 @@ (IMAGE_INSTANCE_WIDGET_FACE (ii), domain, IMAGE_INSTANCE_WIDGET_TEXT (ii)), MAKELPARAM (TRUE, 0)); -#if 0 - /* #### doesn't work. need to investigate more closely. */ - if (IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (ii)) - SetFocus (wnd); -#endif } /* Instantiate a native layout widget. */ @@ -2763,7 +2777,7 @@ default_face_font_info (domain, 0, 0, &height, 0, 0); GET_LIST_LENGTH (items, len); - height = (height + WIDGET_BORDER_HEIGHT * 2 ) * len; + height = (height + DEFAULT_WIDGET_BORDER_WIDTH * 2 ) * len; IMAGE_INSTANCE_HEIGHT (ii) = height; /* Now create the widget. */ @@ -2804,7 +2818,7 @@ if (EQ (prop, Q_text)) { Charcount tchar_len = qxeSendMessage (wnd, WM_GETTEXTLENGTH, 0, 0); - Extbyte *buf = (Extbyte *) alloca (XETCHAR_SIZE * (tchar_len + 1)); + Extbyte *buf = (Extbyte *) ALLOCA (XETCHAR_SIZE * (tchar_len + 1)); qxeSendMessage (wnd, WM_GETTEXT, (WPARAM)tchar_len + 1, (LPARAM) buf); return build_tstr_string (buf); @@ -2841,7 +2855,7 @@ long item = qxeSendMessage (wnd, CB_GETCURSEL, 0, 0); Charcount tchar_len = qxeSendMessage (wnd, CB_GETLBTEXTLEN, (WPARAM)item, 0); - Extbyte *buf = (Extbyte *) alloca (XETCHAR_SIZE * (tchar_len + 1)); + Extbyte *buf = (Extbyte *) ALLOCA (XETCHAR_SIZE * (tchar_len + 1)); qxeSendMessage (wnd, CB_GETLBTEXT, (WPARAM)item, (LPARAM) buf); return build_tstr_string (buf); } @@ -2941,6 +2955,7 @@ CONSOLE_HAS_METHOD (mswindows, locate_pixmap_file); #ifdef HAVE_WIDGETS CONSOLE_HAS_METHOD (mswindows, widget_query_string_geometry); + CONSOLE_HAS_METHOD (mswindows, widget_border_width); #endif /* image methods - printer */ diff --text -u 'xemacs-21.5.6/src/glyphs-msw.h' 'xemacs-21.5.7/src/glyphs-msw.h' Index: ././src/glyphs-msw.h --- ././src/glyphs-msw.h Wed Mar 13 17:52:45 2002 +++ ././src/glyphs-msw.h Sun May 5 20:31:38 2002 @@ -68,21 +68,17 @@ #define XIMAGE_INSTANCE_MSWINDOWS_ICON(i) \ IMAGE_INSTANCE_MSWINDOWS_ICON (XIMAGE_INSTANCE (i)) -int -mswindows_resize_dibitmap_instance (Lisp_Image_Instance *ii, - struct frame *f, - int newx, int newy); -HBITMAP -mswindows_create_resized_bitmap (Lisp_Image_Instance *ii, - struct frame *f, - int newx, int newy); -HBITMAP -mswindows_create_resized_mask (Lisp_Image_Instance *ii, - struct frame *f, - int newx, int newy); -void -mswindows_initialize_image_instance_icon (Lisp_Image_Instance *image, - int cursor); +int mswindows_resize_dibitmap_instance (Lisp_Image_Instance *ii, + struct frame *f, + int newx, int newy); +HBITMAP mswindows_create_resized_bitmap (Lisp_Image_Instance *ii, + struct frame *f, + int newx, int newy); +HBITMAP mswindows_create_resized_mask (Lisp_Image_Instance *ii, + struct frame *f, + int newx, int newy); +void mswindows_initialize_image_instance_icon (Lisp_Image_Instance *image, + int cursor); #define WIDGET_INSTANCE_MSWINDOWS_HANDLE(i) \ (HWND) (IMAGE_INSTANCE_SUBWINDOW_ID (i)) diff --text -u 'xemacs-21.5.6/src/glyphs-widget.c' 'xemacs-21.5.7/src/glyphs-widget.c' Index: ././src/glyphs-widget.c --- ././src/glyphs-widget.c Sun Mar 31 17:28:26 2002 +++ ././src/glyphs-widget.c Fri Jun 21 06:18:34 2002 @@ -1,5 +1,5 @@ /* Widget-specific glyph objects. - Copyright (C) 1998, 1999, 2000 Andy Piper. + Copyright (C) 1998, 1999, 2000, 2002 Andy Piper. This file is part of XEmacs. @@ -27,7 +27,7 @@ #include "bytecode.h" #include "console.h" -#include "device.h" +#include "device-impl.h" #include "faces.h" #include "frame.h" #include "glyphs.h" @@ -61,6 +61,12 @@ Lisp_Object Qetched_in, Qetched_out, Qbevel_in, Qbevel_out; Lisp_Object Qmake_glyph; +Lisp_Object Vwidget_border_width; + +static int widget_border_width (Lisp_Object domain); +static int widget_spacing (Lisp_Object domain); +static void widget_query_string_geometry (Lisp_Object string, Lisp_Object face, + int *width, int *height, Lisp_Object domain); #ifdef DEBUG_WIDGETS int debug_widget_instances; @@ -119,7 +125,15 @@ static void check_valid_justification (Lisp_Object data) { - if (!EQ (data, Qleft) && !EQ (data, Qright) && !EQ (data, Qcenter)) + if (!EQ (data, Qleft) + && + !EQ (data, Qright) + && + !EQ (data, Qtop) + && + !EQ (data, Qbottom) + && + !EQ (data, Qcenter)) invalid_constant ("unknown justification for layout", data); } @@ -239,6 +253,56 @@ } } +/* Determine the border with of the widget. */ +static int +widget_border_width (Lisp_Object domain) +{ + /* #### FIXME -- need to use specifiers (Vwidget_border_width) for + some portion of this. */ + if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), + widget_border_width)) + return DEVMETH (DOMAIN_XDEVICE (domain), widget_border_width, ()); + else + return DEFAULT_WIDGET_BORDER_WIDTH; +} + +static int +widget_instance_border_width (Lisp_Image_Instance* ii) +{ + return widget_border_width (IMAGE_INSTANCE_DOMAIN (ii)); +} + +/* #### Its not clear to me what the value of logical_unit_height should + be, or whether it should even depend on the current + image_instance. It really should probably only depend on the + default widget face and the domain, however you can envisage users + wanting different logical units for nested layouts - so using the + properties of the current lahyout is probably not so dumb. */ +static int +logical_unit_height (Lisp_Object text, Lisp_Object face, Lisp_Object domain) +{ + int charheight = 0; + widget_query_string_geometry (text, face, + 0, &charheight, domain); + /* For the returned value to be useful it needs to be big enough to + accomodate the largest single-height widget. This is currently + the edit-field. */ + return charheight + 2 * widget_spacing (domain) + + 4 * widget_border_width (domain); +} + +static int +widget_logical_unit_height (Lisp_Image_Instance* ii) +{ + return logical_unit_height (NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)) ? + NILP (IMAGE_INSTANCE_NAME (ii)) ? + Fsymbol_name (Qwidget) + : IMAGE_INSTANCE_NAME (ii) + : IMAGE_INSTANCE_WIDGET_TEXT (ii), + IMAGE_INSTANCE_WIDGET_FACE (ii), + IMAGE_INSTANCE_DOMAIN (ii)); +} + /* Wire widget property invocations to specific widgets. The problem we are solving here is that when instantiators get converted to instances they lose some type information (they just become @@ -425,7 +489,8 @@ from lisp does not result in synchronous updates. Do this last so that format-specific methods have an opportunity to prevent wholesale changes - e.g. rebuilding tabs. */ - MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), redisplay_widget, (ii)); + MAYBE_DEVMETH (DOMAIN_XDEVICE (IMAGE_INSTANCE_DOMAIN (ii)), + redisplay_widget, (ii)); /* Pick up the items we recorded earlier. */ if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii)) @@ -450,6 +515,17 @@ } +/* Determine the spacing of the widget. */ +static int +widget_spacing (Lisp_Object domain) +{ + if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), widget_spacing)) + return DEVMETH (DOMAIN_XDEVICE (domain), + widget_spacing, (0)); + else + return DEFAULT_WIDGET_SPACING; +} + /* Query for a widgets desired geometry. If no type specific method is provided then use the widget text to calculate sizes. */ static void @@ -498,21 +574,23 @@ &w, &h, domain); /* Adjust the size for borders. */ if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) - *width = w + 2 * WIDGET_BORDER_WIDTH; + *width = w + 2 * widget_instance_border_width (ii); if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)) - *height = h + 2 * WIDGET_BORDER_HEIGHT; + *height = h + 2 * widget_instance_border_width (ii); } } /* Finish off with dynamic sizing. */ if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii))) { - dynamic_width = Feval (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); + dynamic_width = + eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); if (INTP (dynamic_width)) *width = XINT (dynamic_width); } if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) { - dynamic_height = Feval (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); + dynamic_height = + eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); if (INTP (dynamic_height)) *height = XINT (dynamic_height); } @@ -612,7 +690,8 @@ IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 1; IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 1; IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_HORIZONTAL; - IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) = 0; + IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = 0; + IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = 0; } /* Instantiate a button widget. Unfortunately instantiated widgets are @@ -730,24 +809,44 @@ size in characters is probably as good as any since the widget face is more likely to be proportional and thus give inadequate results. Using character sizes can only ever be approximate - anyway. */ - if (tw || th) + anyway. :height is measured in logical characters which take into + account the borders and spacing on widgets. */ + if (tw) { - int charwidth, charheight; - default_face_font_info (domain, 0, 0, &charheight, &charwidth, 0); - if (tw) - pw = charwidth * tw; - if (th) - ph = charheight * th; + int charwidth; + default_face_font_info (domain, 0, 0, 0, &charwidth, 0); + pw = ROUND_UP (charwidth * tw + 4 * widget_instance_border_width (ii), charwidth); + } + + /* For heights the widget face is more appropriate. */ + if (th == 1) + { + int charheight; + if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) + { + widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), + IMAGE_INSTANCE_WIDGET_FACE (ii), + 0, &charheight, domain); + } + else + { + default_face_font_info (domain, 0, 0, &charheight, 0, 0); + } + ph = (charheight + 2 * widget_instance_border_width (ii)) * th; + } + /* For heights > 1 use logical units. */ + else if (th > 1) + { + ph = widget_logical_unit_height (ii) * th; } /* for a widget with an image pick up the dimensions from that */ if (!NILP (glyph)) { if (!pw) - pw = glyph_width (glyph, image_instance) + 2 * WIDGET_BORDER_WIDTH; + pw = glyph_width (glyph, image_instance) + 2 * widget_instance_border_width (ii); if (!ph) - ph = glyph_height (glyph, image_instance) + 2 * WIDGET_BORDER_HEIGHT; + ph = glyph_height (glyph, image_instance) + 2 * widget_instance_border_width (ii); IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; } @@ -794,7 +893,7 @@ /* Adjust the size for borders. */ if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) { - *width = w + 2 * WIDGET_BORDER_WIDTH; + *width = w + 3 * widget_instance_border_width (ii); if (EQ (XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (ii))->style, Qradio) || @@ -803,7 +902,25 @@ *width += 12; } if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)) - *height = h + 2 * WIDGET_BORDER_HEIGHT; + *height = h + 3 * widget_instance_border_width (ii); +} + +/* Get the geometry of an edit field. */ +static void +edit_field_query_geometry (Lisp_Object image_instance, + int* width, int* height, + enum image_instance_geometry disp, Lisp_Object domain) +{ + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); + int w, h; + widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), + IMAGE_INSTANCE_WIDGET_FACE (ii), + &w, &h, domain); + /* Adjust the size for borders. */ + if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) + *width = w + 4 * widget_instance_border_width (ii); + if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)) + *height = h + 4 * widget_instance_border_width (ii); } /* tree-view geometry - get the height right */ @@ -826,6 +943,7 @@ if (*height) { int len, h; + /* #### widget face would be better here. */ default_face_font_info (domain, 0, 0, &h, 0, 0); GET_LIST_LENGTH (items, len); *height = len * h; @@ -849,11 +967,11 @@ int h, w; widget_query_string_geometry (XGUI_ITEM (XCAR (rest))->name, - IMAGE_INSTANCE_WIDGET_FACE (ii), - &w, &h, domain); - tw += 5 * WIDGET_BORDER_WIDTH; /* some bias */ + IMAGE_INSTANCE_WIDGET_FACE (ii), + &w, &h, domain); + tw += 5 * widget_instance_border_width (ii); /* some bias */ tw += w; - th = max (th, h + 2 * WIDGET_BORDER_HEIGHT); + th = max (th, h + 2 * widget_instance_border_width (ii)); } /* Fixup returned values depending on orientation. */ @@ -963,14 +1081,50 @@ Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); Lisp_Object items = find_keyword_in_vector (instantiator, Q_items); Lisp_Object border_inst = find_keyword_in_vector (instantiator, Q_border); + Lisp_Object justify = find_keyword_in_vector (instantiator, Q_justify); + Lisp_Object hjustify = find_keyword_in_vector (instantiator, Q_horizontally_justify); + Lisp_Object vjustify = find_keyword_in_vector (instantiator, Q_vertically_justify); Lisp_Object border = Qnil; Lisp_Object children = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii); int structure_changed = 0; struct gcpro gcpro1; + /* Pick up horizontal justification, left is the default.*/ + if (!NILP (hjustify)) + { + if (EQ (hjustify, Qright) || EQ (hjustify, Qbottom)) + IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_RIGHT; + else if (EQ (hjustify, Qcenter)) + IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER; + } + /* If not set use general justification. */ + else if (!NILP (justify)) + { + if (EQ (justify, Qright) || EQ (justify, Qbottom)) + IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_RIGHT; + else if (EQ (justify, Qcenter)) + IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER; + } + + /* Pick up vertical justification, top is the default. */ + if (!NILP (vjustify)) + { + if (EQ (vjustify, Qright) || EQ (vjustify, Qbottom)) + IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_BOTTOM; + else if (EQ (vjustify, Qcenter)) + IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER; + } + /* If not set use general justification. */ + else if (!NILP (justify)) + { + if (EQ (justify, Qright) || EQ (justify, Qbottom)) + IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_BOTTOM; + else if (EQ (justify, Qcenter)) + IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER; + } + /* We want to avoid consing if we can. This is quite awkward because we have to deal with the border as well as the items. */ - GCPRO1 (border); if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) @@ -1122,7 +1276,30 @@ glyphs are cached on a device basis like most other glyphs. Instead they should be cached per-window and then the instance would be fixed and we wouldn't have to mess around with font metrics and the - rest. */ + rest. + + Another sizing problem is alignment. We provide layout widgets that + allow users to stack widgets vertically or horizontally. These + layouts also allow the widgets to be centered (space evenly + distributed), left or right justified (fixed spacing widgets + stacked against the left, righ, top or bottom edge). Unfortunately + this doesn't allow widgets in different layouts to be aligned. For + instance how should the search dialog be organized for alignment? + The obvious choice of two vertical columns does not work since the + size of individual widgets will affect where they get placed. The + same is true for several rows of widgets. To solve this problem we + introduce the notion of `logical_unit_height'. This is a size + quantity that is designed to be big enough to accomodate the + largest `single height unit'. The function + widget_logical_unit_height() determines the value of this in + pixels. It is dependent on the widget face and some combination of + spacing and border-width. Thus if users specify left or right + justification in a vertical layout they get something in logical + units. To simplify this the functions + `widget-logical-to-character-height' and + `widget-logical-to-character-width' allow conversion between + characters and logical units so that frames can be sized + appropriately. */ /* Query the geometry of a layout widget. We assume that we can only get here if the size is not already fixed. */ @@ -1134,7 +1311,7 @@ Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest; int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0; - int gheight, gwidth; + int gheight, gwidth, luh; /* If we are not initialized then we won't have any children. */ if (!IMAGE_INSTANCE_INITIALIZED (ii)) @@ -1150,12 +1327,14 @@ !IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) return; + luh = widget_logical_unit_height (ii); + /* Pick up the border text if we have one. */ if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) { glyph_query_geometry (XCAR (items), &gwidth, &gheight, disp, image_instance); - ph_adjust = gheight / 2; + ph_adjust = gheight; items = XCDR (items); } @@ -1166,8 +1345,7 @@ glyph_query_geometry (glyph, &gwidth, &gheight, disp, image_instance); nitems ++; - if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) - == LAYOUT_HORIZONTAL) + if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) { maxph = max (maxph, gheight); maxpw += gwidth; @@ -1184,33 +1362,46 @@ if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii))) { Lisp_Object dynamic_width = - Feval (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); + eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); if (INTP (dynamic_width)) *width = XINT (dynamic_width); } - else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) - == LAYOUT_HORIZONTAL) - *width = maxpw + ((nitems + 1) * WIDGET_BORDER_WIDTH + - IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2; + else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) + { + *width = maxpw + ((nitems + 1) * widget_instance_border_width (ii) + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2; + } else - *width = maxpw + 2 * (WIDGET_BORDER_WIDTH * 2 + - IMAGE_INSTANCE_MARGIN_WIDTH (ii)); + { + *width = maxpw + 2 * (widget_instance_border_width (ii) * 2 + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)); + } /* Work out vertical spacings. */ if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) { Lisp_Object dynamic_height = - Feval (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); + eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); if (INTP (dynamic_height)) *height = XINT (dynamic_height); } - else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) - == LAYOUT_VERTICAL) - *height = maxph + ((nitems + 1) * WIDGET_BORDER_HEIGHT + - IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; + else if (IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT (ii)) + { + *height = nitems * luh + ph_adjust; + } + else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL) + { + *height = maxph + ((nitems + 1) * widget_instance_border_width (ii) + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; + } else - *height = maxph + (2 * WIDGET_BORDER_HEIGHT + - IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; + { + *height = maxph + (2 * widget_instance_border_width (ii) + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; + } +#ifdef DEBUG_WIDGET_OUTPUT + stderr_out ("layout wants %dx%d\n", *width, *height); +#endif } int @@ -1224,20 +1415,34 @@ int x, y, maxph = 0, maxpw = 0, nitems = 0, horiz_spacing, vert_spacing, ph_adjust = 0; int gheight, gwidth; + /* See comments in widget_logical_unit_height(). */ + int luh = widget_logical_unit_height (ii); /* If we are not initialized then we won't have any children. */ if (!IMAGE_INSTANCE_INITIALIZED (ii)) return 0; - /* Pick up the border text if we have one. */ +#ifdef DEBUG_WIDGET_OUTPUT + stderr_out ("layout output %dx%d\n", width, height); +#endif + + /* Pick up the border text if we have one. A border can have the + values Qetched_in, Qetched_out, Qbevel_in, Qbevel_out or an + integer. The first four just affect the display properties of the + border that is drawn. The last is an offset and implies that the + first item in the list of subcontrols is a text control that + should be displayed on the border. */ if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) { Lisp_Object border = XCAR (items); items = XCDR (items); glyph_query_geometry (border, &gwidth, &gheight, IMAGE_DESIRED_GEOMETRY, image_instance); - ph_adjust = gheight / 2; - IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (ph_adjust); + /* The vertical offset for subsequent items is the full height + of the border glyph. */ + ph_adjust = gheight; + /* The offset for the border is half the glyph height. */ + IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (gheight / 2); /* #### Really, what should this be? */ glyph_do_layout (border, gwidth, gheight, 10, 0, @@ -1269,10 +1474,10 @@ if (width < maxpw) /* The user wants a smaller space than the largest item, so we just provide default spacing and will let the output routines - clip.. */ - horiz_spacing = WIDGET_BORDER_WIDTH * 2; + clip. */ + horiz_spacing = widget_spacing (IMAGE_INSTANCE_DOMAIN (ii)); else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) - == LAYOUT_HORIZONTAL) + == LAYOUT_HORIZONTAL) /* We have a larger area to display in so distribute the space evenly. */ horiz_spacing = (width - (maxpw + @@ -1282,18 +1487,30 @@ horiz_spacing = (width - maxpw) / 2 - IMAGE_INSTANCE_MARGIN_WIDTH (ii); + /* We are trying here to get widgets to line up when they are left + or right justified vertically. This means that we must position + widgets on logical unit boundaries, even though their height may + be greater or less than a logical unit. In order to avoid + clipping we need to determine how big the widget wants to be and + then allocate as many logical units as necessary in order to + accommodate it. */ if (height < maxph) - vert_spacing = WIDGET_BORDER_HEIGHT * 2; + vert_spacing = widget_spacing (IMAGE_INSTANCE_DOMAIN (ii)) * 2; else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL) - vert_spacing = (height - (maxph + ph_adjust + - IMAGE_INSTANCE_MARGIN_WIDTH (ii) * 2)) - / (nitems + 1); + { + if (!IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (ii)) + vert_spacing = widget_spacing (IMAGE_INSTANCE_DOMAIN (ii)) * 2; + else + vert_spacing = (height - (maxph + ph_adjust + + IMAGE_INSTANCE_MARGIN_WIDTH (ii) * 2)) + / (nitems + 1); + } else vert_spacing = (height - (maxph + ph_adjust)) / 2 - IMAGE_INSTANCE_MARGIN_WIDTH (ii); - y = vert_spacing + ph_adjust + IMAGE_INSTANCE_MARGIN_WIDTH (ii); + y = yoffset = vert_spacing + ph_adjust + IMAGE_INSTANCE_MARGIN_WIDTH (ii); x = horiz_spacing + IMAGE_INSTANCE_MARGIN_WIDTH (ii); /* Now flip through putting items where we want them, paying @@ -1306,37 +1523,37 @@ glyph_query_geometry (glyph, &gwidth, &gheight, IMAGE_DESIRED_GEOMETRY, image_instance); - if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) - == LAYOUT_HORIZONTAL) + if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) { - if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) - == LAYOUT_JUSTIFY_RIGHT) + if (IMAGE_INSTANCE_SUBWINDOW_BOTTOM_JUSTIFIED (ii)) y = height - (gheight + vert_spacing); - if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) - == LAYOUT_JUSTIFY_CENTER) + else if (IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (ii)) y = (height - gheight) / 2; } else { - if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) - == LAYOUT_JUSTIFY_RIGHT) + if (IMAGE_INSTANCE_SUBWINDOW_RIGHT_JUSTIFIED (ii)) x = width - (gwidth + horiz_spacing); - if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) - == LAYOUT_JUSTIFY_CENTER) + else if (IMAGE_INSTANCE_SUBWINDOW_H_CENTERED (ii)) x = (width - gwidth) / 2; } /* Now layout subwidgets if they require it. */ glyph_do_layout (glyph, gwidth, gheight, x, y, image_instance); - if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) - == LAYOUT_HORIZONTAL) + if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) { x += (gwidth + horiz_spacing); } else { y += (gheight + vert_spacing); + if (!IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (ii)) + { + /* justified, vertical layout, try and align on logical unit + boundaries. */ + y = ROUND_UP (y - yoffset, luh) + yoffset; + } } } @@ -1401,6 +1618,67 @@ return 1; } +DEFUN ("widget-logical-to-character-width", Fwidget_logical_to_character_width, 1, 3, 0, /* +Convert the width in logical widget units to characters. +Logical widget units do not take into account adjusments made for +layout borders, so this adjusment is approximated. +*/ + (width, face, domain)) +{ + int w, neww, charwidth; + int border_width = DEFAULT_WIDGET_BORDER_WIDTH; + + if (NILP (domain)) + domain = Fselected_frame (Qnil); + + CHECK_INT (width); + w = XINT (width); + + if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), widget_border_width)) + border_width = DEVMETH (DOMAIN_XDEVICE (domain), widget_border_width, ()); + + default_face_font_info (domain, 0, 0, 0, &charwidth, 0); + neww = ROUND_UP (charwidth * w + 4 * border_width + 2 * widget_spacing (domain), + charwidth) / charwidth; + + return make_int (neww); +} + +DEFUN ("widget-logical-to-character-height", Fwidget_logical_to_character_height, 1, 3, 0, /* +Convert the height in logical widget units to characters. +Logical widget units do not take into account adjusments made for +layout borders, so this adjustment is approximated. + +If the components of a widget layout are justified to the top or the +bottom then they are aligned in terms of `logical units'. This is a +size quantity that is designed to be big enough to accomodate the +largest `single height' widget. It is dependent on the widget face and +some combination of spacing and border-width. Thus if you specify top +or bottom justification in a vertical layout the subcontrols are laid +out one per logical unit. This allows adjoining layouts to have +identical alignment for their subcontrols. + +Since frame sizes are measured in characters, this function allows you +to do appropriate conversion between logical units and characters. +*/ + (height, face, domain)) +{ + int h, newh, charheight; + + CHECK_INT (height); + if (NILP (domain)) + domain = Fselected_frame (Qnil); + + h = XINT (height); + + default_face_font_info (domain, 0, 0, &charheight, 0, 0); + newh = ROUND_UP (logical_unit_height (Fsymbol_name (Qwidget), + Vwidget_face, domain) * h, charheight) + / charheight; + + return make_int (newh); +} + /************************************************************************/ /* initialization */ @@ -1414,6 +1692,9 @@ DEFSYMBOL (Qbevel_in); DEFSYMBOL (Qbevel_out); DEFSYMBOL (Qmake_glyph); + + DEFSUBR (Fwidget_logical_to_character_height); + DEFSUBR (Fwidget_logical_to_character_width); } #define VALID_GUI_KEYWORDS(type) do { \ @@ -1477,6 +1758,7 @@ IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget); IIFORMAT_HAS_SHARED_METHOD (edit_field, post_instantiate, widget); IIFORMAT_HAS_SHARED_METHOD (edit_field, governing_domain, subwindow); + IIFORMAT_HAS_METHOD (edit_field, query_geometry); VALID_WIDGET_KEYWORDS (edit_field); VALID_GUI_KEYWORDS (edit_field); } @@ -1574,6 +1856,8 @@ VALID_WIDGET_KEYWORDS (layout); \ IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation); \ IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification); \ + IIFORMAT_VALID_KEYWORD (layout, Q_vertically_justify, check_valid_justification); \ + IIFORMAT_VALID_KEYWORD (layout, Q_horizontally_justify, check_valid_justification); \ IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border); \ IIFORMAT_VALID_KEYWORD (layout, Q_margin_width, check_valid_int); \ IIFORMAT_VALID_KEYWORD (layout, Q_items, \ @@ -1641,4 +1925,16 @@ vars_of_glyphs_widget (void) { reinit_vars_of_glyphs_widget (); +} + + +void +specifier_vars_of_glyphs_widget (void) +{ + DEFVAR_SPECIFIER ("widget-border-width", + &Vwidget_border_width /* +*Border width of widgets. +This is a specifier; use `set-specifier' to change it. +*/ ); + Vwidget_border_width = Fmake_specifier (Qnatnum); } diff --text -u 'xemacs-21.5.6/src/glyphs-x.c' 'xemacs-21.5.7/src/glyphs-x.c' Index: ././src/glyphs-x.c --- ././src/glyphs-x.c Sun Mar 31 17:28:27 2002 +++ ././src/glyphs-x.c Fri Jun 21 06:18:34 2002 @@ -4,7 +4,7 @@ Copyright (C) 1995 Tinker Systems Copyright (C) 1995, 1996, 2001, 2002 Ben Wing Copyright (C) 1995 Sun Microsystems - Copyright (C) 1999, 2000 Andy Piper + Copyright (C) 1999, 2000, 2002 Andy Piper This file is part of XEmacs. @@ -55,23 +55,24 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "faces.h" #include "file-coding.h" -#include "frame.h" +#include "frame-impl.h" #include "gui.h" #include "imgproc.h" #include "insdel.h" #include "lstream.h" #include "opaque.h" +#include "process.h" /* egetenv() */ #include "window.h" -#include "console-x.h" +#include "console-x-impl.h" #include "glyphs-x.h" -#include "objects-x.h" #ifdef HAVE_X_WIDGETS #include "gui-x.h" #endif +#include "objects-x-impl.h" #include "xmu.h" #include "sysfile.h" @@ -85,16 +86,6 @@ #endif #include -#if INTBITS == 32 -# define FOUR_BYTE_TYPE unsigned int -#elif LONGBITS == 32 -# define FOUR_BYTE_TYPE unsigned long -#elif SHORTBITS == 32 -# define FOUR_BYTE_TYPE unsigned short -#else -#error What kind of strange-ass system are we running on? -#endif - #define LISP_DEVICE_TO_X_SCREEN(dev) XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev))) DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing); @@ -160,6 +151,8 @@ #endif void emacs_Xt_handle_widget_losing_focus (struct frame* f, Widget losing_widget); +void +enqueue_focus_event (Widget wants_it, Lisp_Object frame, int in_p); #include "bitmaps.h" @@ -186,7 +179,7 @@ UChar_Binary *data, *ip, *dp; quant_table *qtable = 0; union { - FOUR_BYTE_TYPE val; + UINT_32_BIT val; char cp[4]; } conv; @@ -381,7 +374,7 @@ write_fmt_string (printcharfun, "/0x%lx", (unsigned long) IMAGE_INSTANCE_X_MASK (p)); } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); break; default: break; @@ -570,11 +563,11 @@ /* Check non-absolute pathnames with a directory component relative to the search path; that's the way Xt does it. */ /* #### Unix-specific */ - if (XSTRING_BYTE (name, 0) == '/' || - (XSTRING_BYTE (name, 0) == '.' && - (XSTRING_BYTE (name, 1) == '/' || - (XSTRING_BYTE (name, 1) == '.' && - (XSTRING_BYTE (name, 2) == '/'))))) + if (string_byte (name, 0) == '/' || + (string_byte (name, 0) == '.' && + (string_byte (name, 1) == '/' || + (string_byte (name, 1) == '.' && + (string_byte (name, 2) == '/'))))) { if (!NILP (Ffile_readable_p (name))) return Fexpand_file_name (name, Qnil); @@ -582,16 +575,19 @@ return Qnil; } - if (NILP (Vdefault_x_device)) - /* This may occur during initialization. */ - return Qnil; - else - /* We only check the bitmapFilePath resource on the original X device. */ - display = DEVICE_X_DISPLAY (XDEVICE (Vdefault_x_device)); + { + Lisp_Object defx = get_default_device (Qx); + if (NILP (defx)) + /* This may occur during initialization. */ + return Qnil; + else + /* We only check the bitmapFilePath resource on the original X device. */ + display = DEVICE_X_DISPLAY (XDEVICE (defx)); + } #ifdef USE_XBMLANGPATH { - Intbyte *path = egetenv ("XBMLANGPATH"); + Ibyte *path = egetenv ("XBMLANGPATH"); Extbyte *pathext; SubstitutionRec subs[1]; subs[0].match = 'B'; @@ -618,7 +614,7 @@ "bitmapFilePath", "BitmapFilePath", &type, &value) && !strcmp (type, "String")) { - Intbyte *path; + Ibyte *path; EXTERNAL_TO_C_STRING (value.addr, path, Qfile_name); Vx_bitmap_file_path = split_env_path (0, path); @@ -1174,10 +1170,10 @@ symbols[i].name, Qctext); symbols[i].pixel = color.pixel; symbols[i].value = 0; - free_cons (XCONS (cons)); + free_cons (cons); cons = results; results = XCDR (results); - free_cons (XCONS (cons)); + free_cons (cons); } return symbols; } @@ -1569,16 +1565,17 @@ { Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); int i, stattis; - Char_Binary *bits, *bp; - Char_Binary *p; - const Intbyte * volatile emsg = 0; - Char_Binary * volatile dstring; + UChar_Binary *p, *bits, *bp; + const CIbyte * volatile emsg = 0; + const UChar_Binary * volatile dstring; assert (!NILP (data)); - LISP_STRING_TO_EXTERNAL (data, dstring, Qbinary); + TO_EXTERNAL_FORMAT (LISP_STRING, data, + C_STRING_ALLOCA, dstring, + Qbinary); - if ((p = strchr (dstring, ':'))) + if ((p = (UChar_Binary *) strchr ((char *) dstring, ':'))) { dstring = p + 1; } @@ -1586,7 +1583,7 @@ /* Must use setjmp not SETJMP because we used jmp_buf above not JMP_BUF */ if (!(stattis = setjmp (comp_env))) { - UnCompAll (dstring); + UnCompAll ((char *) dstring); UnGenFace (); } @@ -1604,13 +1601,13 @@ } if (emsg) - gui_error_2 (emsg, data, Qimage); + signal_image_error_2 (emsg, data, Qimage); - bp = bits = (Char_Binary *) alloca (PIXELS / 8); + bp = bits = (UChar_Binary *) ALLOCA (PIXELS / 8); /* the compface library exports char F[], which uses a single byte per pixel to represent a 48x48 bitmap. Yuck. */ - for (i = 0, p = F; i < (PIXELS / 8); ++i) + for (i = 0, p = (UChar_Binary *) F; i < (PIXELS / 8); ++i) { int n, b; /* reverse the bit order of each byte... */ @@ -1618,11 +1615,11 @@ { n |= ((*p++) << b); } - *bp++ = (Char_Binary) n; + *bp++ = (UChar_Binary) n; } xbm_instantiate_1 (image_instance, instantiator, pointer_fg, - pointer_bg, dest_mask, 48, 48, bits); + pointer_bg, dest_mask, 48, 48, (Char_Binary *) bits); } #endif /* HAVE_XFACE */ @@ -1809,7 +1806,7 @@ } static Font -safe_XLoadFont (Display *dpy, Intbyte *name) +safe_XLoadFont (Display *dpy, Ibyte *name) { Font font; int (*old_handler) (Display *, XErrorEvent *); @@ -1844,7 +1841,7 @@ Display *dpy; XColor fg, bg; Font source, mask; - Intbyte source_name[PATH_MAX], mask_name[PATH_MAX], dummy; + Ibyte source_name[PATH_MAX], mask_name[PATH_MAX], dummy; int source_char, mask_char; int count; Lisp_Object foreground, background; @@ -2073,6 +2070,14 @@ -dga->xoffset, -dga->yoffset); if (!IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (p)) XtMapWidget (IMAGE_INSTANCE_X_CLIPWIDGET (p)); + /* See comments in glyphs-msw.c about keyboard focus. */ + if (IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (p)) { + /* #### FIXME to pop-up the find dialog we map the text-field + seven times! This doesn't show on a fast linux box but does + under X on windows. */ + enqueue_focus_event (IMAGE_INSTANCE_X_WIDGET_ID (p), + IMAGE_INSTANCE_FRAME (p), 1); + } } } @@ -2246,6 +2251,14 @@ IMAGE_INSTANCE_SUBWINDOW_ID (ii) = (void*)win; } +/* Account for some of the limitations with widget images. */ +static int +x_widget_border_width (void) +{ + return DEFAULT_WIDGET_BORDER_WIDTH * 2; +} + + #if 0 /* #### Should this function exist? If there's any doubt I'm not implementing it --andyp */ DEFUN ("change-subwindow-property", Fchange_subwindow_property, 3, 3, 0, /* @@ -2410,6 +2423,10 @@ free_widget_value_tree (clip_wv); + /* create a sensible name. */ + if (wv->name == 0 || strcmp(wv->name, "") == 0) + wv->name = xstrdup (type); + /* copy any args we were given */ ac = 0; lw_add_value_args_to_args (wv, al, &ac); @@ -2781,6 +2798,7 @@ CONSOLE_HAS_METHOD (x, map_subwindow); CONSOLE_HAS_METHOD (x, redisplay_widget); CONSOLE_HAS_METHOD (x, redisplay_subwindow); + CONSOLE_HAS_METHOD (x, widget_border_width); } void diff --text -u 'xemacs-21.5.6/src/glyphs.c' 'xemacs-21.5.7/src/glyphs.c' Index: ././src/glyphs.c --- ././src/glyphs.c Mon Apr 1 12:58:39 2002 +++ ././src/glyphs.c Fri Jun 21 06:18:34 2002 @@ -33,14 +33,14 @@ #include "blocktype.h" #include "buffer.h" #include "chartab.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "gui.h" #include "insdel.h" -#include "objects.h" +#include "objects-impl.h" #include "opaque.h" #include "rangetab.h" #include "redisplay.h" @@ -187,7 +187,7 @@ } maybe_invalid_argument ("Invalid image-instantiator format", format, - Qimage, errb); + Qimage, errb); return 0; } @@ -646,7 +646,7 @@ if (!NILP (value)) { Lisp_Object window; - VOID_TO_LISP (window, flag_closure); + window = VOID_TO_LISP (flag_closure); assert (EQ (XIMAGE_INSTANCE_DOMAIN (value), window)); } @@ -928,7 +928,7 @@ case IMAGE_POINTER: if (STRINGP (IMAGE_INSTANCE_PIXMAP_FILENAME (ii))) { - Intbyte *s; + Ibyte *s; Lisp_Object filename = IMAGE_INSTANCE_PIXMAP_FILENAME (ii); s = qxestrrchr (XSTRING_DATA (filename), '/'); if (s) @@ -948,37 +948,37 @@ if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)) || !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) { - write_c_string (" @", printcharfun); + write_c_string (printcharfun, " @"); if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))) write_fmt_string (printcharfun, "%ld", XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))); else - write_c_string ("??", printcharfun); - write_c_string (",", printcharfun); + write_c_string (printcharfun, "??"); + write_c_string (printcharfun, ","); if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) write_fmt_string (printcharfun, "%ld", XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))); else - write_c_string ("??", printcharfun); + write_c_string (printcharfun, "??"); } if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii)) || !NILP (IMAGE_INSTANCE_PIXMAP_BG (ii))) { - write_c_string (" (", printcharfun); + write_c_string (printcharfun, " ("); if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii))) { print_internal (XCOLOR_INSTANCE (IMAGE_INSTANCE_PIXMAP_FG (ii))->name, printcharfun, 0); } - write_c_string ("/", printcharfun); + write_c_string (printcharfun, "/"); if (!NILP (IMAGE_INSTANCE_PIXMAP_BG (ii))) { print_internal (XCOLOR_INSTANCE (IMAGE_INSTANCE_PIXMAP_BG (ii))->name, printcharfun, 0); } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); } break; @@ -1002,17 +1002,17 @@ are specific to a particular frame so we want to print in their description what that frame is. */ - write_c_string (" on #<", printcharfun); + write_c_string (printcharfun, " on #<"); { struct frame* f = XFRAME (IMAGE_INSTANCE_FRAME (ii)); if (!FRAME_LIVE_P (f)) - write_c_string ("dead", printcharfun); + write_c_string (printcharfun, "dead"); else - write_c_string (DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f))), - printcharfun); + write_c_string (printcharfun, + DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f)))); } - write_c_string ("-frame>", printcharfun); + write_c_string (printcharfun, "-frame>"); write_fmt_string (printcharfun, " 0x%p", IMAGE_INSTANCE_SUBWINDOW_ID (ii)); @@ -1597,6 +1597,15 @@ return XIMAGE_INSTANCE_NAME (image_instance); } +DEFUN ("image-instance-instantiator", Fimage_instance_instantiator, 1, 1, 0, /* +Return the instantiator that was used to create the image instance. +*/ + (image_instance)) +{ + CHECK_IMAGE_INSTANCE (image_instance); + return XIMAGE_INSTANCE_INSTANTIATOR (image_instance); +} + DEFUN ("image-instance-domain", Fimage_instance_domain, 1, 1, 0, /* Return the governing domain of the given image instance. The governing domain of an image instance is the domain that the image @@ -2127,19 +2136,19 @@ /* error helpers */ /************************************************************************/ DOESNT_RETURN -signal_image_error (const CIntbyte *reason, Lisp_Object frob) +signal_image_error (const CIbyte *reason, Lisp_Object frob) { signal_error (Qimage_conversion_error, reason, frob); } DOESNT_RETURN -signal_image_error_2 (const CIntbyte *reason, Lisp_Object frob0, Lisp_Object frob1) +signal_image_error_2 (const CIbyte *reason, Lisp_Object frob0, Lisp_Object frob1) { signal_error_2 (Qimage_conversion_error, reason, frob0, frob1); } DOESNT_RETURN -signal_double_image_error (const CIntbyte *string1, const CIntbyte *string2, +signal_double_image_error (const CIbyte *string1, const CIbyte *string2, Lisp_Object data) { signal_error_1 (Qimage_conversion_error, @@ -2149,7 +2158,7 @@ } DOESNT_RETURN -signal_double_image_error_2 (const CIntbyte *string1, const CIntbyte *string2, +signal_double_image_error_2 (const CIbyte *string1, const CIbyte *string2, Lisp_Object data1, Lisp_Object data2) { signal_error_1 (Qimage_conversion_error, @@ -2280,7 +2289,7 @@ if (height) { /* Compute string metric info */ - find_charsets_in_intbyte_string (charsets, + find_charsets_in_ibyte_string (charsets, XSTRING_DATA (string), XSTRING_LENGTH (string)); @@ -2330,7 +2339,7 @@ Lisp_Object frame = DOMAIN_FRAME (domain); /* Compute string font info */ - find_charsets_in_intbyte_string (charsets, + find_charsets_in_ibyte_string (charsets, XSTRING_DATA (string), XSTRING_LENGTH (string)); @@ -2345,7 +2354,7 @@ if (charsets[i]) { return FACE_CACHEL_FONT (cachel, - CHARSET_BY_LEADING_BYTE (i + + charset_by_leading_byte (i + MIN_LEADING_BYTE)); } @@ -2538,7 +2547,7 @@ if (!NATNUMP (height)) invalid_argument ("Height must be a natural number", height); - if (((XINT (width) * XINT (height)) / 8) > XSTRING_CHAR_LENGTH (bits)) + if (((XINT (width) * XINT (height)) / 8) > string_char_length (bits)) invalid_argument ("data is too short for width and height", vector3 (width, height, bits)); } @@ -3107,8 +3116,8 @@ glyph, so as long as the glyph is marked the instantiator will be as well and hence the cached image instance also.*/ Fputhash (XCAR (XCDR (locative)), XCAR (locative), XCDR (XCDR (locative))); - free_cons (XCONS (XCDR (locative))); - free_cons (XCONS (locative)); + free_cons (XCDR (locative)); + free_cons (locative); return Qnil; } @@ -4587,8 +4596,17 @@ layouts. We are saved by layout optimization, but I'm undecided as to what the correct fix is. */ else if (WIDGET_IMAGE_INSTANCEP (subwindow) - && (!internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (ii), - IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii), 0) + && (!internal_equal_trapping_problems + (Qglyph, "bad subwindow instantiator", + /* in this case we really don't want to be + interrupted by QUIT because we care about + the return value; and we know that any loops + will ultimately cause errors to be issued. + We specify a retval of 1 in that case so that + the glyph code doesn't try to keep reoutputting + a bad subwindow. */ + INHIBIT_QUIT, 0, 1, IMAGE_INSTANCE_WIDGET_ITEMS (ii), + IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii), 0) || !NILP (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii)) || IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (ii))) return 1; @@ -4840,7 +4858,7 @@ } Lisp_Object -display_table_entry (Emchar ch, Lisp_Object face_table, +display_table_entry (Ichar ch, Lisp_Object face_table, Lisp_Object window_table) { Lisp_Object tail; @@ -4871,12 +4889,12 @@ else if (CHAR_TABLEP (table) && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_CHAR) { - return get_char_table (ch, XCHAR_TABLE (table)); + return get_char_table (ch, table); } else if (CHAR_TABLEP (table) && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_GENERIC) { - Lisp_Object gotit = get_char_table (ch, XCHAR_TABLE (table)); + Lisp_Object gotit = get_char_table (ch, table); if (!NILP (gotit)) return gotit; else @@ -5028,6 +5046,7 @@ DEFSUBR (Fimage_instance_type_list); DEFSUBR (Fimage_instance_name); DEFSUBR (Fimage_instance_domain); + DEFSUBR (Fimage_instance_instantiator); DEFSUBR (Fimage_instance_string); DEFSUBR (Fimage_instance_file_name); DEFSUBR (Fimage_instance_mask_file_name); diff --text -u 'xemacs-21.5.6/src/glyphs.h' 'xemacs-21.5.7/src/glyphs.h' Index: ././src/glyphs.h --- ././src/glyphs.h Sun Mar 31 17:28:31 2002 +++ ././src/glyphs.h Fri Jun 21 06:18:35 2002 @@ -1,6 +1,6 @@ /* Generic glyph data structures + display tables Copyright (C) 1994 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996 Ben Wing + Copyright (C) 1995, 1996, 2002 Ben Wing This file is part of XEmacs. @@ -25,7 +25,7 @@ #define INCLUDED_glyphs_h_ #include "specifier.h" -#include "window.h" /* need for GLYPH_CACHEL_WIDTH */ +#include "window-impl.h" /* need for GLYPH_CACHEL_WIDTH */ /************************************************************************/ /* Image Instantiators */ @@ -97,8 +97,9 @@ #define IMAGE_UNSPECIFIED_GEOMETRY -1 #define IMAGE_UNCHANGED_GEOMETRY -2 -#define WIDGET_BORDER_HEIGHT 4 -#define WIDGET_BORDER_WIDTH 4 +#define DEFAULT_WIDGET_BORDER_WIDTH 2 +#define DEFAULT_WIDGET_SPACING 3 +#define DEFAULT_WIDGET_SHADOW_WIDTH 2 enum governing_domain { @@ -329,16 +330,21 @@ #define INSTANTIATOR_TYPE(inst) (XVECTOR_DATA ((inst))[0]) -struct image_instantiator_methods * -decode_device_ii_format (Lisp_Object device, Lisp_Object format, - Error_Behavior errb); -struct image_instantiator_methods * -decode_image_instantiator_format (Lisp_Object format, Error_Behavior errb); +struct image_instantiator_methods *decode_device_ii_format (Lisp_Object device, + Lisp_Object format, + Error_Behavior + errb); +struct image_instantiator_methods *decode_image_instantiator_format + (Lisp_Object format, Error_Behavior errb); void add_entry_to_image_instantiator_format_list (Lisp_Object symbol, - struct image_instantiator_methods *meths); -void add_entry_to_device_ii_format_list (Lisp_Object device, Lisp_Object symbol, - struct image_instantiator_methods *meths); + struct + image_instantiator_methods * + meths); +void add_entry_to_device_ii_format_list (Lisp_Object device, + Lisp_Object symbol, + struct image_instantiator_methods * + meths); Lisp_Object find_keyword_in_vector (Lisp_Object vector, Lisp_Object keyword); Lisp_Object find_keyword_in_vector_or_given (Lisp_Object vector, @@ -593,7 +599,8 @@ unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */ unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */ unsigned int orientation : 1; /* Vertical or horizontal. */ - unsigned int justification : 2; /* Left, right or center. */ + unsigned int h_justification : 2; /* left, right or center. */ + unsigned int v_justification : 2; /* top, bottom or center. */ /* Face for colors and font. We specify this here because we want people to be able to put :face in the instantiator spec. Using glyph-face is more inconvenient, although more @@ -622,7 +629,9 @@ #define LAYOUT_VERTICAL 1 #define LAYOUT_JUSTIFY_LEFT 0 +#define LAYOUT_JUSTIFY_TOP 0 #define LAYOUT_JUSTIFY_RIGHT 1 +#define LAYOUT_JUSTIFY_BOTTOM 1 #define LAYOUT_JUSTIFY_CENTER 2 #define IMAGE_INSTANCE_HASH_DEPTH 0 @@ -714,8 +723,26 @@ ((i)->u.subwindow.h_resize) #define IMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ ((i)->u.subwindow.orientation) -#define IMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ -((i)->u.subwindow.justification) +#define IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) \ +((i)->u.subwindow.h_justification) +#define IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) \ +((i)->u.subwindow.v_justification) +#define IMAGE_INSTANCE_SUBWINDOW_RIGHT_JUSTIFIED(i) \ + (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_RIGHT) +#define IMAGE_INSTANCE_SUBWINDOW_LEFT_JUSTIFIED(i) \ + (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_LEFT) +#define IMAGE_INSTANCE_SUBWINDOW_TOP_JUSTIFIED(i) \ + (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_TOP) +#define IMAGE_INSTANCE_SUBWINDOW_BOTTOM_JUSTIFIED(i) \ + (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_BOTTOM) +#define IMAGE_INSTANCE_SUBWINDOW_H_CENTERED(i) \ + (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER) +#define IMAGE_INSTANCE_SUBWINDOW_V_CENTERED(i) \ + (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER) +#define IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT(i) \ + (IMAGE_INSTANCE_SUBWINDOW_ORIENT (i) \ + == LAYOUT_VERTICAL && !IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (i)) + #define IMAGE_INSTANCE_SUBWINDOW_FACE(i) \ ((i)->u.subwindow.face) @@ -1059,28 +1086,30 @@ #ifdef ERROR_CHECK_GLYPHS -INLINE_HEADER int -GLYPH_CACHEL_WIDTH (struct window *window, int ind); -INLINE_HEADER int +DECLARE_INLINE_HEADER ( +int GLYPH_CACHEL_WIDTH (struct window *window, int ind) +) { int wid = Dynarr_atp (window->glyph_cachels, ind)->width; assert (wid >= 0 && wid < 10000); return wid; } -INLINE_HEADER int -GLYPH_CACHEL_ASCENT (struct window *window, int ind); -INLINE_HEADER int + +DECLARE_INLINE_HEADER ( +int GLYPH_CACHEL_ASCENT (struct window *window, int ind) +) { int wid = Dynarr_atp (window->glyph_cachels, ind)->ascent; assert (wid >= 0 && wid < 10000); return wid; } -INLINE_HEADER int -GLYPH_CACHEL_DESCENT (struct window *window, int ind); -INLINE_HEADER int + +DECLARE_INLINE_HEADER ( +int GLYPH_CACHEL_DESCENT (struct window *window, int ind) +) { int wid = Dynarr_atp (window->glyph_cachels, ind)->descent; assert (wid >= 0 && wid < 10000); @@ -1120,7 +1149,7 @@ /* Display Tables */ /************************************************************************/ -Lisp_Object display_table_entry (Emchar, Lisp_Object, Lisp_Object); +Lisp_Object display_table_entry (Ichar, Lisp_Object, Lisp_Object); void get_display_tables (struct window *, face_index, Lisp_Object *, Lisp_Object *); @@ -1153,5 +1182,7 @@ int check_for_ignored_expose (struct frame* f, int x, int y, int width, int height); extern int hold_ignored_expose_registration; + +#define ROUND_UP(arg, unit) (((int)((arg) + (unit) - 1) / (int)(unit)) * (int)(unit)) #endif /* INCLUDED_glyphs_h_ */ diff --text -u 'xemacs-21.5.6/src/gpmevent.c' 'xemacs-21.5.7/src/gpmevent.c' Index: ././src/gpmevent.c --- ././src/gpmevent.c Fri Mar 29 13:47:52 2002 +++ ././src/gpmevent.c Sun Jun 23 18:25:12 2002 @@ -35,6 +35,10 @@ #include "lstream.h" #include "process.h" #include "sysdep.h" +#include "frame.h" +#include "device-impl.h" +#include "console-impl.h" +#include "console-tty-impl.h" #include "sysproc.h" /* for MAXDESC */ @@ -94,8 +98,8 @@ static int get_process_infd (Lisp_Process *p) { - Lisp_Object instr, outstr; - get_process_streams (p, &instr, &outstr); + Lisp_Object instr, outstr, errstr; + get_process_streams (p, &instr, &outstr, &errstr); assert (!NILP (instr)); return filedesc_stream_fd (XLSTREAM (instr)); } @@ -261,7 +265,7 @@ while (1) { - Intbyte tempbuf[1024]; /* some random amount */ + Ibyte tempbuf[1024]; /* some random amount */ Bytecount i; Bytecount size_in_bytes = Lstream_read (XLSTREAM (terminal_stream), @@ -588,7 +592,7 @@ rval = 0; Fprocess_kill_without_query (gpm_process, Qnil); gpm_filter = wrap_subr (&SFreceive_gpm_event); - set_process_filter (gpm_process, gpm_filter, 1); + set_process_filter (gpm_process, gpm_filter, 1, 0); /* Keep track of the device for later */ /* Fput (gpm_process, intern ("gpm-device"), device); */ diff --text -u 'xemacs-21.5.6/src/gtk-glue.c' 'xemacs-21.5.7/src/gtk-glue.c' Index: ././src/gtk-glue.c --- ././src/gtk-glue.c Sat Mar 16 19:39:17 2002 +++ ././src/gtk-glue.c Sun Jun 23 18:25:12 2002 @@ -7,6 +7,8 @@ GtkType GTK_TYPE_OBJECT_LIST = 0; GtkType GTK_TYPE_GDK_GC = 0; +#include "objects-gtk-impl.h" + static GtkType xemacs_type_register (gchar *name, GtkType parent) { diff --text -u 'xemacs-21.5.6/src/gtk-xemacs.c' 'xemacs-21.5.7/src/gtk-xemacs.c' Index: ././src/gtk-xemacs.c --- ././src/gtk-xemacs.c Fri Mar 29 13:47:53 2002 +++ ././src/gtk-xemacs.c Sun Jun 23 18:25:12 2002 @@ -13,9 +13,14 @@ #include "console-gtk.h" #include "objects-gtk.h" #include "gtk-xemacs.h" +#include "device.h" +#include "glyphs.h" #include "window.h" #include "faces.h" #include "event-gtk.h" +#include "frame-impl.h" +#include "console-gtk-impl.h" +#include "device-impl.h" extern Lisp_Object Vmodeline_face; extern Lisp_Object Vscrollbar_on_left_p; diff --text -u 'xemacs-21.5.6/src/gui-gtk.c' 'xemacs-21.5.7/src/gui-gtk.c' Index: ././src/gui-gtk.c --- ././src/gui-gtk.c Thu May 24 16:51:19 2001 +++ ././src/gui-gtk.c Fri Jun 21 06:18:35 2002 @@ -1,6 +1,6 @@ /* General GUI code -- X-specific. (menubars, scrollbars, toolbars, dialogs) Copyright (C) 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. Copyright (C) 1995 Sun Microsystems, Inc. Copyright (C) 1998 Free Software Foundation, Inc. @@ -26,13 +26,14 @@ #include #include "lisp.h" -#include "console-gtk.h" -#include "gui-gtk.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "frame.h" #include "gui.h" #include "opaque.h" + +#include "console-gtk-impl.h" +#include "gui-gtk.h" #ifdef HAVE_POPUPS Lisp_Object Qmenu_no_selection_hook; diff --text -u 'xemacs-21.5.6/src/gui-msw.c' 'xemacs-21.5.7/src/gui-msw.c' Index: ././src/gui-msw.c --- ././src/gui-msw.c Fri Mar 29 13:47:53 2002 +++ ././src/gui-msw.c Fri Jun 21 06:18:35 2002 @@ -25,11 +25,11 @@ #include #include "lisp.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "redisplay.h" #include "gui.h" #include "glyphs.h" -#include "frame.h" +#include "frame-impl.h" #include "elhash.h" #include "events.h" #include "buffer.h" @@ -48,10 +48,7 @@ frame = wrap_frame (f); - /* #### make_int should assert that --kkm */ - assert (XINT (make_int (id)) == id); - - image_instance = Fgethash (make_int (id), + image_instance = Fgethash (make_int_verify (id), FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil); /* It is possible for a widget action to cause it to get out of sync with its instantiator. Thus it is necessary to signal this diff --text -u 'xemacs-21.5.6/src/gui-x.c' 'xemacs-21.5.7/src/gui-x.c' Index: ././src/gui-x.c --- ././src/gui-x.c Fri Mar 29 13:47:54 2002 +++ ././src/gui-x.c Fri Jun 21 06:18:35 2002 @@ -28,19 +28,22 @@ #include #include "lisp.h" -#include "console-x.h" -#ifdef LWLIB_USES_MOTIF -#include /* for XmVersion */ -#endif -#include "gui-x.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "frame.h" -#include "gui.h" #include "glyphs.h" -#include "redisplay.h" +#include "gui.h" +#include "menubar.h" #include "opaque.h" +#include "redisplay.h" + +#include "console-x-impl.h" +#include "gui-x.h" + +#ifdef LWLIB_USES_MOTIF +#include /* for XmVersion */ +#endif /* we need a unique id for each popup menu, dialog box, and scrollbar */ static LWLIB_ID lwlib_id_tick; @@ -66,13 +69,13 @@ Lisp_Object markee; if (val->call_data) { - VOID_TO_LISP (markee, val->call_data); + markee = VOID_TO_LISP (val->call_data); mark_object (markee); } if (val->accel) { - VOID_TO_LISP (markee, val->accel); + markee = VOID_TO_LISP (val->accel); mark_object (markee); } return 0; @@ -219,15 +222,17 @@ struct device *d = get_device_from_display (XtDisplay (widget)); struct frame *f = x_any_widget_or_parent_to_frame (d, widget); +#ifdef HAVE_MENUBARS /* set in lwlib to the time stamp associated with the most recent menu operation */ extern Time x_focus_timestamp_really_sucks_fix_me_better; +#endif if (!f) return; if (((EMACS_INT) client_data) == 0) return; - VOID_TO_LISP (data, client_data); + data = VOID_TO_LISP (client_data); frame = wrap_frame (f); #if 0 @@ -291,7 +296,7 @@ /* This is the timestamp used for asserting focus so we need to get an up-to-date value event if no events have been dispatched to emacs */ -#if defined(HAVE_MENUBARS) +#ifdef HAVE_MENUBARS DEVICE_X_MOUSE_TIMESTAMP (d) = x_focus_timestamp_really_sucks_fix_me_better; #else DEVICE_X_MOUSE_TIMESTAMP (d) = DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (d); @@ -319,10 +324,10 @@ #endif Extbyte * -menu_separator_style_and_to_external (const Intbyte *s) +menu_separator_style_and_to_external (const Ibyte *s) { - const Intbyte *p; - Intbyte first; + const Ibyte *p; + Ibyte first; if (!s || s[0] == '\0') return NULL; @@ -358,7 +363,7 @@ int i; int found_accel = 0; Extbyte *retval; - Intbyte *name = XSTRING_DATA (string); + Ibyte *name = XSTRING_DATA (string); for (i = 0; name[i]; ++i) if (name[i] == '%' && name[i+1] == '_') @@ -372,7 +377,7 @@ else { Bytecount namelen = XSTRING_LENGTH (string); - Intbyte *chars = (Intbyte *) alloca (namelen + 3); + Ibyte *chars = (Ibyte *) ALLOCA (namelen + 3); chars[0] = '%'; chars[1] = '_'; memcpy (chars + 2, name, namelen + 1); @@ -382,16 +387,15 @@ return retval; } -/* This does the dirty work. begin_gc_forbidden() is active when this is - called. */ +/* This does the dirty work. GC is inhibited when this is called. + */ int button_item_to_widget_value (Lisp_Object gui_object_instance, Lisp_Object gui_item, widget_value *wv, int allow_text_field_p, int no_keys_p, int menu_entry_p, int accel_p) { - /* This function cannot GC because begin_gc_forbidden() is active when - it's called. */ + /* This function cannot GC because GC is inhibited when it's called */ Lisp_Gui_Item* pgui = 0; /* degenerate case */ @@ -489,7 +493,7 @@ CHECK_SYMBOL (pgui->style); if (NILP (pgui->style)) { - Intbyte *intname; + Ibyte *intname; Bytecount intlen; /* If the callback is nil, treat this item like unselectable text. This way, dashes will show up as a separator. */ diff --text -u 'xemacs-21.5.6/src/gui-x.h' 'xemacs-21.5.7/src/gui-x.h' Index: ././src/gui-x.h --- ././src/gui-x.h Fri Mar 29 13:47:54 2002 +++ ././src/gui-x.h Wed Jun 5 18:56:01 2002 @@ -77,7 +77,7 @@ int menu_entry_p, int accel_p); widget_value * gui_items_to_widget_values (Lisp_Object gui_object_instance, Lisp_Object items, int accel_p); -Extbyte *menu_separator_style_and_to_external (const Intbyte *s); +Extbyte *menu_separator_style_and_to_external (const Ibyte *s); Lisp_Object widget_value_unwind (Lisp_Object closure); #endif /* INCLUDED_gui_x_h_ */ diff --text -u 'xemacs-21.5.6/src/gui.c' 'xemacs-21.5.7/src/gui.c' Index: ././src/gui.c --- ././src/gui.c Fri Mar 29 13:47:55 2002 +++ ././src/gui.c Fri Jun 21 06:18:35 2002 @@ -27,10 +27,12 @@ #include #include "lisp.h" -#include "gui.h" -#include "elhash.h" + #include "buffer.h" #include "bytecode.h" +#include "elhash.h" +#include "gui.h" +#include "menubar.h" Lisp_Object Qmenu_no_selection_hook; Lisp_Object Vmenu_no_selection_hook; @@ -56,10 +58,10 @@ #endif /* HAVE_POPUPS */ int -separator_string_p (const Intbyte *s) +separator_string_p (const Ibyte *s) { - const Intbyte *p; - Intbyte first; + const Ibyte *p; + Ibyte first; if (!s || s[0] == '\0') return 0; @@ -410,7 +412,7 @@ Lisp_Object gui_name_accelerator (Lisp_Object nm) { - Intbyte *name = XSTRING_DATA (nm); + Ibyte *name = XSTRING_DATA (nm); while (*name) { @@ -421,13 +423,13 @@ return Qnil; if (*name == '_' && *(name + 1)) { - Emchar accelerator = charptr_emchar (name + 1); + Ichar accelerator = itext_ichar (name + 1); return make_char (DOWNCASE (0, accelerator)); } } - INC_CHARPTR (name); + INC_IBYTEPTR (name); } - return make_char (DOWNCASE (0, charptr_emchar (XSTRING_DATA (nm)))); + return make_char (DOWNCASE (0, itext_ichar (XSTRING_DATA (nm)))); } /* @@ -594,8 +596,7 @@ { int hashid = gui_item_hash (gitem, 0); int id = GUI_ITEM_ID_BITS (hashid, slot); - while (!NILP (Fgethash (make_int (id), - hashtable, Qnil))) + while (!UNBOUNDP (Fgethash (make_int (id), hashtable, Qunbound))) { id = GUI_ITEM_ID_BITS (id + 1, slot); } diff --text -u 'xemacs-21.5.6/src/gui.h' 'xemacs-21.5.7/src/gui.h' Index: ././src/gui.h --- ././src/gui.h Fri Mar 29 13:47:55 2002 +++ ././src/gui.h Wed Jun 5 18:56:03 2002 @@ -1,6 +1,6 @@ /* Generic GUI code. (menubars, scrollbars, toolbars, dialogs) Copyright (C) 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. Copyright (C) 1995 Sun Microsystems, Inc. This file is part of XEmacs. @@ -27,7 +27,7 @@ #ifndef INCLUDED_gui_h_ #define INCLUDED_gui_h_ -int separator_string_p (const Intbyte *s); +int separator_string_p (const Ibyte *s); void get_gui_callback (Lisp_Object, Lisp_Object *, Lisp_Object *); int gui_item_equal_sans_selected (Lisp_Object obj1, Lisp_Object obj2, int depth); diff --text -u 'xemacs-21.5.6/src/gutter.c' 'xemacs-21.5.7/src/gutter.c' Index: ././src/gutter.c --- ././src/gutter.c Mon Apr 1 12:58:40 2002 +++ ././src/gutter.c Fri Jun 21 06:18:35 2002 @@ -27,8 +27,8 @@ #include "lisp.h" #include "buffer.h" -#include "frame.h" -#include "device.h" +#include "frame-impl.h" +#include "device-impl.h" #include "faces.h" #include "glyphs.h" #include "redisplay.h" @@ -690,16 +690,17 @@ int height) { enum gutter_pos pos; + int depth; /* We have to be "in display" when we output the gutter - make it so. */ - hold_frame_size_changes (); + depth = enter_redisplay_critical_section (); GUTTER_POS_LOOP (pos) { if (FRAME_GUTTER_VISIBLE (f, pos)) redraw_exposed_gutter (f, pos, x, y, width, height); } - unhold_one_frame_size_changes (f); + exit_redisplay_critical_section (depth); } void @@ -745,11 +746,13 @@ if (cur != new) { + int depth; + /* The following calls will automatically cause the dirty flags to be set; we delay frame size changes to avoid lots of frame flickering. */ /* #### I think this should be GC protected. -sb */ - hold_frame_size_changes (); + depth = enter_redisplay_critical_section (); set_specifier_fallback (Vgutter[cur], list1 (Fcons (Qnil, Qnil))); set_specifier_fallback (Vgutter[new], Vdefault_gutter); set_specifier_fallback (Vgutter_size[cur], list1 (Fcons (Qnil, Qzero))); @@ -765,7 +768,7 @@ set_specifier_fallback (Vgutter_visible_p[new], Vdefault_gutter_visible_p); Vdefault_gutter_position = position; - unhold_frame_size_changes (); + exit_redisplay_critical_section (depth); } run_hook (Qdefault_gutter_position_changed_hook); @@ -1079,11 +1082,13 @@ redisplay_frame (f, 1); else if (FRAME_REPAINT_P (f)) { + int depth; + /* We have to be "in display" when we output the gutter - make it so. */ - hold_frame_size_changes (); + depth = enter_redisplay_critical_section (); update_frame_gutters (f); - unhold_one_frame_size_changes (f); + exit_redisplay_critical_section (depth); } MAYBE_DEVMETH (d, frame_output_end, (f)); diff --text -u 'xemacs-21.5.6/src/gutter.h' 'xemacs-21.5.7/src/gutter.h' Index: ././src/gutter.h --- ././src/gutter.h Fri Mar 29 13:47:56 2002 +++ ././src/gutter.h Sun May 5 20:31:45 2002 @@ -46,7 +46,7 @@ /* Iterate over all possible gutter positions */ #define GUTTER_POS_LOOP(var) \ -for (var = (enum gutter_pos) 0; var < 4; var = (enum gutter_pos) (var + 1)) + for (var = (enum gutter_pos) 0; var < 4; var = (enum gutter_pos) (var + 1)) extern Lisp_Object Qgutter; diff --text -u 'xemacs-21.5.6/src/hash.h' 'xemacs-21.5.7/src/hash.h' Index: ././src/hash.h --- ././src/hash.h Thu Sep 20 15:29:03 2001 +++ ././src/hash.h Sun May 5 20:31:46 2002 @@ -44,10 +44,11 @@ automatically if the number of entries approaches the size */ struct hash_table *make_hash_table (Elemcount size); -struct hash_table * -make_general_hash_table (Elemcount size, - hash_table_hash_function hash_function, - hash_table_test_function test_function); +struct hash_table *make_general_hash_table (Elemcount size, + hash_table_hash_function + hash_function, + hash_table_test_function + test_function); /* Clear HASH-TABLE. A freshly created hash table is already cleared up. */ void clrhash (struct hash_table *hash_table); diff --text -u 'xemacs-21.5.6/src/hpplay.c' 'xemacs-21.5.7/src/hpplay.c' Index: ././src/hpplay.c --- ././src/hpplay.c Wed Mar 13 17:52:48 2002 +++ ././src/hpplay.c Wed Jun 5 18:56:04 2002 @@ -75,7 +75,7 @@ player_error_internal (Audio * audio, Char_ASCII * text, long errorCode) { Extbyte errorbuff[132]; - Intbyte *interr; + Ibyte *interr; AGetErrorText (audio, errorCode, errorbuff, 131); EXTERNAL_TO_C_STRING (errorbuf, interr, Qnative); diff --text -u 'xemacs-21.5.6/src/indent.c' 'xemacs-21.5.7/src/indent.c' Index: ././src/indent.c --- ././src/indent.c Fri Mar 29 13:47:57 2002 +++ ././src/indent.c Wed Jun 5 18:56:05 2002 @@ -1,8 +1,8 @@ /* Indentation functions. Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993, 1994, 1995 - Copyright (C) 2002 Ben Wing. Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -132,7 +132,7 @@ int tab_width = XINT (buf->tab_width); int post_tab; Charbpos pos = init_pos; - Emchar c; + Ichar c; if (tab_width <= 0 || tab_width > 1000) tab_width = 8; col = tab_seen = post_tab = 0; @@ -170,7 +170,7 @@ + displayed_glyphs->end_columns)); #else /* XEmacs */ #ifdef MULE - col += XCHARSET_COLUMNS (CHAR_CHARSET (c)); + col += XCHARSET_COLUMNS (ichar_charset (c)); #else col ++; #endif /* MULE */ @@ -202,7 +202,7 @@ int tab_seen; int post_tab; Charbpos pos = init_pos; - Emchar c; + Ichar c; if (tab_width <= 0 || tab_width > 1000) tab_width = 8; col = tab_seen = post_tab = 0; @@ -213,7 +213,7 @@ break; pos--; - c = XSTRING_CHAR (s, pos); + c = string_ichar (s, pos); if (c == '\t') { if (tab_seen) @@ -227,7 +227,7 @@ break; else #ifdef MULE - col += XCHARSET_COLUMNS (CHAR_CHARSET (c)); + col += XCHARSET_COLUMNS (ichar_charset (c)); #else col ++; #endif /* MULE */ @@ -341,22 +341,22 @@ } int -bi_spaces_at_point (struct buffer *b, Bytebpos bi_pos) +byte_spaces_at_point (struct buffer *b, Bytebpos byte_pos) { - Bytebpos bi_end = BI_BUF_ZV (b); + Bytebpos byte_end = BYTE_BUF_ZV (b); int col = 0; - Emchar c; + Ichar c; int tab_width = XINT (b->tab_width); if (tab_width <= 0 || tab_width > 1000) tab_width = 8; - while (bi_pos < bi_end && - (c = BI_BUF_FETCH_CHAR (b, bi_pos), + while (byte_pos < byte_end && + (c = BYTE_BUF_FETCH_CHAR (b, byte_pos), (c == '\t' ? (col += tab_width - col % tab_width) : (c == ' ' ? ++col : 0)))) - INC_BYTEBPOS (b, bi_pos); + INC_BYTEBPOS (b, byte_pos); return col; } @@ -377,7 +377,7 @@ if (!NILP (Fextent_at (make_int (pos), buffer, Qinvisible, Qnil, Qnil))) return Qzero; - return make_int (bi_spaces_at_point (buf, charbpos_to_bytebpos (buf, pos))); + return make_int (byte_spaces_at_point (buf, charbpos_to_bytebpos (buf, pos))); } @@ -410,7 +410,7 @@ int tab_width = XINT (buf->tab_width); int prev_col = 0; - Emchar c = 0; + Ichar c = 0; buffer = wrap_buffer (buf); if (tab_width <= 0 || tab_width > 1000) tab_width = 8; @@ -457,7 +457,7 @@ + displayed_glyphs->end_columns)); #else /* XEmacs */ #ifdef MULE - col += XCHARSET_COLUMNS (CHAR_CHARSET (c)); + col += XCHARSET_COLUMNS (ichar_charset (c)); #else col ++; #endif /* MULE */ @@ -497,7 +497,7 @@ #if 0 /* #### OK boys, this function needs to be present, I think. It was there before the 19.12 redisplay rewrite. */ -xxDEFUN ("compute-motion", Fcompute_motion, 7, 7, 0, /* +DEFUN ("compute-motion", Fcompute_motion, 7, 7, 0, /* "Scan through the current buffer, calculating screen position. Scan the current buffer forward from offset FROM, assuming it is at position FROMPOS--a cons of the form (HPOS . VPOS)-- diff --text -u 'xemacs-21.5.6/src/inline.c' 'xemacs-21.5.7/src/inline.c' Index: ././src/inline.c --- ././src/inline.c Wed Mar 13 17:52:48 2002 +++ ././src/inline.c Fri Jun 28 07:50:29 2002 @@ -42,22 +42,24 @@ #include #include "lisp.h" + +#include "sysfile.h" + #include "buffer.h" #include "bytecode.h" #include "casetab.h" #include "chartab.h" -#include "console.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "events.h" -#include "extents.h" +#include "extents-impl.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "gui.h" #include "keymap.h" #include "lstream.h" -#include "objects.h" +#include "objects-impl.h" #include "opaque.h" #include "process.h" #include "rangetab.h" diff --text -u 'xemacs-21.5.6/src/input-method-xlib.c' 'xemacs-21.5.7/src/input-method-xlib.c' Index: ././src/input-method-xlib.c --- ././src/input-method-xlib.c Fri Mar 29 13:47:57 2002 +++ ././src/input-method-xlib.c Fri Jun 21 06:18:35 2002 @@ -71,15 +71,18 @@ #include #include "lisp.h" -#include /* More portable than ? */ -#include -#include "frame.h" -#include "device.h" -#include "window.h" + #include "buffer.h" -#include "console-x.h" -#include "EmacsFrame.h" +#include "device-impl.h" #include "events.h" +#include "frame-impl.h" +#include "window-impl.h" + +#include "console-x-impl.h" +#include "EmacsFrame.h" + +#include /* More portable than ? */ +#include #if !defined (XIM_XLIB) && !defined (USE_XFONTSET) #error neither XIM_XLIB nor USE_XFONTSET is defined?? @@ -655,7 +658,7 @@ if (p->count_styles == 0) { /* No valid styles? */ - char *buf = (char *)alloca (strlen (fromVal->addr) + char *buf = (char *)ALLOCA (strlen (fromVal->addr) + strlen (DefaultXIMStyles) + 100); XrmValue new_from; diff --text -u 'xemacs-21.5.6/src/insdel.c' 'xemacs-21.5.7/src/insdel.c' Index: ././src/insdel.c --- ././src/insdel.c Sun Mar 31 17:28:32 2002 +++ ././src/insdel.c Wed Jun 5 18:56:07 2002 @@ -25,7 +25,13 @@ /* This file has been Mule-ized. */ -/* Overhauled by Ben Wing, December 1994, for Mule implementation. */ +/* Original file from FSF, 1991. + Some changes for extents, c. 1991 by unknown Lucid author. + Completely rewritten December 1994, for Mule implementation by Ben Wing; + all buffer modification code ripped out of other files and consolidated + here. + Indirect buffers written c. 1997? by Hrvoje Niksic. +*/ #include #include "lisp.h" @@ -60,11 +66,11 @@ do { (buf)->text->end_gap_size = (value); } while (0) /* Gap location. */ -#define BI_BUF_GPT(buf) ((buf)->text->gpt + 0) -#define BUF_GPT_ADDR(buf) (BUF_BEG_ADDR (buf) + BI_BUF_GPT (buf) - 1) +#define BYTE_BUF_GPT(buf) ((buf)->text->gpt + 0) +#define BUF_GPT_ADDR(buf) (BUF_BEG_ADDR (buf) + BYTE_BUF_GPT (buf) - 1) /* Set gap location. */ -#define SET_BI_BUF_GPT(buf, value) do { (buf)->text->gpt = (value); } while (0) +#define SET_BYTE_BUF_GPT(buf, value) do { (buf)->text->gpt = (value); } while (0) /* Set end of buffer. */ #define SET_BOTH_BUF_Z(buf, val, bival) \ @@ -95,7 +101,7 @@ # define SET_GAP_SENTINEL(buf) (*BUF_GPT_ADDR (buf) = 0) # define BUF_END_SENTINEL_SIZE 1 # define SET_END_SENTINEL(buf) \ - (*(BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + BI_BUF_Z (buf) - 1) = 0) + (*(BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + BYTE_BUF_Z (buf) - 1) = 0) #else # define GAP_CAN_HOLD_SIZE_P(buf, len) (BUF_GAP_SIZE (buf) >= (len)) # define SET_GAP_SENTINEL(buf) @@ -137,8 +143,8 @@ void set_buffer_point (struct buffer *buf, Charbpos charbpos, Bytebpos bytpos) { - assert (bytpos >= BI_BUF_BEGV (buf) && bytpos <= BI_BUF_ZV (buf)); - if (bytpos == BI_BUF_PT (buf)) + assert (bytpos >= BYTE_BUF_BEGV (buf) && bytpos <= BYTE_BUF_ZV (buf)); + if (bytpos == BYTE_BUF_PT (buf)) return; JUST_SET_POINT (buf, charbpos, bytpos); MARK_POINT_CHANGED; @@ -253,7 +259,7 @@ static void gap_left (struct buffer *buf, Bytebpos pos) { - Intbyte *to, *from; + Ibyte *to, *from; Bytecount i; Bytebpos new_s1; struct buffer *mbuf; @@ -261,7 +267,7 @@ from = BUF_GPT_ADDR (buf); to = from + BUF_GAP_SIZE (buf); - new_s1 = BI_BUF_GPT (buf); + new_s1 = BYTE_BUF_GPT (buf); /* Now copy the characters. To move the gap down, copy characters up. */ @@ -303,14 +309,14 @@ or may be where a quit was detected. */ MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - adjust_markers (mbuf, pos, BI_BUF_GPT (mbuf), BUF_GAP_SIZE (mbuf)); + adjust_markers (mbuf, pos, BYTE_BUF_GPT (mbuf), BUF_GAP_SIZE (mbuf)); } MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - adjust_extents (wrap_buffer (mbuf), pos, BI_BUF_GPT (mbuf), + adjust_extents (wrap_buffer (mbuf), pos, BYTE_BUF_GPT (mbuf), BUF_GAP_SIZE (mbuf)); } - SET_BI_BUF_GPT (buf, pos); + SET_BYTE_BUF_GPT (buf, pos); SET_GAP_SENTINEL (buf); #ifdef ERROR_CHECK_EXTENTS MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) @@ -324,7 +330,7 @@ static void gap_right (struct buffer *buf, Bytebpos pos) { - Intbyte *to, *from; + Ibyte *to, *from; Bytecount i; Bytebpos new_s1; struct buffer *mbuf; @@ -332,7 +338,7 @@ to = BUF_GPT_ADDR (buf); from = to + BUF_GAP_SIZE (buf); - new_s1 = BI_BUF_GPT (buf); + new_s1 = BYTE_BUF_GPT (buf); /* Now copy the characters. To move the gap up, copy characters down. */ @@ -373,14 +379,14 @@ int gsize = BUF_GAP_SIZE (buf); MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - adjust_markers (mbuf, BI_BUF_GPT (mbuf) + gsize, pos + gsize, - gsize); + adjust_markers (mbuf, BYTE_BUF_GPT (mbuf) + gsize, pos + gsize, - gsize); } MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - adjust_extents (wrap_buffer (mbuf), BI_BUF_GPT (mbuf) + gsize, + adjust_extents (wrap_buffer (mbuf), BYTE_BUF_GPT (mbuf) + gsize, pos + gsize, - gsize); } - SET_BI_BUF_GPT (buf, pos); + SET_BYTE_BUF_GPT (buf, pos); SET_GAP_SENTINEL (buf); #ifdef ERROR_CHECK_EXTENTS MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) @@ -389,7 +395,7 @@ } #endif } - if (pos == BI_BUF_Z (buf)) + if (pos == BYTE_BUF_Z (buf)) { /* merge gap with end gap */ @@ -409,9 +415,9 @@ { if (! BUF_BEG_ADDR (buf)) abort (); - if (pos < BI_BUF_GPT (buf)) + if (pos < BYTE_BUF_GPT (buf)) gap_left (buf, pos); - else if (pos > BI_BUF_GPT (buf)) + else if (pos > BYTE_BUF_GPT (buf)) gap_right (buf, pos); } @@ -434,11 +440,11 @@ tem = Vinhibit_quit; Vinhibit_quit = Qt; - real_gap_loc = BI_BUF_GPT (buf); + real_gap_loc = BYTE_BUF_GPT (buf); old_gap_size = BUF_GAP_SIZE (buf); /* Pretend the end gap is the gap */ - SET_BI_BUF_GPT (buf, BI_BUF_Z (buf) + BUF_GAP_SIZE (buf)); + SET_BYTE_BUF_GPT (buf, BYTE_BUF_Z (buf) + BUF_GAP_SIZE (buf)); SET_BUF_GAP_SIZE (buf, increment); /* Move the new gap down to be consecutive with the end of the old one. @@ -447,7 +453,7 @@ /* Now combine the two into one large gap. */ SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) + old_gap_size); - SET_BI_BUF_GPT (buf, real_gap_loc); + SET_BYTE_BUF_GPT (buf, real_gap_loc); SET_GAP_SENTINEL (buf); /* We changed the total size of the buffer (including gap), @@ -463,14 +469,18 @@ static void make_gap (struct buffer *buf, Bytecount increment) { - Intbyte *result; + Ibyte *result; Lisp_Object tem; Bytebpos real_gap_loc; Bytecount old_gap_size; /* If we have to get more space, get enough to last a while. We use a geometric progression that saves on realloc space. */ - increment += 2000 + ((BI_BUF_Z (buf) - BI_BUF_BEG (buf)) / 8); + increment += 2000 + ((BYTE_BUF_Z (buf) - BYTE_BUF_BEG (buf)) / 8); + /* Make sure the gap is always aligned properly in case we're using a + 16-bit or 32-bit fixed-width format. (Other sizes should already be + aligned in such a case.) */ + increment = MAX_ALIGN_SIZE (increment); if (increment > BUF_END_GAP_SIZE (buf)) { @@ -483,7 +493,7 @@ out_of_memory ("Maximum buffer size exceeded", Qunbound); result = BUFFER_REALLOC (buf->text->beg, - BI_BUF_Z (buf) - BI_BUF_BEG (buf) + + BYTE_BUF_Z (buf) - BYTE_BUF_BEG (buf) + BUF_GAP_SIZE (buf) + increment + BUF_END_SENTINEL_SIZE); if (result == 0) @@ -498,11 +508,11 @@ tem = Vinhibit_quit; Vinhibit_quit = Qt; - real_gap_loc = BI_BUF_GPT (buf); + real_gap_loc = BYTE_BUF_GPT (buf); old_gap_size = BUF_GAP_SIZE (buf); /* Call the newly allocated space a gap at the end of the whole space. */ - SET_BI_BUF_GPT (buf, BI_BUF_Z (buf) + BUF_GAP_SIZE (buf)); + SET_BYTE_BUF_GPT (buf, BYTE_BUF_Z (buf) + BUF_GAP_SIZE (buf)); SET_BUF_GAP_SIZE (buf, increment); SET_BUF_END_GAP_SIZE (buf, 0); @@ -513,7 +523,7 @@ /* Now combine the two into one large gap. */ SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) + old_gap_size); - SET_BI_BUF_GPT (buf, real_gap_loc); + SET_BYTE_BUF_GPT (buf, real_gap_loc); SET_GAP_SENTINEL (buf); /* We changed the total size of the buffer (including gap), @@ -725,7 +735,9 @@ record_unwind_protect (first_change_hook_restore, buffer); set_buffer_internal (buf); in_first_change = 1; - run_hook (Qfirst_change_hook); + run_hook_trapping_problems + (0, Qfirst_change_hook, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); unbind_to (speccount); } } @@ -794,11 +806,15 @@ || !NILP (symbol_value_in_buffer (Qbefore_change_function, buffer))) { set_buffer_internal (buf); - va_run_hook_with_args (Qbefore_change_functions, 2, - make_int (start), make_int (end)); + va_run_hook_with_args_trapping_problems + (0, Qbefore_change_functions, 2, + make_int (start), make_int (end), + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); /* Obsolete, for compatibility */ - va_run_hook_with_args (Qbefore_change_function, 2, - make_int (start), make_int (end)); + va_run_hook_with_args_trapping_problems + (0, Qbefore_change_function, 2, + make_int (start), make_int (end), + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); } } @@ -811,8 +827,7 @@ MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - buffer = wrap_buffer (mbuf); - report_extent_modification (buffer, start, end, 0); + report_extent_modification (wrap_buffer (mbuf), start, end, 0); } unbind_to (speccount); @@ -841,12 +856,14 @@ /* always do this. */ buffer_signal_changed_region (mbuf, start, new_end); } +#ifdef USE_C_FONT_LOCK MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { /* #### This seems inefficient. Wouldn't it be better to just keep one cache per base buffer? */ font_lock_maybe_update_syntactic_caches (mbuf, start, orig_end, new_end); } +#endif /* USE_C_FONT_LOCK */ if (!inside_change_hook) { @@ -878,13 +895,17 @@ set_buffer_internal (buf); /* The actual after-change functions take slightly different arguments than what we were passed. */ - va_run_hook_with_args (Qafter_change_functions, 3, - make_int (start), make_int (new_end), - make_int (orig_end - start)); + va_run_hook_with_args_trapping_problems + (0, Qafter_change_functions, 3, + make_int (start), make_int (new_end), + make_int (orig_end - start), + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); /* Obsolete, for compatibility */ - va_run_hook_with_args (Qafter_change_function, 3, - make_int (start), make_int (new_end), - make_int (orig_end - start)); + va_run_hook_with_args_trapping_problems + (0, Qafter_change_function, 3, + make_int (start), make_int (new_end), + make_int (orig_end - start), + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); } } @@ -925,6 +946,8 @@ MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { + check_allowed_operation (OPERATION_MODIFY_BUFFER_TEXT, + wrap_buffer (mbuf), Qnil); barf_if_buffer_read_only (mbuf, start, end); } @@ -982,7 +1005,7 @@ /************************************************************************/ void -fixup_internal_substring (const Intbyte *nonreloc, Lisp_Object reloc, +fixup_internal_substring (const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount *len) { assert ((nonreloc && NILP (reloc)) || (!nonreloc && STRINGP (reloc))); @@ -1024,13 +1047,14 @@ Charcount buffer_insert_string_1 (struct buffer *buf, Charbpos pos, - const Intbyte *nonreloc, Lisp_Object reloc, + const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length, int flags) { /* This function can GC */ struct gcpro gcpro1; - Bytebpos ind; + Bytebpos bytepos; + Bytecount length_in_buffer; Charcount cclen; int move_point = 0; struct buffer *mbuf; @@ -1080,7 +1104,7 @@ if (pos > BUF_ZV (buf)) pos = BUF_ZV (buf); - ind = charbpos_to_bytebpos (buf, pos); + bytepos = charbpos_to_bytebpos (buf, pos); /* string may have been relocated up to this point */ if (STRINGP (reloc)) @@ -1090,20 +1114,35 @@ } else cclen = bytecount_to_charcount (nonreloc + offset, length); + /* &&#### Here we check if the text can't fit into the format of the buffer, + and if so convert it to another format (either default or 32-bit-fixed, + according to some flag; if no flag, use default). */ + + length_in_buffer = copy_text_between_formats (nonreloc + offset, length, + FORMAT_DEFAULT, + STRINGP (reloc) ? reloc : Qnil, + NULL, 0, + BUF_FORMAT (buf), + wrap_buffer (buf), + NULL); - if (ind != BI_BUF_GPT (buf)) + if (bytepos != BYTE_BUF_GPT (buf)) /* #### if debug-on-quit is invoked and the user changes the buffer, bad things can happen. This is a rampant problem in Emacs. */ - move_gap (buf, ind); /* may QUIT */ - if (! GAP_CAN_HOLD_SIZE_P (buf, length)) + move_gap (buf, bytepos); /* may QUIT */ + if (! GAP_CAN_HOLD_SIZE_P (buf, length_in_buffer)) { - if (BUF_END_GAP_SIZE (buf) >= length) + if (BUF_END_GAP_SIZE (buf) >= length_in_buffer) merge_gap_with_end_gap (buf); else - make_gap (buf, length - BUF_GAP_SIZE (buf)); + make_gap (buf, length_in_buffer - BUF_GAP_SIZE (buf)); } + /* At this point, no more QUITting or processing of Lisp code. Buffer is + in a consistent state. Following code puts buffer in an inconsistent + state and can be considered a "critical section". */ + insert_invalidate_line_number_cache (buf, pos, nonreloc + offset, length); MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) @@ -1114,35 +1153,65 @@ BUF_MODIFF (buf)++; MARK_BUFFERS_CHANGED; - /* string may have been relocated up to this point */ + /* string may have been relocated up to this point #### if string is + modified during quit processing, bad things can happen. */ if (STRINGP (reloc)) nonreloc = XSTRING_DATA (reloc); memcpy (BUF_GPT_ADDR (buf), nonreloc + offset, length); - SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) - length); - SET_BI_BUF_GPT (buf, BI_BUF_GPT (buf) + length); + copy_text_between_formats (nonreloc + offset, length, FORMAT_DEFAULT, + STRINGP (reloc) ? reloc : Qnil, + BUF_GPT_ADDR (buf), length_in_buffer, + BUF_FORMAT (buf), wrap_buffer (buf), NULL); + + SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) - length_in_buffer); + SET_BYTE_BUF_GPT (buf, BYTE_BUF_GPT (buf) + length_in_buffer); MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - SET_BOTH_BUF_ZV (mbuf, BUF_ZV (mbuf) + cclen, BI_BUF_ZV (mbuf) + length); + SET_BOTH_BUF_ZV (mbuf, BUF_ZV (mbuf) + cclen, + BYTE_BUF_ZV (mbuf) + length_in_buffer); } - SET_BOTH_BUF_Z (buf, BUF_Z (buf) + cclen, BI_BUF_Z (buf) + length); + SET_BOTH_BUF_Z (buf, BUF_Z (buf) + cclen, BYTE_BUF_Z (buf) + length_in_buffer); SET_GAP_SENTINEL (buf); #ifdef MULE - buffer_mule_signal_inserted_region (buf, pos, length, cclen); + buffer_mule_signal_inserted_region (buf, pos, length_in_buffer, cclen); + /* Update our count of ASCII, 8-bit and 16-bit chars and the + entirely-one-byte flag */ + { + const Ibyte *ptr = nonreloc + offset; + const Ibyte *ptrend = ptr + length; + + while (ptr < ptrend) + { + Ichar ch = itext_ichar (ptr); + if (ichar_ascii_p (ch)) + buf->text->num_ascii_chars++; + if (ichar_8_bit_fixed_p (ch, wrap_buffer (buf))) + buf->text->num_8_bit_fixed_chars++; + if (ichar_16_bit_fixed_p (ch, wrap_buffer (buf))) + buf->text->num_16_bit_fixed_chars++; + INC_IBYTEPTR (ptr); + } + + buf->text->entirely_one_byte_p = + (BUF_FORMAT (buf) == FORMAT_8_BIT_FIXED || + (BUF_FORMAT (buf) == FORMAT_DEFAULT && BUF_Z (buf) == BYTE_BUF_Z (buf))); + } #endif MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - process_extents_for_insertion (wrap_buffer (mbuf), ind, length); + process_extents_for_insertion (wrap_buffer (mbuf), bytepos, + length_in_buffer); } MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - /* We know the gap is at IND so the cast is OK. */ - adjust_markers_for_insert (mbuf, (Membpos) ind, length); + /* We know the gap is at BYTEPOS so the cast is OK. */ + adjust_markers_for_insert (mbuf, (Membpos) bytepos, length_in_buffer); } /* Point logically doesn't move, but may need to be adjusted because @@ -1150,20 +1219,20 @@ memory index. */ MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - if (BI_BUF_PT (mbuf) > ind) + if (BYTE_BUF_PT (mbuf) > bytepos) JUST_SET_POINT (mbuf, BUF_PT (mbuf) + cclen, - BI_BUF_PT (mbuf) + length); + BYTE_BUF_PT (mbuf) + length_in_buffer); } /* Well, point might move. */ if (move_point) - BI_BUF_SET_PT (buf, ind + length); + BYTE_BUF_SET_PT (buf, bytepos + length_in_buffer); if (STRINGP (reloc)) { MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - splice_in_string_extents (reloc, mbuf, ind, length, offset); + splice_in_string_extents (reloc, mbuf, bytepos, length, offset); } } @@ -1171,13 +1240,18 @@ { MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - /* ind - 1 is correct because the FROM argument is exclusive. + /* bytepos - 1 is correct because the FROM argument is exclusive. I formerly used DEC_BYTEBPOS() but that caused problems at the beginning of the buffer. */ - adjust_markers (mbuf, ind - 1, ind, length); + adjust_markers (mbuf, bytepos - 1, bytepos, length_in_buffer); } } + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + { + signal_syntax_table_extent_adjust (mbuf); + } + signal_after_change (buf, pos, pos, pos + cclen); UNGCPRO; @@ -1194,7 +1268,7 @@ Charcount buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos, - const Intbyte *nonreloc, Bytecount length, + const Ibyte *nonreloc, Bytecount length, int flags) { /* This function can GC */ @@ -1220,17 +1294,17 @@ { /* This function can GC */ const char *translated = GETTEXT (s); - return buffer_insert_string_1 (buf, pos, (const Intbyte *) translated, Qnil, + return buffer_insert_string_1 (buf, pos, (const Ibyte *) translated, Qnil, 0, strlen (translated), flags); } Charcount -buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, Emchar ch, +buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, Ichar ch, int flags) { /* This function can GC */ - Intbyte str[MAX_EMCHAR_LEN]; - Bytecount len = set_charptr_emchar (str, ch); + Ibyte str[MAX_ICHAR_LEN]; + Bytecount len = set_itext_ichar (str, ch); return buffer_insert_string_1 (buf, pos, str, Qnil, 0, len, flags); } @@ -1239,7 +1313,7 @@ int flags) { /* This function can GC */ - return buffer_insert_emacs_char_1 (buf, pos, (Emchar) (unsigned char) c, + return buffer_insert_emacs_char_1 (buf, pos, (Ichar) (unsigned char) c, flags); } @@ -1266,11 +1340,12 @@ { /* This function can GC */ Charcount numdel; - Bytebpos bi_from, bi_to; - Bytecount bc_numdel; + Bytebpos byte_from, byte_to; + Bytecount byte_numdel; EMACS_INT shortage; struct buffer *mbuf; Lisp_Object bufcons; + int do_move_gap = 0; /* Defensive steps just in case a buffer gets deleted and a calling function doesn't notice it. */ @@ -1301,6 +1376,42 @@ if ((numdel = to - from) <= 0) return; + byte_from = charbpos_to_bytebpos (buf, from); + byte_to = charbpos_to_bytebpos (buf, to); + byte_numdel = byte_to - byte_from; + + if (to == BUF_Z (buf) && + byte_from > BYTE_BUF_GPT (buf)) + /* avoid moving the gap just to delete from the bottom. */ + do_move_gap = 0; + else + { + /* Make sure the gap is somewhere in or next to what we are deleting. */ + /* NOTE: Can QUIT! */ + if (byte_to < BYTE_BUF_GPT (buf)) + gap_left (buf, byte_to); + if (byte_from > BYTE_BUF_GPT (buf)) + gap_right (buf, byte_from); + do_move_gap = 1; + } + + /* At this point, no more QUITting or processing of Lisp code. Buffer is + in a consistent state. Following code puts buffer in an inconsistent + state and can be considered a "critical section". */ + + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + { + record_delete (mbuf, from, numdel); + } + BUF_MODIFF (buf)++; + MARK_BUFFERS_CHANGED; + + /* We used to do the following before the gap move. But that might QUIT, + and (as a result of this) the gap code always leaves the buffer in + a consistent state. Therefore, it's totally safe to do these operations + now, and just as well not before, as we're making state changes + related to the deletion. */ + /* Redisplay needs to know if a newline was in the deleted region. If we've already marked the changed region as having a deleted newline there is no use in performing the check. */ @@ -1316,162 +1427,98 @@ } } - bi_from = charbpos_to_bytebpos (buf, from); - bi_to = charbpos_to_bytebpos (buf, to); - bc_numdel = bi_to - bi_from; - delete_invalidate_line_number_cache (buf, from, to); - if (to == BUF_Z (buf) && - bi_from > BI_BUF_GPT (buf)) - { - /* avoid moving the gap just to delete from the bottom. */ - - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - record_delete (mbuf, from, numdel); - } - BUF_MODIFF (buf)++; - MARK_BUFFERS_CHANGED; - - /* #### Point used to be modified here, but this causes problems - with MULE, as point is used to calculate bytebposs, and if the - offset in bc_numdel causes point to move to a non first-byte - location, causing some other function to throw an assertion - in ASSERT_VALID_BYTEBPOS. I've moved the code to right after - the other movements and adjustments, but before the gap is - moved. -- jh 970813 */ - - /* Detach any extents that are completely within the range [FROM, TO], - if the extents are detachable. - - This must come AFTER record_delete(), so that the appropriate - extents will be present to be recorded, and BEFORE the gap - size is increased, as otherwise we will be confused about - where the extents end. */ - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - process_extents_for_deletion (wrap_buffer (mbuf), bi_from, bi_to, 0); - } +#ifdef MULE + /* Update our count of ASCII, 8-bit and 16-bit chars and the + entirely-one-byte flag */ + { + Bytebpos i; - /* Relocate all markers pointing into the new, larger gap to - point at the end of the text before the gap. */ - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - adjust_markers (mbuf, - (bi_to + BUF_GAP_SIZE (mbuf)), - (bi_to + BUF_GAP_SIZE (mbuf)), - (- bc_numdel)); - } + for (i = byte_from; i < byte_to; i = next_bytebpos (buf, i)) + { + Ichar ch = BYTE_BUF_FETCH_CHAR (buf, i); + if (ichar_ascii_p (ch)) + buf->text->num_ascii_chars--; + if (ichar_8_bit_fixed_p (ch, wrap_buffer (buf))) + buf->text->num_8_bit_fixed_chars--; + if (ichar_16_bit_fixed_p (ch, wrap_buffer (buf))) + buf->text->num_16_bit_fixed_chars--; + } + } +#endif /* MULE */ - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - /* Relocate any extent endpoints just like markers. */ - adjust_extents_for_deletion (wrap_buffer (mbuf), bi_from, bi_to, - BUF_GAP_SIZE (mbuf), bc_numdel, 0); - } + /* #### Point used to be modified here, but this causes problems + with MULE, as point is used to calculate bytebpos's, and if the + offset in byte_numdel causes point to move to a non first-byte + location, causing some other function to throw an assertion + in ASSERT_VALID_BYTEBPOS. I've moved the code to right after + the other movements and adjustments, but before the gap is + moved. -- jh 970813 */ + + /* Detach any extents that are completely within the range [FROM, TO], + if the extents are detachable. + + This must come AFTER record_delete(), so that the appropriate extents + will be present to be recorded, and BEFORE the gap size is increased, + as otherwise we will be confused about where the extents end. */ + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + { + process_extents_for_deletion (wrap_buffer (mbuf), byte_from, byte_to, 0); + } - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - /* Relocate point as if it were a marker. */ - if (bi_from < BI_BUF_PT (mbuf)) - { - if (BI_BUF_PT (mbuf) < bi_to) - JUST_SET_POINT (mbuf, from, bi_from); - else - JUST_SET_POINT (mbuf, BUF_PT (mbuf) - numdel, - BI_BUF_PT (mbuf) - bc_numdel); - } - } + /* Relocate all markers pointing into the new, larger gap to + point at the end of the text before the gap. */ + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + { + adjust_markers (mbuf, + (byte_to + BUF_GAP_SIZE (mbuf)), + (byte_to + BUF_GAP_SIZE (mbuf)), + (- byte_numdel - + (do_move_gap ? BUF_GAP_SIZE (mbuf) : 0))); + } - SET_BUF_END_GAP_SIZE (buf, BUF_END_GAP_SIZE (buf) + bc_numdel); + /* Relocate any extent endpoints just like markers. */ + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + { + adjust_extents_for_deletion (wrap_buffer (mbuf), byte_from, byte_to, + BUF_GAP_SIZE (mbuf), + byte_numdel, + do_move_gap ? BUF_GAP_SIZE (mbuf) : 0); + } - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + { + /* Relocate point as if it were a marker. */ + if (byte_from < BYTE_BUF_PT (mbuf)) { - SET_BOTH_BUF_ZV (mbuf, BUF_ZV (mbuf) - numdel, - BI_BUF_ZV (mbuf) - bc_numdel); + if (BYTE_BUF_PT (mbuf) < byte_to) + JUST_SET_POINT (mbuf, from, byte_from); + else + JUST_SET_POINT (mbuf, BUF_PT (mbuf) - numdel, + BYTE_BUF_PT (mbuf) - byte_numdel); } - SET_BOTH_BUF_Z (buf, BUF_Z (buf) - numdel, BI_BUF_Z (buf) - bc_numdel); - SET_GAP_SENTINEL (buf); } + + if (do_move_gap) + SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) + byte_numdel); else + SET_BUF_END_GAP_SIZE (buf, BUF_END_GAP_SIZE (buf) + byte_numdel); + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) { - /* Make sure the gap is somewhere in or next to what we are deleting. */ - if (bi_to < BI_BUF_GPT (buf)) - gap_left (buf, bi_to); - if (bi_from > BI_BUF_GPT (buf)) - gap_right (buf, bi_from); - - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - record_delete (mbuf, from, numdel); - } - BUF_MODIFF (buf)++; - MARK_BUFFERS_CHANGED; - - /* #### Point used to be modified here, but this causes problems - with MULE, as point is used to calculate bytebposs, and if the - offset in bc_numdel causes point to move to a non first-byte - location, causing some other function to throw an assertion - in ASSERT_VALID_BYTEBPOS. I've moved the code to right after - the other movements and adjustments, but before the gap is - moved. -- jh 970813 */ - - /* Detach any extents that are completely within the range [FROM, TO], - if the extents are detachable. - - This must come AFTER record_delete(), so that the appropriate extents - will be present to be recorded, and BEFORE the gap size is increased, - as otherwise we will be confused about where the extents end. */ - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - process_extents_for_deletion (wrap_buffer (mbuf), bi_from, bi_to, 0); - } - - /* Relocate all markers pointing into the new, larger gap to - point at the end of the text before the gap. */ - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - adjust_markers (mbuf, - (bi_to + BUF_GAP_SIZE (mbuf)), - (bi_to + BUF_GAP_SIZE (mbuf)), - (- bc_numdel - BUF_GAP_SIZE (mbuf))); - } - - /* Relocate any extent endpoints just like markers. */ - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - adjust_extents_for_deletion (wrap_buffer (mbuf), bi_from, bi_to, - BUF_GAP_SIZE (mbuf), - bc_numdel, BUF_GAP_SIZE (mbuf)); - } - - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - /* Relocate point as if it were a marker. */ - if (bi_from < BI_BUF_PT (mbuf)) - { - if (BI_BUF_PT (mbuf) < bi_to) - JUST_SET_POINT (mbuf, from, bi_from); - else - JUST_SET_POINT (mbuf, BUF_PT (mbuf) - numdel, - BI_BUF_PT (mbuf) - bc_numdel); - } - } - - SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) + bc_numdel); - MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) - { - SET_BOTH_BUF_ZV (mbuf, BUF_ZV (mbuf) - numdel, - BI_BUF_ZV (mbuf) - bc_numdel); - } - SET_BOTH_BUF_Z (buf, BUF_Z (buf) - numdel, BI_BUF_Z (buf) - bc_numdel); - SET_BI_BUF_GPT (buf, bi_from); - SET_GAP_SENTINEL (buf); + SET_BOTH_BUF_ZV (mbuf, BUF_ZV (mbuf) - numdel, + BYTE_BUF_ZV (mbuf) - byte_numdel); } + SET_BOTH_BUF_Z (buf, BUF_Z (buf) - numdel, BYTE_BUF_Z (buf) - byte_numdel); + if (do_move_gap) + SET_BYTE_BUF_GPT (buf, byte_from); + SET_GAP_SENTINEL (buf); #ifdef MULE - buffer_mule_signal_deleted_region (buf, from, to, bi_from, bi_to); + buffer_mule_signal_deleted_region (buf, from, to, byte_from, byte_to); + buf->text->entirely_one_byte_p = + (BUF_FORMAT (buf) == FORMAT_8_BIT_FIXED || + (BUF_FORMAT (buf) == FORMAT_DEFAULT && BUF_Z (buf) == BYTE_BUF_Z (buf))); #endif #ifdef ERROR_CHECK_EXTENTS @@ -1481,6 +1528,15 @@ } #endif + MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons) + { + signal_syntax_table_extent_adjust (mbuf); + } + + /* &&#### Here we consider converting the buffer from default to + 8-bit-fixed if is entirely 8-bit-fixed chars and has been that way for + a long time, e.g. 20 minutes. And if the buffer just switched to all + 8-bit-fixed chars, start the timer. */ signal_after_change (buf, from, to, from); } @@ -1492,23 +1548,24 @@ /* Replace the character at POS in buffer B with CH. */ void -buffer_replace_char (struct buffer *buf, Charbpos pos, Emchar ch, +buffer_replace_char (struct buffer *buf, Charbpos pos, Ichar ch, int not_real_change, int force_lock_check) { /* This function can GC */ - Intbyte curstr[MAX_EMCHAR_LEN]; - Intbyte newstr[MAX_EMCHAR_LEN]; - Bytecount curlen, newlen; + Ibyte newstr[MAX_ICHAR_LEN]; + Bytecount newlen; + Ichar oldch; /* Defensive steps just in case a buffer gets deleted and a calling function doesn't notice it. */ if (!BUFFER_LIVE_P (buf)) return; - curlen = BUF_CHARPTR_COPY_CHAR (buf, pos, curstr); - newlen = set_charptr_emchar (newstr, ch); - - if (curlen == newlen) + newlen = set_itext_ichar_fmt (newstr, ch, BUF_FORMAT (buf), + wrap_buffer (buf)); + oldch = BUF_FETCH_CHAR (buf, pos); + if (ichar_fits_in_format (ch, BUF_FORMAT (buf), wrap_buffer (buf)) && + newlen == ichar_len_fmt (oldch, BUF_FORMAT (buf))) { struct buffer *mbuf; Lisp_Object bufcons; @@ -1547,6 +1604,22 @@ } BUF_MODIFF (buf)++; } + +#ifdef MULE + if (ichar_ascii_p (oldch)) + buf->text->num_ascii_chars--; + if (ichar_8_bit_fixed_p (oldch, wrap_buffer (buf))) + buf->text->num_8_bit_fixed_chars--; + if (ichar_16_bit_fixed_p (oldch, wrap_buffer (buf))) + buf->text->num_16_bit_fixed_chars--; + if (ichar_ascii_p (ch)) + buf->text->num_ascii_chars++; + if (ichar_8_bit_fixed_p (ch, wrap_buffer (buf))) + buf->text->num_8_bit_fixed_chars++; + if (ichar_16_bit_fixed_p (ch, wrap_buffer (buf))) + buf->text->num_16_bit_fixed_chars++; +#endif /* MULE */ + memcpy (BUF_BYTE_ADDRESS (buf, pos), newstr, newlen); signal_after_change (buf, pos, pos + 1, pos + 1); @@ -1604,42 +1677,19 @@ int no_extents) { /* This function can GC */ - Bytebpos bi_ind = charbpos_to_bytebpos (buf, pos); - Bytecount bi_len = charbpos_to_bytebpos (buf, pos + length) - bi_ind; - Lisp_Object val = make_uninit_string (bi_len); + Bytebpos bytepos = charbpos_to_bytebpos (buf, pos); + Bytecount bytelen = charbpos_to_bytebpos (buf, pos + length) - bytepos; + Bytecount needed = copy_buffer_text_out (buf, bytepos, bytelen, NULL, 0, + FORMAT_DEFAULT, Qnil, NULL); + Lisp_Object val = make_uninit_string (needed); struct gcpro gcpro1; GCPRO1 (val); if (!no_extents) - add_string_extents (val, buf, bi_ind, bi_len); - - { - Bytecount len1 = BI_BUF_GPT (buf) - bi_ind; - Intbyte *start1 = BI_BUF_BYTE_ADDRESS (buf, bi_ind); - Intbyte *dest = XSTRING_DATA (val); - - if (len1 < 0) - { - /* Completely after gap */ - memcpy (dest, start1, bi_len); - } - else if (bi_len <= len1) - { - /* Completely before gap */ - memcpy (dest, start1, bi_len); - } - else - { - /* Spans gap */ - Bytebpos pos2 = bi_ind + len1; - Intbyte *start2 = BI_BUF_BYTE_ADDRESS (buf, pos2); - - memcpy (dest, start1, len1); - memcpy (dest + len1, start2, bi_len - len1); - } - } - + add_string_extents (val, buf, bytepos, bytelen); + copy_buffer_text_out (buf, bytepos, bytelen, XSTRING_DATA (val), needed, + FORMAT_DEFAULT, Qnil, NULL); init_string_ascii_begin (val); sledgehammer_check_ascii_begin (val); @@ -1717,7 +1767,7 @@ memory_full (); SET_BUF_END_GAP_SIZE (b, 0); - SET_BI_BUF_GPT (b, 1); + SET_BYTE_BUF_GPT (b, 1); SET_BOTH_BUF_Z (b, 1, 1); SET_GAP_SENTINEL (b); SET_END_SENTINEL (b); @@ -1727,9 +1777,7 @@ b->text->mule_bufmin = b->text->mule_bufmax = 1; b->text->mule_bytmin = b->text->mule_bytmax = 1; - b->text->mule_shifter = 0; - b->text->mule_three_p = 0; - b->text->entirely_ascii_p = 1; + b->text->entirely_one_byte_p = 1; for (i = 0; i < 16; i++) { @@ -1737,6 +1785,8 @@ b->text->mule_bytebpos_cache[i] = 1; } } + /* &&#### Set to FORMAT_8_BIT_FIXED when that code is working */ + BUF_FORMAT (b) = FORMAT_DEFAULT; #endif /* MULE */ b->text->line_number_cache = Qnil; @@ -1751,11 +1801,11 @@ } else { - JUST_SET_POINT (b, BUF_PT (b->base_buffer), BI_BUF_PT (b->base_buffer)); + JUST_SET_POINT (b, BUF_PT (b->base_buffer), BYTE_BUF_PT (b->base_buffer)); SET_BOTH_BUF_BEGV (b, BUF_BEGV (b->base_buffer), - BI_BUF_BEGV (b->base_buffer)); + BYTE_BUF_BEGV (b->base_buffer)); SET_BOTH_BUF_ZV (b, BUF_ZV (b->base_buffer), - BI_BUF_ZV (b->base_buffer)); + BYTE_BUF_ZV (b->base_buffer)); } b->changes = xnew_and_zero (struct each_buffer_change_data); diff --text -u 'xemacs-21.5.6/src/insdel.h' 'xemacs-21.5.7/src/insdel.h' Index: ././src/insdel.h --- ././src/insdel.h Thu Sep 20 15:29:04 2001 +++ ././src/insdel.h Wed Jun 5 18:56:09 2002 @@ -38,18 +38,18 @@ #define INSDEL_NO_LOCKING 2 Charcount buffer_insert_string_1 (struct buffer *buf, Charbpos pos, - const Intbyte *nonreloc, Lisp_Object reloc, + const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length, int flags); Charcount buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos, - const Intbyte *nonreloc, + const Ibyte *nonreloc, Bytecount length, int flags); Charcount buffer_insert_lisp_string_1 (struct buffer *buf, Charbpos pos, Lisp_Object str, int flags); Charcount buffer_insert_c_string_1 (struct buffer *buf, Charbpos pos, const char *s, int flags); Charcount buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, - Emchar ch, int flags); + Ichar ch, int flags); Charcount buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c, int flags); Charcount buffer_insert_from_buffer_1 (struct buffer *buf, Charbpos pos, @@ -76,7 +76,7 @@ void buffer_delete_range (struct buffer *buf, Charbpos from, Charbpos to, int flags); -void buffer_replace_char (struct buffer *b, Charbpos pos, Emchar ch, +void buffer_replace_char (struct buffer *b, Charbpos pos, Ichar ch, int not_real_change, int force_lock_check); @@ -142,7 +142,7 @@ Membpos do_marker_adjustment (Membpos mpos, Membpos from, Membpos to, Bytecount amount); -void fixup_internal_substring (const Intbyte *nonreloc, +void fixup_internal_substring (const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount *len); diff --text -u 'xemacs-21.5.6/src/intl-auto-encap-win32.c' 'xemacs-21.5.7/src/intl-auto-encap-win32.c' Index: ././src/intl-auto-encap-win32.c --- ././src/intl-auto-encap-win32.c Sun Mar 31 17:28:33 2002 +++ ././src/intl-auto-encap-win32.c Mon May 6 23:15:41 2002 @@ -2587,6 +2587,8 @@ return GetLongPathNameA ((LPCSTR) lpszShortPath, (LPSTR) lpszLongPath, cchBuffer); } +/* Skipping GetEnvironmentStrings because misnamed ANSI version of the function */ + BOOL qxeFreeEnvironmentStrings (Extbyte * arg1) { diff --text -u 'xemacs-21.5.6/src/intl-auto-encap-win32.h' 'xemacs-21.5.7/src/intl-auto-encap-win32.h' Index: ././src/intl-auto-encap-win32.h --- ././src/intl-auto-encap-win32.h Sun Mar 31 17:28:34 2002 +++ ././src/intl-auto-encap-win32.h Mon May 6 23:15:43 2002 @@ -1835,6 +1835,8 @@ #endif DWORD qxeGetLongPathName (const Extbyte * lpszShortPath, Extbyte * lpszLongPath, DWORD cchBuffer); +/* Skipping GetEnvironmentStrings because misnamed ANSI version of the function */ + #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED #undef FreeEnvironmentStrings #define FreeEnvironmentStrings error use qxeFreeEnvironmentStrings or FreeEnvironmentStringsA/FreeEnvironmentStringsW diff --text -u 'xemacs-21.5.6/src/intl-encap-win32.c' 'xemacs-21.5.7/src/intl-encap-win32.c' Index: ././src/intl-encap-win32.c --- ././src/intl-encap-win32.c Sun Mar 31 17:28:35 2002 +++ ././src/intl-encap-win32.c Fri Jun 21 06:18:36 2002 @@ -217,7 +217,7 @@ yes GetBinaryType yes GetShortPathName yes GetLongPathName -yes GetEnvironmentStrings +skip GetEnvironmentStrings misnamed ANSI version of the function yes FreeEnvironmentStrings yes FormatMessage yes CreateMailslot @@ -1925,6 +1925,8 @@ memcpy (dst, src, sizeof (LOGFONTA)); } +#if 0 /* unused */ + static void copy_enumlogfonta_to_enumlogfontw (const ENUMLOGFONTA *src, ENUMLOGFONTW *dst) { @@ -1940,6 +1942,8 @@ memcpy (dst->elfStyle, src->elfStyle, sizeof (src->elfStyle)); } +#endif /* 0 */ + static void copy_enumlogfontexa_to_enumlogfontexw (const ENUMLOGFONTEXA *src, ENUMLOGFONTEXW *dst) @@ -1997,6 +2001,8 @@ dst->ntmFontSig = src->ntmFontSig; } +#if 0 /* unused */ + static void copy_textmetricw_to_textmetrica (const TEXTMETRICW *src, TEXTMETRICA *dst) @@ -2013,6 +2019,8 @@ dst->tmDefaultChar = (BYTE) src->tmDefaultChar; dst->tmBreakChar = (BYTE) src->tmBreakChar; } + +#endif /* 0 */ static void copy_textmetrica_to_textmetricw (const TEXTMETRICA *src, diff --text -u 'xemacs-21.5.6/src/intl-win32.c' 'xemacs-21.5.7/src/intl-win32.c' Index: ././src/intl-win32.c --- ././src/intl-win32.c Sun Mar 31 17:28:36 2002 +++ ././src/intl-win32.c Fri Jun 21 06:18:36 2002 @@ -38,11 +38,11 @@ #include "elhash.h" #include "faces.h" #include "file-coding.h" -#include "frame.h" -#include "window.h" +#include "frame-impl.h" +#include "window-impl.h" -#include "console-msw.h" -#include "objects-msw.h" +#include "console-msw-impl.h" +#include "objects-msw-impl.h" #ifndef CYGWIN_HEADERS # include @@ -64,6 +64,7 @@ #ifdef MULE static Lisp_Object Vmswindows_charset_code_page_table; +static Lisp_Object Vmswindows_charset_registry_table; LCID current_locale; @@ -1023,7 +1024,7 @@ #ifdef DEBUG_XEMACS -static int getacp (void); +int getacp (void); int getacp (void) { @@ -1270,11 +1271,61 @@ return charset; } +DEFUN ("mswindows-charset-registry", + Fmswindows_charset_registry, 1, 1, 0, /* +Return the registry for the CHARSET. +This is the last item in an MS Windows font spec. + +#### This function may be changed in the near future. +*/ + (charset)) +{ + charset = Fget_charset (charset); + return Fgethash (charset, Vmswindows_charset_registry_table, Qnil); +} + +DEFUN ("mswindows-set-charset-registry", + Fmswindows_set_charset_registry, 2, 2, 0, /* +Set the REGISTRY for the CHARSET. + +#### This function may be changed once full Unicode support is present. +*/ + (charset, registry)) +{ + charset = Fget_charset (charset); + CHECK_STRING (registry); + Fputhash (charset, registry, Vmswindows_charset_registry_table); + invalidate_charset_font_caches (charset); + face_property_was_changed (Vdefault_face, Qfont, Qglobal); + return Qnil; +} + +Lisp_Object +mswindows_get_registry_charset (Ibyte *registry) +{ + Lisp_Object charset_tail; + Lisp_Object charset = Qunbound; + + LIST_LOOP (charset_tail, Fcharset_list ()) + { + Lisp_Object charset_registry; + + charset_registry = Fmswindows_charset_registry (XCAR (charset_tail)); + if (STRINGP (charset_registry) && + !qxestrcasecmp (XSTRING_DATA (charset_registry), registry)) + { + charset = Fget_charset (XCAR (charset_tail)); + break; + } + } + return charset; +} + #if 0 /* #### from Emacs 20.6; consider porting */ -xxDEFUN ("mswindows-get-locale-info", Fmswindows_get_locale_info, 1, 2, 0, /* +DEFUN ("mswindows-get-locale-info", Fmswindows_get_locale_info, 1, 2, 0, /* Return information about the Windows locale LCID. By default, return a three letter locale code which encodes the default language as the first two characters, and the country or regionial variant @@ -1339,7 +1390,7 @@ return TRUE; } -xxDEFUN ("mswindows-get-valid-code-pages", Fmswindows_get_valid_code_pages, 0, 0, 0, /* +DEFUN ("mswindows-get-valid-code-pages", Fmswindows_get_valid_code_pages, 0, 0, 0, /* Return list of all valid Windows code pages. */ ()) @@ -1352,7 +1403,7 @@ return Vmswindows_valid_code_pages; } -xxDEFUN ("mswindows-get-console-code-page", Fmswindows_get_console_code_page, 0, 0, 0, /* +DEFUN ("mswindows-get-console-code-page", Fmswindows_get_console_code_page, 0, 0, 0, /* Return current Windows code page for console input. */ ()) @@ -1360,7 +1411,7 @@ return make_int (GetConsoleCP ()); } -xxDEFUN ("mswindows-set-console-code-page", Fmswindows_set_console_code_page, 1, 1, 0, /* +DEFUN ("mswindows-set-console-code-page", Fmswindows_set_console_code_page, 1, 1, 0, /* Make Windows code page CP be the current code page setting for Emacs. The code page setting affects keyboard input and display in tty mode. If successful, the new CP is returned, otherwise nil. @@ -1378,7 +1429,7 @@ return make_int (GetConsoleCP ()); } -xxDEFUN ("mswindows-get-console-output-code-page", Fmswindows_get_console_output_code_page, 0, 0, 0, /* +DEFUN ("mswindows-get-console-output-code-page", Fmswindows_get_console_output_code_page, 0, 0, 0, /* Return current Windows code page for console output. */ ()) @@ -1386,7 +1437,7 @@ return make_int (GetConsoleOutputCP ()); } -xxDEFUN ("mswindows-set-console-output-code-page", Fmswindows_set_console_output_code_page, 1, 1, 0, /* +DEFUN ("mswindows-set-console-output-code-page", Fmswindows_set_console_output_code_page, 1, 1, 0, /* Make Windows code page CP be the current code page setting for Emacs. The code page setting affects keyboard input and display in tty mode. If successful, the new CP is returned, otherwise nil. @@ -1404,7 +1455,7 @@ return make_int (GetConsoleOutputCP ()); } -xxDEFUN ("mswindows-get-code-page-charset", Fmswindows_get_code_page_charset, 1, 1, 0, /* +DEFUN ("mswindows-get-code-page-charset", Fmswindows_get_code_page_charset, 1, 1, 0, /* Return charset of code page CP. Returns nil if the code page is not valid. */ @@ -1423,14 +1474,14 @@ return Qnil; } -xxDEFUN ("mswindows-get-valid-keyboard-layouts", Fmswindows_get_valid_keyboard_layouts, 0, 0, 0, /* +DEFUN ("mswindows-get-valid-keyboard-layouts", Fmswindows_get_valid_keyboard_layouts, 0, 0, 0, /* Return list of Windows keyboard languages and layouts. The return value is a list of pairs of language id and layout id. */ ()) { int num_layouts = GetKeyboardLayoutList (0, NULL); - HKL * layouts = (HKL *) alloca (num_layouts * sizeof (HKL)); + HKL * layouts = (HKL *) ALLOCA (num_layouts * sizeof (HKL)); Lisp_Object obj = Qnil; if (GetKeyboardLayoutList (num_layouts, layouts) == num_layouts) @@ -1448,7 +1499,7 @@ return obj; } -xxDEFUN ("mswindows-get-keyboard-layout", Fmswindows_get_keyboard_layout, 0, 0, 0, /* +DEFUN ("mswindows-get-keyboard-layout", Fmswindows_get_keyboard_layout, 0, 0, 0, /* Return current Windows keyboard language and layout. The return value is the cons of the language id and the layout id. */ @@ -1460,7 +1511,7 @@ make_int ((kl >> 16) & 0xffff)); } -xxDEFUN ("mswindows-set-keyboard-layout", Fmswindows_set_keyboard_layout, 1, 1, 0, /* +DEFUN ("mswindows-set-keyboard-layout", Fmswindows_set_keyboard_layout, 1, 1, 0, /* Make LAYOUT be the current keyboard layout for Emacs. The keyboard layout setting affects interpretation of keyboard input. If successful, the new layout id is returned, otherwise nil. @@ -1827,7 +1878,7 @@ struct mswindows_multibyte_to_unicode_coding_system *data = XCODING_SYSTEM_TYPE_DATA (cs, mswindows_multibyte_to_unicode); - write_c_string ("(", printcharfun); + write_c_string (printcharfun, "("); if (data->locale_type == MULTIBYTE_SPECIFIED_CODE_PAGE) print_internal (make_int (data->cp), printcharfun, 1); else @@ -1835,7 +1886,7 @@ write_fmt_string_lisp (printcharfun, "%s, ", 1, mswindows_multibyte_to_unicode_getprop (cs, Qlocale)); print_internal (mswindows_multibyte_to_unicode_getprop (cs, Qcode_page), printcharfun, 0); } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); } /* Convert multibyte to Unicode according to the specified code page @@ -1867,13 +1918,13 @@ See above for why this exists, and the TO_INTERNAL_FORMAT() macros aren't just used. */ -Intbyte * +Ibyte * convert_multibyte_to_internal_malloc (const Extbyte *src, Bytecount n, int cp, Bytecount *size_out) { Bytecount size; Extbyte *unidata = convert_multibyte_to_unicode_malloc (src, n, cp, &size); - Intbyte *intdata; + Ibyte *intdata; TO_INTERNAL_FORMAT (DATA, (unidata, size), MALLOC, (intdata, size), Qmswindows_unicode); @@ -2126,6 +2177,8 @@ DEFSUBR (Fmswindows_supported_locales); DEFSUBR (Fmswindows_charset_code_page); DEFSUBR (Fmswindows_set_charset_code_page); + DEFSUBR (Fmswindows_charset_registry); + DEFSUBR (Fmswindows_set_charset_registry); #if 0 DEFSUBR (Fmswindows_get_locale_info); @@ -2198,6 +2251,9 @@ Vmswindows_charset_code_page_table = make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); staticpro (&Vmswindows_charset_code_page_table); + Vmswindows_charset_registry_table = + make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); + staticpro (&Vmswindows_charset_registry_table); #endif /* MULE */ } diff --text -u 'xemacs-21.5.6/src/intl.c' 'xemacs-21.5.7/src/intl.c' Index: ././src/intl.c --- ././src/intl.c Wed Mar 13 17:52:49 2002 +++ ././src/intl.c Tue May 28 17:44:55 2002 @@ -1,6 +1,6 @@ /* Various functions for internationalizing XEmacs. Copyright (C) 1993, 1994, 1995 Board of Trustees, University of Illinois. - Copyright (C) 2000, 2001 Ben Wing. + Copyright (C) 2000, 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -101,7 +101,7 @@ Lisp_Object Qdefer_gettext; -xxDEFUN ("ignore-defer-gettext", Fignore_defer_gettext, 1, 1, 0, /* +DEFUN ("ignore-defer-gettext", Fignore_defer_gettext, 1, 1, 0, /* If OBJECT is of the form (defer-gettext "string"), return the string. The purpose of the defer-gettext symbol is to identify strings which are translated when they are referenced instead of when they are defined. @@ -162,19 +162,23 @@ void init_intl (void) { + /* This function can GC */ if (initialized) { - /* #### port to new error-trapping system when i sync up the code */ int count = begin_gc_forbidden (); + Lisp_Object args[2]; + specbind (Qinhibit_quit, Qt); - call0_with_handler (Qreally_early_error_handler, - intern ("init-locale-at-early-startup")); + args[0] = Qreally_early_error_handler; + args[1] = intern ("init-locale-at-early-startup"); + Fcall_with_condition_handler (2, args); + /* Should be calling this here, but problems with `data-directory' and locating the files. See comment in mule-cmds.el:`init-mule-at-startup'. - call0_with_handler (Qreally_early_error_handler, - intern ("init-unicode-at-early-startup")); + args[1] = intern ("init-unicode-at-early-startup"); + Fcall_with_condition_handler (2, args); */ unbind_to (count); } diff --text -u 'xemacs-21.5.6/src/keymap.c' 'xemacs-21.5.7/src/keymap.c' Index: ././src/keymap.c --- ././src/keymap.c Sun Mar 31 17:28:37 2002 +++ ././src/keymap.c Fri Jun 21 06:18:36 2002 @@ -31,9 +31,10 @@ #include "buffer.h" #include "bytecode.h" -#include "console.h" +#include "console-impl.h" #include "elhash.h" #include "events.h" +#include "extents.h" #include "frame.h" #include "insdel.h" #include "keymap.h" @@ -259,7 +260,7 @@ Lisp_Keymap *keymap = XKEYMAP (obj); if (print_readably) printing_unreadable_object ("#", keymap->header.uid); - write_c_string ("#name)) { write_fmt_string_lisp (printcharfun, "%S ", 1, keymap->name); @@ -319,8 +320,8 @@ { while (CONSP (malloc_bites)) { - Lisp_Cons *victim = XCONS (malloc_bites); - malloc_bites = victim->cdr; + Lisp_Object victim = malloc_bites; + malloc_bites = XCDR (victim); free_cons (victim); } UNGCPRO; @@ -336,9 +337,9 @@ stack_depth--; if (CONSP (malloc_bites)) { - Lisp_Cons *victim = XCONS (malloc_bites); - tail = victim->car; - malloc_bites = victim->cdr; + Lisp_Object victim = malloc_bites; + tail = XCAR (victim); + malloc_bites = XCDR (victim); free_cons (victim); } else @@ -440,8 +441,8 @@ "9" as its name. */ /* !!#### I'm not sure how correct this is. */ - Intbyte str [1 + MAX_EMCHAR_LEN]; - Bytecount count = set_charptr_emchar (str, XCHAR (keysym)); + Ibyte str [1 + MAX_ICHAR_LEN]; + Bytecount count = set_itext_ichar (str, XCHAR (keysym)); str[count] = 0; keysym = intern_int (str); } @@ -475,10 +476,10 @@ k = XKEYMAP (keymap); /* If the keysym is a one-character symbol, use the char code instead. */ - if (SYMBOLP (keysym) && XSTRING_CHAR_LENGTH (XSYMBOL (keysym)->name) == 1) + if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) { Lisp_Object i_fart_on_gcc = - make_char (XSTRING_CHAR (XSYMBOL (keysym)->name, 0)); + make_char (string_ichar (XSYMBOL (keysym)->name, 0)); keysym = i_fart_on_gcc; } @@ -653,8 +654,8 @@ | XEMACS_MOD_ALT | XEMACS_MOD_SHIFT)) == 0); /* If the keysym is a one-character symbol, use the char code instead. */ - if (SYMBOLP (keysym) && XSTRING_CHAR_LENGTH (XSYMBOL (keysym)->name) == 1) - keysym = make_char (XSTRING_CHAR (XSYMBOL (keysym)->name, 0)); + if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) + keysym = make_char (string_ichar (XSYMBOL (keysym)->name, 0)); if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ { @@ -1261,10 +1262,10 @@ /* Now, check and massage the trailing keysym specifier. */ if (SYMBOLP (*keysym)) { - if (XSTRING_CHAR_LENGTH (XSYMBOL (*keysym)->name) == 1) + if (string_char_length (XSYMBOL (*keysym)->name) == 1) { Lisp_Object ream_gcc_up_the_ass = - make_char (XSTRING_CHAR (XSYMBOL (*keysym)->name, 0)); + make_char (string_ichar (XSYMBOL (*keysym)->name, 0)); *keysym = ream_gcc_up_the_ass; goto fixnum_keysym; } @@ -1291,7 +1292,7 @@ if (SYMBOLP (*keysym)) { - Intbyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name); + Ibyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name); /* FSFmacs uses symbols with the printed representation of keysyms in their names, like 'M-x, and we use the syntax '(meta x). So, to avoid @@ -1861,7 +1862,7 @@ if (VECTORP (keys)) len = XVECTOR_LENGTH (keys); else if (STRINGP (keys)) - len = XSTRING_CHAR_LENGTH (keys); + len = string_char_length (keys); else if (CHAR_OR_CHAR_INTP (keys) || SYMBOLP (keys) || CONSP (keys)) { if (!CONSP (keys)) keys = list1 (keys); @@ -1899,7 +1900,7 @@ struct key_data raw_key2; if (STRINGP (keys)) - c = make_char (XSTRING_CHAR (keys, idx)); + c = make_char (string_ichar (keys, idx)); else c = XVECTOR_DATA (keys) [idx]; @@ -2217,7 +2218,7 @@ return lookup_keys (keymap, 1, &keys, !NILP (accept_default)); else if (STRINGP (keys)) { - int length = XSTRING_CHAR_LENGTH (keys); + int length = string_char_length (keys); int i; struct key_data *raw_keys = alloca_array (struct key_data, length); if (length == 0) @@ -2225,7 +2226,7 @@ for (i = 0; i < length; i++) { - Emchar n = XSTRING_CHAR (keys, i); + Ichar n = string_ichar (keys, i); define_key_parser (make_char (n), &(raw_keys[i])); } return raw_lookup_key (keymap, raw_keys, length, 0, @@ -2922,8 +2923,8 @@ /* otherwise, string-sort them. */ { - Intbyte *s1 = XSTRING_DATA (XSYMBOL (obj1)->name); - Intbyte *s2 = XSTRING_DATA (XSYMBOL (obj2)->name); + Ibyte *s1 = XSTRING_DATA (XSYMBOL (obj1)->name); + Ibyte *s2 = XSTRING_DATA (XSYMBOL (obj2)->name); return 0 > qxestrcmp (s1, s2) ? 1 : -1; } } @@ -2984,7 +2985,7 @@ { /* This function can GC */ Lisp_Object fn; - VOID_TO_LISP (fn, function); + fn = VOID_TO_LISP (function); call2 (fn, make_key_description (key, 1), binding); } @@ -3240,7 +3241,7 @@ { Lisp_Object s2 = Fsingle_key_description (STRINGP (keys) - ? make_char (XSTRING_CHAR (keys, i)) + ? make_char (string_ichar (keys, i)) : XVECTOR_DATA (keys)[i]); if (i == 0) @@ -3338,12 +3339,12 @@ */ (chr)) { - Intbyte buf[200]; - Intbyte *p; - Emchar c; + Ibyte buf[200]; + Ibyte *p; + Ichar c; Lisp_Object ctl_arrow = current_buffer->ctl_arrow; int ctl_p = !NILP (ctl_arrow); - Emchar printable_min = (CHAR_OR_CHAR_INTP (ctl_arrow) + Ichar printable_min = (CHAR_OR_CHAR_INTP (ctl_arrow) ? XCHAR_OR_CHAR_INT (ctl_arrow) : ((EQ (ctl_arrow, Qt) || NILP (ctl_arrow)) ? 256 : 160)); @@ -3366,7 +3367,7 @@ if (c >= printable_min) { - p += set_charptr_emchar (p, c); + p += set_itext_ichar (p, c); } else if (c < 040 && ctl_p) { @@ -3399,7 +3400,7 @@ } else { - p += set_charptr_emchar (p, c); + p += set_itext_ichar (p, c); } *p = 0; @@ -4149,7 +4150,7 @@ struct describe_map_closure describe_map_closure; Lisp_Object list = Qnil; struct buffer *buf = XBUFFER (buffer); - Emchar printable_min = (CHAR_OR_CHAR_INTP (buf->ctl_arrow) + Ichar printable_min = (CHAR_OR_CHAR_INTP (buf->ctl_arrow) ? XCHAR_OR_CHAR_INT (buf->ctl_arrow) : ((EQ (buf->ctl_arrow, Qt) || EQ (buf->ctl_arrow, Qnil)) @@ -4197,8 +4198,8 @@ if (SYMBOLP (keysym)) { Lisp_Object code = Fget (keysym, Vcharacter_set_property, Qnil); - Emchar c = (CHAR_OR_CHAR_INTP (code) - ? XCHAR_OR_CHAR_INT (code) : (Emchar) -1); + Ichar c = (CHAR_OR_CHAR_INTP (code) + ? XCHAR_OR_CHAR_INT (code) : (Ichar) -1); /* Calling Fsingle_key_description() would cons more */ #if 0 /* This is bogus */ if (EQ (keysym, QKlinefeed)) @@ -4417,7 +4418,7 @@ staticpro (&Vcurrent_global_map); - Vsingle_space_string = make_string ((const Intbyte *) " ", 1); + Vsingle_space_string = make_string ((const Ibyte *) " ", 1); staticpro (&Vsingle_space_string); } diff --text -u /dev/null 'xemacs-21.5.7/src/libinterface.c' Index: ././src/libinterface.c --- ././src/libinterface.c Thu Jan 1 09:00:00 1970 +++ ././src/libinterface.c Mon Jun 10 21:43:41 2002 @@ -0,0 +1,197 @@ +/* Interface to graphics/etc libraries, with cdecl calling convention. + Copyright (C) 2002 Ben Wing + +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 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. */ + +/* Synched up with: Not in FSF. */ + +#include +#include "lisp.h" + +#include "libinterface.h" + +/* YUUUUUUUUUUUUUUCK! + + This file exists only because VC++ lacks pragmas that let you change the + default calling convention in the middle of a file. With optimization, + we compile XEmacs using fastcall as the default convention; but + libraries are not compiled this way, and thus need __cdecl in their + declaration. Without the pragma, we either + + (a) depend on libraries that declare their external functions with + suitable preprocessor definitions that we can change; + + (b) force the user to recompile the library with fastcall (not + reasonable); + + (c) hack the headers manually (not reasonable); + + (d) put all calls to the library in a separate file where the default + calling convention is __cdecl (hence, this file). + + In fact, some libraries do make (a) feasible. This is the case with PNG + and ZLIB. JPEG almost does so, since all externs are wrapped with + EXTERN(); but they fail to wrap their definition of EXTERN with #ifndef + EXTERN, so we can't override it. XPM is similar, wrapping their externs + with FUNC() -- again, not overridable. With PNG, we define PNG_EXPORT; + with ZLIB, we define ZEXPORT and ZEXPORTVA. */ + +#ifdef HAVE_XPM + +void +qxe_XpmFreeXpmImage (XpmImage *image) +{ + XpmFreeXpmImage (image); +} + +void +qxe_XpmFreeXpmInfo (XpmInfo *info) +{ + XpmFreeXpmInfo (info); +} + +int +qxe_XpmCreateXpmImageFromBuffer (char *buffer, XpmImage *image, XpmInfo *info) +{ + return XpmCreateXpmImageFromBuffer (buffer, image, info); +} + +void +qxe_XpmFree (void *ptr) +{ + XpmFree (ptr); +} + +int +qxe_XpmReadFileToData (char *filename, char ***data_return) +{ + return XpmReadFileToData (filename, data_return); +} + +#endif /* HAVE_XPM */ + +#ifdef HAVE_JPEG + +boolean +qxe_jpeg_finish_decompress (j_decompress_ptr cinfo) +{ + return jpeg_finish_decompress (cinfo); +} + +boolean +qxe_jpeg_start_decompress (j_decompress_ptr cinfo) +{ + return jpeg_start_decompress (cinfo); +} + +JDIMENSION +qxe_jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, + JDIMENSION max_lines) +{ + return jpeg_read_scanlines (cinfo, scanlines, max_lines); +} + +int +qxe_jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) +{ + return jpeg_read_header (cinfo, require_image); +} + +void +qxe_jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, + size_t structsize) +{ + jpeg_CreateDecompress (cinfo, version, structsize); +} + +struct jpeg_error_mgr * +qxe_jpeg_std_error (struct jpeg_error_mgr *err) +{ + return jpeg_std_error (err); +} + +void +qxe_jpeg_destroy_decompress (j_decompress_ptr cinfo) +{ + jpeg_destroy_decompress (cinfo); +} + +boolean +qxe_jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) +{ + return jpeg_resync_to_restart (cinfo, desired); +} + +#endif /* HAVE_JPEG */ + +#ifdef HAVE_TIFF + +tdata_t +qxe_TIFFmalloc (tsize_t x1) +{ + return _TIFFmalloc (x1); +} + +void +qxe_TIFFfree (tdata_t x1) +{ + _TIFFfree (x1); +} + +void +qxe_TIFFClose (TIFF *x1) +{ + TIFFClose (x1); +} + +int +qxe_TIFFGetField (TIFF *x1, ttag_t x2, uint32 *x3) +{ + return TIFFGetField (x1, x2, x3); +} + +TIFF * +qxe_TIFFClientOpen (const char *x1, const char *x2, + thandle_t x3, + TIFFReadWriteProc x4, TIFFReadWriteProc x5, + TIFFSeekProc x6, TIFFCloseProc x7, + TIFFSizeProc x8, + TIFFMapFileProc x9, TIFFUnmapFileProc x10) +{ + return TIFFClientOpen (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10); +} + +TIFFErrorHandler +qxe_TIFFSetErrorHandler (TIFFErrorHandler x1) +{ + return TIFFSetErrorHandler (x1); +} + +TIFFErrorHandler +qxe_TIFFSetWarningHandler (TIFFErrorHandler x1) +{ + return TIFFSetWarningHandler (x1); +} + +int +qxe_TIFFReadRGBAImage (TIFF *x1, uint32 x2, uint32 x3, uint32 *x4, int x5) +{ + return TIFFReadRGBAImage (x1, x2, x3, x4, x5); +} + +#endif /* HAVE_TIFF */ diff --text -u /dev/null 'xemacs-21.5.7/src/libinterface.h' Index: ././src/libinterface.h --- ././src/libinterface.h Thu Jan 1 09:00:00 1970 +++ ././src/libinterface.h Mon Jun 10 21:43:42 2002 @@ -0,0 +1,124 @@ +/* Define prototypes for graphics library interface functions. + Copyright (C) 2002 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +#ifndef INCLUDED_libinterface_h_ +#define INCLUDED_libinterface_h_ + +#ifdef HAVE_GIF +#include "gifrlib.h" +#endif /* HAVE_GIF */ + +#ifdef HAVE_PNG +#ifdef __cplusplus +extern "C" { +#endif +#define message message_ /* Yuck */ + /* See comment in libinterface.c for the following */ +#define PNG_EXPORT(type, symbol) type XCDECL symbol +#define ZEXPORT XCDECL +#define ZEXPORTVA XCDECL +#include +#undef message +#ifdef __cplusplus +} +#endif +#endif /* HAVE_PNG */ + +/* #### WARNING: Utterly random magic here to prevent namespace conflicts + when no one bothers to be the least bit namespace-clean. Potential + problems: INT32, FAR. DONT_NEED_JPEG avoids the problem with FAR in + glyphs-msw.c. For some reason, putting the XPM code after this fixes + other problems; don't move it before. --ben */ +#if defined (HAVE_JPEG) && !defined (DONT_NEED_JPEG) +#ifdef __cplusplus +extern "C" { +#endif +#ifdef _MSC_VER +# ifndef XMD_H + /* Yuck! This tricks jpeglib.h into not defining INT32, which is defined + in VC98/INCLUDE/basetsd.h */ +# define UNDEF_XMD_H_ME_HARDER +# define XMD_H +# endif +#endif /* _MSC_VER */ +#include +#ifdef UNDEF_XMD_H_ME_HARDER +# undef XMD_H +#endif +#include +#ifdef __cplusplus +} +#endif + +boolean XCDECL qxe_jpeg_finish_decompress (j_decompress_ptr cinfo); +boolean XCDECL qxe_jpeg_start_decompress (j_decompress_ptr cinfo); +JDIMENSION XCDECL qxe_jpeg_read_scanlines (j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines); +int XCDECL qxe_jpeg_read_header (j_decompress_ptr cinfo, boolean require_image); +#define qxe_jpeg_create_decompress(cinfo) \ + qxe_jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_decompress_struct)) +void XCDECL qxe_jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, + size_t structsize); +struct jpeg_error_mgr * XCDECL qxe_jpeg_std_error (struct jpeg_error_mgr *err); +void XCDECL qxe_jpeg_destroy_decompress (j_decompress_ptr cinfo); +boolean XCDECL qxe_jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired); + +#endif /* defined (HAVE_JPEG) && !defined (DONT_NEED_JPEG) */ + +#ifdef HAVE_XPM + +#ifndef HAVE_GTK /* #### ????????????????????? No comprendo ni un poco. + This was here before, in a different file. --ben */ +#include +#endif + +void XCDECL qxe_XpmFreeXpmImage (XpmImage *image); +void XCDECL qxe_XpmFreeXpmInfo (XpmInfo *info); +int XCDECL qxe_XpmCreateXpmImageFromBuffer (char *buffer, XpmImage *image, + XpmInfo *info); +void XCDECL qxe_XpmFree (void *ptr); +int XCDECL qxe_XpmReadFileToData (char *filename, char ***data_return); + +#endif /* HAVE_XPM */ + +#ifdef HAVE_TIFF +#include "tiffio.h" + +tdata_t XCDECL qxe_TIFFmalloc (tsize_t x1); +void XCDECL qxe_TIFFfree (tdata_t x1); +void XCDECL qxe_TIFFClose (TIFF *x1); +int XCDECL qxe_TIFFGetField (TIFF *x1, ttag_t x2, uint32 *x3); +TIFF * XCDECL qxe_TIFFClientOpen (const char *x1, const char *x2, + thandle_t x3, TIFFReadWriteProc x4, + TIFFReadWriteProc x5, TIFFSeekProc x6, + TIFFCloseProc x7, TIFFSizeProc x8, + TIFFMapFileProc x9, TIFFUnmapFileProc x10); +TIFFErrorHandler XCDECL qxe_TIFFSetErrorHandler (TIFFErrorHandler x1); +TIFFErrorHandler XCDECL qxe_TIFFSetWarningHandler (TIFFErrorHandler x1); +int XCDECL qxe_TIFFReadRGBAImage (TIFF *x1, uint32 x2, uint32 x3, uint32 *x4, + int x5); + +#endif /* HAVE_TIFF */ + +#endif /* INCLUDED_libinterface_h_ */ diff --text -u 'xemacs-21.5.6/src/line-number.c' 'xemacs-21.5.7/src/line-number.c' Index: ././src/line-number.c --- ././src/line-number.c Wed Mar 13 17:52:50 2002 +++ ././src/line-number.c Wed Jun 5 18:56:15 2002 @@ -158,7 +158,7 @@ This will do nothing if the cache is uninitialized. */ void insert_invalidate_line_number_cache (struct buffer *b, Charbpos pos, - const Intbyte *nonreloc, Bytecount length) + const Ibyte *nonreloc, Bytecount length) { if (NILP (b->text->line_number_cache)) return; diff --text -u 'xemacs-21.5.6/src/line-number.h' 'xemacs-21.5.7/src/line-number.h' Index: ././src/line-number.h --- ././src/line-number.h Thu Sep 20 15:29:05 2001 +++ ././src/line-number.h Wed Jun 5 18:56:16 2002 @@ -24,7 +24,7 @@ void narrow_line_number_cache (struct buffer *); void insert_invalidate_line_number_cache (struct buffer *, Charbpos, - const Intbyte *, Bytecount); + const Ibyte *, Bytecount); void delete_invalidate_line_number_cache (struct buffer *, Charbpos, Charbpos); EMACS_INT buffer_line_number (struct buffer *, Charbpos, int); diff --text -u 'xemacs-21.5.6/src/lisp-disunion.h' 'xemacs-21.5.7/src/lisp-disunion.h' Index: ././src/lisp-disunion.h --- ././src/lisp-disunion.h Sun Mar 31 17:28:38 2002 +++ ././src/lisp-disunion.h Wed Jun 5 18:56:16 2002 @@ -1,6 +1,6 @@ /* Fundamental definitions for XEmacs Lisp interpreter -- non-union objects. Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -68,7 +68,7 @@ XTYPE The type bits of a Lisp_Object XPNTRVAL The value bits of a Lisp_Object storing a pointer - XCHARVAL The value bits of a Lisp_Object storing a Emchar + XCHARVAL The value bits of a Lisp_Object storing a Ichar XREALINT The value bits of a Lisp_Object storing an integer, signed XUINT The value bits of a Lisp_Object storing an integer, unsigned INTP Non-zero if this Lisp_Object is an integer @@ -79,16 +79,31 @@ typedef EMACS_INT Lisp_Object; #define Lisp_Type_Int_Bit (Lisp_Type_Int_Even & Lisp_Type_Int_Odd) -#define wrap_pointer_1(ptr) ((Lisp_Object) (ptr)) -#define make_int(x) ((Lisp_Object) (((x) << INT_GCBITS) | Lisp_Type_Int_Bit)) -#define volatile_make_int(x) make_int (x) -#define make_char(x) ((Lisp_Object) (((x) << GCBITS) | Lisp_Type_Char)) #define VALMASK (((1UL << VALBITS) - 1UL) << GCTYPEBITS) #define XTYPE(x) ((enum Lisp_Type) (((EMACS_UINT)(x)) & ~VALMASK)) #define XPNTRVAL(x) (x) /* This depends on Lisp_Type_Record == 0 */ #define XCHARVAL(x) ((x) >> GCBITS) #define XREALINT(x) ((x) >> INT_GCBITS) #define XUINT(x) ((EMACS_UINT)(x) >> INT_GCBITS) + +#define wrap_pointer_1(ptr) ((Lisp_Object) (ptr)) + +DECLARE_INLINE_HEADER ( +Lisp_Object +make_int_verify (EMACS_INT val) +) +{ + Lisp_Object obj = (Lisp_Object) ((val << INT_GCBITS) | Lisp_Type_Int_Bit); + type_checking_assert (XREALINT (obj) == val); + return obj; +} + +#define make_int(x) ((Lisp_Object) (((x) << INT_GCBITS) | Lisp_Type_Int_Bit)) + +#define volatile_make_int(x) make_int (x) + +#define make_char_1(x) ((Lisp_Object) (((x) << GCBITS) | Lisp_Type_Char)) + #define INTP(x) ((EMACS_UINT)(x) & Lisp_Type_Int_Bit) #define INT_PLUS(x,y) ((x)+(y)-Lisp_Type_Int_Bit) #define INT_MINUS(x,y) ((x)-(y)+Lisp_Type_Int_Bit) @@ -99,12 +114,17 @@ #define Qnull_pointer ((Lisp_Object) 0) #define EQ(x,y) ((x) == (y)) +/* WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + You can only VOID_TO_LISP something that had previously been + LISP_TO_VOID'd. You cannot go the other way, i.e. create a bogus + Lisp_Object. If you want to stuff a void * into a Lisp_Object, use + make_opaque_ptr(). */ + /* Convert between a (void *) and a Lisp_Object, as when the Lisp_Object is passed to a toolkit callback function */ -#define VOID_TO_LISP(larg,varg) ((void) ((larg) = ((Lisp_Object) (varg)))) -#define CVOID_TO_LISP VOID_TO_LISP +#define VOID_TO_LISP(varg) ((Lisp_Object) (varg)) #define LISP_TO_VOID(larg) ((void *) (larg)) -#define LISP_TO_CVOID(larg) ((const void *) (larg)) /* Convert a Lisp_Object into something that can't be used as an lvalue. Useful for type-checking. */ diff --text -u 'xemacs-21.5.6/src/lisp-union.h' 'xemacs-21.5.7/src/lisp-union.h' Index: ././src/lisp-union.h --- ././src/lisp-union.h Mon Apr 1 12:58:41 2002 +++ ././src/lisp-union.h Wed Jun 5 18:56:17 2002 @@ -77,23 +77,39 @@ GCC to accept any (yes, any) pointer as the argument of a function declared to accept a Lisp_Object. */ struct nosuchstruct *v; - const struct nosuchstruct *cv; } Lisp_Object; #define XCHARVAL(x) ((x).gu.val) -# define XPNTRVAL(x) ((x).ui) +#define XPNTRVAL(x) ((x).ui) -INLINE_HEADER Lisp_Object make_int (EMACS_INT val); -INLINE_HEADER Lisp_Object -make_int (EMACS_INT val) +#define XREALINT(x) ((x).s.val) +#define XUINT(x) ((x).u.val) +#define XTYPE(x) ((x).gu.type) +#define EQ(x,y) ((x).v == (y).v) + +DECLARE_INLINE_HEADER ( +Lisp_Object +make_int_verify (EMACS_INT val) +) { Lisp_Object obj; obj.s.bits = 1; obj.s.val = val; + type_checking_assert (XREALINT (obj) == val); return obj; } +DECLARE_INLINE_HEADER ( +Lisp_Object +make_int (EMACS_INT val) +) +{ + Lisp_Object obj; + obj.s.bits = 1; + obj.s.val = val; + return obj; +} #ifdef __cplusplus @@ -109,9 +125,10 @@ already has a built-in system for dealing with non-local exits and such, in a smart way that doesn't clobber registers, and incorporates longjmp() into that. */ -INLINE_HEADER Lisp_Object volatile_make_int (EMACS_INT val); -INLINE_HEADER Lisp_Object +DECLARE_INLINE_HEADER ( +Lisp_Object volatile_make_int (EMACS_INT val) +) { volatile Lisp_Object obj; obj.s.bits = 1; @@ -121,10 +138,10 @@ #endif /* __cplusplus */ - -INLINE_HEADER Lisp_Object make_char (Emchar val); -INLINE_HEADER Lisp_Object -make_char (Emchar val) +DECLARE_INLINE_HEADER ( +Lisp_Object +make_char_1 (Ichar val) +) { Lisp_Object obj; obj.gu.type = Lisp_Type_Char; @@ -132,9 +149,10 @@ return obj; } -INLINE_HEADER Lisp_Object wrap_pointer_1 (const void *ptr); -INLINE_HEADER Lisp_Object +DECLARE_INLINE_HEADER ( +Lisp_Object wrap_pointer_1 (const void *ptr) +) { Lisp_Object obj; obj.ui = (EMACS_UINT) ptr; @@ -143,25 +161,32 @@ extern Lisp_Object Qnull_pointer, Qzero; -#define XREALINT(x) ((x).s.val) -#define XUINT(x) ((x).u.val) -#define XTYPE(x) ((x).gu.type) -#define EQ(x,y) ((x).v == (y).v) - #define INTP(x) ((x).s.bits) #define INT_PLUS(x,y) make_int (XINT (x) + XINT (y)) #define INT_MINUS(x,y) make_int (XINT (x) - XINT (y)) #define INT_PLUS1(x) make_int (XINT (x) + 1) #define INT_MINUS1(x) make_int (XINT (x) - 1) +/* WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + You can only VOID_TO_LISP something that had previously been + LISP_TO_VOID'd. You cannot go the other way, i.e. create a bogus + Lisp_Object. If you want to stuff a void * into a Lisp_Object, use + make_opaque_ptr(). */ + /* Convert between a (void *) and a Lisp_Object, as when the Lisp_Object is passed to a toolkit callback function */ -#define VOID_TO_LISP(larg,varg) \ - ((void) ((larg).v = (struct nosuchstruct *) (varg))) -#define CVOID_TO_LISP(larg,varg) \ - ((void) ((larg).cv = (const struct nosuchstruct *) (varg))) +DECLARE_INLINE_HEADER ( +Lisp_Object +VOID_TO_LISP (const void *arg) +) +{ + Lisp_Object larg; + larg.v = (struct nosuchstruct *) arg; + return larg; +} + #define LISP_TO_VOID(larg) ((void *) ((larg).v)) -#define LISP_TO_CVOID(larg) ((const void *) ((larg).cv)) /* Convert a Lisp_Object into something that can't be used as an lvalue. Useful for type-checking. */ diff --text -u 'xemacs-21.5.6/src/lisp.h' 'xemacs-21.5.7/src/lisp.h' Index: ././src/lisp.h --- ././src/lisp.h Wed Apr 3 19:47:51 2002 +++ ././src/lisp.h Fri Jun 28 23:24:08 2002 @@ -22,6 +22,31 @@ /* Synched up with: FSF 19.30. */ +/* Authorship: + + Based on code from pre-release FSF 19, c. 1991. + Various changes by Jamie Zawinski 1991-1994: + converting to ANSI C, splitting out function prototypes to a separate + file (later moved back for unknown reasons by Steve Baur?), debug-gcpro + stuff (now moribund). + ANSI-fication of DEFUN macros by Felix Lee, c. 1992? + NOT_REACHED, DOESNT_RETURN, PRINTF_ARGS by Richard Mlynarik, c. 1994. + Many changes over the years corresponding to Lisp_Object definition + changes, esp. by Richard Mlynarik (c. 1993) and Kyle Jones (c. 1998). + See alloc.c for more details. + Overhauled and reordered by Ben Wing, 1995-1996, and many things added: + Dynarrs, REALLOC macros, asserts, typedefs, inline header code, + first LIST_LOOP macros, CONCHECK_*, all error-checking code + (e.g. error-checking versions of XFOO macros), structure read syntax, + weak lists, lcrecord lists, reworking of quit handling, object hashing, + nested GCPRO, character objects and Ebola checking, memory usage stats, + others. + LOADHIST changes from Steve Baur, c. 1997? + Various macro-related changes by Martin Buchholz, 1998-1999: + LIST_LOOP macros greatly expanded and tortoise-hared; + RETURN_SANS_WARNINGS; reworked DEFUN macros; EXFUN macros (???). +*/ + #ifndef INCLUDED_lisp_h_ #define INCLUDED_lisp_h_ @@ -45,6 +70,21 @@ #include #include +/* --------------------- error-checking sublevels --------------------- */ + +/* The large categories established by configure can be subdivided into + smaller subcategories, for problems in specific modules. You can't + control this using configure, but you can manually stick in a define as + necessary. */ + +#ifdef ERROR_CHECK_STRUCTURES +/* Check for problems with the catch list and specbind stack */ +#define ERROR_CHECK_CATCH +/* Check for insufficient use of call_trapping_problems(), particularly + due to glyph-related changes causing eval or QUIT within redisplay */ +#define ERROR_CHECK_TRAPPING_PROBLEMS +#endif + /* ------------------------ definition of EMACS_INT ------------------- */ /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit. @@ -77,6 +117,64 @@ #define BITS_PER_EMACS_INT (SIZEOF_EMACS_INT * BITS_PER_CHAR) +#if SIZEOF_SHORT == 2 +#define INT_16_BIT short +#define UINT_16_BIT unsigned short +#elif SIZEOF_INT == 2 +/* Bwa ha ha. As if XEmacs could actually support such systems. */ +#define INT_16_BIT int +#define UINT_16_BIT unsigned int +#else +#error Unable to find a 16-bit integral type +#endif + +#if SIZEOF_INT == 4 +#define INT_32_BIT int +#define UINT_32_BIT unsigned int +#define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##U +#elif SIZEOF_LONG == 4 +/* Bwa ha ha again. */ +#define INT_32_BIT long +#define UINT_32_BIT unsigned long +#define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##UL +#elif SIZEOF_SHORT == 4 +/* And again. */ +#define INT_32_BIT short +#define UINT_32_BIT unsigned short +#define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##U +#elif /* Unable to find a 32-bit integral type! */ +#error What kind of strange-ass system are you running on? +#endif + +#if SIZEOF_LONG == 8 +#define INT_64_BIT long +#define UINT_64_BIT unsigned long +#define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##UL +#elif SIZEOF_LONG_LONG == 8 +#define INT_64_BIT long long +#define UINT_64_BIT unsigned long long +#define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##ULL +/* No error otherwise; just leave undefined */ +#endif + +#if SIZEOF_LONG_LONG == 16 +#define INT_128_BIT long long +#define UINT_128_BIT unsigned long long +#define MAKE_128_BIT_UNSIGNED_CONSTANT(num) num##ULL +/* No error otherwise; just leave undefined */ +#endif + +/* #### Fill this in for other systems */ +#if defined (INT_64_BIT) && !(defined (i386) || defined (__i386__)) +#define EFFICIENT_INT_64_BIT INT_64_BIT +#define EFFICIENT_UINT_64_BIT UINT_64_BIT +#endif + +#if defined (INT_128_BIT) +#define EFFICIENT_INT_128_BIT INT_128_BIT +#define EFFICIENT_UINT_128_BIT UINT_128_BIT +#endif + /* ------------------------ basic char/int typedefs ------------------- */ /* The definitions we put here use typedefs to attribute specific meaning @@ -96,20 +194,20 @@ functions declared as such. */ /* The data representing the text in a buffer is logically a set - of Intbytes, declared as follows. */ + of Ibytes, declared as follows. */ -typedef unsigned char Intbyte; +typedef unsigned char Ibyte; /* The following should be used when you are working with internal data but for whatever reason need to have it declared a "char *". Examples are function arguments whose values are most commonly literal strings, or where you have to apply a stdlib string function to internal data. - In general, you should avoid this where possible and use Intbyte instead, + In general, you should avoid this where possible and use Ibyte instead, for consistency. For example, the new Mule workspace contains - Intbyte versions of the stdlib string functions. */ + Ibyte versions of the stdlib string functions. */ -typedef char CIntbyte; +typedef char CIbyte; /* The data representing a string in "external" format (binary or any external encoding) is logically a set of Extbytes, declared as @@ -131,29 +229,524 @@ typedef char Char_ASCII; typedef unsigned char UChar_ASCII; +/* To the user, a buffer is made up of characters. In the non-Mule world, + characters and Ibytes are equivalent, restricted to the range 0 - 255. + In the Mule world, many more characters are possible (19 bits worth, + more or less), and a character requires (typically) 1 to 4 Ibytes for + its representation in a buffer or string. Note that the representation + of a character by itself, in a variable, is very different from its + representation in a string of text (in a buffer or Lisp string). + + Under Mule, text can be represented in more than one way. The "default" + format is variable-width (1 to 4 bytes) and compatible with ASCII -- + ASCII chars are stored in one byte, as themselves, and all other chars + use only high bytes. The default format is currently the only format + used for text stored anywhere but in a buffer. In a buffer, other + formats -- fixed-width formats (1, 2, or 4 bytes) -- are possible, for + speed. + + See text.c/text.h for a detailed discussion of all of this. */ + +/* A character, as represented on its own. */ + +typedef int Ichar; + +/* The "raw value" of a character as stored in the buffer. In the default + format, this is just the same as the character. In fixed-width formats, + this is the actual value in the buffer, which will be limited to the + range as established by the format. This is used when searching for a + character in a buffer -- it's faster to convert the character to the raw + value and look for that, than repeatedly convert each raw value in the + buffer into a character. */ + +typedef int Raw_Ichar; + + +#if !defined (__cplusplus) || !defined (CPLUSPLUS_INTEGRAL_CLASSES_NOT_YET) -/* To the user, a buffer is made up of characters, declared as follows. - In the non-Mule world, characters and Intbytes are equivalent. - In the Mule world, a character requires (typically) 1 to 4 - Intbytes for its representation in a buffer. */ +/* Counts of bytes or chars */ -typedef int Emchar; +typedef EMACS_INT Bytecount; +typedef EMACS_INT Charcount; /* Different ways of referring to a position in a buffer. We use the typedefs in preference to 'EMACS_INT' to make it clearer what - sort of position is being used. See extents.c for a description - of the different positions. We put them here instead of in - buffer.h (where they rightfully belong) to avoid syntax errors - in function prototypes. */ + sort of position is being used. See text.c for a description + of the different positions. + Note that buffer positions are 1-based, and there's a gap in the middle + of a buffer; that's why we have separate typedefs. For Lisp strings and + other strings of text, we just use Bytecount and Charcount. */ typedef EMACS_INT Charbpos; typedef EMACS_INT Bytebpos; typedef EMACS_INT Membpos; -/* Counts of bytes or chars */ -typedef EMACS_INT Bytecount; -typedef EMACS_INT Charcount; +/* Different ways of referring to a position that can be either in a buffer + or string; used when passing around an object that can be either a + buffer or string, and an associated position. Conceptually, they + resolve as follows: + + Typedef Buffer String + ------------------------------------------------------ + Charxpos Charbpos Charcount + Bytexpos Bytebpos Bytecount + Memxpos Membpos Bytecount + + */ + +typedef EMACS_INT Charxpos; +typedef EMACS_INT Bytexpos; +typedef EMACS_INT Memxpos; + +#else /* __cplusplus */ + +/* Implement strong type-checking of the above integral types by declaring + them to be classes and using operator overloading. Unfortunately this + is a huge pain in the ass because C++ doesn't strongly distinguish + "bool" and "size_t" from int. The problem is especially bad with "bool" + -- if you want to be able to say 'if (len--)' where len is e.g. a + Bytecount, you need to declare a conversion operator to bool(); and + since bool is just an alias for int, you suddenly get tons and tons of + ambiguities, which need to be resolved by lots of laborious declarations + for every single possible type combination. Hence the multitude of + declarations in DECLARE_INTCLASS_ARITH_COMPARE(). The bool/int + equivalence also means that we have to forcibly block the combinations + we don't want by creating overloaded versions of them and declaring them + private. */ + +#undef class +#undef this + +class Bytecount; +class Bytebpos; +class Bytexpos; +class Charcount; +class Charbpos; +class Charxpos; +class Membpos; +class Memxpos; + +/* Declare the arithmetic and comparison operations for an integral class, + i.e. one of the above classes. If this is a "position" class, where the + difference between two positions is a different class (a "count" class), + then use POSCL for the position class and COUNTCL for the count class. + If this is a simple class, where all operations yield the same class, + substitute the same class for POSCL and COUNTCL. */ + +#define DECLARE_INTCLASS_ARITH_COMPARE(poscl, countcl) \ + poscl operator += (const countcl& l) { data += l.data; return *this; } \ + poscl operator -= (const countcl& l) { data -= l.data; return *this; } \ + poscl operator + (const countcl& l) const { return poscl (data + l.data); } \ + poscl operator - (const countcl& l) const { return poscl (data - l.data); } \ + poscl operator += (const int& l) { data += l; return *this; } \ + poscl operator -= (const int& l) { data -= l; return *this; } \ + poscl operator + (const int& l) const { return poscl (data + l); } \ + poscl operator - (const int& l) const { return poscl (data - l); } \ + poscl operator += (const unsigned int& l) { data += l; return *this; } \ + poscl operator -= (const unsigned int& l) { data -= l; return *this; } \ + poscl operator + (const unsigned int& l) const \ + { return poscl (data + l); } \ + poscl operator - (const unsigned int& l) const \ + { return poscl (data - l); } \ + poscl operator += (const long& l) { data += l; return *this; } \ + poscl operator -= (const long& l) { data -= l; return *this; } \ + poscl operator + (const long& l) const { return poscl (data + l); } \ + poscl operator - (const long& l) const { return poscl (data - l); } \ + poscl operator += (const unsigned long& l) { data += l; return *this; } \ + poscl operator -= (const unsigned long& l) { data -= l; return *this; } \ + poscl operator + (const unsigned long& l) const \ + { return poscl (data + l); } \ + poscl operator - (const unsigned long& l) const \ + { return poscl (data - l); } \ + poscl operator += (const short& l) { data += l; return *this; } \ + poscl operator -= (const short& l) { data -= l; return *this; } \ + poscl operator + (const short& l) const { return poscl (data + l); } \ + poscl operator - (const short& l) const { return poscl (data - l); } \ + poscl operator += (const unsigned short& l) { data += l; return *this; } \ + poscl operator -= (const unsigned short& l) { data -= l; return *this; } \ + poscl operator + (const unsigned short& l) const \ + { return poscl (data + l); } \ + poscl operator - (const unsigned short& l) const \ + { return poscl (data - l); } \ + \ + poscl operator *= (const countcl& l) { data *= l.data; return *this; } \ + poscl operator /= (const countcl& l) { data /= l.data; return *this; } \ + poscl operator * (const countcl& l) const { return poscl (data * l.data); } \ + poscl operator / (const countcl& l) const { return poscl (data / l.data); } \ + poscl operator *= (const int& l) { data *= l; return *this; } \ + poscl operator /= (const int& l) { data /= l; return *this; } \ + poscl operator * (const int& l) const { return poscl (data * l); } \ + poscl operator / (const int& l) const { return poscl (data / l); } \ + poscl operator *= (const unsigned int& l) { data *= l; return *this; } \ + poscl operator /= (const unsigned int& l) { data /= l; return *this; } \ + poscl operator * (const unsigned int& l) const { return poscl (data * l); } \ + poscl operator / (const unsigned int& l) const { return poscl (data / l); } \ + poscl operator *= (const long& l) { data *= l; return *this; } \ + poscl operator /= (const long& l) { data /= l; return *this; } \ + poscl operator * (const long& l) const { return poscl (data * l); } \ + poscl operator / (const long& l) const { return poscl (data / l); } \ + poscl operator *= (const unsigned long& l) { data *= l; return *this; } \ + poscl operator /= (const unsigned long& l) { data /= l; return *this; } \ + poscl operator * (const unsigned long& l) const \ + { return poscl (data * l); } \ + poscl operator / (const unsigned long& l) const \ + { return poscl (data / l); } \ + poscl operator *= (const short& l) { data *= l; return *this; } \ + poscl operator /= (const short& l) { data /= l; return *this; } \ + poscl operator * (const short& l) const { return poscl (data * l); } \ + poscl operator / (const short& l) const { return poscl (data / l); } \ + poscl operator *= (const unsigned short& l) { data *= l; return *this; } \ + poscl operator /= (const unsigned short& l) { data /= l; return *this; } \ + poscl operator * (const unsigned short& l) const \ + { return poscl (data * l); } \ + poscl operator / (const unsigned short& l) const \ + { return poscl (data / l); } \ + \ + poscl operator &= (const countcl& l) { data &= l.data; return *this; } \ + poscl operator |= (const countcl& l) { data |= l.data; return *this; } \ + poscl operator & (const countcl& l) const { return poscl (data & l.data); } \ + poscl operator | (const countcl& l) const { return poscl (data | l.data); } \ + poscl operator &= (const int& l) { data &= l; return *this; } \ + poscl operator |= (const int& l) { data |= l; return *this; } \ + poscl operator & (const int& l) const { return poscl (data & l); } \ + poscl operator | (const int& l) const { return poscl (data | l); } \ + poscl operator &= (const unsigned int& l) { data &= l; return *this; } \ + poscl operator |= (const unsigned int& l) { data |= l; return *this; } \ + poscl operator & (const unsigned int& l) const { return poscl (data & l); } \ + poscl operator | (const unsigned int& l) const { return poscl (data | l); } \ + poscl operator &= (const long& l) { data &= l; return *this; } \ + poscl operator |= (const long& l) { data |= l; return *this; } \ + poscl operator & (const long& l) const { return poscl (data & l); } \ + poscl operator | (const long& l) const { return poscl (data | l); } \ + poscl operator &= (const unsigned long& l) { data &= l; return *this; } \ + poscl operator |= (const unsigned long& l) { data |= l; return *this; } \ + poscl operator & (const unsigned long& l) const \ + { return poscl (data & l); } \ + poscl operator | (const unsigned long& l) const \ + { return poscl (data | l); } \ + poscl operator &= (const short& l) { data &= l; return *this; } \ + poscl operator |= (const short& l) { data |= l; return *this; } \ + poscl operator & (const short& l) const { return poscl (data & l); } \ + poscl operator | (const short& l) const { return poscl (data | l); } \ + poscl operator &= (const unsigned short& l) { data &= l; return *this; } \ + poscl operator |= (const unsigned short& l) { data |= l; return *this; } \ + poscl operator & (const unsigned short& l) const \ + { return poscl (data & l); } \ + poscl operator | (const unsigned short& l) const \ + { return poscl (data | l); } \ + \ + poscl operator - () { return poscl (-data); } \ + poscl operator-- () { data--; return *this; } \ + poscl operator-- (int) { data--; return poscl (data + 1); } \ + poscl operator++ () { data++; return *this; } \ + poscl operator++ (int) { data++; return poscl (data - 1); } \ + \ + bool operator < (const poscl& l) const { return data < l.data; } \ + bool operator <= (const poscl& l) const { return data <= l.data; } \ + bool operator > (const poscl& l) const { return data > l.data; } \ + bool operator >= (const poscl& l) const { return data >= l.data; } \ + bool operator == (const poscl& l) const { return data == l.data; } \ + bool operator != (const poscl& l) const { return data != l.data; } \ + bool operator < (const int& l) const { return data < (EMACS_INT) l; } \ + bool operator <= (const int& l) const { return data <= (EMACS_INT) l; } \ + bool operator > (const int& l) const { return data > (EMACS_INT) l; } \ + bool operator >= (const int& l) const { return data >= (EMACS_INT) l; } \ + bool operator == (const int& l) const { return data == (EMACS_INT) l; } \ + bool operator != (const int& l) const { return data != (EMACS_INT) l; } \ + bool operator < (const unsigned int& l) const \ + { return data < (EMACS_INT) l; } \ + bool operator <= (const unsigned int& l) const \ + { return data <= (EMACS_INT) l; } \ + bool operator > (const unsigned int& l) const \ + { return data > (EMACS_INT) l; } \ + bool operator >= (const unsigned int& l) const \ + { return data >= (EMACS_INT) l; } \ + bool operator == (const unsigned int& l) const \ + { return data == (EMACS_INT) l; } \ + bool operator != (const unsigned int& l) const \ + { return data != (EMACS_INT) l; } \ + bool operator < (const long& l) const { return data < (EMACS_INT) l; } \ + bool operator <= (const long& l) const { return data <= (EMACS_INT) l; } \ + bool operator > (const long& l) const { return data > (EMACS_INT) l; } \ + bool operator >= (const long& l) const { return data >= (EMACS_INT) l; } \ + bool operator == (const long& l) const { return data == (EMACS_INT) l; } \ + bool operator != (const long& l) const { return data != (EMACS_INT) l; } \ + bool operator < (const unsigned long& l) const \ + { return data < (EMACS_INT) l; } \ + bool operator <= (const unsigned long& l) const \ + { return data <= (EMACS_INT) l; } \ + bool operator > (const unsigned long& l) const \ + { return data > (EMACS_INT) l; } \ + bool operator >= (const unsigned long& l) const \ + { return data >= (EMACS_INT) l; } \ + bool operator == (const unsigned long& l) const \ + { return data == (EMACS_INT) l; } \ + bool operator != (const unsigned long& l) const \ + { return data != (EMACS_INT) l; } \ + bool operator < (const short& l) const { return data < (EMACS_INT) l; } \ + bool operator <= (const short& l) const { return data <= (EMACS_INT) l; } \ + bool operator > (const short& l) const { return data > (EMACS_INT) l; } \ + bool operator >= (const short& l) const { return data >= (EMACS_INT) l; } \ + bool operator == (const short& l) const { return data == (EMACS_INT) l; } \ + bool operator != (const short& l) const { return data != (EMACS_INT) l; } \ + bool operator < (const unsigned short& l) const \ + { return data < (EMACS_INT) l; } \ + bool operator <= (const unsigned short& l) const \ + { return data <= (EMACS_INT) l; } \ + bool operator > (const unsigned short& l) const \ + { return data > (EMACS_INT) l; } \ + bool operator >= (const unsigned short& l) const \ + { return data >= (EMACS_INT) l; } \ + bool operator == (const unsigned short& l) const \ + { return data == (EMACS_INT) l; } \ + bool operator != (const unsigned short& l) const \ + { return data != (EMACS_INT) l; } \ + bool operator ! () const { return !data; } + +/* Declare the "bad" or disallowed arithmetic and comparion operations + between class GOOD and class BAD. Meant to go inside the private + section of class GOOD. */ + +#define DECLARE_BAD_INTCLASS_ARITH_COMPARE(good, bad) \ + good operator += (const bad& l) { return badret; } \ + good operator -= (const bad& l) { return badret; } \ + good operator *= (const bad& l) { return badret; } \ + good operator /= (const bad& l) { return badret; } \ + good operator + (const bad& l) { return badret; } \ + good operator - (const bad& l) { return badret; } \ + good operator * (const bad& l) { return badret; } \ + good operator / (const bad& l) { return badret; } \ + \ + bool operator < (const bad& l) { return 0; } \ + bool operator <= (const bad& l) { return 0; } \ + bool operator > (const bad& l) { return 0; } \ + bool operator >= (const bad& l) { return 0; } \ + bool operator == (const bad& l) { return 0; } \ + bool operator != (const bad& l) { return 0; } + +/* Declare the "bad" or disallowed arithmetic operations between class GOOD + and another of the same class, for a position class. Meant to go inside + the private section of class GOOD. */ + +#define DECLARE_BAD_POS_CLASS_ARITH(good) \ + good operator += (const good& l) { return badret; } \ + good operator -= (const good& l) { return badret; } \ + good operator *= (const good& l) { return badret; } \ + good operator /= (const good& l) { return badret; } \ + good operator + (const good& l) { return badret; } \ + good operator * (const good& l) { return badret; } \ + good operator / (const good& l) { return badret; } + +/* Basic declaration at the top of all integral classes. Don't call + directly, use one of the more specific versions below. */ + +#define DECLARE_INTCLASS(cl) \ + public: \ + EMACS_INT data; \ + cl () { data = 0xCDCDCDCD; } \ + cl (int i) { data = i; } \ + cl (unsigned int i) { data = i; } \ + cl (long i) { data = i; } \ + cl (unsigned long i) { data = i; } \ + cl (short i) { data = i; } \ + cl (unsigned short i) { data = i; } \ + operator EMACS_INT () const { return data; } + +/* Basic declaration at the top of all count classes. */ + +#define DECLARE_COUNT_CLASS(cl) \ + DECLARE_INTCLASS (cl) \ + DECLARE_INTCLASS_ARITH_COMPARE (cl, cl) \ + private: \ + static cl badret; + +/* Basic declaration at the bottom of the prelude of all position classes. + Don't call directly. */ + +#define DECLARE_POS_CLASS_SECOND_HALF(cl, countcl) \ + DECLARE_INTCLASS_ARITH_COMPARE (cl, countcl) \ + countcl operator - (const cl& l) const { return countcl (data - l.data); } \ + private: \ + static cl badret; \ + DECLARE_BAD_POS_INTCLASS_ARITH (cl) + +/* Basic declaration at the top of all buffer position classes. */ + +#define DECLARE_BPOS_CLASS(cl, countcl) \ + DECLARE_INTCLASS (cl) \ + DECLARE_POS_CLASS_SECOND_HALF (cl, countcl) + +/* Basic declaration at the top of all X-position classes (that can refer + to buffers or strings). CL1 and CL2 are the equivalent more specific + classes referring only to buffers or strings, respefitvely. */ + +#define DECLARE_XPOS_CLASS(cl, countcl, cl1, cl2) \ + DECLARE_INTCLASS (cl) \ + cl (const cl1& x) { data = x.data; } \ + cl (const cl2& x) { data = x.data; } \ + operator cl1 () const { return cl1 (data); } \ + operator cl2 () const { return cl2 (data); } \ + DECLARE_POS_CLASS_SECOND_HALF (cl, countcl) + +/* Declare the "bad" or disallowed arithmetic and comparion operations + between class CHARCL (a character class) and various non-character + classes. Meant to go inside the private section of class GOOD. */ + +#define DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE(charcl) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytecount) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytebpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytexpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Membpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Memxpos) + +/* Declare the "bad" or disallowed arithmetic and comparion operations + between class BYTECL (a byte class) and various non-byte classes. + Meant to go inside the private section of class GOOD. */ + +#define DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE(bytecl) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charcount) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charbpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charxpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Membpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Memxpos) + +/* Declare the "bad" or disallowed arithmetic and comparion operations + between class BYTECL (a mem class) and various non-mem classes. + Meant to go inside the private section of class GOOD. */ + +#define DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE(bytecl) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charcount) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charbpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charxpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Bytebpos) \ + DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Bytexpos) + +class Charcount +{ + DECLARE_COUNT_CLASS (Charcount) + DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charcount) +}; + +class Charbpos +{ + DECLARE_BPOS_CLASS (Charbpos, Charcount) + DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charbpos) +}; + +class Charxpos +{ + DECLARE_XPOS_CLASS (Charxpos, Charcount, Charbpos, Charcount) + DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charxpos) +}; + +class Bytecount +{ + DECLARE_COUNT_CLASS (Bytecount) + DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytecount) +}; + +class Bytebpos +{ + DECLARE_BPOS_CLASS (Bytebpos, Bytecount) + DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytebpos) +}; + +class Bytexpos +{ + DECLARE_XPOS_CLASS (Bytexpos, Bytecount, Bytebpos, Bytecount) + DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytexpos) +}; + +class Membpos +{ + DECLARE_BPOS_CLASS (Membpos, Bytecount) + DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE (Membpos) +}; + +class Memxpos +{ + DECLARE_XPOS_CLASS (Memxpos, Bytecount, Membpos, Bytecount) + DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE (Memxpos) +}; + +#define DECLARE_POINTER_TYPE_ARITH_COUNT(pointer, countcl) \ +inline pointer operator += (const pointer & x, const countcl& y) \ +{ x += y.data; return x; } \ +inline pointer operator -= (const pointer & x, const countcl& y) \ +{ x -= y.data; return x; } \ +inline pointer operator + (const pointer x, const countcl& y) \ +{ return x + y.data; } \ +inline pointer operator - (const pointer x, const countcl& y) \ +{ return x - y.data; } + +#define DECLARE_INTEGRAL_TYPE_ARITH_COUNT(integral, countcl) \ +inline integral operator += (integral & x, const countcl& y) \ +{ x += y.data; return x; } \ +inline integral operator -= (integral & x, const countcl& y) \ +{ x -= y.data; return x; } \ +inline countcl operator + (integral x, const countcl& y) \ +{ return countcl (x + y.data); } \ +inline countcl operator - (integral x, const countcl& y) \ +{ return countcl (x - y.data); } + +#define DECLARE_INTEGRAL_TYPE_COMPARE(integral, cl) \ +inline bool operator < (integral x, const cl& y) \ + { return (EMACS_INT) x < y.data; } \ +inline bool operator <= (integral x, const cl& y) \ + { return (EMACS_INT) x <= y.data; } \ +inline bool operator > (integral x, const cl& y) \ + { return (EMACS_INT) x > y.data; } \ +inline bool operator >= (integral x, const cl& y) \ + { return (EMACS_INT) x >= y.data; } \ +inline bool operator == (integral x, const cl& y) \ + { return (EMACS_INT) x == y.data; } \ +inline bool operator != (integral x, const cl& y) \ + { return (EMACS_INT) x != y.data; } + +#if 0 +/* Unfortunately C++ doesn't let you overload the ?: operator, so we have + to manually deal with ambiguities using casting */ +#define DECLARE_INTEGRAL_TYPE_TRISTATE(integral, cl) \ +inline cl operator ?: (bool b, integral x, const cl& y) \ + { return b ? cl (x) : y; } \ +inline cl operator ?: (bool b, const cl& x, integral y) \ + { return b ? x : cl (y); } +#endif /* 0 */ + +/* DECLARE_POINTER_TYPE_ARITH_COUNT (const Ibyte *, Bytecount); + DECLARE_POINTER_TYPE_ARITH_COUNT (const Extbyte *, Bytecount); */ +DECLARE_POINTER_TYPE_ARITH_COUNT (Ibyte *, Bytecount); +DECLARE_POINTER_TYPE_ARITH_COUNT (Extbyte *, Bytecount); + +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (int, Bytecount); +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (int, Charcount); +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned int, Bytecount); +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned int, Charcount); +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (long, Bytecount); +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (long, Charcount); +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned long, Bytecount); +DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned long, Charcount); + +DECLARE_INTEGRAL_TYPE_COMPARE (int, Bytecount); +DECLARE_INTEGRAL_TYPE_COMPARE (int, Charcount); +DECLARE_INTEGRAL_TYPE_COMPARE (unsigned int, Bytecount); +DECLARE_INTEGRAL_TYPE_COMPARE (unsigned int, Charcount); +DECLARE_INTEGRAL_TYPE_COMPARE (long, Bytecount); +DECLARE_INTEGRAL_TYPE_COMPARE (long, Charcount); +DECLARE_INTEGRAL_TYPE_COMPARE (unsigned long, Bytecount); +DECLARE_INTEGRAL_TYPE_COMPARE (unsigned long, Charcount); + +#if 0 /* doesn't work */ +inline Bytecount operator - (const Ibyte *x, const Ibyte *y) \ + { return Bytecount (x - y); } +#endif + +#define class c_class +#define this c_this + +#endif /* __cplusplus */ + /* Counts of elements */ typedef EMACS_INT Elemcount; /* Hash codes */ @@ -302,16 +895,25 @@ #define ALIGN_SIZE(len, unit) \ ((((len) + (unit) - 1) / (unit)) * (unit)) +/* ALIGN_FOR_TYPE returns the smallest size greater than or equal to LEN + which is aligned for the given type. This can be used to assure that + data that follows a block of the returned size is of correct alignment + for the type (provided that the block itself is correctly aligned for + this type; memory returned by malloc() is guaranteed to be correctly + aligned for all types). */ + +#define ALIGN_FOR_TYPE(len, type) ALIGN_SIZE (len, ALIGNOF (type)) + /* MAX_ALIGN_SIZE returns the smallest size greater than or equal to LEN which guarantees that data following a block of such size is correctly aligned for all types (provided that the block itself is so aligned, which is the case for memory returned by malloc()). */ -#define MAX_ALIGN_SIZE(len) ALIGN_SIZE (len, ALIGNOF (max_align_t)) +#define MAX_ALIGN_SIZE(len) ALIGN_FOR_TYPE (len, max_align_t) -/* #### Yuck, this is kind of evil */ -#define ALIGN_PTR(ptr, unit) \ - ((void *) ALIGN_SIZE ((size_t) (ptr), unit)) +/* ALIGN_PTR returns the smallest pointer >= PTR which is aligned for + data of TYPE. */ +#define ALIGN_PTR(ptr, type) ((void *) ALIGN_FOR_TYPE ((size_t) (ptr), type)) /* ------------------------ assertions ------------------- */ @@ -333,18 +935,44 @@ void assert_failed (const char *, int, const char *); # define abort() (assert_failed (__FILE__, __LINE__, "abort()")) # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x)) +# define assert_with_message(x, msg) \ + ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg)) # define assert_at_line(x, file, line) \ ((x) ? (void) 0 : assert_failed (file, line, #x)) #else # ifdef DEBUG_XEMACS # define assert(x) ((x) ? (void) 0 : (void) abort ()) +# define assert_with_message(x, msg) ((x) ? (void) 0 : (void) abort ()) # define assert_at_line(x, file, line) assert (x) # else # define assert(x) ((void) 0) +# define assert_with_message(x, msg) # define assert_at_line(x, file, line) assert (x) # endif #endif +/* #### + Why the hell do we do this??????????????????????????????? */ +/*#ifdef DEBUG_XEMACS*/ +#define REGISTER +#define register +/*#else*/ +/*#define REGISTER register*/ +/*#endif*/ + + +/* EMACS_INT is the underlying integral type into which a Lisp_Object must fit. + In particular, it must be large enough to contain a pointer. + config.h can override this, e.g. to use `long long' for bigger lisp ints. + + #### In point of fact, it would NOT be a good idea for config.h to mess + with EMACS_INT. A lot of code makes the basic assumption that EMACS_INT + is the size of a pointer. */ + +#ifndef SIZEOF_EMACS_INT +# define SIZEOF_EMACS_INT SIZEOF_VOID_P +#endif + #if 0 #ifdef USE_ASSERTIONS /* Highly dubious kludge */ @@ -377,8 +1005,91 @@ #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue))) #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type))) #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type)))) -#define alloca_new(type) ((type *) alloca (sizeof (type))) -#define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type))) +#define alloca_new(type) ((type *) ALLOCA (sizeof (type))) +#define alloca_array(type, len) ((type *) ALLOCA ((len) * sizeof (type))) + +void *xemacs_c_alloca (unsigned int size); + +int record_unwind_protect_freeing (void *ptr); + +DECLARE_INLINE_HEADER ( +void * +xmalloc_and_record_unwind (Bytecount size) +) +{ + void *ptr = xmalloc (size); + record_unwind_protect_freeing (ptr); + return ptr; +} + +/* Stack allocation. + + Allocating excessively large blocks on the stack can cause crashes. + We provide MALLOC_OR_ALLOCA() below for places where it's likely that + large amounts will be allocated; it mallocs the block if it's too big. + Unfortunately, that requires a call to unbind_to() at the end of the + function, and it's not feasible to rewrite all calls to alloca() this + way. + + Instead, we use the portable C alloca() substitute in alloca.c above a + certain size. This actually uses malloc(), but checks the current stack + pointer to see if data from previous alloca() calls needs to be freed. + However, this can lead to large heap sizes -- especially since cleanup + can only happen in a parent function, and will never happen if (as will + often be the case) it's the same function in the same place in the code + that keeps tripping the alloca() limit. + + So we set up a system to periodically force cleanup. Currently we + do cleanup: + + -- Only when there's C alloca() data, and then + -- Every stack alloca() or allocation of Lisp data, every call to + next_event_internal() [typically near the top of the stack], + or every 10th funcall + + This should not be a big penalty because + + (a) If there are few C alloca() chunks, checking them will be fast + (b) If not, we've allocated a huge amount of heap space (remember, each + chunk represents > 256K of heap), and we really want them gone +*/ + +/* We use a larger maximum when the choice is alloca() vs. the C alloca() + substitute than when the choice is vs. malloc(), because in the former + case, our alternative choice is less palatable because the memory may + not be freed for awhile. */ + +#define MAX_ALLOCA_VS_C_ALLOCA 262144 +#define MAX_ALLOCA_VS_MALLOC 65536 + +#define MAX_FUNCALLS_BETWEEN_ALLOCA_CLEANUP 10 + +extern Bytecount __temp_alloca_size__; +extern Bytecount funcall_alloca_count; + +/* Do stack or heap alloca() depending on size. + +NOTE: The use of a global temporary like this is unsafe if ALLOCA() occurs +twice anywhere in the same expression; but that seems highly unlikely. The +alternative is to force all callers to declare a local temporary if the +expression has side effects -- something easy to forget. */ + +#define ALLOCA(size) \ + (__temp_alloca_size__ = (size), \ + __temp_alloca_size__ > MAX_ALLOCA_VS_C_ALLOCA ? \ + xemacs_c_alloca (__temp_alloca_size__) : \ + (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \ + alloca (__temp_alloca_size__))) + +/* WARNING: If you use this, you must unbind_to() at the end of your + function! */ + +#define MALLOC_OR_ALLOCA(size) \ + (__temp_alloca_size__ = (size), \ + __temp_alloca_size__ > MAX_ALLOCA_VS_MALLOC ? \ + xmalloc_and_record_unwind (__temp_alloca_size__) : \ + (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0, \ + alloca (__temp_alloca_size__))) /* also generally useful if you want to avoid arbitrary size limits but don't need a full dynamic array. Assumes that BASEVAR points @@ -437,7 +1148,7 @@ #define Dynarr_at(d, pos) ((d)->base[pos]) #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) #define Dynarr_begin(d) Dynarr_atp (d, 0) -#define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d)) +#define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d) - 1) #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize) #ifdef ERROR_CHECK_STRUCTURES @@ -499,10 +1210,7 @@ Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); #endif - -/************************************************************************/ -/* typedefs */ -/************************************************************************/ +/* Counts of bytes or chars */ /* Note that the simplest typedefs are near the top of this file. */ @@ -576,14 +1284,14 @@ typedef unsigned int USID; typedef int face_index; typedef int glyph_index; -typedef struct lstream Lstream; -typedef struct extent *EXTENT; +typedef struct lstream Lstream; /* lstream-impl.h */ +typedef struct extent *EXTENT; /* extents-impl.h */ typedef struct Lisp_Event Lisp_Event; /* "events.h" */ -typedef struct Lisp_Face Lisp_Face; /* "faces.h" */ +typedef struct Lisp_Face Lisp_Face; /* "faces-impl.h" */ typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */ -typedef struct Lisp_Color_Instance Lisp_Color_Instance; -typedef struct Lisp_Font_Instance Lisp_Font_Instance; -typedef struct Lisp_Image_Instance Lisp_Image_Instance; +typedef struct Lisp_Color_Instance Lisp_Color_Instance; /* objects-impl.h */ +typedef struct Lisp_Font_Instance Lisp_Font_Instance; /* objects-impl.h */ +typedef struct Lisp_Image_Instance Lisp_Image_Instance; /* glyphs-impl.h */ typedef struct Lisp_Gui_Item Lisp_Gui_Item; /* ------------------------------- */ @@ -594,8 +1302,8 @@ typedef struct { - Dynarr_declare (Intbyte); -} Intbyte_dynarr; + Dynarr_declare (Ibyte); +} Ibyte_dynarr; typedef struct { @@ -604,8 +1312,8 @@ typedef struct { - Dynarr_declare (Emchar); -} Emchar_dynarr; + Dynarr_declare (Ichar); +} Ichar_dynarr; typedef struct { @@ -848,7 +1556,7 @@ struct Lisp_Cons { struct lrecord_header lheader; - Lisp_Object car, cdr; + Lisp_Object car_, cdr_; }; typedef struct Lisp_Cons Lisp_Cons; @@ -877,8 +1585,12 @@ extern Lisp_Object Qnil; #define NILP(x) EQ (x, Qnil) -#define XCAR(a) (XCONS (a)->car) -#define XCDR(a) (XCONS (a)->cdr) +#define cons_car(a) ((a)->car_) +#define cons_cdr(a) ((a)->cdr_) +#define XCAR(a) (XCONS (a)->car_) +#define XCDR(a) (XCONS (a)->cdr_) +#define XSETCAR(a, b) (XCONS (a)->car_ = (b)) +#define XSETCDR(a, b) (XCONS (a)->cdr_ = (b)) #define LISTP(x) (CONSP(x) || NILP(x)) #define CHECK_LIST(x) do { \ @@ -1294,9 +2006,10 @@ ) /* Return 1 if LIST is properly acyclic and nil-terminated, else 0. */ -INLINE_HEADER int TRUE_LIST_P (Lisp_Object object); -INLINE_HEADER int +DECLARE_INLINE_HEADER ( +int TRUE_LIST_P (Lisp_Object object) +) { Lisp_Object hare, tortoise; EMACS_INT len; @@ -1356,17 +2069,17 @@ unsigned int c_readonly :1; unsigned int lisp_readonly :1; /* Number of chars at beginning of string that are one byte in length - (BYTE_ASCII_P) */ + (byte_ascii_p) */ unsigned int ascii_begin :21; } v; } u; Bytecount size_; - Intbyte *data_; + Ibyte *data_; Lisp_Object plist; }; typedef struct Lisp_String Lisp_String; -#define MAX_STRING_ASCII_BEGIN ((2 << 21) - 1) +#define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1) DECLARE_LRECORD (string, Lisp_String); #define XSTRING(x) XRECORD (x, string, Lisp_String) @@ -1375,184 +2088,27 @@ #define CHECK_STRING(x) CHECK_RECORD (x, string) #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string) -#ifdef MULE - -Charcount bytecount_to_charcount (const Intbyte *ptr, Bytecount len); -Bytecount charcount_to_bytecount (const Intbyte *ptr, Charcount len); - -#else /* not MULE */ - -# define bytecount_to_charcount(ptr, len) (len) -# define charcount_to_bytecount(ptr, len) (len) - -#endif /* not MULE */ +/* Most basic macros for strings -- basically just accessing or setting + fields -- are here. Everything else is in text.h, since they depend on + stuff there. */ /* Operations on Lisp_String *'s; only ones left */ -#define set_string_length(s, len) ((void) ((s)->size_ = (len))) -#define set_string_data(s, ptr) ((void) ((s)->data_ = (ptr))) +#define set_lispstringp_length(s, len) ((void) ((s)->size_ = (len))) +#define set_lispstringp_data(s, ptr) ((void) ((s)->data_ = (ptr))) +/* Operations on strings as Lisp_Objects. Don't manipulate Lisp_String *'s + in any new code. */ #define XSTRING_LENGTH(s) (XSTRING (s)->size_) #define XSTRING_PLIST(s) (XSTRING (s)->plist) #define XSTRING_DATA(s) (XSTRING (s)->data_ + 0) #define XSTRING_ASCII_BEGIN(s) (XSTRING (s)->u.v.ascii_begin + 0) -#define XSTRING_CHAR_LENGTH(s) \ - string_index_byte_to_char (s, XSTRING_LENGTH (s)) -#define XSTRING_BYTE(s, i) (XSTRING (s)->data_[i] + 0) -#define set_string_byte(s, i, c) (XSTRING (s)->data_[i] = (c)) - -#define string_byte_addr(s, i) (&((XSTRING (s))->data_[i])) -#define XSTRING_CHAR(s, i) charptr_emchar (string_char_addr (s, i)) -#define XSET_STRING_LENGTH(s, ptr) set_string_length (XSTRING (s), ptr) -#define XSET_STRING_DATA(s, ptr) set_string_data (XSTRING (s), ptr) +#define XSET_STRING_LENGTH(s, ptr) set_lispstringp_length (XSTRING (s), ptr) +#define XSET_STRING_DATA(s, ptr) set_lispstringp_data (XSTRING (s), ptr) /* WARNING: If you modify an existing string, you must call bump_string_modiff() afterwards. */ #define XSET_STRING_ASCII_BEGIN(s, val) \ ((void) (XSTRING (s)->u.v.ascii_begin = (val))) - -#ifdef ERROR_CHECK_TEXT -#define SLEDGEHAMMER_CHECK_ASCII_BEGIN -#endif - -#ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN -void sledgehammer_check_ascii_begin (Lisp_Object str); -#else -#define sledgehammer_check_ascii_begin(str) -#endif - -/* Make an alloca'd copy of a Lisp string */ -#define LISP_STRING_TO_ALLOCA(s, lval) \ -do { \ - Intbyte **_lta_ = (Intbyte **) &(lval); \ - Lisp_Object _lta_2 = (s); \ - *_lta_ = alloca_array (Intbyte, 1 + XSTRING_LENGTH (_lta_2)); \ - memcpy (*_lta_, XSTRING_DATA (_lta_2), 1 + XSTRING_LENGTH (_lta_2)); \ -} while (0) - -/* Make an alloca'd copy of a Intbyte * */ -#define INTBYTE_STRING_TO_ALLOCA(p, lval) \ -do { \ - Intbyte **_bsta_ = (Intbyte **) &(lval); \ - const Intbyte *_bsta_2 = (p); \ - Bytecount _bsta_3 = qxestrlen (_bsta_2); \ - *_bsta_ = alloca_array (Intbyte, 1 + _bsta_3); \ - memcpy (*_bsta_, _bsta_2, 1 + _bsta_3); \ -} while (0) - -#define alloca_intbytes(num) alloca_array (Intbyte, num) -#define alloca_extbytes(num) alloca_array (Extbyte, num) - -void resize_string (Lisp_Object s, Bytecount pos, Bytecount delta); - -#ifdef MULE - -/* Convert a byte index into a string into a char index. */ -DECLARE_INLINE_HEADER ( -Charcount -string_index_byte_to_char (Lisp_Object s, Bytecount idx) -) -{ - Charcount retval; - if (idx <= (Bytecount) XSTRING_ASCII_BEGIN (s)) - retval = idx; - else - retval = (XSTRING_ASCII_BEGIN (s) + - bytecount_to_charcount (XSTRING_DATA (s) + - XSTRING_ASCII_BEGIN (s), - idx - XSTRING_ASCII_BEGIN (s))); -#ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN - assert (retval == bytecount_to_charcount (XSTRING_DATA (s), idx)); -#endif - return retval; -} - -/* Convert a char index into a string into a byte index. */ -DECLARE_INLINE_HEADER ( -Bytecount -string_index_char_to_byte (Lisp_Object s, Charcount idx) -) -{ - Bytecount retval; - if (idx <= (Charcount) XSTRING_ASCII_BEGIN (s)) - retval = idx; - else - retval = (XSTRING_ASCII_BEGIN (s) + - charcount_to_bytecount (XSTRING_DATA (s) + - XSTRING_ASCII_BEGIN (s), - idx - XSTRING_ASCII_BEGIN (s))); -#ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN - assert (retval == charcount_to_bytecount (XSTRING_DATA (s), idx)); -#endif - return retval; -} - -/* Convert a substring length (starting at byte offset OFF) from bytes to - chars. */ -DECLARE_INLINE_HEADER ( -Charcount -string_offset_byte_to_char_len (Lisp_Object s, Bytecount off, Bytecount len) -) -{ - Charcount retval; - if (off + len <= (Bytecount) XSTRING_ASCII_BEGIN (s)) - retval = len; - else if (off < (Bytecount) XSTRING_ASCII_BEGIN (s)) - retval = - XSTRING_ASCII_BEGIN (s) - off + - bytecount_to_charcount (XSTRING_DATA (s) + XSTRING_ASCII_BEGIN (s), - len - (XSTRING_ASCII_BEGIN (s) - off)); - else - retval = bytecount_to_charcount (XSTRING_DATA (s) + off, len); -#ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN - assert (retval == bytecount_to_charcount (XSTRING_DATA (s) + off, len)); -#endif - return retval; -} - -/* Convert a substring length (starting at byte offset OFF) from chars to - bytes. */ -DECLARE_INLINE_HEADER ( -Bytecount -string_offset_char_to_byte_len (Lisp_Object s, Bytecount off, Charcount len) -) -{ - Bytecount retval; - if (off + len <= (Bytecount) XSTRING_ASCII_BEGIN (s)) - retval = len; - else if (off < (Bytecount) XSTRING_ASCII_BEGIN (s)) - retval = - XSTRING_ASCII_BEGIN (s) - off + - charcount_to_bytecount (XSTRING_DATA (s) + XSTRING_ASCII_BEGIN (s), - len - (XSTRING_ASCII_BEGIN (s) - off)); - else - retval = charcount_to_bytecount (XSTRING_DATA (s) + off, len); -#ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN - assert (retval == charcount_to_bytecount (XSTRING_DATA (s) + off, len)); -#endif - return retval; -} - -DECLARE_INLINE_HEADER ( -Intbyte * -string_char_addr (Lisp_Object s, Charcount idx) -) -{ - return XSTRING_DATA (s) + string_index_char_to_byte (s, idx); -} - -void set_string_char (Lisp_Object s, Charcount i, Emchar c); - -#else /* not MULE */ - -#define string_index_byte_to_char(s, idx) (idx) -#define string_index_char_to_byte(s, idx) (idx) -#define string_offset_byte_to_char_len(s, off, len) (len) -#define string_offset_char_to_byte_len(s, off, len) (len) -# define string_char_addr(s, i) string_byte_addr (s, i) -/* WARNING: If you modify an existing string, you must call - bump_string_modiff() afterwards. */ -# define set_string_char(s, i, c) set_string_byte (s, i, c) - -#endif /* not MULE */ +#define XSTRING_FORMAT(s) FORMAT_DEFAULT /* Return the true aligned size of a struct whose last member is a variable-length array field. (this is known as the "struct hack") */ @@ -1570,12 +2126,12 @@ (offsetof (structtype, fieldname[1]) - \ offsetof (structtype, fieldname[0])) * \ (array_length)) \ - : (ALIGN_SIZE \ + : (ALIGN_FOR_TYPE \ ((offsetof (structtype, fieldname) + \ (offsetof (structtype, fieldname[1]) - \ offsetof (structtype, fieldname[0])) * \ (array_length)), \ - ALIGNOF (structtype)))) + structtype))) /*------------------------------ vector --------------------------------*/ @@ -1650,17 +2206,19 @@ #define bit_vector_length(v) ((v)->size) #define bit_vector_next(v) ((v)->next) -INLINE_HEADER int bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n); -INLINE_HEADER int +DECLARE_INLINE_HEADER ( +int bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n) +) { return ((v->bits[n >> LONGBITS_LOG2] >> (n & (LONGBITS_POWER_OF_2 - 1))) & 1); } -INLINE_HEADER void set_bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n, int value); -INLINE_HEADER void +DECLARE_INLINE_HEADER ( +void set_bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n, int value) +) { if (value) v->bits[n >> LONGBITS_LOG2] |= (1UL << (n & (LONGBITS_POWER_OF_2 - 1))); @@ -1672,6 +2230,7 @@ #define BIT_VECTOR_LONG_STORAGE(len) \ (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2) + /*------------------------------ symbol --------------------------------*/ typedef struct Lisp_Symbol Lisp_Symbol; @@ -1687,7 +2246,7 @@ }; #define SYMBOL_IS_KEYWORD(sym) \ - ((XSTRING_BYTE (symbol_name (XSYMBOL (sym)), 0) == ':') \ + ((string_byte (symbol_name (XSYMBOL (sym)), 0) == ':') \ && EQ (sym, oblookup (Vobarray, \ XSTRING_DATA (symbol_name (XSYMBOL (sym))), \ XSTRING_LENGTH (symbol_name (XSYMBOL (sym)))))) @@ -1715,6 +2274,8 @@ /*------------------------------- subr ---------------------------------*/ +/* A function that takes no arguments and returns a Lisp_Object. + We could define such types for n arguments, if needed. */ typedef Lisp_Object (*lisp_fn_t) (void); struct Lisp_Subr @@ -1774,9 +2335,10 @@ #ifdef ERROR_CHECK_TYPES -INLINE_HEADER Emchar XCHAR_1 (Lisp_Object obj, const char *file, int line); -INLINE_HEADER Emchar +DECLARE_INLINE_HEADER ( +Ichar XCHAR_1 (Lisp_Object obj, const char *file, int line) +) { assert_at_line (CHARP (obj), file, line); return XCHARVAL (obj); @@ -1786,7 +2348,7 @@ #else /* no error checking */ -#define XCHAR(x) ((Emchar) XCHARVAL (x)) +#define XCHAR(x) ((Ichar) XCHARVAL (x)) #endif /* no error checking */ @@ -1857,18 +2419,19 @@ #define XCHAR_OR_INT(x) XCHAR_OR_INT_1 (x, __FILE__, __LINE__) #define XINT(x) XINT_1 (x, __FILE__, __LINE__) -INLINE_HEADER EMACS_INT XINT_1 (Lisp_Object obj, const char *file, int line); -INLINE_HEADER EMACS_INT +DECLARE_INLINE_HEADER ( +EMACS_INT XINT_1 (Lisp_Object obj, const char *file, int line) +) { assert_at_line (INTP (obj), file, line); return XREALINT (obj); } -INLINE_HEADER EMACS_INT XCHAR_OR_INT_1 (Lisp_Object obj, const char *file, - int line); -INLINE_HEADER EMACS_INT +DECLARE_INLINE_HEADER ( +EMACS_INT XCHAR_OR_INT_1 (Lisp_Object obj, const char *file, int line) +) { assert_at_line (INTP (obj) || CHARP (obj), file, line); return CHARP (obj) ? XCHAR (obj) : XINT (obj); @@ -1986,6 +2549,69 @@ Lisp_Object value, Error_Behavior errb)); +/*---------------------------- weak boxes ------------------------------*/ + +struct weak_box +{ + struct lcrecord_header header; + Lisp_Object value; + + Lisp_Object next_weak_box; /* don't mark through this! */ +}; + +void prune_weak_boxes (void); +Lisp_Object make_weak_box (Lisp_Object value); +Lisp_Object weak_box_ref (Lisp_Object value); + +DECLARE_LRECORD (weak_box, struct weak_box); +#define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box) +#define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v)) +#define wrap_weak_box(p) wrap_record (p, weak_box) +#define WEAK_BOXP(x) RECORDP (x, weak_box) +#define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box) +#define CONCHECK_WEAK_BOX(x) CONCHECK_RECORD (x, weak_box) + +/*--------------------------- ephemerons ----------------------------*/ + +struct ephemeron +{ + struct lcrecord_header header; + + Lisp_Object key; + + /* This field holds a pair. The cdr of this cons points to the next + ephemeron in Vall_ephemerons. The car points to another pair + whose car is the value and whose cdr is the finalizer. + + This representation makes it very easy to unlink an ephemeron + from Vall_ephemerons and chain it into + Vall_ephemerons_to_finalize. */ + + Lisp_Object cons_chain; + + Lisp_Object value; +}; + +void prune_ephemerons (void); +Lisp_Object ephemeron_value(Lisp_Object ephi); +int finish_marking_ephemerons(void); +Lisp_Object zap_finalize_list(void); +Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer); + +DECLARE_LRECORD(ephemeron, struct ephemeron); +#define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron) +#define XEPHEMERON_REF(x) (XEPHEMERON (x)->value) +#define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain)) +#define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain))) +#define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n)) +#define XSET_EPHEMERON_VALUE(x, v) (XEPHEMERON(x)->value = (v)) +#define XSET_EPHEMERON_KEY(x, k) (XEPHEMERON(x)->key = (k)) +#define wrap_ephemeron(p) wrap_record (p, ephemeron) +#define EPHEMERONP(x) RECORDP (x, ephemeron) +#define CHECK_EPHEMERON(x) CHECK_RECORD (x, ephemeron) +#define CONCHECK_EPHEMERON(x) CONCHECK_RECORD (x, ephemeron) + + /*---------------------------- weak lists ------------------------------*/ enum weak_list_type @@ -2200,48 +2826,72 @@ /* Checking for QUIT */ /************************************************************************/ +/* The exact workings of this mechanism are described in detail in signal.c. */ + /* Asynchronous events set something_happened, and then are processed within the QUIT macro. At this point, we are guaranteed to not be in any sensitive code. */ extern volatile int something_happened; extern int dont_check_for_quit; -int check_what_happened (void); +void check_what_happened (void); extern volatile int quit_check_signal_happened; extern volatile int quit_check_signal_tick_count; -int check_quit (void); +void check_quit (void); void signal_quit (void); +extern int dont_check_for_quit; +int begin_dont_check_for_quit (void); +int begin_do_check_for_quit (void); + +/* Nonzero if the values of `quit-flag' and `inhibit-quit' indicate + that a quit should be signalled. */ #define QUIT_FLAG_SAYS_SHOULD_QUIT \ (!NILP (Vquit_flag) && \ (NILP (Vinhibit_quit) \ || (EQ (Vquit_flag, Qcritical) && !dont_check_for_quit))) -/* Nonzero if ought to quit now. */ +/* Nonzero if ought to quit now. This is the "efficient" version, which + respects the flags set to indicate whether the full quit check should + be done. Therefore it may be inaccurate (i.e. lagging reality), esp. + when poll for quit is used. + + This is defined for code that wants to allow quitting, but needs to + do some cleanup if that happens. (You could always register the cleanup + code using record_unwind_protect(), but sometimes it makes more sense + to do it using QUITP.) To use this macro, just call it at the + appropriate time, and if its value is non-zero, do your cleanup code + and then call QUIT. + + A different version (below) is used for the actual QUIT macro. */ #define QUITP \ - ((quit_check_signal_happened ? check_quit () : 0), \ + ((quit_check_signal_happened ? check_quit () : (void) 0), \ QUIT_FLAG_SAYS_SHOULD_QUIT) -/* QUIT used to call QUITP, but there are some places where QUITP - is called directly, and check_what_happened() should only be called - when Emacs is actually ready to quit because it could do things - like switch threads. */ +/* This is the version actually called by QUIT. The difference + between it and QUITP is that it also has side effects in that it + will handle anything else that has recently signalled itself + asynchronously and wants to be handled now. Currently this + includes executing asynchronous timeouts that may have been set + from Lisp or from the poll-for-quit or poll-for-sigchld + timers. (#### It seems that, to be slightly more accurate, we + should also process poll-for-quit timers in the above version. + However, this mechanism is inherently approximate, so it really + doesn't matter much.) In the future, it might also include doing a + thread context switch. Callers of QUITP generally don't except + random side effects to happen, so we have this different + version. */ #define INTERNAL_QUITP \ - ((something_happened ? check_what_happened () : 0), \ - QUIT_FLAG_SAYS_SHOULD_QUIT) - -#define INTERNAL_REALLY_QUITP \ - (check_what_happened (), \ + ((something_happened ? check_what_happened () : (void) 0), \ QUIT_FLAG_SAYS_SHOULD_QUIT) /* Check quit-flag and quit if it is non-nil. Also do any other things - that might have gotten queued until it was safe. */ + that are triggered by asynchronous events and might want to be + handled. */ #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0) -#define REALLY_QUIT do { if (INTERNAL_REALLY_QUITP) signal_quit (); } while (0) - /************************************************************************/ /* hashing */ @@ -2289,7 +2939,7 @@ returned string. See Fgettext(). CGETTEXT() is the same as GETTEXT() but works with char * strings - instead of Intbyte * strings. + instead of Ibyte * strings. build_msg_string() is a shorthand for build_string (GETTEXT (x)). build_msg_intstring() is a shorthand for build_intstring (GETTEXT (x)). @@ -2431,6 +3081,21 @@ gcpro5.next = &gcpro4, gcpro5.var = &var5, gcpro5.nvars = 1, \ gcprolist = &gcpro5 )) +#define GCPRO1_ARRAY(array, n) ((void) ( \ + gcpro1.next = gcprolist, gcpro1.var = array, gcpro1.nvars = n, \ + gcprolist = &gcpro1 )) + +#define GCPRO2_ARRAY(array1, n1, array2, n2) ((void) ( \ + gcpro1.next = gcprolist, gcpro1.var = array1, gcpro1.nvars = n1, \ + gcpro2.next = &gcpro1, gcpro2.var = array2, gcpro2.nvars = n2, \ + gcprolist = &gcpro2 )) + +#define GCPRO3_ARRAY(array1, n1, array2, n2, array3, n3) ((void) ( \ + gcpro1.next = gcprolist, gcpro1.var = array1, gcpro1.nvars = n1, \ + gcpro2.next = &gcpro1, gcpro2.var = array2, gcpro2.nvars = n2, \ + gcpro3.next = &gcpro2, gcpro3.var = array3, gcpro3.nvars = n3, \ + gcprolist = &gcpro3 )) + #define UNGCPRO ((void) (gcprolist = gcpro1.next)) #define NGCPRO1(var1) ((void) ( \ @@ -2463,6 +3128,21 @@ ngcpro5.next = &ngcpro4, ngcpro5.var = &var5, ngcpro5.nvars = 1, \ gcprolist = &ngcpro5 )) +#define NGCPRO1_ARRAY(array, n) ((void) ( \ + ngcpro1.next = gcprolist, ngcpro1.var = array, ngcpro1.nvars = n, \ + gcprolist = &ngcpro1 )) + +#define NGCPRO2_ARRAY(array1, n1, array2, n2) ((void) ( \ + ngcpro1.next = gcprolist, ngcpro1.var = array1, ngcpro1.nvars = n1, \ + ngcpro2.next = &ngcpro1, ngcpro2.var = array2, ngcpro2.nvars = n2, \ + gcprolist = &ngcpro2 )) + +#define NGCPRO3_ARRAY(array1, n1, array2, n2, array3, n3) ((void) ( \ + ngcpro1.next = gcprolist, ngcpro1.var = array1, ngcpro1.nvars = n1, \ + ngcpro2.next = &ngcpro1, ngcpro2.var = array2, ngcpro2.nvars = n2, \ + ngcpro3.next = &ngcpro2, ngcpro3.var = array3, ngcpro3.nvars = n3, \ + gcprolist = &ngcpro3 )) + #define NUNGCPRO ((void) (gcprolist = ngcpro1.next)) #define NNGCPRO1(var1) ((void) ( \ @@ -2495,6 +3175,21 @@ nngcpro5.next = &nngcpro4, nngcpro5.var = &var5, nngcpro5.nvars = 1, \ gcprolist = &nngcpro5 )) +#define NNGCPRO1_ARRAY(array, n) ((void) ( \ + nngcpro1.next = gcprolist, nngcpro1.var = array, nngcpro1.nvars = n, \ + gcprolist = &nngcpro1 )) + +#define NNGCPRO2_ARRAY(array1, n1, array2, n2) ((void) ( \ + nngcpro1.next = gcprolist, nngcpro1.var = array1, nngcpro1.nvars = n1, \ + nngcpro2.next = &nngcpro1, nngcpro2.var = array2, nngcpro2.nvars = n2, \ + gcprolist = &nngcpro2 )) + +#define NNGCPRO3_ARRAY(array1, n1, array2, n2, array3, n3) ((void) ( \ + nngcpro1.next = gcprolist, nngcpro1.var = array1, nngcpro1.nvars = n1, \ + nngcpro2.next = &nngcpro1, nngcpro2.var = array2, nngcpro2.nvars = n2, \ + nngcpro3.next = &nngcpro2, nngcpro3.var = array3, nngcpro3.nvars = n3, \ + gcprolist = &nngcpro3 )) + #define NNUNGCPRO ((void) (gcprolist = nngcpro1.next)) #endif /* ! DEBUG_GCPRO */ @@ -2652,7 +3347,19 @@ /* Prototypes for all init/syms_of/vars_of initialization functions. */ #include "symsinit.h" +/* Defined in abbrev.c */ +EXFUN (Fexpand_abbrev, 0); + /* Defined in alloc.c */ +EXFUN (Fcons, 2); +EXFUN (Flist, MANY); +EXFUN (Fmake_byte_code, MANY); +EXFUN (Fmake_list, 2); +EXFUN (Fmake_string, 2); +EXFUN (Fmake_symbol, 1); +EXFUN (Fmake_vector, 2); +EXFUN (Fvector, MANY); + void release_breathing_space (void); Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object); Lisp_Object make_vector (Elemcount, Lisp_Object); @@ -2676,22 +3383,21 @@ DECLARE_DOESNT_RETURN (memory_full (void)); void disksave_object_finalization (void); extern int purify_flag; -extern int gc_currently_forbidden; extern EMACS_INT gc_generation_number[1]; int c_readonly (Lisp_Object); int lisp_readonly (Lisp_Object); -Lisp_Object build_intstring (const Intbyte *); -Lisp_Object build_string (const CIntbyte *); +Lisp_Object build_intstring (const Ibyte *); +Lisp_Object build_string (const CIbyte *); Lisp_Object build_ext_string (const Extbyte *, Lisp_Object); -Lisp_Object build_msg_intstring (const Intbyte *); -Lisp_Object build_msg_string (const CIntbyte *); -Lisp_Object make_string (const Intbyte *, Bytecount); +Lisp_Object build_msg_intstring (const Ibyte *); +Lisp_Object build_msg_string (const CIbyte *); +Lisp_Object make_string (const Ibyte *, Bytecount); Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object); void init_string_ascii_begin (Lisp_Object string); Lisp_Object make_uninit_string (Bytecount); Lisp_Object make_float (double); -Lisp_Object make_string_nocopy (const Intbyte *, Bytecount); -void free_cons (Lisp_Cons *); +Lisp_Object make_string_nocopy (const Ibyte *, Bytecount); +void free_cons (Lisp_Object); void free_list (Lisp_Object); void free_alist (Lisp_Object); void mark_conses_in_list (Lisp_Object); @@ -2699,7 +3405,12 @@ int object_dead_p (Lisp_Object); void mark_object (Lisp_Object obj); int marked_p (Lisp_Object obj); -int need_to_garbage_collect (void); +extern int funcall_allocation_flag; +extern int need_to_garbage_collect; +extern int need_to_check_c_alloca; +extern int need_to_signal_post_gc; +extern Lisp_Object Qpost_gc_hook; +void recompute_funcall_allocation_flag (void); #ifdef MEMORY_USAGE_STATS Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *); @@ -2720,7 +3431,7 @@ void switch_to_buffer (Lisp_Object, Lisp_Object); extern int find_file_compare_truenames; extern int find_file_use_truenames; -Intbyte *get_initial_directory (Intbyte *pathname, Bytecount size); +Ibyte *get_initial_directory (Ibyte *pathname, Bytecount size); extern Lisp_Object Vbuffer_alist; void set_buffer_internal (struct buffer *b); struct buffer *decode_buffer (Lisp_Object buffer, int allow_string); @@ -2760,39 +3471,75 @@ extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode; /* Defined in bytecode.c */ +EXFUN (Fbyte_code, 3); + DECLARE_DOESNT_RETURN (invalid_byte_code - (const CIntbyte *reason, Lisp_Object frob)); + (const CIbyte *reason, Lisp_Object frob)); -/* Defined in callproc.c */ -Intbyte *egetenv (const CIntbyte *var); -void eputenv (const CIntbyte *var, const CIntbyte *value); -extern int env_initted; - -/* Defined in console.c */ -void stuff_buffered_input (Lisp_Object); - -/* Defined in console-msw.c */ -EXFUN (Fmswindows_message_box, 3); -extern int mswindows_message_outputted; -void mswindows_hide_console (void); -int mswindows_output_console_string (const Intbyte *ptr, Bytecount len); -void write_string_to_mswindows_debugging_output (Intbyte *str, Bytecount len); +/* Defined in callint.c */ +EXFUN (Fcall_interactively, 3); +EXFUN (Fprefix_numeric_value, 1); -/* Defined in data.c */ -DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object)); -DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object)); -DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object)); -DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object, - Lisp_Object)); -Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); -DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object)); -void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT); +/* Defined in casefiddle.c */ +EXFUN (Fdowncase, 2); +EXFUN (Fupcase, 2); +EXFUN (Fupcase_initials, 2); +EXFUN (Fupcase_initials_region, 3); +EXFUN (Fupcase_region, 3); -EXFUN (Fint_to_char, 1); -EXFUN (Fchar_to_int, 1); +/* Defined in casetab.c */ +EXFUN (Fset_standard_case_table, 1); -enum arith_comparison { - arith_equal, +/* Defined in chartab.c */ +EXFUN (Freset_char_table, 1); + +/* Defined in cmds.c */ +EXFUN (Fbeginning_of_line, 2); +EXFUN (Fend_of_line, 2); +EXFUN (Fforward_char, 2); +EXFUN (Fforward_line, 2); + +/* Defined in data.c */ +EXFUN (Fadd1, 1); +EXFUN (Faref, 2); +EXFUN (Faset, 3); +EXFUN (Fcar, 1); +EXFUN (Fcar_safe, 1); +EXFUN (Fcdr, 1); +EXFUN (Fgeq, MANY); +EXFUN (Fgtr, MANY); +EXFUN (Findirect_function, 1); +EXFUN (Fleq, MANY); +EXFUN (Flistp, 1); +EXFUN (Flss, MANY); +EXFUN (Fmax, MANY); +EXFUN (Fmin, MANY); +EXFUN (Fminus, MANY); +EXFUN (Fnumber_to_string, 1); +EXFUN (Fplus, MANY); +EXFUN (Fquo, MANY); +EXFUN (Frem, 2); +EXFUN (Fsetcar, 2); +EXFUN (Fsetcdr, 2); +EXFUN (Fsub1, 1); +EXFUN (Fsubr_max_args, 1); +EXFUN (Fsubr_min_args, 1); +EXFUN (Ftimes, MANY); + +DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object)); +DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object)); +DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object)); +DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object, + Lisp_Object)); +Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); +DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object)); +void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT); + +EXFUN (Fint_to_char, 1); +EXFUN (Fchar_to_int, 1); + +enum arith_comparison { + arith_equal, arith_notequal, arith_less, arith_grtr, @@ -2807,58 +3554,85 @@ unsigned int lisp_to_word (Lisp_Object); /* Defined in dired.c */ -Lisp_Object make_directory_hash_table (const Intbyte *); +Lisp_Object make_directory_hash_table (const Ibyte *); Lisp_Object wasteful_word_to_lisp (unsigned int); /* Defined in doc.c */ -Lisp_Object unparesseuxify_doc_string (int, EMACS_INT, Intbyte *, Lisp_Object); +EXFUN (Fsubstitute_command_keys, 1); + +Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position, + Ibyte *name_nonreloc, + Lisp_Object name_reloc, + int standard_doc_file); Lisp_Object read_doc_string (Lisp_Object); /* Defined in doprnt.c */ - -Bytecount emacs_doprnt_va (Lisp_Object stream, const Intbyte *format_nonreloc, +Bytecount emacs_doprnt_va (Lisp_Object stream, const Ibyte *format_nonreloc, Bytecount format_length, Lisp_Object format_reloc, va_list vargs); -Bytecount emacs_doprnt (Lisp_Object stream, const Intbyte *format_nonreloc, +Bytecount emacs_doprnt (Lisp_Object stream, const Ibyte *format_nonreloc, Bytecount format_length, Lisp_Object format_reloc, int nargs, const Lisp_Object *largs, ...); -Lisp_Object emacs_vsprintf_string_lisp (const CIntbyte *format_nonreloc, +Lisp_Object emacs_vsprintf_string_lisp (const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, const Lisp_Object *largs); -Lisp_Object emacs_sprintf_string_lisp (const CIntbyte *format_nonreloc, +Lisp_Object emacs_sprintf_string_lisp (const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, ...); -Intbyte *emacs_vsprintf_malloc_lisp (const CIntbyte *format_nonreloc, +Ibyte *emacs_vsprintf_malloc_lisp (const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, const Lisp_Object *largs, Bytecount *len_out); -Intbyte *emacs_sprintf_malloc_lisp (Bytecount *len_out, - const CIntbyte *format_nonreloc, +Ibyte *emacs_sprintf_malloc_lisp (Bytecount *len_out, + const CIbyte *format_nonreloc, Lisp_Object format_reloc, int nargs, ...); -Lisp_Object emacs_vsprintf_string (const CIntbyte *format, va_list vargs); -Lisp_Object emacs_sprintf_string (const CIntbyte *format, ...) +Lisp_Object emacs_vsprintf_string (const CIbyte *format, va_list vargs); +Lisp_Object emacs_sprintf_string (const CIbyte *format, ...) PRINTF_ARGS (1, 2); -Intbyte *emacs_vsprintf_malloc (const CIntbyte *format, va_list vargs, +Ibyte *emacs_vsprintf_malloc (const CIbyte *format, va_list vargs, Bytecount *len_out); -Intbyte *emacs_sprintf_malloc (Bytecount *len_out, const CIntbyte *format, ...) +Ibyte *emacs_sprintf_malloc (Bytecount *len_out, const CIbyte *format, ...) PRINTF_ARGS (2, 3); -Bytecount emacs_vsprintf (Intbyte *output, const CIntbyte *format, +Bytecount emacs_vsprintf (Ibyte *output, const CIbyte *format, va_list vargs); -Bytecount emacs_sprintf (Intbyte *output, const CIntbyte *format, ...) +Bytecount emacs_sprintf (Ibyte *output, const CIbyte *format, ...) PRINTF_ARGS (2, 3); /* Defined in editfns.c */ +EXFUN (Fbobp, 1); +EXFUN (Fbolp, 1); +EXFUN (Fbuffer_substring, 3); +EXFUN (Fchar_after, 2); +EXFUN (Fchar_to_string, 1); +EXFUN (Fdelete_region, 3); +EXFUN (Feobp, 1); +EXFUN (Feolp, 1); +EXFUN (Ffollowing_char, 1); +EXFUN (Fformat, MANY); +EXFUN (Fgoto_char, 2); +EXFUN (Finsert, MANY); +EXFUN (Finsert_buffer_substring, 3); +EXFUN (Finsert_char, 4); +EXFUN (Fnarrow_to_region, 3); +EXFUN (Fpoint, 1); +EXFUN (Fpoint_marker, 2); +EXFUN (Fpoint_max, 1); +EXFUN (Fpoint_min, 1); +EXFUN (Fpreceding_char, 1); +EXFUN (Fsystem_name, 0); +EXFUN (Fuser_home_directory, 0); +EXFUN (Fuser_login_name, 1); +EXFUN (Fwiden, 1); + void uncache_home_directory (void); -Intbyte *get_home_directory (void); -Intbyte *user_login_name (uid_t *); -Charbpos charbpos_clip_to_bounds (Charbpos, Charbpos, Charbpos); -Bytebpos bytebpos_clip_to_bounds (Bytebpos, Bytebpos, Bytebpos); +Ibyte *get_home_directory (void); +Ibyte *user_login_name (uid_t *); void buffer_insert1 (struct buffer *, Lisp_Object); Lisp_Object make_string_from_buffer (struct buffer *, Charbpos, Charcount); Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Charbpos, Charcount); Lisp_Object make_time (time_t); Lisp_Object save_excursion_save (void); -Lisp_Object save_restriction_save (void); +Lisp_Object save_restriction_save (struct buffer *buf); Lisp_Object save_excursion_restore (Lisp_Object); Lisp_Object save_restriction_restore (Lisp_Object); void widen_buffer (struct buffer *b, int no_clip); @@ -2868,26 +3642,48 @@ Lisp_Object save_current_buffer_restore (Lisp_Object); /* Defined in emacs.c */ +EXFUN (Fkill_emacs, 1); +EXFUN (Frunning_temacs_p, 0); + SIGTYPE fatal_error_signal (int); Lisp_Object make_arg_list (int, Extbyte **); void make_argc_argv (Lisp_Object, int *, Extbyte ***); void free_argc_argv (Extbyte **); Lisp_Object split_external_path (const Extbyte *path); -Lisp_Object split_env_path (const CIntbyte *evarname, const Intbyte *default_); +Lisp_Object split_env_path (const CIbyte *evarname, const Ibyte *default_); /* Nonzero means don't do interactive redisplay and don't change tty modes */ extern int noninteractive, noninteractive1; extern int inhibit_non_essential_printing_operations; extern int preparing_for_armageddon; extern Fixnum emacs_priority; -extern int running_asynch_code; extern int suppress_early_error_handler_backtrace; void debug_break (void); int debug_can_access_memory (void *ptr, Bytecount len); void really_abort (void); void zero_out_command_line_status_vars (void); +/* Defined in emodules.c */ +EXFUN (Flist_modules, 0); +EXFUN (Fload_module, 3); + + /* Defined in eval.c */ +EXFUN (Fapply, MANY); +EXFUN (Fbacktrace, 2); +EXFUN (Fcommand_execute, 3); +EXFUN (Fcommandp, 1); +EXFUN (Feval, 1); +EXFUN (Ffuncall, MANY); +EXFUN (Ffunctionp, 1); +EXFUN (Finteractive_p, 0); +EXFUN (Fprogn, UNEVALLED); +EXFUN (Fsignal, 2); +EXFUN (Fthrow, 2); +EXFUN (Fcall_with_condition_handler, MANY); +EXFUN (Ffunction_max_args, 1); +EXFUN (Ffunction_min_args, 1); + DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object)); void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior); @@ -2895,50 +3691,50 @@ Lisp_Object, Error_Behavior); DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror (Lisp_Object, - const CIntbyte *, + const CIbyte *, ...), 2, 3); void maybe_signal_ferror (Lisp_Object, Lisp_Object, Error_Behavior, - const CIntbyte *, ...) PRINTF_ARGS (4, 5); -Lisp_Object signal_continuable_ferror (Lisp_Object, const CIntbyte *, ...) + const CIbyte *, ...) PRINTF_ARGS (4, 5); +Lisp_Object signal_continuable_ferror (Lisp_Object, const CIbyte *, ...) PRINTF_ARGS (2, 3); Lisp_Object maybe_signal_continuable_ferror (Lisp_Object, Lisp_Object, Error_Behavior, - const CIntbyte *, ...) + const CIbyte *, ...) PRINTF_ARGS (4, 5); -Lisp_Object build_error_data (const CIntbyte *reason, Lisp_Object frob); -DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CIntbyte *, +Lisp_Object build_error_data (const CIbyte *reason, Lisp_Object frob); +DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CIbyte *, Lisp_Object)); -void maybe_signal_error (Lisp_Object, const CIntbyte *, Lisp_Object, +void maybe_signal_error (Lisp_Object, const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -Lisp_Object signal_continuable_error (Lisp_Object, const CIntbyte *, +Lisp_Object signal_continuable_error (Lisp_Object, const CIbyte *, Lisp_Object); -Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIntbyte *, +Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror_with_frob (Lisp_Object, Lisp_Object, - const CIntbyte *, + const CIbyte *, ...), 3, 4); void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior, - const CIntbyte *, ...) PRINTF_ARGS (5, 6); + const CIbyte *, ...) PRINTF_ARGS (5, 6); Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object, - const CIntbyte *, + const CIbyte *, ...) PRINTF_ARGS (3, 4); Lisp_Object maybe_signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior, - const CIntbyte *, ...) + const CIbyte *, ...) PRINTF_ARGS (5, 6); -DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CIntbyte *, +DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CIbyte *, Lisp_Object, Lisp_Object)); -void maybe_signal_error_2 (Lisp_Object, const CIntbyte *, Lisp_Object, +void maybe_signal_error_2 (Lisp_Object, const CIbyte *, Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior); -Lisp_Object signal_continuable_error_2 (Lisp_Object, const CIntbyte *, +Lisp_Object signal_continuable_error_2 (Lisp_Object, const CIbyte *, Lisp_Object, Lisp_Object); -Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CIntbyte *, +Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CIbyte *, Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior); @@ -2949,60 +3745,60 @@ DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object)); DECLARE_DOESNT_RETURN (signal_circular_property_list_error (Lisp_Object)); -DECLARE_DOESNT_RETURN (syntax_error (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (syntax_error (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (syntax_error_2 (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (syntax_error_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_syntax_error (const CIntbyte *, Lisp_Object, Lisp_Object, +void maybe_syntax_error (const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (sferror (const CIntbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (sferror_2 (const CIntbyte *reason, Lisp_Object frob1, +DECLARE_DOESNT_RETURN (sferror (const CIbyte *reason, Lisp_Object frob)); +DECLARE_DOESNT_RETURN (sferror_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_sferror (const CIntbyte *, Lisp_Object, Lisp_Object, +void maybe_sferror (const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (invalid_argument (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_argument (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_argument (const CIntbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_argument (const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (invalid_operation (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_operation (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_operation (const CIntbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_operation (const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (invalid_state (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_state (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_state_2 (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_state_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_state (const CIntbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_state (const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (invalid_change (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_change (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_change_2 (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_change_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_change (const CIntbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_change (const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (invalid_constant (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_constant (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_constant (const CIntbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_constant (const CIbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (wtaerror (const CIntbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (out_of_memory (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (wtaerror (const CIbyte *reason, Lisp_Object frob)); +DECLARE_DOESNT_RETURN (out_of_memory (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (stack_overflow (const CIntbyte *reason, +DECLARE_DOESNT_RETURN (stack_overflow (const CIbyte *reason, Lisp_Object frob)); DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (printing_unreadable_object - (const CIntbyte *, + (const CIbyte *, ...), 1, 2); Lisp_Object signal_void_function_error (Lisp_Object); @@ -3046,21 +3842,116 @@ Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); Lisp_Object eval_in_buffer (struct buffer *, Lisp_Object); -Lisp_Object call0_with_handler (Lisp_Object, Lisp_Object); -Lisp_Object call1_with_handler (Lisp_Object, Lisp_Object, Lisp_Object); -Lisp_Object eval_in_buffer_trapping_errors (const CIntbyte *, struct buffer *, - Lisp_Object); -Lisp_Object run_hook_trapping_errors (const CIntbyte *, Lisp_Object); -Lisp_Object safe_run_hook_trapping_errors (const CIntbyte *, Lisp_Object, int); -Lisp_Object call0_trapping_errors (const CIntbyte *, Lisp_Object); -Lisp_Object call1_trapping_errors (const CIntbyte *, Lisp_Object, Lisp_Object); -Lisp_Object call2_trapping_errors (const CIntbyte *, - Lisp_Object, Lisp_Object, Lisp_Object); -Lisp_Object call_with_suspended_errors (lisp_fn_t, volatile Lisp_Object, Lisp_Object, + +struct call_trapping_problems_result +{ + int caught_error, caught_throw; + Lisp_Object error_conditions, data; + Lisp_Object backtrace; + Lisp_Object thrown_tag; + Lisp_Object thrown_value; +}; + +#define NO_INHIBIT_ERRORS (1<<0) +#define NO_INHIBIT_THROWS (1<<1) +#define INTERNAL_INHIBIT_ERRORS (1<<0) +#define INTERNAL_INHIBIT_THROWS (1<<1) +#define INHIBIT_WARNING_ISSUE (1<<2) +#define ISSUE_WARNINGS_AT_DEBUG_LEVEL (1<<3) +#define INHIBIT_QUIT (1<<4) +#define UNINHIBIT_QUIT (1<<5) +#define INHIBIT_GC (1<<6) +#define INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION (1<<7) +#define INHIBIT_EXISTING_CODING_SYSTEM_DELETION (1<<8) +#define INHIBIT_EXISTING_CHARSET_DELETION (1<<9) +#define INHIBIT_PERMANENT_DISPLAY_OBJECT_CREATION (1<<10) +#define INHIBIT_CODING_SYSTEM_CREATION (1<<11) +#define INHIBIT_CHARSET_CREATION (1<<12) +#define INHIBIT_EXISTING_BUFFER_TEXT_MODIFICATION (1<<13) +#define INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY (1<<14) +#define INHIBIT_ENTERING_DEBUGGER (1<<15) +#define CALL_WITH_SUSPENDED_ERRORS (1<<16) + +enum check_allowed_operation +{ + OPERATION_DELETE_OBJECT, + OPERATION_CREATE_OBJECT, + OPERATION_MODIFY_BUFFER_TEXT, + OPERATION_MODIFY_OBJECT_PROPERTY, +}; + +int get_inhibit_flags (void); +void check_allowed_operation (int what, Lisp_Object obj, Lisp_Object prop); +void note_object_created (Lisp_Object obj); +void note_object_deleted (Lisp_Object obj); +Lisp_Object call_with_condition_handler (Lisp_Object (*handler) (Lisp_Object, + Lisp_Object, + Lisp_Object), + Lisp_Object handler_arg, + Lisp_Object (*fun) (Lisp_Object), + Lisp_Object arg); +Lisp_Object call_trapping_problems (Lisp_Object warning_class, + const char *warning_string, + int flags, + struct call_trapping_problems_result + *problem, + Lisp_Object (*fun) (void *), + void *arg); +Lisp_Object va_call_trapping_problems (Lisp_Object warning_class, + const char *warning_string, + int flags, + struct call_trapping_problems_result + *problem, + lisp_fn_t fun, int nargs, ...); +Lisp_Object call0_trapping_problems (const char *, Lisp_Object, int); +Lisp_Object call1_trapping_problems (const char *, Lisp_Object, Lisp_Object, + int); +Lisp_Object call2_trapping_problems (const char *, Lisp_Object, Lisp_Object, + Lisp_Object, int); +Lisp_Object call3_trapping_problems (const char *, Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, int); +Lisp_Object call4_trapping_problems (const char *, Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, Lisp_Object, + int); +Lisp_Object call5_trapping_problems (const char *, Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, int); +Lisp_Object eval_in_buffer_trapping_problems (const char *, struct buffer *, + Lisp_Object, int); +Lisp_Object run_hook_trapping_problems (const char *, Lisp_Object, int); +Lisp_Object safe_run_hook_trapping_problems (const char *, Lisp_Object, int); +Lisp_Object run_hook_with_args_in_buffer_trapping_problems (const char + *warning_string, + struct buffer + *buf, int nargs, + Lisp_Object *args, + enum + run_hooks_condition + cond, int flags); +Lisp_Object run_hook_with_args_trapping_problems (const char *warning_string, + int nargs, + Lisp_Object *args, + enum run_hooks_condition + cond, + int flags); +Lisp_Object va_run_hook_with_args_trapping_problems (const char + *warning_string, + Lisp_Object hook_var, + int nargs, ...); +Lisp_Object va_run_hook_with_args_in_buffer_trapping_problems (const char + *warning_string, + struct buffer + *buf, + Lisp_Object + hook_var, + int nargs, ...); +Lisp_Object call_with_suspended_errors (lisp_fn_t, Lisp_Object, + Lisp_Object, Error_Behavior, int, ...); /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */ Lisp_Object internal_catch (Lisp_Object, Lisp_Object (*) (Lisp_Object), - Lisp_Object, int * volatile); + Lisp_Object, int * volatile, + Lisp_Object * volatile); Lisp_Object condition_case_1 (Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object, @@ -3078,11 +3969,22 @@ void do_autoload (Lisp_Object, Lisp_Object); Lisp_Object un_autoload (Lisp_Object); void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); -void warn_when_safe (Lisp_Object, Lisp_Object, const CIntbyte *, +void warn_when_safe (Lisp_Object, Lisp_Object, const CIbyte *, ...) PRINTF_ARGS (3, 4); /* Defined in event-stream.c */ +EXFUN (Faccept_process_output, 3); +EXFUN (Fadd_timeout, 4); +EXFUN (Fdisable_timeout, 1); +EXFUN (Fdiscard_input, 0); +EXFUN (Fdispatch_event, 1); +EXFUN (Fenqueue_eval_event, 2); +EXFUN (Fnext_event, 2); +EXFUN (Fread_key_sequence, 3); +EXFUN (Fsit_for, 2); +EXFUN (Fsleep_for, 1); + void wait_delaying_user_input (int (*) (void *), void *); int detect_input_pending (void); void reset_this_command_keys (Lisp_Object, int); @@ -3097,6 +3999,9 @@ /* Defined in events.c */ +EXFUN (Fcopy_event, 2); +EXFUN (Fevent_to_character, 4); + void clear_event_resource (void); Lisp_Object allocate_event (void); @@ -3159,21 +4064,44 @@ /* Defined in fileio.c */ +EXFUN (Fdirectory_file_name, 1); +EXFUN (Fdo_auto_save, 2); +EXFUN (Fexpand_file_name, 2); +EXFUN (Ffile_accessible_directory_p, 1); +EXFUN (Ffile_directory_p, 1); +EXFUN (Ffile_executable_p, 1); +EXFUN (Ffile_exists_p, 1); +EXFUN (Ffile_name_absolute_p, 1); +EXFUN (Ffile_name_as_directory, 1); +EXFUN (Ffile_name_directory, 1); +EXFUN (Ffile_name_nondirectory, 1); +EXFUN (Ffile_readable_p, 1); +EXFUN (Ffile_symlink_p, 1); +EXFUN (Ffile_truename, 2); +EXFUN (Ffind_file_name_handler, 2); +EXFUN (Finsert_file_contents_internal, 7); +EXFUN (Fmake_temp_name, 1); +EXFUN (Fsubstitute_in_file_name, 1); +EXFUN (Funhandled_file_name_directory, 1); +EXFUN (Fverify_visited_file_modtime, 1); + void record_auto_save (void); void force_auto_save_soon (void); DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype, - const CIntbyte *string, + const CIbyte *string, Lisp_Object data)); DECLARE_DOESNT_RETURN (report_file_type_error (Lisp_Object errtype, Lisp_Object oserrmess, - const CIntbyte *string, + const CIbyte *string, Lisp_Object data)); -DECLARE_DOESNT_RETURN (report_file_error (const CIntbyte *, Lisp_Object)); +DECLARE_DOESNT_RETURN (report_file_error (const CIbyte *, Lisp_Object)); Lisp_Object lisp_strerror (int); Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); int internal_delete_file (Lisp_Object); /* Defined in filelock.c */ +EXFUN (Funlock_buffer, 0); + void lock_file (Lisp_Object); void unlock_file (Lisp_Object); void unlock_all_files (void); @@ -3183,9 +4111,56 @@ void filemodestring (struct stat *, char *); /* Defined in floatfns.c */ +EXFUN (Ftruncate, 1); + double extract_float (Lisp_Object); /* Defined in fns.c */ +EXFUN (Fappend, MANY); +EXFUN (Fassoc, 2); +EXFUN (Fassq, 2); +EXFUN (Fcanonicalize_lax_plist, 2); +EXFUN (Fcanonicalize_plist, 2); +EXFUN (Fcheck_valid_plist, 1); +EXFUN (Fconcat, MANY); +EXFUN (Fcopy_alist, 1); +EXFUN (Fcopy_list, 1); +EXFUN (Fcopy_sequence, 1); +EXFUN (Fcopy_tree, 2); +EXFUN (Fdelete, 2); +EXFUN (Fdelq, 2); +EXFUN (Fdestructive_alist_to_plist, 1); +EXFUN (Felt, 2); +EXFUN (Fequal, 2); +EXFUN (Fget, 3); +EXFUN (Flast, 2); +EXFUN (Flax_plist_get, 3); +EXFUN (Flax_plist_remprop, 2); +EXFUN (Flength, 1); +EXFUN (Fmapcar, 2); +EXFUN (Fmember, 2); +EXFUN (Fmemq, 2); +EXFUN (Fnconc, MANY); +EXFUN (Fnreverse, 1); +EXFUN (Fnthcdr, 2); +EXFUN (Fold_assq, 2); +EXFUN (Fold_equal, 2); +EXFUN (Fold_member, 2); +EXFUN (Fold_memq, 2); +EXFUN (Fplist_get, 3); +EXFUN (Fplist_member, 2); +EXFUN (Fplist_put, 3); +EXFUN (Fprovide, 1); +EXFUN (Fput, 3); +EXFUN (Frassq, 2); +EXFUN (Fremassq, 2); +EXFUN (Freplace_list, 2); +EXFUN (Fsort, 2); +EXFUN (Fstring_equal, 2); +EXFUN (Fstring_lessp, 2); +EXFUN (Fsubstring, 3); +EXFUN (Fvalid_plist_p, 1); + Lisp_Object list_sort (Lisp_Object, Lisp_Object, int (*) (Lisp_Object, Lisp_Object, Lisp_Object)); Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); @@ -3210,6 +4185,13 @@ void external_plist_put (Lisp_Object *, Lisp_Object, Lisp_Object, int, Error_Behavior); int external_remprop (Lisp_Object *, Lisp_Object, int, Error_Behavior); +int internal_equal_trapping_problems (Lisp_Object warning_class, + const char *warning_string, + int flags, + struct call_trapping_problems_result *p, + int retval, + Lisp_Object obj1, Lisp_Object obj2, + int depth); int internal_equal (Lisp_Object, Lisp_Object, int); int internal_equalp (Lisp_Object obj1, Lisp_Object obj2, int depth); Lisp_Object concat2 (Lisp_Object, Lisp_Object); @@ -3225,7 +4207,12 @@ Lisp_Object add_prefix_to_symbol (const Char_ASCII *ascii_string, Lisp_Object symbol); +/* Defined in free-hook.c */ +EXFUN (Freally_free, 1); + /* Defined in glyphs.c */ +EXFUN (Fmake_glyph_internal, 1); + Error_Behavior decode_error_behavior_flag (Lisp_Object); Lisp_Object encode_error_behavior_flag (Error_Behavior); @@ -3243,7 +4230,10 @@ DECLARE_DOESNT_RETURN (gui_error_2 (const char *reason, Lisp_Object frob0, Lisp_Object frob1)); /* Defined in indent.c */ -int bi_spaces_at_point (struct buffer *, Bytebpos); +EXFUN (Findent_to, 3); +EXFUN (Fvertical_motion, 3); + +int byte_spaces_at_point (struct buffer *, Bytebpos); int column_at_point (struct buffer *, Charbpos, int); int string_column_at_point (Lisp_Object, Charbpos, int); int current_column (struct buffer *); @@ -3254,23 +4244,20 @@ /* Defined in insdel.c */ void set_buffer_point (struct buffer *buf, Charbpos pos, Bytebpos bipos); -/* Defined in intl-win32.c */ -EXFUN (Fmswindows_set_current_locale, 1); -EXFUN (Fmswindows_current_locale, 0); -EXFUN (Fmswindows_user_default_locale, 0); -EXFUN (Fmswindows_system_default_locale, 0); -EXFUN (Fmswindows_locale_code_page, 1); -EXFUN (Fmswindows_supported_locales, 0); -EXFUN (Fmswindows_charset_code_page, 1); -EXFUN (Fmswindows_set_charset_code_page, 2); - -extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode; -extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; +/* Defined in intl.c */ +EXFUN (Fgettext, 1); /* Defined in keymap.c */ +EXFUN (Fdefine_key, 3); +EXFUN (Fkey_description, 1); +EXFUN (Flookup_key, 3); +EXFUN (Fmake_sparse_keymap, 1); + void where_is_to_char (Lisp_Object, Eistring *); /* Defined in lread.c */ +EXFUN (Fread, 1); + void ebolify_bytecode_constants (Lisp_Object); void close_load_descs (void); int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int); @@ -3293,10 +4280,20 @@ # define LOADHIST_ATTACH(x) #endif /*! LOADHIST */ +/* Defined in macros.c */ +EXFUN (Fexecute_kbd_macro, 2); + /* Defined in marker.c */ -Bytebpos bi_marker_position (Lisp_Object); +EXFUN (Fcopy_marker, 2); +EXFUN (Fmake_marker, 0); +EXFUN (Fmarker_buffer, 1); +EXFUN (Fmarker_position, 1); +EXFUN (Fset_marker, 3); +EXFUN (Fset_marker_insertion_type, 2); + +Bytebpos byte_marker_position (Lisp_Object); Charbpos marker_position (Lisp_Object); -void set_bi_marker_position (Lisp_Object, Bytebpos); +void set_byte_marker_position (Lisp_Object, Bytebpos); void set_marker_position (Lisp_Object, Charbpos); void unchain_marker (Lisp_Object); Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object); @@ -3307,29 +4304,24 @@ void init_buffer_markers (struct buffer *b); void uninit_buffer_markers (struct buffer *b); -/* Defined in menubar.c */ -extern int popup_menu_up_p; -extern int menubar_show_keybindings; -extern int popup_menu_titles; - /* Defined in minibuf.c */ extern int minibuf_level; -Charcount scmp_1 (const Intbyte *, const Intbyte *, Charcount, int); +Charcount scmp_1 (const Ibyte *, const Ibyte *, Charcount, int); #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case) extern int completion_ignore_case; -int regexp_ignore_completion_p (const Intbyte *, Lisp_Object, +int regexp_ignore_completion_p (const Ibyte *, Lisp_Object, Bytecount, Bytecount); Lisp_Object clear_echo_area (struct frame *, Lisp_Object, int); Lisp_Object clear_echo_area_from_print (struct frame *, Lisp_Object, int); -void echo_area_append (struct frame *, const Intbyte *, Lisp_Object, +void echo_area_append (struct frame *, const Ibyte *, Lisp_Object, Bytecount, Bytecount, Lisp_Object); -void echo_area_message (struct frame *, const Intbyte *, Lisp_Object, +void echo_area_message (struct frame *, const Ibyte *, Lisp_Object, Bytecount, Bytecount, Lisp_Object); Lisp_Object echo_area_status (struct frame *); int echo_area_active (struct frame *); Lisp_Object echo_area_contents (struct frame *); -void message_internal (const Intbyte *, Lisp_Object, Bytecount, Bytecount); -void message_append_internal (const Intbyte *, Lisp_Object, +void message_internal (const Ibyte *, Lisp_Object, Bytecount, Bytecount); +void message_append_internal (const Ibyte *, Lisp_Object, Bytecount, Bytecount); void message (const char *, ...) PRINTF_ARGS (1, 2); void message_append (const char *, ...) PRINTF_ARGS (1, 2); @@ -3337,9 +4329,18 @@ void clear_message (void); /* Defined in mule-charset.c */ +EXFUN (Fmake_charset, 3); + extern Lisp_Object Ql2r, Qr2l; /* Defined in print.c */ +EXFUN (Fdisplay_error, 2); +EXFUN (Ferror_message_string, 1); +EXFUN (Fprin1, 2); +EXFUN (Fprin1_to_string, 2); +EXFUN (Fprinc, 2); +EXFUN (Fprint, 2); + /* Lower-level ways to output data: */ void print_internal (Lisp_Object, Lisp_Object, int); @@ -3347,22 +4348,22 @@ /* NOTE: Do not call this with the data of a Lisp_String. Use princ. * Note: stream should be defaulted before calling * (eg Qnil means stdout, not Vstandard_output, etc) */ -void write_c_string (const CIntbyte *str, Lisp_Object stream); +void write_c_string (Lisp_Object stream, const CIbyte *str); /* Same goes for this function. */ -void write_string (const Intbyte *str, Lisp_Object stream); +void write_string (Lisp_Object stream, const Ibyte *str); /* Same goes for this function. */ -void write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream); -void write_eistring (const Eistring *ei, Lisp_Object stream); +void write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size); +void write_eistring (Lisp_Object stream, const Eistring *ei); /* Higher-level (printf-style) ways to output data: */ -void write_fmt_string (Lisp_Object stream, const CIntbyte *fmt, ...); -void write_fmt_string_lisp (Lisp_Object stream, const CIntbyte *fmt, +void write_fmt_string (Lisp_Object stream, const CIbyte *fmt, ...); +void write_fmt_string_lisp (Lisp_Object stream, const CIbyte *fmt, int nargs, ...); -void stderr_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2); -void stderr_out_lisp (const CIntbyte *, int nargs, ...); -void stdout_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2); -void debug_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2); -DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const CIntbyte *, +void stderr_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); +void stderr_out_lisp (const CIbyte *, int nargs, ...); +void stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); +void debug_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); +DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const CIbyte *, ...), 1, 2); /* Internal functions: */ @@ -3394,10 +4395,6 @@ void debug_short_backtrace (int); void debug_backtrace (void); -/* Defined in process.c */ -DECLARE_DOESNT_RETURN (report_process_error (const char *, Lisp_Object)); -DECLARE_DOESNT_RETURN (report_network_error (const char *, Lisp_Object)); - /* Defined in profile.c */ void mark_profiling_info (void); void profile_increase_call_count (Lisp_Object); @@ -3405,6 +4402,11 @@ extern int profiling_redisplay_flag; /* Defined in rangetab.c */ +EXFUN (Fclear_range_table, 1); +EXFUN (Fget_range_table, 3); +EXFUN (Fmake_range_table, 0); +EXFUN (Fput_range_table, 4); + void put_range_table (Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object); int unified_range_table_bytes_needed (Lisp_Object); int unified_range_table_bytes_used (void *); @@ -3415,43 +4417,75 @@ Lisp_Object *); /* Defined in search.c */ +EXFUN (Fmatch_beginning, 1); +EXFUN (Fmatch_end, 1); +EXFUN (Fskip_chars_backward, 3); +EXFUN (Fskip_chars_forward, 3); +EXFUN (Fstring_match, 4); + struct re_pattern_buffer; struct re_registers; -Charbpos scan_buffer (struct buffer *, Emchar, Charbpos, Charbpos, EMACS_INT, EMACS_INT *, int); +Charbpos scan_buffer (struct buffer *, Ichar, Charbpos, Charbpos, EMACS_INT, + EMACS_INT *, int); Charbpos find_next_newline (struct buffer *, Charbpos, int); Charbpos find_next_newline_no_quit (struct buffer *, Charbpos, int); -Bytebpos bi_find_next_newline_no_quit (struct buffer *, Bytebpos, int); -Bytebpos bi_find_next_emchar_in_string (Lisp_Object, Emchar, Bytebpos, EMACS_INT); +Bytebpos byte_find_next_newline_no_quit (struct buffer *, Bytebpos, int); +Bytecount byte_find_next_ichar_in_string (Lisp_Object, Ichar, Bytecount, + EMACS_INT); Charbpos find_before_next_newline (struct buffer *, Charbpos, Charbpos, int); -struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *, - Lisp_Object, int, Error_Behavior); -Bytecount fast_string_match (Lisp_Object, const Intbyte *, +struct re_pattern_buffer *compile_pattern (Lisp_Object pattern, + struct re_registers *regp, + Lisp_Object translate, + Lisp_Object searchobj, + struct buffer *searchbuf, + int posix, Error_Behavior errb); +Bytecount fast_string_match (Lisp_Object, const Ibyte *, Lisp_Object, Bytecount, Bytecount, int, Error_Behavior, int); Bytecount fast_lisp_string_match (Lisp_Object, Lisp_Object); -void restore_match_data (void); extern Fixnum warn_about_possibly_incompatible_back_references; /* Defined in signal.c */ void init_interrupts_late (void); -int begin_dont_check_for_quit (void); /* Defined in sound.c */ +EXFUN (Fding, 3); + void init_device_sound (struct device *); DECLARE_DOESNT_RETURN (report_sound_error (const Char_ASCII *, Lisp_Object)); /* Defined in specifier.c */ +EXFUN (Fadd_spec_to_specifier, 5); +EXFUN (Fspecifier_spec_list, 4); + Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior, int, int, Lisp_Object); Lisp_Object specifier_instance_no_quit (Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior, int, Lisp_Object); /* Defined in symbols.c */ -unsigned int hash_string (const Intbyte *, Bytecount); -Lisp_Object intern_int (const Intbyte *str); -Lisp_Object intern (const CIntbyte *str); -Lisp_Object oblookup (Lisp_Object, const Intbyte *, Bytecount); +EXFUN (Fboundp, 1); +EXFUN (Fbuilt_in_variable_type, 1); +EXFUN (Fdefault_boundp, 1); +EXFUN (Fdefault_value, 1); +EXFUN (Ffboundp, 1); +EXFUN (Ffset, 2); +EXFUN (Fintern, 2); +EXFUN (Fintern_soft, 2); +EXFUN (Fkill_local_variable, 1); +EXFUN (Fset, 2); +EXFUN (Fset_default, 2); +EXFUN (Fsymbol_function, 1); +EXFUN (Fsymbol_name, 1); +EXFUN (Fsymbol_plist, 1); +EXFUN (Fsymbol_value, 1); + +unsigned int hash_string (const Ibyte *, Bytecount); +Lisp_Object intern_int (const Ibyte *str); +Lisp_Object intern (const CIbyte *str); +Lisp_Object intern_converting_underscores_to_dashes (const CIbyte *str); +Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount); void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *); Lisp_Object indirect_function (Lisp_Object, int); Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object); @@ -3466,31 +4500,51 @@ /* Defined in syntax.c */ Charbpos scan_words (struct buffer *, Charbpos, int); +EXFUN (Fchar_syntax, 2); +EXFUN (Fforward_word, 2); +extern Lisp_Object Vstandard_syntax_table; +void signal_syntax_table_extent_changed (EXTENT extent); +void signal_syntax_table_extent_adjust (struct buffer *buf); +void init_buffer_syntax_cache (struct buffer *buf); +void mark_buffer_syntax_cache (struct buffer *buf); +void uninit_buffer_syntax_cache (struct buffer *buf); +extern Lisp_Object Qsyntax_table; /* Defined in sysdep.c */ long get_random (void); void seed_random (long arg); /* Defined in text.c */ -void find_charsets_in_intbyte_string (unsigned char *charsets, - const Intbyte *str, +void find_charsets_in_ibyte_string (unsigned char *charsets, + const Ibyte *str, Bytecount len); -void find_charsets_in_emchar_string (unsigned char *charsets, - const Emchar *str, +void find_charsets_in_ichar_string (unsigned char *charsets, + const Ichar *str, Charcount len); -int intbyte_string_displayed_columns (const Intbyte *str, Bytecount len); -int emchar_string_displayed_columns (const Emchar *str, Charcount len); -Charcount intbyte_string_nonascii_chars (const Intbyte *str, Bytecount len); -void convert_intbyte_string_into_emchar_dynarr (const Intbyte *str, +int ibyte_string_displayed_columns (const Ibyte *str, Bytecount len); +int ichar_string_displayed_columns (const Ichar *str, Charcount len); +Charcount ibyte_string_nonascii_chars (const Ibyte *str, Bytecount len); +void convert_ibyte_string_into_ichar_dynarr (const Ibyte *str, Bytecount len, - Emchar_dynarr *dyn); -Charcount convert_intbyte_string_into_emchar_string (const Intbyte *str, + Ichar_dynarr *dyn); +Charcount convert_ibyte_string_into_ichar_string (const Ibyte *str, Bytecount len, - Emchar *arr); -void convert_emchar_string_into_intbyte_dynarr (Emchar *arr, int nels, - Intbyte_dynarr *dyn); -Intbyte *convert_emchar_string_into_malloced_string (Emchar *arr, int nels, + Ichar *arr); +void convert_ichar_string_into_ibyte_dynarr (Ichar *arr, int nels, + Ibyte_dynarr *dyn); +Ibyte *convert_ichar_string_into_malloced_string (Ichar *arr, int nels, Bytecount *len_out); +Bytecount copy_text_between_formats (const Ibyte *src, Bytecount srclen, + Internal_Format srcfmt, + Lisp_Object srcobj, + Ibyte *dst, Bytecount dstlen, + Internal_Format dstfmt, + Lisp_Object dstobj, + Bytecount *src_used); +Bytecount copy_buffer_text_out (struct buffer *buf, Bytebpos pos, + Bytecount len, Ibyte *dst, Bytecount dstlen, + Internal_Format dstfmt, Lisp_Object dstobj, + Bytecount *src_used); /* flags for get_buffer_pos_char(), get_buffer_range_char(), etc. */ /* At most one of GB_COERCE_RANGE and GB_NO_ERROR_IF_BAD should be @@ -3525,29 +4579,46 @@ void get_string_range_byte (Lisp_Object string, Lisp_Object from, Lisp_Object to, Bytecount *from_out, Bytecount *to_out, unsigned int flags); -Charbpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos, - unsigned int flags); -Bytebpos get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos, - unsigned int flags); +Charxpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos, + unsigned int flags); +Bytexpos get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos, + unsigned int flags); void get_buffer_or_string_range_char (Lisp_Object object, Lisp_Object from, - Lisp_Object to, Charbpos *from_out, - Charbpos *to_out, unsigned int flags); + Lisp_Object to, Charxpos *from_out, + Charxpos *to_out, unsigned int flags); void get_buffer_or_string_range_byte (Lisp_Object object, Lisp_Object from, - Lisp_Object to, Bytebpos *from_out, - Bytebpos *to_out, unsigned int flags); -Charbpos buffer_or_string_accessible_begin_char (Lisp_Object object); -Charbpos buffer_or_string_accessible_end_char (Lisp_Object object); -Bytebpos buffer_or_string_accessible_begin_byte (Lisp_Object object); -Bytebpos buffer_or_string_accessible_end_byte (Lisp_Object object); -Charbpos buffer_or_string_absolute_begin_char (Lisp_Object object); -Charbpos buffer_or_string_absolute_end_char (Lisp_Object object); -Bytebpos buffer_or_string_absolute_begin_byte (Lisp_Object object); -Bytebpos buffer_or_string_absolute_end_byte (Lisp_Object object); + Lisp_Object to, Bytexpos *from_out, + Bytexpos *to_out, unsigned int flags); +Charxpos buffer_or_string_accessible_begin_char (Lisp_Object object); +Charxpos buffer_or_string_accessible_end_char (Lisp_Object object); +Bytexpos buffer_or_string_accessible_begin_byte (Lisp_Object object); +Bytexpos buffer_or_string_accessible_end_byte (Lisp_Object object); +Charxpos buffer_or_string_absolute_begin_char (Lisp_Object object); +Charxpos buffer_or_string_absolute_end_char (Lisp_Object object); +Bytexpos buffer_or_string_absolute_begin_byte (Lisp_Object object); +Bytexpos buffer_or_string_absolute_end_byte (Lisp_Object object); +Charbpos charbpos_clip_to_bounds (Charbpos lower, Charbpos num, + Charbpos upper); +Bytebpos bytebpos_clip_to_bounds (Bytebpos lower, Bytebpos num, + Bytebpos upper); +Charxpos charxpos_clip_to_bounds (Charxpos lower, Charxpos num, + Charxpos upper); +Bytexpos bytexpos_clip_to_bounds (Bytexpos lower, Bytexpos num, + Bytexpos upper); +Charxpos buffer_or_string_clip_to_accessible_char (Lisp_Object object, + Charxpos pos); +Bytexpos buffer_or_string_clip_to_accessible_byte (Lisp_Object object, + Bytexpos pos); +Charxpos buffer_or_string_clip_to_absolute_char (Lisp_Object object, + Charxpos pos); +Bytexpos buffer_or_string_clip_to_absolute_byte (Lisp_Object object, + Bytexpos pos); + #ifdef ENABLE_COMPOSITE_CHARS -Emchar lookup_composite_char (Intbyte *str, int len); -Lisp_Object composite_char_string (Emchar ch); +Ichar lookup_composite_char (Ibyte *str, int len); +Lisp_Object composite_char_string (Ichar ch); #endif /* ENABLE_COMPOSITE_CHARS */ EXFUN (Ffind_charset, 1); @@ -3579,213 +4650,213 @@ extern Lisp_Object Vcharset_chinese_big5_2; extern Lisp_Object Vcharset_composite; -Emchar Lstream_get_emchar_1 (Lstream *stream, int first_char); -int Lstream_fput_emchar (Lstream *stream, Emchar ch); -void Lstream_funget_emchar (Lstream *stream, Emchar ch); +Ichar Lstream_get_ichar_1 (Lstream *stream, int first_char); +int Lstream_fput_ichar (Lstream *stream, Ichar ch); +void Lstream_funget_ichar (Lstream *stream, Ichar ch); -DECLARE_INLINE_HEADER (Intbyte *qxestrdup (const Intbyte *s)) +DECLARE_INLINE_HEADER (Ibyte *qxestrdup (const Ibyte *s)) { - return (Intbyte *) xstrdup ((const char *) s); + return (Ibyte *) xstrdup ((const char *) s); } -DECLARE_INLINE_HEADER (Bytecount qxestrlen (const Intbyte *s)) +DECLARE_INLINE_HEADER (Bytecount qxestrlen (const Ibyte *s)) { return strlen ((const char *) s); } -DECLARE_INLINE_HEADER (Charcount qxestrcharlen (const Intbyte *s)) +DECLARE_INLINE_HEADER (Charcount qxestrcharlen (const Ibyte *s)) { return bytecount_to_charcount (s, qxestrlen (s)); } -DECLARE_INLINE_HEADER (int qxestrcmp (const Intbyte *s1, - const Intbyte *s2)) +DECLARE_INLINE_HEADER (int qxestrcmp (const Ibyte *s1, + const Ibyte *s2)) { return strcmp ((const char *) s1, (const char *) s2); } -DECLARE_INLINE_HEADER (int qxestrcmp_c (const Intbyte *s1, +DECLARE_INLINE_HEADER (int qxestrcmp_c (const Ibyte *s1, const char *s2)) { return strcmp ((const char *) s1, s2); } -DECLARE_INLINE_HEADER (int qxestrncmp (const Intbyte *string1, - const Intbyte *string2, +DECLARE_INLINE_HEADER (int qxestrncmp (const Ibyte *string1, + const Ibyte *string2, Bytecount count)) { return strncmp ((const char *) string1, (const char *) string2, (size_t) count); } -DECLARE_INLINE_HEADER (int qxestrncmp_c (const Intbyte *string1, +DECLARE_INLINE_HEADER (int qxestrncmp_c (const Ibyte *string1, const char *string2, Bytecount count)) { return strncmp ((const char *) string1, string2, (size_t) count); } -DECLARE_INLINE_HEADER (Intbyte *qxestrcpy (Intbyte *strDest, - const Intbyte *strSource)) +DECLARE_INLINE_HEADER (Ibyte *qxestrcpy (Ibyte *strDest, + const Ibyte *strSource)) { - return (Intbyte *) strcpy ((char *) strDest, (const char *) strSource); + return (Ibyte *) strcpy ((char *) strDest, (const char *) strSource); } -DECLARE_INLINE_HEADER (Intbyte *qxestrcpy_c (Intbyte *strDest, +DECLARE_INLINE_HEADER (Ibyte *qxestrcpy_c (Ibyte *strDest, const char *strSource)) { - return (Intbyte *) strcpy ((char *) strDest, strSource); + return (Ibyte *) strcpy ((char *) strDest, strSource); } -DECLARE_INLINE_HEADER (Intbyte *qxestrncpy (Intbyte *strDest, - const Intbyte *strSource, +DECLARE_INLINE_HEADER (Ibyte *qxestrncpy (Ibyte *strDest, + const Ibyte *strSource, Bytecount count)) { - return (Intbyte *) strncpy ((char *) strDest, (const char *) strSource, + return (Ibyte *) strncpy ((char *) strDest, (const char *) strSource, (size_t) count); } -DECLARE_INLINE_HEADER (Intbyte *qxestrncpy_c (Intbyte *strDest, +DECLARE_INLINE_HEADER (Ibyte *qxestrncpy_c (Ibyte *strDest, const char *strSource, Bytecount count)) { - return (Intbyte *) strncpy ((char *) strDest, strSource, (size_t) count); + return (Ibyte *) strncpy ((char *) strDest, strSource, (size_t) count); } -DECLARE_INLINE_HEADER (Intbyte *qxestrcat (Intbyte *strDest, - const Intbyte *strSource)) +DECLARE_INLINE_HEADER (Ibyte *qxestrcat (Ibyte *strDest, + const Ibyte *strSource)) { - return (Intbyte *) strcat ((char *) strDest, (const char *) strSource); + return (Ibyte *) strcat ((char *) strDest, (const char *) strSource); } -DECLARE_INLINE_HEADER (Intbyte *qxestrcat_c (Intbyte *strDest, +DECLARE_INLINE_HEADER (Ibyte *qxestrcat_c (Ibyte *strDest, const char *strSource)) { - return (Intbyte *) strcat ((char *) strDest, strSource); + return (Ibyte *) strcat ((char *) strDest, strSource); } -DECLARE_INLINE_HEADER (Intbyte *qxestrncat (Intbyte *strDest, - const Intbyte *strSource, +DECLARE_INLINE_HEADER (Ibyte *qxestrncat (Ibyte *strDest, + const Ibyte *strSource, Bytecount count)) { - return (Intbyte *) strncat ((char *) strDest, (const char *) strSource, + return (Ibyte *) strncat ((char *) strDest, (const char *) strSource, (size_t) count); } -DECLARE_INLINE_HEADER (Intbyte *qxestrncat_c (Intbyte *strDest, +DECLARE_INLINE_HEADER (Ibyte *qxestrncat_c (Ibyte *strDest, const char *strSource, Bytecount count)) { - return (Intbyte *) strncat ((char *) strDest, strSource, (size_t) count); + return (Ibyte *) strncat ((char *) strDest, strSource, (size_t) count); } -DECLARE_INLINE_HEADER (Intbyte *qxestrchr (const Intbyte *s, Emchar c)) +DECLARE_INLINE_HEADER (Ibyte *qxestrchr (const Ibyte *s, Ichar c)) { assert (c >= 0 && c <= 255); - return (Intbyte *) strchr ((const char *) s, c); + return (Ibyte *) strchr ((const char *) s, c); } -DECLARE_INLINE_HEADER (Intbyte *qxestrrchr (const Intbyte *s, Emchar c)) +DECLARE_INLINE_HEADER (Ibyte *qxestrrchr (const Ibyte *s, Ichar c)) { assert (c >= 0 && c <= 255); - return (Intbyte *) strrchr ((const char *) s, c); + return (Ibyte *) strrchr ((const char *) s, c); } -DECLARE_INLINE_HEADER (Intbyte *qxestrstr (const Intbyte *string1, - const Intbyte *string2)) +DECLARE_INLINE_HEADER (Ibyte *qxestrstr (const Ibyte *string1, + const Ibyte *string2)) { - return (Intbyte *) strstr ((const char *) string1, (const char *) string2); + return (Ibyte *) strstr ((const char *) string1, (const char *) string2); } -DECLARE_INLINE_HEADER (Bytecount qxestrcspn (const Intbyte *string, - const CIntbyte *strCharSet)) +DECLARE_INLINE_HEADER (Bytecount qxestrcspn (const Ibyte *string, + const CIbyte *strCharSet)) { return (Bytecount) strcspn ((const char *) string, strCharSet); } -DECLARE_INLINE_HEADER (Bytecount qxestrspn (const Intbyte *string, - const CIntbyte *strCharSet)) +DECLARE_INLINE_HEADER (Bytecount qxestrspn (const Ibyte *string, + const CIbyte *strCharSet)) { return (Bytecount) strspn ((const char *) string, strCharSet); } -DECLARE_INLINE_HEADER (Intbyte *qxestrpbrk (const Intbyte *string, - const CIntbyte *strCharSet)) +DECLARE_INLINE_HEADER (Ibyte *qxestrpbrk (const Ibyte *string, + const CIbyte *strCharSet)) { - return (Intbyte *) strpbrk ((const char *) string, strCharSet); + return (Ibyte *) strpbrk ((const char *) string, strCharSet); } -DECLARE_INLINE_HEADER (Intbyte *qxestrtok (Intbyte *strToken, - const CIntbyte *strDelimit)) +DECLARE_INLINE_HEADER (Ibyte *qxestrtok (Ibyte *strToken, + const CIbyte *strDelimit)) { - return (Intbyte *) strtok ((char *) strToken, strDelimit); + return (Ibyte *) strtok ((char *) strToken, strDelimit); } -DECLARE_INLINE_HEADER (double qxestrtod (const Intbyte *nptr, - Intbyte **endptr)) +DECLARE_INLINE_HEADER (double qxestrtod (const Ibyte *nptr, + Ibyte **endptr)) { return strtod ((const char *) nptr, (char **) endptr); } -DECLARE_INLINE_HEADER (long qxestrtol (const Intbyte *nptr, Intbyte **endptr, +DECLARE_INLINE_HEADER (long qxestrtol (const Ibyte *nptr, Ibyte **endptr, int base)) { return strtol ((const char *) nptr, (char **) endptr, base); } -DECLARE_INLINE_HEADER (unsigned long qxestrtoul (const Intbyte *nptr, - Intbyte **endptr, +DECLARE_INLINE_HEADER (unsigned long qxestrtoul (const Ibyte *nptr, + Ibyte **endptr, int base)) { return strtoul ((const char *) nptr, (char **) endptr, base); } -DECLARE_INLINE_HEADER (int qxeatoi (const Intbyte *string)) +DECLARE_INLINE_HEADER (int qxeatoi (const Ibyte *string)) { return atoi ((const char *) string); } -int qxesprintf (Intbyte *buffer, const CIntbyte *format, ...) +int qxesprintf (Ibyte *buffer, const CIbyte *format, ...) PRINTF_ARGS (2, 3); /* Do not use POSIX locale routines. Not Mule-correct. */ #define qxestrcoll DO NOT USE. #define qxestrxfrm DO NOT USE. -int qxestrcasecmp (const Intbyte *s1, const Intbyte *s2); -int qxestrcasecmp_c (const Intbyte *s1, const Char_ASCII *s2); -int qxestrcasecmp_i18n (const Intbyte *s1, const Intbyte *s2); +int qxestrcasecmp (const Ibyte *s1, const Ibyte *s2); +int qxestrcasecmp_c (const Ibyte *s1, const Char_ASCII *s2); +int qxestrcasecmp_i18n (const Ibyte *s1, const Ibyte *s2); int ascii_strcasecmp (const Char_ASCII *s1, const Char_ASCII *s2); int lisp_strcasecmp (Lisp_Object s1, Lisp_Object s2); int lisp_strcasecmp_i18n (Lisp_Object s1, Lisp_Object s2); -int qxestrncasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len); -int qxestrncasecmp_c (const Intbyte *s1, const Char_ASCII *s2, Bytecount len); -int qxestrncasecmp_i18n (const Intbyte *s1, const Intbyte *s2, Bytecount len); +int qxestrncasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len); +int qxestrncasecmp_c (const Ibyte *s1, const Char_ASCII *s2, Bytecount len); +int qxestrncasecmp_i18n (const Ibyte *s1, const Ibyte *s2, Bytecount len); int ascii_strncasecmp (const Char_ASCII *s1, const Char_ASCII *s2, Bytecount len); -int qxememcmp (const Intbyte *s1, const Intbyte *s2, Bytecount len); -int qxememcmp4 (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2); -int qxememcasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len); -int qxememcasecmp4 (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2); -int qxetextcmp (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2); -int qxetextcmp_matching (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2, +int qxememcmp (const Ibyte *s1, const Ibyte *s2, Bytecount len); +int qxememcmp4 (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2); +int qxememcasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len); +int qxememcasecmp4 (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2); +int qxetextcmp (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2); +int qxetextcmp_matching (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2, Charcount *matching); -int qxetextcasecmp (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2); -int qxetextcasecmp_matching (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2, +int qxetextcasecmp (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2); +int qxetextcasecmp_matching (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2, Charcount *matching); void buffer_mule_signal_inserted_region (struct buffer *buf, Charbpos start, Bytecount bytelength, Charcount charlength); void buffer_mule_signal_deleted_region (struct buffer *buf, Charbpos start, - Charbpos end, Bytebpos bi_start, - Bytebpos bi_end); + Charbpos end, Bytebpos byte_start, + Bytebpos byte_end); /* Defined in unicode.c */ extern const struct struct_description to_unicode_description[]; @@ -3803,6 +4874,8 @@ #endif /* MEMORY_USAGE_STATS */ /* Defined in undo.c */ +EXFUN (Fundo_boundary, 0); + Lisp_Object truncate_undo_list (Lisp_Object, int, int); void record_extent (Lisp_Object, int); void record_insert (struct buffer *, Charbpos, Charcount); @@ -3810,7 +4883,11 @@ void record_change (struct buffer *, Charbpos, Charcount); /* Defined in unex*.c */ -int unexec (char *, char *, uintptr_t, uintptr_t, uintptr_t); +#ifdef WIN32_NATIVE +int unexec (Ibyte *, Ibyte *, uintptr_t, uintptr_t, uintptr_t); +#else +int unexec (Extbyte *, Extbyte *, uintptr_t, uintptr_t, uintptr_t); +#endif #ifdef RUN_TIME_REMAP int run_time_remap (char *); #endif @@ -3818,243 +4895,11 @@ /* Defined in vm-limit.c */ void memory_warnings (void *, void (*) (const char *)); -/* Defined in window.c */ -Lisp_Object save_window_excursion_unwind (Lisp_Object); -Lisp_Object display_buffer (Lisp_Object, Lisp_Object, Lisp_Object); - -/*--------------- prototypes for Lisp primitives in C ------------*/ - -/* The following were machine generated 19980312 */ - -EXFUN (Faccept_process_output, 3); -EXFUN (Fadd1, 1); -EXFUN (Fadd_spec_to_specifier, 5); -EXFUN (Fadd_timeout, 4); -EXFUN (Fappend, MANY); -EXFUN (Fapply, MANY); -EXFUN (Faref, 2); -EXFUN (Faset, 3); -EXFUN (Fassoc, 2); -EXFUN (Fassq, 2); -EXFUN (Fbacktrace, 2); -EXFUN (Fbeginning_of_line, 2); -EXFUN (Fbobp, 1); -EXFUN (Fbolp, 1); -EXFUN (Fboundp, 1); -EXFUN (Fbuffer_substring, 3); -EXFUN (Fbuilt_in_variable_type, 1); -EXFUN (Fbyte_code, 3); -EXFUN (Fcall_interactively, 3); -EXFUN (Fcanonicalize_lax_plist, 2); -EXFUN (Fcanonicalize_plist, 2); -EXFUN (Fcar, 1); -EXFUN (Fcar_safe, 1); -EXFUN (Fcdr, 1); -EXFUN (Fchar_after, 2); -EXFUN (Fchar_to_string, 1); -EXFUN (Fcheck_valid_plist, 1); -EXFUN (Fvalid_plist_p, 1); -EXFUN (Fclear_range_table, 1); -EXFUN (Fcommand_execute, 3); -EXFUN (Fcommandp, 1); -EXFUN (Fconcat, MANY); -EXFUN (Fcons, 2); -EXFUN (Fcopy_alist, 1); -EXFUN (Fcopy_event, 2); -EXFUN (Fcopy_list, 1); -EXFUN (Fcopy_marker, 2); -EXFUN (Fcopy_sequence, 1); -EXFUN (Fcopy_tree, 2); -EXFUN (Fcurrent_window_configuration, 1); -EXFUN (Fdefault_boundp, 1); -EXFUN (Fdefault_value, 1); -EXFUN (Fdefine_key, 3); -EXFUN (Fdelete, 2); -EXFUN (Fdelete_region, 3); -EXFUN (Fdelete_process, 1); -EXFUN (Fdelq, 2); -EXFUN (Fdestructive_alist_to_plist, 1); -EXFUN (Fdgettext, 2); -EXFUN (Fding, 3); -EXFUN (Fdirectory_file_name, 1); -EXFUN (Fdisable_timeout, 1); -EXFUN (Fdiscard_input, 0); -EXFUN (Fdispatch_event, 1); -EXFUN (Fdisplay_error, 2); -EXFUN (Fdo_auto_save, 2); -EXFUN (Fdowncase, 2); -EXFUN (Felt, 2); -EXFUN (Fend_of_line, 2); -EXFUN (Fenqueue_eval_event, 2); -EXFUN (Feobp, 1); -EXFUN (Feolp, 1); -EXFUN (Fequal, 2); -EXFUN (Ferror_message_string, 1); -EXFUN (Feval, 1); -EXFUN (Fevent_to_character, 4); -EXFUN (Fexecute_kbd_macro, 2); -EXFUN (Fexpand_abbrev, 0); -EXFUN (Fexpand_file_name, 2); -EXFUN (Fextent_at, 5); -EXFUN (Fextent_property, 3); -EXFUN (Ffboundp, 1); -EXFUN (Ffile_accessible_directory_p, 1); -EXFUN (Ffile_directory_p, 1); -EXFUN (Ffile_executable_p, 1); -EXFUN (Ffile_exists_p, 1); -EXFUN (Ffile_name_absolute_p, 1); -EXFUN (Ffile_name_as_directory, 1); -EXFUN (Ffile_name_directory, 1); -EXFUN (Ffile_name_nondirectory, 1); -EXFUN (Ffile_readable_p, 1); -EXFUN (Ffile_symlink_p, 1); -EXFUN (Ffile_truename, 2); -EXFUN (Ffind_file_name_handler, 2); -EXFUN (Ffollowing_char, 1); -EXFUN (Fformat, MANY); -EXFUN (Fforward_char, 2); -EXFUN (Fforward_line, 2); -EXFUN (Ffset, 2); -EXFUN (Ffuncall, MANY); -EXFUN (Ffunctionp, 1); -EXFUN (Fgeq, MANY); -EXFUN (Fget, 3); -EXFUN (Fget_buffer_process, 1); -EXFUN (Fget_process, 1); -EXFUN (Fget_range_table, 3); -EXFUN (Fgettext, 1); -EXFUN (Fgoto_char, 2); -EXFUN (Fgtr, MANY); -EXFUN (Findent_to, 3); -EXFUN (Findirect_function, 1); -EXFUN (Finsert, MANY); -EXFUN (Finsert_buffer_substring, 3); -EXFUN (Finsert_char, 4); -EXFUN (Finsert_file_contents_internal, 7); -EXFUN (Finteractive_p, 0); -EXFUN (Fintern, 2); -EXFUN (Fintern_soft, 2); -EXFUN (Fkey_description, 1); -EXFUN (Fkill_emacs, 1); -EXFUN (Fkill_local_variable, 1); -EXFUN (Flast, 2); -EXFUN (Flax_plist_get, 3); -EXFUN (Flax_plist_remprop, 2); -EXFUN (Flength, 1); -EXFUN (Fleq, MANY); -EXFUN (Flist, MANY); -EXFUN (Flistp, 1); -EXFUN (Flist_modules, 0); -EXFUN (Fload_module, 3); -EXFUN (Flookup_key, 3); -EXFUN (Flss, MANY); -EXFUN (Fmake_byte_code, MANY); -EXFUN (Fmake_charset, 3); -EXFUN (Fmake_glyph_internal, 1); -EXFUN (Fmake_list, 2); -EXFUN (Fmake_marker, 0); -EXFUN (Fmake_range_table, 0); -EXFUN (Fmake_temp_name, 1); -EXFUN (Fmake_sparse_keymap, 1); -EXFUN (Fmake_string, 2); -EXFUN (Fmake_symbol, 1); -EXFUN (Fmake_vector, 2); -EXFUN (Fmapcar, 2); -EXFUN (Fmarker_buffer, 1); -EXFUN (Fmarker_position, 1); -EXFUN (Fmatch_beginning, 1); -EXFUN (Fmatch_end, 1); -EXFUN (Fmax, MANY); -EXFUN (Fmember, 2); -EXFUN (Fmemq, 2); -EXFUN (Fmin, MANY); -EXFUN (Fminus, MANY); -EXFUN (Fnarrow_to_region, 3); -EXFUN (Fnconc, MANY); -EXFUN (Fnext_event, 2); -EXFUN (Fnreverse, 1); -EXFUN (Fnthcdr, 2); -EXFUN (Fnumber_to_string, 1); -EXFUN (Fold_assq, 2); -EXFUN (Fold_equal, 2); -EXFUN (Fold_member, 2); -EXFUN (Fold_memq, 2); -EXFUN (Fplist_get, 3); -EXFUN (Fplist_member, 2); -EXFUN (Fplist_put, 3); -EXFUN (Fplus, MANY); -EXFUN (Fpoint, 1); -EXFUN (Fpoint_marker, 2); -EXFUN (Fpoint_max, 1); -EXFUN (Fpoint_min, 1); -EXFUN (Fpreceding_char, 1); -EXFUN (Fprefix_numeric_value, 1); -EXFUN (Fprin1, 2); -EXFUN (Fprin1_to_string, 2); -EXFUN (Fprinc, 2); -EXFUN (Fprint, 2); -EXFUN (Fprocess_status, 1); -EXFUN (Fprogn, UNEVALLED); -EXFUN (Fprovide, 1); -EXFUN (Fput, 3); -EXFUN (Fput_range_table, 4); -EXFUN (Fput_text_property, 5); -EXFUN (Fquo, MANY); -EXFUN (Frassq, 2); -EXFUN (Fread, 1); -EXFUN (Fread_key_sequence, 3); -EXFUN (Freally_free, 1); -EXFUN (Frem, 2); -EXFUN (Fremassq, 2); -EXFUN (Freplace_list, 2); -EXFUN (Frunning_temacs_p, 0); -EXFUN (Fselected_frame, 1); -EXFUN (Fset, 2); -EXFUN (Fset_default, 2); -EXFUN (Fset_marker, 3); -EXFUN (Fset_standard_case_table, 1); -EXFUN (Fsetcar, 2); -EXFUN (Fsetcdr, 2); -EXFUN (Fsignal, 2); -EXFUN (Fsit_for, 2); -EXFUN (Fskip_chars_backward, 3); -EXFUN (Fskip_chars_forward, 3); -EXFUN (Fsleep_for, 1); -EXFUN (Fsort, 2); -EXFUN (Fspecifier_spec_list, 4); -EXFUN (Fstring_equal, 2); -EXFUN (Fstring_lessp, 2); -EXFUN (Fstring_match, 4); -EXFUN (Fsub1, 1); -EXFUN (Fsubr_max_args, 1); -EXFUN (Fsubr_min_args, 1); -EXFUN (Fsubstitute_command_keys, 1); -EXFUN (Fsubstitute_in_file_name, 1); -EXFUN (Fsubstring, 3); -EXFUN (Fsymbol_function, 1); -EXFUN (Fsymbol_name, 1); -EXFUN (Fsymbol_plist, 1); -EXFUN (Fsymbol_value, 1); -EXFUN (Fsystem_name, 0); -EXFUN (Fthrow, 2); -EXFUN (Ftimes, MANY); -EXFUN (Ftruncate, 1); -EXFUN (Fundo_boundary, 0); -EXFUN (Funhandled_file_name_directory, 1); -EXFUN (Funlock_buffer, 0); -EXFUN (Fupcase, 2); -EXFUN (Fupcase_initials, 2); -EXFUN (Fupcase_initials_region, 3); -EXFUN (Fupcase_region, 3); -EXFUN (Fuser_home_directory, 0); -EXFUN (Fuser_login_name, 1); -EXFUN (Fvector, MANY); -EXFUN (Fverify_visited_file_modtime, 1); -EXFUN (Fvertical_motion, 3); -EXFUN (Fwiden, 1); - /*--------------- prototypes for constant symbols ------------*/ +/* #### We should get rid of this and put the prototypes back up there in + #### the per-file stuff, where they belong. */ + /* Use the following when you have to add a bunch of symbols. */ /* @@ -4109,15 +4954,16 @@ */ -extern Lisp_Object Qactivate_menubar_hook, Qarith_error, Qarrayp, Qautoload; -extern Lisp_Object Qbackground, Qbackground_pixmap, Qbeginning_of_buffer; -extern Lisp_Object Qbitp, Qblinking, Qbuffer_glyph_p, Qbuffer_live_p; -extern Lisp_Object Qbuffer_read_only, Qbyte_code, Qcall_interactively; -extern Lisp_Object Qcategory_designator_p, Qcategory_table_value_p, Qcdr; -extern Lisp_Object Qchar_or_string_p, Qcharacterp, Qcircular_list; -extern Lisp_Object Qcircular_property_list, Qcolor_pixmap_image_instance_p; -extern Lisp_Object Qcommandp, Qcompletion_ignore_case, Qconsole_live_p; -extern Lisp_Object Qconst_specifier, Qconversion_error, Qcurrent_menubar; +extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest; +extern Lisp_Object Qarith_error, Qarrayp, Qautoload, Qbackground; +extern Lisp_Object Qbackground_pixmap, Qbeginning_of_buffer, Qbitp, Qblinking; +extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only; +extern Lisp_Object Qbyte_code, Qcall_interactively, Qcategory_designator_p; +extern Lisp_Object Qcategory_table_value_p, Qcdr, Qchar_or_string_p; +extern Lisp_Object Qcharacterp, Qcircular_list, Qcircular_property_list; +extern Lisp_Object Qcolor_pixmap_image_instance_p, Qcommandp; +extern Lisp_Object Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier; +extern Lisp_Object Qconversion_error, Qcurrent_menubar; extern Lisp_Object Qcyclic_variable_indirection, Qdefun, Qdevice_live_p, Qdim; extern Lisp_Object Qdirection, Qdisabled, Qdisabled_command_hook; extern Lisp_Object Qdisplay_table, Qdomain_error, Qediting_error; @@ -4173,6 +5019,9 @@ #undef SYMBOL_GENERAL /*--------------- prototypes for variables of type Lisp_Object ------------*/ + +/* #### We should get rid of this and put the prototypes back up there in + #### the per-file stuff, where they belong. */ extern Lisp_Object Vactivate_menubar_hook; extern Lisp_Object Vautoload_queue, Vblank_menubar; diff --text -u 'xemacs-21.5.6/src/lread.c' 'xemacs-21.5.7/src/lread.c' Index: ././src/lread.c --- ././src/lread.c Sun Mar 31 17:28:41 2002 +++ ././src/lread.c Wed Jun 5 18:56:20 2002 @@ -150,11 +150,6 @@ /* An array describing all known built-in structure types */ static structure_type_dynarr *the_structure_type_dynarr; -#if 0 /* FSF defun hack */ -/* When nonzero, read conses in pure space */ -static int read_pure; -#endif - #if 0 /* FSF stuff */ /* For use within read-from-string (this reader is non-reentrant!!) */ static int read_from_string_index; @@ -192,7 +187,7 @@ the containing objects that have (#$ . INT) conses in them (this will only be compiled-function objects and lists), and when the file is finished loading, we go through and fill in all the - doc strings at once. */ + doc strings at once. --ben */ /* This contains the last string skipped with #@. */ static char *saved_doc_string; @@ -228,14 +223,14 @@ /* Handle unreading and rereading of characters. */ -static Emchar +static Ichar readchar (Lisp_Object readcharfun) { /* This function can GC */ if (BUFFERP (readcharfun)) { - Emchar c; + Ichar c; struct buffer *b = XBUFFER (readcharfun); if (!BUFFER_LIVE_P (b)) @@ -250,7 +245,7 @@ } else if (LSTREAMP (readcharfun)) { - Emchar c = Lstream_get_emchar (XLSTREAM (readcharfun)); + Ichar c = Lstream_get_ichar (XLSTREAM (readcharfun)); #ifdef DEBUG_XEMACS /* testing Mule */ static int testing_mule = 0; /* Change via debugger */ if (testing_mule) @@ -264,7 +259,7 @@ } else if (MARKERP (readcharfun)) { - Emchar c; + Ichar c; Charbpos mpos = marker_position (readcharfun); struct buffer *inbuffer = XMARKER (readcharfun)->buffer; @@ -288,7 +283,7 @@ If the stream is a user function, call it with the char as argument. */ static void -unreadchar (Lisp_Object readcharfun, Emchar c) +unreadchar (Lisp_Object readcharfun, Ichar c) { if (c == -1) /* Don't back up the pointer if we're unreading the end-of-input mark, @@ -298,7 +293,7 @@ BUF_SET_PT (XBUFFER (readcharfun), BUF_PT (XBUFFER (readcharfun)) - 1); else if (LSTREAMP (readcharfun)) { - Lstream_unget_emchar (XLSTREAM (readcharfun), c); + Lstream_unget_ichar (XLSTREAM (readcharfun), c); #ifdef DEBUG_XEMACS /* testing Mule */ { static int testing_mule = 0; /* Set this using debugger */ @@ -317,23 +312,8 @@ static Lisp_Object read0 (Lisp_Object readcharfun); static Lisp_Object read1 (Lisp_Object readcharfun); -/* allow_dotted_lists means that something like (foo bar . baz) - is acceptable. If -1, means check for starting with defun - and make structure pure. (not implemented, probably for very - good reasons) -*/ -/* - If check_for_doc_references, look for (#$ . INT) doc references - in the list and record if load_force_doc_strings is non-zero. - (Such doc references will be destroyed during the loadup phase - by replacing with Qzero, because Snarf-documentation will fill - them in again.) - - WARNING: If you set this, you sure as hell better not call - free_list() on the returned list here. */ - static Lisp_Object read_list (Lisp_Object readcharfun, - Emchar terminator, + Ichar terminator, int allow_dotted_lists, int check_for_doc_references); @@ -346,36 +326,6 @@ load_unwind (Lisp_Object stream) /* used as unwind-protect function in load */ { Lstream_close (XLSTREAM (stream)); - if (--load_in_progress < 0) - load_in_progress = 0; - return Qnil; -} - -static Lisp_Object -load_descriptor_unwind (Lisp_Object oldlist) -{ - Vload_descriptor_list = oldlist; - return Qnil; -} - -static Lisp_Object -load_file_name_internal_unwind (Lisp_Object oldval) -{ - Vload_file_name_internal = oldval; - return Qnil; -} - -static Lisp_Object -load_file_name_internal_the_purecopy_unwind (Lisp_Object oldval) -{ - Vload_file_name_internal_the_purecopy = oldval; - return Qnil; -} - -static Lisp_Object -load_byte_code_version_unwind (Lisp_Object oldval) -{ - load_byte_code_version = XINT (oldval); return Qnil; } @@ -426,7 +376,7 @@ pos = XINT (XCDR (victim)); if (pos < 0) pos = -pos; /* kludge to mark a user variable */ - tem = unparesseuxify_doc_string (fd, pos, 0, Vload_file_name_internal); + tem = unparesseuxify_doc_string (fd, pos, 0, Vload_file_name_internal, 0); if (!STRINGP (tem)) signal_error_1 (Qinvalid_byte_code, tem); return tem; @@ -462,7 +412,8 @@ { struct gcpro ngcpro1; Lisp_Object juan = (pas_de_holgazan_ici - (fd, XCOMPILED_FUNCTION (john)->instructions)); + (fd, + XCOMPILED_FUNCTION (john)->instructions)); Lisp_Object ivan; NGCPRO1 (juan); @@ -509,13 +460,6 @@ #ifdef I18N3 Lisp_Object Vfile_domain; - -Lisp_Object -restore_file_domain (Lisp_Object val) -{ - Vfile_domain = val; - return Qnil; -} #endif /* I18N3 */ DEFUN ("load-internal", Fload_internal, 1, 6, 0, /* @@ -579,7 +523,7 @@ Unix truly sucks. */ if (XSTRING_LENGTH (file) > 0) { - Intbyte *foundstr; + Ibyte *foundstr; int foundlen; fd = locate_file (Vload_path, file, @@ -600,7 +544,7 @@ } } - foundstr = (Intbyte *) alloca (XSTRING_LENGTH (found) + 1); + foundstr = (Ibyte *) ALLOCA (XSTRING_LENGTH (found) + 1); qxestrcpy (foundstr, XSTRING_DATA (found)); foundlen = qxestrlen (foundstr); @@ -694,28 +638,24 @@ Lstream_set_buffering (XLSTREAM (lispstream), LSTREAM_BLOCKN_BUFFERED, block_size); /* NOTE: Order of these is very important. Don't rearrange them. */ + internal_bind_int (&load_in_progress, 1 + load_in_progress); record_unwind_protect (load_unwind, lispstream); - record_unwind_protect (load_descriptor_unwind, Vload_descriptor_list); - record_unwind_protect (load_file_name_internal_unwind, - Vload_file_name_internal); - record_unwind_protect (load_file_name_internal_the_purecopy_unwind, - Vload_file_name_internal_the_purecopy); + internal_bind_lisp_object (&Vload_descriptor_list, + Fcons (make_int (fd), Vload_descriptor_list)); + internal_bind_lisp_object (&Vload_file_name_internal, found); + internal_bind_lisp_object (&Vload_file_name_internal_the_purecopy, Qnil); + /* this is not a simple internal_bind. */ record_unwind_protect (load_force_doc_string_unwind, Vload_force_doc_string_list); - Vload_file_name_internal = found; - Vload_file_name_internal_the_purecopy = Qnil; - specbind (Qload_file_name, found); - Vload_descriptor_list = Fcons (make_int (fd), Vload_descriptor_list); Vload_force_doc_string_list = Qnil; + specbind (Qload_file_name, found); #ifdef I18N3 - record_unwind_protect (restore_file_domain, Vfile_domain); - Vfile_domain = Qnil; /* set it to nil; a call to #'domain will set it. */ + /* set it to nil; a call to #'domain will set it. */ + internal_bind_lisp_object (&Vfile_domain, Qnil); #endif - load_in_progress++; /* Now determine what sort of ELC file we're reading in. */ - record_unwind_protect (load_byte_code_version_unwind, - make_int (load_byte_code_version)); + internal_bind_int (&load_byte_code_version, load_byte_code_version); if (reading_elc) { char elc_header[8]; @@ -921,11 +861,11 @@ FUN returns non-zero. */ static void locate_file_map_suffixes (Lisp_Object filename, Lisp_Object suffixes, - int (*fun) (Intbyte *, void *), + int (*fun) (Ibyte *, void *), void *arg) { /* This function can GC */ - Intbyte *fn; + Ibyte *fn; int fn_len, max; /* Calculate maximum size of any filename made from @@ -948,7 +888,7 @@ max = XSTRING_LENGTH (suffixes); fn_len = XSTRING_LENGTH (filename); - fn = (Intbyte *) alloca (max + fn_len + 1); + fn = (Ibyte *) ALLOCA (max + fn_len + 1); memcpy (fn, XSTRING_DATA (filename), fn_len); /* Loop over suffixes. */ @@ -978,11 +918,11 @@ else { /* Case c) */ - const Intbyte *nsuffix = XSTRING_DATA (suffixes); + const Ibyte *nsuffix = XSTRING_DATA (suffixes); while (1) { - Intbyte *esuffix = qxestrchr (nsuffix, ':'); + Ibyte *esuffix = qxestrchr (nsuffix, ':'); Bytecount lsuffix = esuffix ? esuffix - nsuffix : qxestrlen (nsuffix); @@ -1009,7 +949,7 @@ }; static int -locate_file_in_directory_mapper (Intbyte *fn, void *arg) +locate_file_in_directory_mapper (Ibyte *fn, void *arg) { struct locate_file_in_directory_mapper_closure *closure = (struct locate_file_in_directory_mapper_closure *) arg; @@ -1117,7 +1057,7 @@ } static int -locate_file_construct_suffixed_files_mapper (Intbyte *fn, void *arg) +locate_file_construct_suffixed_files_mapper (Ibyte *fn, void *arg) { Lisp_Object *tail = (Lisp_Object *) arg; *tail = Fcons (build_intstring (fn), *tail); @@ -1367,15 +1307,6 @@ #endif /* !LOADHIST */ -#if 0 /* FSFmacs defun hack */ -Lisp_Object -unreadpure (void) /* Used as unwind-protect function in readevalloop */ -{ - read_pure = 0; - return Qnil; -} -#endif /* 0 */ - static void readevalloop (Lisp_Object readcharfun, Lisp_Object sourcename, @@ -1383,7 +1314,7 @@ int printflag) { /* This function can GC */ - REGISTER Emchar c; + REGISTER Ichar c; REGISTER Lisp_Object val = Qnil; int speccount = specpdl_depth (); struct gcpro gcpro1, gcpro2; @@ -1429,25 +1360,12 @@ if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r') continue; -#if 0 /* FSFmacs defun hack */ - if (purify_flag && c == '(') - { - int count1 = specpdl_depth (); - record_unwind_protect (unreadpure, Qnil); - val = read_list (readcharfun, ')', -1, 1); - unbind_to (count1); - } + unreadchar (readcharfun, c); + Vread_objects = Qnil; + if (NILP (Vload_read_function)) + val = read0 (readcharfun); else -#else /* No "defun hack" -- Emacs 19 uses read-time syntax for bytecodes */ - { - unreadchar (readcharfun, c); - Vread_objects = Qnil; - if (NILP (Vload_read_function)) - val = read0 (readcharfun); - else - val = call1 (Vload_read_function, readcharfun); - } -#endif + val = call1 (Vload_read_function, readcharfun); val = (*evalfun) (val); if (printflag) { @@ -1505,7 +1423,7 @@ } #if 0 -xxDEFUN ("eval-current-buffer", Feval_current_buffer, 0, 1, "", /* +DEFUN ("eval-current-buffer", Feval_current_buffer, 0, 1, "", /* Execute the current buffer as Lisp code. Programs can pass argument PRINTFLAG which controls printing of output: nil means discard it; anything else is stream for print. @@ -1549,7 +1467,8 @@ if (NILP (stream)) record_unwind_protect (save_excursion_restore, save_excursion_save ()); - record_unwind_protect (save_restriction_restore, save_restriction_save ()); + record_unwind_protect (save_restriction_restore, + save_restriction_save (current_buffer)); /* This both uses start and checks its type. */ Fgoto_char (start, cbuf); @@ -1635,19 +1554,6 @@ } -#ifdef LISP_BACKQUOTES - -static Lisp_Object -backquote_unwind (Lisp_Object ptr) -{ /* used as unwind-protect function in read0() */ - int *counter = (int *) get_opaque_ptr (ptr); - if (--*counter < 0) - *counter = 0; - free_opaque_ptr (ptr); - return Qnil; -} - -#endif /* Use this for recursive reads, in contexts where internal tokens are not allowed. See also read1(). */ @@ -1658,8 +1564,8 @@ if (CONSP (val) && UNBOUNDP (XCAR (val))) { - Emchar c = XCHAR (XCDR (val)); - free_cons (XCONS (val)); + Ichar c = XCHAR (XCDR (val)); + free_cons (val); return Fsignal (Qinvalid_read_syntax, list1 (Fchar_to_string (make_char (c)))); } @@ -1667,11 +1573,11 @@ return val; } -static Emchar +static Ichar read_escape (Lisp_Object readcharfun) { /* This function can GC */ - Emchar c = readchar (readcharfun); + Ichar c = readchar (readcharfun); if (c < 0) signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun)); @@ -1714,41 +1620,9 @@ For these reasons, FSF_KEYS hack is useless and without hope of ever working under XEmacs 20. */ -#undef FSF_KEYS - #ifdef FSF_KEYS -#define alt_modifier (0x040000) -#define super_modifier (0x080000) -#define hyper_modifier (0x100000) -#define shift_modifier (0x200000) -/* fsf uses a different modifiers for meta and control. Possibly - byte_compiled code will still work fsfmacs, though... --Stig - - #define ctl_modifier (0x400000) - #define meta_modifier (0x800000) -*/ -#define FSF_LOSSAGE(mask) \ - if (fail_on_bucky_bit_character_escapes || \ - ((c = readchar (readcharfun)) != '-')) \ - syntax_error ("Invalid escape character syntax", Qunbound); \ - c = readchar (readcharfun); \ - if (c < 0) \ - signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun)); \ - if (c == '\\') \ - c = read_escape (readcharfun); \ - return c | mask - - case 'S': FSF_LOSSAGE (shift_modifier); - case 'H': FSF_LOSSAGE (hyper_modifier); - case 'A': FSF_LOSSAGE (alt_modifier); - case 's': FSF_LOSSAGE (super_modifier); -#undef alt_modifier -#undef super_modifier -#undef hyper_modifier -#undef shift_modifier -#undef FSF_LOSSAGE - -#endif /* FSF_KEYS */ + /* Deleted */ +#endif case 'C': c = readchar (readcharfun); @@ -1779,7 +1653,7 @@ case '7': /* An octal escape, as in ANSI C. */ { - REGISTER Emchar i = c - '0'; + REGISTER Ichar i = c - '0'; REGISTER int count = 0; while (++count < 3) { @@ -1791,6 +1665,9 @@ break; } } + if (i >= 0400) + syntax_error ("Attempt to create non-ASCII/ISO-8859-1 character", + make_int (i)); return i; } @@ -1800,12 +1677,12 @@ mean, anyways, if the internal representation is hidden? This is also consistent with the treatment of octal escapes. */ { - REGISTER Emchar i = 0; + REGISTER Ichar i = 0; REGISTER int count = 0; while (++count <= 2) { c = readchar (readcharfun); - /* Remember, can't use isdigit(), isalpha() etc. on Emchars */ + /* Remember, can't use isdigit(), isalpha() etc. on Ichars */ if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; @@ -1832,10 +1709,10 @@ /* read symbol-constituent stuff into `Vread_buffer_stream'. */ static Bytecount -read_atom_0 (Lisp_Object readcharfun, Emchar firstchar, int *saw_a_backslash) +read_atom_0 (Lisp_Object readcharfun, Ichar firstchar, int *saw_a_backslash) { /* This function can GC */ - Emchar c = ((firstchar) >= 0 ? firstchar : readchar (readcharfun)); + Ichar c = ((firstchar) >= 0 ? firstchar : readchar (readcharfun)); Lstream_rewind (XLSTREAM (Vread_buffer_stream)); *saw_a_backslash = 0; @@ -1858,7 +1735,7 @@ signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun)); *saw_a_backslash = 1; } - Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c); + Lstream_put_ichar (XLSTREAM (Vread_buffer_stream), c); QUIT; c = readchar (readcharfun); } @@ -1866,17 +1743,17 @@ if (c >= 0) unreadchar (readcharfun, c); /* blasted terminating 0 */ - Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), 0); + Lstream_put_ichar (XLSTREAM (Vread_buffer_stream), 0); Lstream_flush (XLSTREAM (Vread_buffer_stream)); return Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1; } -static Lisp_Object parse_integer (const Intbyte *buf, Bytecount len, int base); +static Lisp_Object parse_integer (const Ibyte *buf, Bytecount len, int base); static Lisp_Object read_atom (Lisp_Object readcharfun, - Emchar firstchar, + Ichar firstchar, int uninterned_symbol) { /* This function can GC */ @@ -1927,7 +1804,7 @@ return make_int (number); } #else - return parse_integer ((Intbyte *) read_ptr, len, 10); + return parse_integer ((Ibyte *) read_ptr, len, 10); #endif } } @@ -1940,10 +1817,10 @@ { Lisp_Object sym; if (uninterned_symbol) - sym = Fmake_symbol ( make_string ((Intbyte *) read_ptr, len)); + sym = Fmake_symbol ( make_string ((Ibyte *) read_ptr, len)); else { - Lisp_Object name = make_string ((Intbyte *) read_ptr, len); + Lisp_Object name = make_string ((Ibyte *) read_ptr, len); sym = Fintern (name, Qnil); } return sym; @@ -1952,10 +1829,10 @@ static Lisp_Object -parse_integer (const Intbyte *buf, Bytecount len, int base) +parse_integer (const Ibyte *buf, Bytecount len, int base) { - const Intbyte *lim = buf + len; - const Intbyte *p = buf; + const Ibyte *lim = buf + len; + const Ibyte *p = buf; EMACS_UINT num = 0; int negativland = 0; @@ -2042,7 +1919,7 @@ while (1) { unsigned char bit; - Emchar c = readchar (readcharfun); + Ichar c = readchar (readcharfun); if (c == '0') bit = 0; else if (c == '1') @@ -2116,7 +1993,7 @@ static Lisp_Object read_structure (Lisp_Object readcharfun) { - Emchar c = readchar (readcharfun); + Ichar c = readchar (readcharfun); Lisp_Object list = Qnil; Lisp_Object orig_list = Qnil; Lisp_Object already_seen = Qnil; @@ -2205,11 +2082,11 @@ /* Get the next character; filter out whitespace and comments */ -static Emchar +static Ichar reader_nextchar (Lisp_Object readcharfun) { /* This function can GC */ - Emchar c; + Ichar c; retry: QUIT; @@ -2254,7 +2131,7 @@ static Lisp_Object read1 (Lisp_Object readcharfun) { - Emchar c; + Ichar c; retry: c = reader_nextchar (readcharfun); @@ -2265,16 +2142,14 @@ { #ifdef LISP_BACKQUOTES /* old backquote compatibility in lisp reader */ /* if this is disabled, then other code in eval.c must be enabled */ - Emchar ch = reader_nextchar (readcharfun); + Ichar ch = reader_nextchar (readcharfun); switch (ch) { case '`': { Lisp_Object tem; - int speccount = specpdl_depth (); - ++old_backquote_flag; - record_unwind_protect (backquote_unwind, - make_opaque_ptr (&old_backquote_flag)); + int speccount = internal_bind_int (&old_backquote_flag, + 1 + old_backquote_flag); tem = read0 (readcharfun); unbind_to (speccount); ch = reader_nextchar (readcharfun); @@ -2353,7 +2228,7 @@ c = readchar (readcharfun); unreadchar (readcharfun, c); - /* Can't use isdigit on Emchars */ + /* Can't use isdigit on Ichars */ if (c < '0' || c > '9') return noseeum_cons (Qunbound, make_char ('.')); @@ -2406,7 +2281,7 @@ if (!STRINGP (tmp)) { if (CONSP (tmp) && UNBOUNDP (XCAR (tmp))) - free_cons (XCONS (tmp)); + free_cons (tmp); return Fsignal (Qinvalid_read_syntax, list1 (build_string ("#"))); } @@ -2415,14 +2290,14 @@ while (1) { Lisp_Object beg, end, plist; - Emchar ch; + Ichar ch; int invalid = 0; beg = read1 (readcharfun); if (CONSP (beg) && UNBOUNDP (XCAR (beg))) { ch = XCHAR (XCDR (beg)); - free_cons (XCONS (beg)); + free_cons (beg); if (ch == ')') break; else @@ -2433,7 +2308,7 @@ end = read1 (readcharfun); if (CONSP (end) && UNBOUNDP (XCAR (end))) { - free_cons (XCONS (end)); + free_cons (end); invalid = 1; } } @@ -2442,7 +2317,7 @@ plist = read1 (readcharfun); if (CONSP (plist) && UNBOUNDP (XCAR (plist))) { - free_cons (XCONS (plist)); + free_cons (plist); invalid = 1; } } @@ -2582,10 +2457,8 @@ case '`': { Lisp_Object tem; - int speccount = specpdl_depth (); - ++new_backquote_flag; - record_unwind_protect (backquote_unwind, - make_opaque_ptr (&new_backquote_flag)); + int speccount = internal_bind_int (&new_backquote_flag, + 1 + new_backquote_flag); tem = read0 (readcharfun); unbind_to (speccount); return list2 (Qbackquote, tem); @@ -2662,7 +2535,7 @@ cancel = 1; } else - Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c); + Lstream_put_ichar (XLSTREAM (Vread_buffer_stream), c); QUIT; } if (c < 0) @@ -2705,7 +2578,7 @@ isfloat_string (const char *cp) { int state = 0; - const Intbyte *ucp = (const Intbyte *) cp; + const Ibyte *ucp = (const Ibyte *) cp; if (*ucp == '+' || *ucp == '-') ucp++; @@ -2753,7 +2626,7 @@ static void * sequence_reader (Lisp_Object readcharfun, - Emchar terminator, + Ichar terminator, void *state, void * (*conser) (Lisp_Object readcharfun, void *state, Charcount len)) @@ -2762,7 +2635,7 @@ for (len = 0; ; len++) { - Emchar ch; + Ichar ch; QUIT; ch = reader_nextchar (readcharfun); @@ -2788,7 +2661,7 @@ Lisp_Object tail; int length; int allow_dotted_lists; - Emchar terminator; + Ichar terminator; }; static void * @@ -2802,10 +2675,10 @@ if (CONSP (elt) && UNBOUNDP (XCAR (elt))) { Lisp_Object tem = elt; - Emchar ch; + Ichar ch; elt = XCDR (elt); - free_cons (XCONS (tem)); + free_cons (tem); tem = Qnil; ch = XCHAR (elt); #ifdef FEATUREP_SYNTAX @@ -2834,7 +2707,7 @@ if (CONSP (elt) && UNBOUNDP (XCAR (elt))) { ch = XCHAR (XCDR (elt)); - free_cons (XCONS (elt)); + free_cons (elt); if (ch == s->terminator) { unreadchar (readcharfun, s->terminator); @@ -2845,14 +2718,6 @@ } } -#if 0 /* FSFmacs defun hack, or something ... */ - if (NILP (tail) && defun_hack && EQ (elt, Qdefun) && !read_pure) - { - record_unwind_protect (unreadpure, Qzero); - read_pure = 1; - } -#endif - #ifdef COMPILED_FUNCTION_ANNOTATION_HACK if (s->length == 1 && s->allow_dotted_lists && EQ (XCAR (s->head), Qfset)) { @@ -2875,14 +2740,24 @@ } -#if 0 /* FSFmacs defun hack */ -/* -1 for allow_dotted_lists means allow_dotted_lists and check - for starting with defun and make structure pure. */ -#endif +/* allow_dotted_lists means that something like (foo bar . baz) + is acceptable. If -1, means check for starting with defun + and make structure pure. (not implemented, probably for very + good reasons) + + If check_for_doc_references, look for (#$ . INT) doc references + in the list and record if load_force_doc_strings is non-zero. + (Such doc references will be destroyed during the loadup phase + by replacing with Qzero, because Snarf-documentation will fill + them in again.) + + WARNING: If you set this, you sure as hell better not call + free_list() on the returned list here. + */ static Lisp_Object read_list (Lisp_Object readcharfun, - Emchar terminator, + Ichar terminator, int allow_dotted_lists, int check_for_doc_references) { @@ -2976,7 +2851,7 @@ static Lisp_Object read_vector (Lisp_Object readcharfun, - Emchar terminator) + Ichar terminator) { Lisp_Object tem; Lisp_Object *p; @@ -2997,28 +2872,23 @@ tem = s.head; len = XINT (Flength (tem)); -#if 0 /* FSFmacs defun hack */ - if (read_pure) - s.head = make_pure_vector (len, Qnil); - else -#endif - s.head = make_vector (len, Qnil); + s.head = make_vector (len, Qnil); for (i = 0, p = &(XVECTOR_DATA (s.head)[0]); i < len; i++, p++) { - Lisp_Cons *otem = XCONS (tem); + Lisp_Object otem = tem; tem = Fcar (tem); *p = tem; - tem = otem->cdr; + tem = XCDR (otem); free_cons (otem); } return s.head; } static Lisp_Object -read_compiled_function (Lisp_Object readcharfun, Emchar terminator) +read_compiled_function (Lisp_Object readcharfun, Ichar terminator) { /* Accept compiled functions at read-time so that we don't have to build them at load-time. */ @@ -3040,7 +2910,7 @@ for (iii = 0; CONSP (stuff); iii++) { - Lisp_Cons *victim = XCONS (stuff); + Lisp_Object victim = stuff; make_byte_code_args[iii] = Fcar (stuff); if ((purify_flag || load_force_doc_strings) && CONSP (make_byte_code_args[iii]) diff --text -u 'xemacs-21.5.6/src/lrecord.h' 'xemacs-21.5.7/src/lrecord.h' Index: ././src/lrecord.h --- ././src/lrecord.h Sun Mar 31 17:28:42 2002 +++ ././src/lrecord.h Fri Jun 28 23:24:08 2002 @@ -196,6 +196,8 @@ lrecord_type_emacs_ffi, lrecord_type_emacs_gtk_object, lrecord_type_emacs_gtk_boxed, + lrecord_type_weak_box, + lrecord_type_ephemeron, lrecord_type_free, /* only used for "free" lrecords */ lrecord_type_undefined, /* only used for debugging */ lrecord_type_last_built_in_type /* must be last */ @@ -336,17 +338,25 @@ structures, whenever the structure size is given, rather than being defaulted by specifying 0 for the size.) - A struct_description is used for describing nested "structures". - (Again a misnomer, since it can be used for any blocks of memory, - not just structures.) It just contains a size for the memory block, - a pointer to an lrecord_description, and (for unions only) a union - constant, described below. The size can be 0 (#### not yet - implemented!), in which case the size will be determined from the - largest offset logically referenced (i.e. last offset mentioned + - size of that object). This is useful for stretchy arrays. + A struct_description is used for describing nested "structures". (Again + a misnomer, since it can be used for any blocks of memory, not just + structures.) It just contains a size for the memory block, a pointer to + an lrecord_description, and (for unions only) a union constant, + described below. The size can be 0, in which case the size will be + determined from the largest offset logically referenced (i.e. last + offset mentioned + size of that object). This is useful for stretchy + arrays. Some example descriptions : + struct Lisp_String + { + struct lrecord_header lheader; + Bytecount size; + Ibyte *data; + Lisp_Object plist; + }; + static const struct lrecord_description cons_description[] = { { XD_LISP_OBJECT, offsetof (Lisp_Cons, car) }, { XD_LISP_OBJECT, offsetof (Lisp_Cons, cdr) }, @@ -355,16 +365,100 @@ Which means "two lisp objects starting at the 'car' and 'cdr' elements" - static const struct lrecord_description string_description[] = { - { XD_BYTECOUNT, offsetof (Lisp_String, size) }, - { XD_OPAQUE_DATA_PTR, offsetof (Lisp_String, data), XD_INDIRECT(0, 1) }, - { XD_LISP_OBJECT, offsetof (Lisp_String, plist) }, - { XD_END } - }; - "A pointer to string data at 'data', the size of the pointed array being the value - of the size variable plus 1, and one lisp object at 'plist'" + static const struct lrecord_description string_description[] = { + { XD_BYTECOUNT, offsetof (Lisp_String, size) }, + { XD_OPAQUE_DATA_PTR, offsetof (Lisp_String, data), XD_INDIRECT(0, 1) }, + { XD_LISP_OBJECT, offsetof (Lisp_String, plist) }, + { XD_END } + }; + + "A pointer to string data at 'data', the size of the pointed array being + the value of the size variable plus 1, and one lisp object at 'plist'" + + If your object has a pointer to an array of Lisp_Objects in it, something + like this: + + struct Lisp_Foo + { + ...; + int count; + Lisp_Object *objects; + ...; + } + + You'd use XD_STRUCT_PTR, something like: + + static const struct lrecord_description lo_description_1[] = { + { XD_LISP_OBJECT, 0 }, + { XD_END } + }; + + static const struct struct_description lo_description = { + sizeof (Lisp_Object), + lo_description_1 + }; + + static const struct lrecord_description foo_description[] = { + ... + { XD_INT, offsetof (Lisp_Foo, count) }, + { XD_STRUCT_PTR, offsetof (Lisp_Foo, objects), + XD_INDIRECT (0, 0), &lo_description }, + ... + }; + + + Another example of XD_STRUCT_PTR: + + typedef struct hentry + { + Lisp_Object key; + Lisp_Object value; + } hentry; + + struct Lisp_Hash_Table + { + struct lcrecord_header header; + Elemcount size; + Elemcount count; + Elemcount rehash_count; + double rehash_size; + double rehash_threshold; + Elemcount golden_ratio; + hash_table_hash_function_t hash_function; + hash_table_test_function_t test_function; + hentry *hentries; + enum hash_table_weakness weakness; + Lisp_Object next_weak; // Used to chain together all of the weak + // hash tables. Don't mark through this. + }; + + static const struct lrecord_description hentry_description_1[] = { + { XD_LISP_OBJECT, offsetof (hentry, key) }, + { XD_LISP_OBJECT, offsetof (hentry, value) }, + { XD_END } + }; + + static const struct struct_description hentry_description = { + sizeof (hentry), + hentry_description_1 + }; + + const struct lrecord_description hash_table_description[] = { + { XD_ELEMCOUNT, offsetof (Lisp_Hash_Table, size) }, + { XD_STRUCT_PTR, offsetof (Lisp_Hash_Table, hentries), XD_INDIRECT(0, 1), + &hentry_description }, + { XD_LO_LINK, offsetof (Lisp_Hash_Table, next_weak) }, + { XD_END } + }; + + Note that we don't need to declare all the elements in the structure, just + the ones that need to be relocated (Lisp_Objects and structures) or that + need to be referenced as counts for relocated objects. + + + The existing types : + - The existing types : XD_LISP_OBJECT A Lisp object. This is also the type to use for pointers to other lrecords. @@ -751,10 +845,10 @@ # define DECLARE_LRECORD(c_name, structtype) \ extern const struct lrecord_implementation lrecord_##c_name; \ -INLINE_HEADER structtype * \ -error_check_##c_name (Lisp_Object obj, const char *file, int line); \ -INLINE_HEADER structtype * \ +DECLARE_INLINE_HEADER ( \ +structtype * \ error_check_##c_name (Lisp_Object obj, const char *file, int line) \ +) \ { \ assert_at_line (RECORD_TYPEP (obj, lrecord_type_##c_name), file, line); \ return (structtype *) XPNTR (obj); \ @@ -764,10 +858,10 @@ # define DECLARE_EXTERNAL_LRECORD(c_name, structtype) \ extern int lrecord_type_##c_name; \ extern struct lrecord_implementation lrecord_##c_name; \ -INLINE_HEADER structtype * \ -error_check_##c_name (Lisp_Object obj, const char *file, int line); \ -INLINE_HEADER structtype * \ +DECLARE_INLINE_HEADER ( \ +structtype * \ error_check_##c_name (Lisp_Object obj, const char *file, int line) \ +) \ { \ assert_at_line (RECORD_TYPEP (obj, lrecord_type_##c_name), file, line); \ return (structtype *) XPNTR (obj); \ @@ -775,10 +869,10 @@ extern Lisp_Object Q##c_name##p # define DECLARE_NONRECORD(c_name, type_enum, structtype) \ -INLINE_HEADER structtype * \ -error_check_##c_name (Lisp_Object obj, const char *file, int line); \ -INLINE_HEADER structtype * \ +DECLARE_INLINE_HEADER ( \ +structtype * \ error_check_##c_name (Lisp_Object obj, const char *file, int line) \ +) \ { \ assert_at_line (XTYPE (obj) == type_enum, file, line); \ return (structtype *) XPNTR (obj); \ @@ -790,11 +884,11 @@ # define XNONRECORD(x, c_name, type_enum, structtype) \ error_check_##c_name (x, __FILE__, __LINE__) -INLINE_HEADER Lisp_Object wrap_record_1 (const void *ptr, enum lrecord_type ty, - const char *file, int line); -INLINE_HEADER Lisp_Object +DECLARE_INLINE_HEADER ( +Lisp_Object wrap_record_1 (const void *ptr, enum lrecord_type ty, const char *file, int line) +) { Lisp_Object obj = wrap_pointer_1 (ptr); @@ -866,6 +960,9 @@ if (XTYPE (x) != lisp_enum) \ dead_wrong_type_argument (predicate, x); \ } while (0) + +/* Various ways of allocating lcrecords. All bytes (except lcrecord + header) are zeroed in returned structure. */ void *alloc_lcrecord (Bytecount size, const struct lrecord_implementation *); diff --text -u 'xemacs-21.5.6/src/lstream.c' 'xemacs-21.5.7/src/lstream.c' Index: ././src/lstream.c --- ././src/lstream.c Sun Mar 31 17:28:43 2002 +++ ././src/lstream.c Wed Jun 5 18:56:24 2002 @@ -104,8 +104,8 @@ inline static Bytecount aligned_sizeof_lstream (Bytecount lstream_type_specific_size) { - return ALIGN_SIZE (offsetof (Lstream, data) + lstream_type_specific_size, - ALIGNOF (max_align_t)); + return MAX_ALIGN_SIZE (offsetof (Lstream, data) + + lstream_type_specific_size); } static Bytecount @@ -208,7 +208,12 @@ note the non-parallelism in who should set this mode on the stream: The *CALLER* sets character mode on read streams it creates; the *STREAM ITSELF* sets character mode on write streams, typically at creation - time. */ + time. + + (However, if a read stream always generates internal-format data, then + the callers will almost always want character mode, and it's allowed to + set this on behalf of the caller, as long as a flag can be provided at + creation time to disable this behavior.) */ void Lstream_set_character_mode (Lstream *lstr) @@ -232,12 +237,12 @@ object hanging around anywhere where they might be used! When streams are chained together, be VERY CAREFUL of the order in which you delete them! (e.g. if the streams are in a singly-linked list, delete the head - first; this will close, and may send data down to the rest. Then + first; this will close (but check the documentation, e.g. of + make_coding_input_stream()), and may send data down to the rest. Then proceed to the rest, one by one. If the chains are in a doubly-linked list, close all the streams first (again, from the head to the tail), disconnect the back links, then delete starting from the head. In - general, it's a good idea to close everything before deleting - anything. + general, it's a good idea to close everything before deleting anything. NOTE: DO NOT CALL DURING GARBAGE COLLECTION (e.g. in a finalizer). You will be aborted. See free_managed_lcrecord(). */ @@ -303,13 +308,13 @@ const unsigned char *dataend = data + size - 1; assert (size > 0); /* safety check ... */ /* Optimize the most common case. */ - if (!BYTE_ASCII_P (*dataend)) + if (!byte_ascii_p (*dataend)) { /* Go back to the beginning of the last (and possibly partial) character, and bump forward to see if the character is complete. */ - VALIDATE_CHARPTR_BACKWARD (dataend); - if (dataend + REP_BYTES_BY_FIRST_BYTE (*dataend) != data + size) + VALIDATE_IBYTEPTR_BACKWARD (dataend); + if (dataend + rep_bytes_by_first_byte (*dataend) != data + size) /* If not, chop the size down to ignore the last char and stash it away for next time. */ size = dataend - data; @@ -599,8 +604,9 @@ any data at other times, particularly if SIZE is too small. this needs to be fixed!). -1 means an error occurred and no bytes were read. */ -Bytecount -Lstream_read (Lstream *lstr, void *data, Bytecount size) +static Bytecount +Lstream_read_1 (Lstream *lstr, void *data, Bytecount size, + int override_no_partial_chars) { unsigned char *p = (unsigned char *) data; Bytecount off = 0; @@ -662,12 +668,13 @@ } } - if (lstr->flags & LSTREAM_FL_NO_PARTIAL_CHARS) + if ((lstr->flags & LSTREAM_FL_NO_PARTIAL_CHARS) && + !override_no_partial_chars) { /* It's quite possible for us to get passed an incomplete character at the end. We need to spit back that incomplete character. */ - Bytecount newoff = validate_intbyte_string_backward (p, off); + Bytecount newoff = validate_ibyte_string_backward (p, off); if (newoff < off) { Lstream_unread (lstr, p + newoff, off - newoff); @@ -678,6 +685,13 @@ return off == 0 && error_occurred ? -1 : off; } +Bytecount +Lstream_read (Lstream *lstr, void *data, Bytecount size) +{ + return Lstream_read_1 (lstr, data, size, 0); +} + + /* Push back SIZE bytes of DATA onto the input queue. The next call to Lstream_read() with the same size will read the same bytes back. Note that this will be the case even if there is other pending @@ -827,7 +841,7 @@ Lstream_fgetc (Lstream *lstr) { unsigned char ch; - if (Lstream_read (lstr, &ch, 1) <= 0) + if (Lstream_read_1 (lstr, &ch, 1, 1) <= 0) return -1; return ch; } @@ -970,7 +984,7 @@ { int fd; int pty_max_bytes; - Intbyte eof_char; + Ibyte eof_char; int starting_pos; int current_pos; int end_pos; @@ -1013,6 +1027,25 @@ return wrap_lstream (lstr); } +/* Flags: + + LSTR_CLOSING + If set, close the descriptor or FILE * when the stream is closed. + + LSTR_ALLOW_QUIT + If set, allow quitting out of the actual I/O. + + LSTR_PTY_FLUSHING + If set and filedesc_stream_set_pty_flushing() has been called + on the stream, do not send more than pty_max_bytes on a single + line without flushing the data out using the eof_char. + + LSTR_BLOCKED_OK + If set, an EWOULDBLOCK error is not treated as an error but + simply causes the write function to return 0 as the number + of bytes written out. + */ + Lisp_Object make_filedesc_input_stream (int filedesc, int offset, int count, int flags) { @@ -1149,7 +1182,7 @@ in pty-flushing mode. */ if (need_newline) { - Intbyte nl = '\n'; + Ibyte nl = '\n'; Bytecount retval2 = str->allow_quit ? write_allowing_quit (str->fd, &nl, 1) : retry_write (str->fd, &nl, 1); @@ -1232,7 +1265,7 @@ void filedesc_stream_set_pty_flushing (Lstream *stream, int pty_max_bytes, - Intbyte eof_char) + Ibyte eof_char) { struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream); str->pty_max_bytes = pty_max_bytes; @@ -1290,15 +1323,15 @@ struct lisp_string_stream *str = LISP_STRING_STREAM_DATA (stream); /* Don't lose if the string shrank past us ... */ Bytecount offset = min (str->offset, XSTRING_LENGTH (str->obj)); - Intbyte *strstart = XSTRING_DATA (str->obj); - Intbyte *start = strstart + offset; + Ibyte *strstart = XSTRING_DATA (str->obj); + Ibyte *start = strstart + offset; /* ... or if someone changed the string and we ended up in the middle of a character. */ /* Being in the middle of a character is `normal' unless LSTREAM_NO_PARTIAL_CHARS - mrb */ if (stream->flags & LSTREAM_FL_NO_PARTIAL_CHARS) - VALIDATE_CHARPTR_BACKWARD (start); + VALIDATE_IBYTEPTR_BACKWARD (start); offset = start - strstart; size = min (size, (Bytecount) (str->end - offset)); memcpy (data, start, size); @@ -1318,9 +1351,9 @@ /* ... or if someone changed the string and we ended up in the middle of a character. */ { - Intbyte *strstart = XSTRING_DATA (str->obj); - Intbyte *start = strstart + pos; - VALIDATE_CHARPTR_BACKWARD (start); + Ibyte *strstart = XSTRING_DATA (str->obj); + Ibyte *start = strstart + pos; + VALIDATE_IBYTEPTR_BACKWARD (start); pos = start - strstart; } str->offset = pos; @@ -1488,7 +1521,7 @@ /* Note: If you have a dynarr whose type is not unsigned_char_dynarr but which is really just an unsigned_char_dynarr (e.g. its type - is Intbyte or Extbyte), just cast to unsigned_char_dynarr. */ + is Ibyte or Extbyte), just cast to unsigned_char_dynarr. */ #define DYNARR_STREAM_DATA(stream) \ LSTREAM_TYPE_DATA (stream, dynarr) @@ -1553,7 +1586,7 @@ static Lisp_Object make_lisp_buffer_stream_1 (struct buffer *buf, Charbpos start, Charbpos end, - int flags, const char *mode) + int flags, const Char_ASCII *mode) { Lstream *lstr; struct lisp_buffer_stream *str; @@ -1615,8 +1648,8 @@ } Lisp_Object -make_lisp_buffer_input_stream (struct buffer *buf, Charbpos start, Charbpos end, - int flags) +make_lisp_buffer_input_stream (struct buffer *buf, Charbpos start, + Charbpos end, int flags) { return make_lisp_buffer_stream_1 (buf, start, end, flags, "r"); } @@ -1631,66 +1664,46 @@ } static Bytecount -lisp_buffer_reader (Lstream *stream, unsigned char *data, - Bytecount size) +lisp_buffer_reader (Lstream *stream, Ibyte *data, Bytecount size) { struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream); - unsigned char *orig_data = data; Bytebpos start; Bytebpos end; struct buffer *buf = XBUFFER (str->buffer); + Bytecount src_used; if (!BUFFER_LIVE_P (buf)) return 0; /* Fut. */ - /* NOTE: We do all our operations in Bytebpos's. - Keep in mind that SIZE is a value in bytes, not chars. */ - - start = bi_marker_position (str->start); - end = bi_marker_position (str->end); + start = byte_marker_position (str->start); + end = byte_marker_position (str->end); if (!(str->flags & LSTR_IGNORE_ACCESSIBLE)) { - start = bytebpos_clip_to_bounds (BI_BUF_BEGV (buf), start, - BI_BUF_ZV (buf)); - end = bytebpos_clip_to_bounds (BI_BUF_BEGV (buf), end, - BI_BUF_ZV (buf)); + start = bytebpos_clip_to_bounds (BYTE_BUF_BEGV (buf), start, + BYTE_BUF_ZV (buf)); + end = bytebpos_clip_to_bounds (BYTE_BUF_BEGV (buf), end, + BYTE_BUF_ZV (buf)); } - size = min (size, (Bytecount) (end - start)); - end = start + size; - /* We cannot return a partial character. */ - VALIDATE_BYTEBPOS_BACKWARD (buf, end); - - while (start < end) - { - Bytebpos ceil; - Bytecount chunk; - - if (str->flags & LSTR_IGNORE_ACCESSIBLE) - ceil = BI_BUF_CEILING_OF_IGNORE_ACCESSIBLE (buf, start); - else - ceil = BI_BUF_CEILING_OF (buf, start); - chunk = min (ceil, end) - start; - memcpy (data, BI_BUF_BYTE_ADDRESS (buf, start), chunk); - data += chunk; - start += chunk; - } + size = copy_buffer_text_out (buf, start, end - start, data, size, + FORMAT_DEFAULT, Qnil, &src_used); + end = start + src_used; if (EQ (buf->selective_display, Qt) && str->flags & LSTR_SELECTIVE) { /* What a kludge. What a kludge. What a kludge. */ - unsigned char *p; - for (p = orig_data; p < data; p++) + Ibyte *p; + for (p = data; p < data + src_used; p++) if (*p == '\r') *p = '\n'; } - set_bi_marker_position (str->start, end); - return data - orig_data; + set_byte_marker_position (str->start, end); + return size; } static Bytecount -lisp_buffer_writer (Lstream *stream, const unsigned char *data, +lisp_buffer_writer (Lstream *stream, const Ibyte *data, Bytecount size) { struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream); diff --text -u 'xemacs-21.5.6/src/lstream.h' 'xemacs-21.5.7/src/lstream.h' Index: ././src/lstream.h --- ././src/lstream.h Sun Mar 31 17:28:43 2002 +++ ././src/lstream.h Wed Jun 5 18:56:25 2002 @@ -133,8 +133,8 @@ { const char *name; Bytecount size; /* Number of additional bytes to be - allocated with this stream. Access this - data using Lstream_data(). */ + allocated with this stream. Access this + data using Lstream_data(). */ /* Read some data from the stream's end and store it into DATA, which can hold SIZE bytes. Return the number of bytes read. A return value of 0 means no bytes can be read at this time. This may @@ -154,7 +154,7 @@ Lisp, thinks that it is bogus that the types and implementations of input and output streams are the same. */ Bytecount (*reader) (Lstream *stream, unsigned char *data, - Bytecount size); + Bytecount size); /* Send some data to the stream's end. Data to be sent is in DATA and is SIZE bytes. Return the number of bytes sent. This function can send and return fewer bytes than is passed in; in @@ -166,7 +166,7 @@ non-blocking file descriptor and are getting EWOULDBLOCK errors.) This function can be NULL if the stream is input-only. */ Bytecount (*writer) (Lstream *stream, const unsigned char *data, - Bytecount size); + Bytecount size); /* Return non-zero if the last write operation on the stream resulted in an attempt to block (EWOULDBLOCK). If this method does not exists, the implementation returns 0 */ @@ -248,12 +248,11 @@ ((lstr)->imp == lstream_##type) #ifdef ERROR_CHECK_TYPES -INLINE_HEADER struct lstream * -error_check_lstream_type (struct lstream *stream, - const Lstream_implementation *imp); -INLINE_HEADER struct lstream * +DECLARE_INLINE_HEADER ( +struct lstream * error_check_lstream_type (struct lstream *stream, const Lstream_implementation *imp) +) { assert (stream->imp == imp); return stream; @@ -356,47 +355,50 @@ /************************************************************************/ -/* working with an Lstream as a stream of Emchars */ +/* working with an Lstream as a stream of Ichars */ /************************************************************************/ #ifdef MULE -INLINE_HEADER Emchar Lstream_get_emchar (Lstream *stream); -INLINE_HEADER Emchar -Lstream_get_emchar (Lstream *stream) +DECLARE_INLINE_HEADER ( +Ichar +Lstream_get_ichar (Lstream *stream) +) { int c = Lstream_getc (stream); - return (c < 0x80 /* c == EOF || BYTE_ASCII_P (c) */ - ? (Emchar) c - : Lstream_get_emchar_1 (stream, c)); + return (c < 0x80 /* c == EOF || byte_ascii_p (c) */ + ? (Ichar) c + : Lstream_get_ichar_1 (stream, c)); } -/* Write an Emchar to a stream. Return value is 0 for success, -1 for +/* Write an Ichar to a stream. Return value is 0 for success, -1 for failure. */ -INLINE_HEADER int Lstream_put_emchar (Lstream *stream, Emchar ch); -INLINE_HEADER int -Lstream_put_emchar (Lstream *stream, Emchar ch) +DECLARE_INLINE_HEADER ( +int +Lstream_put_ichar (Lstream *stream, Ichar ch) +) { - return CHAR_ASCII_P (ch) ? + return ichar_ascii_p (ch) ? Lstream_putc (stream, ch) : - Lstream_fput_emchar (stream, ch); + Lstream_fput_ichar (stream, ch); } -INLINE_HEADER void Lstream_unget_emchar (Lstream *stream, Emchar ch); -INLINE_HEADER void -Lstream_unget_emchar (Lstream *stream, Emchar ch) +DECLARE_INLINE_HEADER ( +void +Lstream_unget_ichar (Lstream *stream, Ichar ch) +) { - if (CHAR_ASCII_P (ch)) + if (ichar_ascii_p (ch)) Lstream_ungetc (stream, ch); else - Lstream_funget_emchar (stream, ch); + Lstream_funget_ichar (stream, ch); } #else /* not MULE */ -# define Lstream_get_emchar(stream) Lstream_getc (stream) -# define Lstream_put_emchar(stream, ch) Lstream_putc (stream, ch) -# define Lstream_unget_emchar(stream, ch) Lstream_ungetc (stream, ch) +# define Lstream_get_ichar(stream) Lstream_getc (stream) +# define Lstream_put_ichar(stream, ch) Lstream_putc (stream, ch) +# define Lstream_unget_ichar(stream, ch) Lstream_ungetc (stream, ch) #endif /* not MULE */ @@ -431,7 +433,7 @@ int flags); void filedesc_stream_set_pty_flushing (Lstream *stream, int pty_max_bytes, - Intbyte eof_char); + Ibyte eof_char); int filedesc_stream_fd (Lstream *stream); Lisp_Object make_lisp_string_input_stream (Lisp_Object string, Bytecount offset, diff --text -u 'xemacs-21.5.6/src/macros.c' 'xemacs-21.5.7/src/macros.c' Index: ././src/macros.c --- ././src/macros.c Sun Mar 31 17:28:44 2002 +++ ././src/macros.c Fri Jun 21 06:18:37 2002 @@ -33,7 +33,7 @@ #include "buffer.h" #include "commands.h" -#include "console.h" +#include "console-impl.h" #include "device.h" #include "events.h" #include "frame.h" @@ -244,16 +244,6 @@ return Qnil; } -/* Restore Vexecuting_macro and executing_macro_index - called when - the unwind-protect in Fexecute_kbd_macro gets invoked. */ -static Lisp_Object -pop_kbd_macro (Lisp_Object info) -{ - Vexecuting_macro = Fcar (info); - executing_macro_index = XINT (Fcdr (info)); - return Qnil; -} - DEFUN ("execute-kbd-macro", Fexecute_kbd_macro, 1, 2, 0, /* Execute MACRO as string of editor command characters. If MACRO is a symbol, its function definition is used. @@ -263,7 +253,6 @@ { /* This function can GC */ Lisp_Object final; - Lisp_Object tem; int speccount = specpdl_depth (); int repeat = 1; struct gcpro gcpro1; @@ -279,8 +268,8 @@ if (!STRINGP (final) && !VECTORP (final)) invalid_argument ("Keyboard macros must be strings or vectors", Qunbound); - tem = Fcons (Vexecuting_macro, make_int (executing_macro_index)); - record_unwind_protect (pop_kbd_macro, tem); + internal_bind_lisp_object (&Vexecuting_macro, Vexecuting_macro); + internal_bind_int (&executing_macro_index, executing_macro_index); GCPRO1 (final); do @@ -289,7 +278,7 @@ executing_macro_index = 0; con->prefix_arg = Qnil; internal_catch (Qexecute_kbd_macro, call_command_loop, - Qnil, 0); + Qnil, 0, 0); } while (--repeat != 0 && (STRINGP (Vexecuting_macro) || diff --text -u 'xemacs-21.5.6/src/marker.c' 'xemacs-21.5.7/src/marker.c' Index: ././src/marker.c --- ././src/marker.c Sun Mar 31 17:28:44 2002 +++ ././src/marker.c Tue May 14 22:04:00 2002 @@ -61,14 +61,17 @@ if (print_readably) printing_unreadable_object ("#", (long) marker); - write_c_string (GETTEXT ("#buffer) - write_c_string (GETTEXT ("in no buffer"), printcharfun); + write_c_string (printcharfun, GETTEXT ("in no buffer")); else { - write_fmt_string (printcharfun, "at %ld in ", (long) marker_position (obj)); + write_fmt_string (printcharfun, "at %ld in ", + (long) marker_position (obj)); print_internal (marker->buffer->name, printcharfun, 0); } + if (marker->insertion_type) + write_c_string (printcharfun, " insertion-type=t"); write_fmt_string (printcharfun, " 0x%lx>", (long) marker); } @@ -316,7 +319,7 @@ } Bytebpos -bi_marker_position (Lisp_Object marker) +byte_marker_position (Lisp_Object marker) { Lisp_Marker *m = XMARKER (marker); struct buffer *buf = m->buffer; @@ -333,11 +336,6 @@ positions. */ pos = membpos_to_bytebpos (buf, m->membpos); -#ifdef ERROR_CHECK_TEXT - if (pos < BI_BUF_BEG (buf) || pos > BI_BUF_Z (buf)) - abort (); -#endif - return pos; } @@ -349,11 +347,11 @@ if (!buf) invalid_argument ("Marker does not point anywhere", Qunbound); - return bytebpos_to_charbpos (buf, bi_marker_position (marker)); + return bytebpos_to_charbpos (buf, byte_marker_position (marker)); } void -set_bi_marker_position (Lisp_Object marker, Bytebpos pos) +set_byte_marker_position (Lisp_Object marker, Bytebpos pos) { Lisp_Marker *m = XMARKER (marker); struct buffer *buf = m->buffer; @@ -361,11 +359,6 @@ if (!buf) invalid_argument ("Marker does not point anywhere", Qunbound); -#ifdef ERROR_CHECK_TEXT - if (pos < BI_BUF_BEG (buf) || pos > BI_BUF_Z (buf)) - abort (); -#endif - m->membpos = bytebpos_to_membpos (buf, pos); } @@ -377,7 +370,7 @@ if (!buf) invalid_argument ("Marker does not point anywhere", Qunbound); - set_bi_marker_position (marker, charbpos_to_bytebpos (buf, pos)); + set_byte_marker_position (marker, charbpos_to_bytebpos (buf, pos)); } static Lisp_Object @@ -457,7 +450,7 @@ it by default (although I've debugged it). If you want to use it, use extents instead. --hniksic */ #if 0 -xxDEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, 1, 1, 0, /* +DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, 1, 1, 0, /* Return t if there are markers pointing at POSITION in the current buffer. */ (position)) diff --text -u 'xemacs-21.5.6/src/md5.c' 'xemacs-21.5.7/src/md5.c' Index: ././src/md5.c --- ././src/md5.c Sun Mar 31 17:28:45 2002 +++ ././src/md5.c Wed Jun 5 18:56:26 2002 @@ -553,7 +553,7 @@ /* Get the data while doing the conversion. */ while (1) { - Intbyte tempbuf[1024]; /* some random amount */ + Ibyte tempbuf[1024]; /* some random amount */ Bytecount size_in_bytes = Lstream_read (XLSTREAM (instream), tempbuf, sizeof (tempbuf)); if (!size_in_bytes) diff --text -u 'xemacs-21.5.6/src/menubar-gtk.c' 'xemacs-21.5.7/src/menubar-gtk.c' Index: ././src/menubar-gtk.c --- ././src/menubar-gtk.c Fri Mar 29 13:48:07 2002 +++ ././src/menubar-gtk.c Sun Jun 23 18:25:12 2002 @@ -26,17 +26,21 @@ #include #include "lisp.h" -#include "console-gtk.h" -#include "gui-gtk.h" - #include "buffer.h" #include "commands.h" /* zmacs_regions */ -#include "ui-gtk.h" -#include "gui.h" +#include "device.h" #include "events.h" -#include "frame.h" +#include "device-impl.h" +#include "frame-impl.h" +#include "gui.h" #include "opaque.h" #include "window.h" +#include "window-impl.h" + +#include "console-gtk-impl.h" +#include "gui-gtk.h" +#include "ui-gtk.h" +#include "menubar.h" #ifdef HAVE_GNOME #include @@ -205,7 +209,7 @@ Lisp_Object menu_desc = Qnil; GtkWidget *old_submenu = GTK_MENU_ITEM (menu_item)->submenu; - VOID_TO_LISP (menu_desc, gtk_object_get_data (GTK_OBJECT (menu_item), XEMACS_MENU_DESCR_TAG)); + menu_desc = VOID_TO_LISP (gtk_object_get_data (GTK_OBJECT (menu_item), XEMACS_MENU_DESCR_TAG)); /* GCPRO all of our very own */ gcpro_popup_callbacks (id, menu_desc); @@ -270,7 +274,7 @@ return; } - VOID_TO_LISP (desc, gtk_object_get_data (GTK_OBJECT (item), XEMACS_MENU_DESCR_TAG)); + desc = VOID_TO_LISP (gtk_object_get_data (GTK_OBJECT (item), XEMACS_MENU_DESCR_TAG)); #ifdef TEAR_OFF_MENUS /* Lets stick in a detacher just for giggles */ @@ -289,7 +293,7 @@ Lisp_Object hook_fn; struct gcpro gcpro1, gcpro2; - VOID_TO_LISP (hook_fn, gtk_object_get_data (GTK_OBJECT (item), XEMACS_MENU_FILTER_TAG)); + hook_fn = VOID_TO_LISP (gtk_object_get_data (GTK_OBJECT (item), XEMACS_MENU_FILTER_TAG)); GCPRO2 (desc, hook_fn); @@ -565,7 +569,7 @@ channel = wrap_frame (__get_channel (GTK_WIDGET (item))); - VOID_TO_LISP (callback, user_data); + callback = VOID_TO_LISP (user_data); get_gui_callback (callback, &function, &data); @@ -696,12 +700,12 @@ if (STRINGP (suffix) && XSTRING_LENGTH (suffix)) { - label_buffer = alloca (XSTRING_LENGTH (name) + 15 + XSTRING_LENGTH (suffix)); + label_buffer = ALLOCA (XSTRING_LENGTH (name) + 15 + XSTRING_LENGTH (suffix)); sprintf (label_buffer, "%s %s ", XSTRING_DATA (name), XSTRING_DATA (suffix)); } else { - label_buffer = alloca (XSTRING_LENGTH (name) + 15); + label_buffer = ALLOCA (XSTRING_LENGTH (name) + 15); sprintf (label_buffer, "%s ", XSTRING_DATA (name)); } @@ -753,7 +757,14 @@ /* #### Warning, dependency here on current_buffer and point */ where_is_to_char (callback, buf); - keys = eimake_string (buf); + if (eilen (buf) > 0) + keys = eimake_string (buf); + else + { + + keys = Qnil; + } + eifree (buf); } } @@ -851,7 +862,13 @@ if (STRINGP (keys) && XSTRING_LENGTH (keys)) { - l->accel_string = g_strdup (XSTRING_DATA (keys)); + C_STRING_TO_EXTERNAL_MALLOC (XSTRING_DATA (keys), l->accel_string, + Qctext); + stderr_out ("accel: %s\n", l->accel_string); + } + else + { + // l->accel_string = ""; } } diff --text -u 'xemacs-21.5.6/src/menubar-msw.c' 'xemacs-21.5.7/src/menubar-msw.c' Index: ././src/menubar-msw.c --- ././src/menubar-msw.c Fri Mar 29 13:48:08 2002 +++ ././src/menubar-msw.c Fri Jun 21 06:18:37 2002 @@ -2,7 +2,7 @@ Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems and INS Engineering Corp. Copyright (C) 1997 Kirill M. Katsnelson . - Copyright (C) 2000, 2001 Ben Wing. + Copyright (C) 2000, 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -84,16 +84,16 @@ #include "buffer.h" #include "commands.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "elhash.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "gui.h" #include "lisp.h" #include "menubar.h" #include "menubar-msw.h" #include "opaque.h" -#include "window.h" +#include "window-impl.h" /* #### */ #define REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIGHT_FLUSH 0 @@ -121,7 +121,7 @@ /* * Translate X accelerator syntax to win32 accelerator syntax. - * accel = (Emchar*) to receive the accelerator character + * accel = (Ichar*) to receive the accelerator character * or NULL to suppress accelerators in the menu or dialog item. * * %% is replaced with % @@ -135,10 +135,10 @@ */ Lisp_Object -mswindows_translate_menu_or_dialog_item (Lisp_Object item, Emchar *accel) +mswindows_translate_menu_or_dialog_item (Lisp_Object item, Ichar *accel) { Bytecount len = XSTRING_LENGTH (item); - Intbyte *it = (Intbyte *) alloca (2 * len + 42), *ptr = it; + Ibyte *it = (Ibyte *) ALLOCA (2 * len + 42), *ptr = it; memcpy (ptr, XSTRING_DATA (item), len + 1); if (accel) @@ -146,7 +146,7 @@ /* Escape '&' as '&&' */ - while ((ptr = (Intbyte *) memchr (ptr, '&', len - (ptr - it))) != NULL) + while ((ptr = (Ibyte *) memchr (ptr, '&', len - (ptr - it))) != NULL) { memmove (ptr + 1, ptr, (len - (ptr - it)) + 1); len++; @@ -156,7 +156,7 @@ /* Replace XEmacs accelerator '%_' with Windows accelerator '&' and `%%' with `%'. */ ptr = it; - while ((ptr = (Intbyte *) memchr (ptr, '%', len - (ptr - it))) != NULL) + while ((ptr = (Ibyte *) memchr (ptr, '%', len - (ptr - it))) != NULL) { if (*(ptr + 1) == '_') { @@ -164,7 +164,7 @@ { *ptr = '&'; if (!*accel) - *accel = DOWNCASE (0, charptr_emchar (ptr + 2)); + *accel = DOWNCASE (0, itext_ichar (ptr + 2)); memmove (ptr + 1, ptr + 2, len - (ptr - it + 2) + 1); len--; } @@ -189,7 +189,7 @@ /* Force a default accelerator */ ptr = it; memmove (ptr + 1, ptr, len + 1); - *accel = DOWNCASE (0, charptr_emchar (ptr + 1)); + *accel = DOWNCASE (0, itext_ichar (ptr + 1)); *ptr = '&'; len++; @@ -204,7 +204,7 @@ */ static Lisp_Object -displayable_menu_item (Lisp_Object gui_item, int bar_p, Emchar *accel) +displayable_menu_item (Lisp_Object gui_item, int bar_p, Ichar *accel) { Lisp_Object left, right = Qnil; @@ -336,7 +336,7 @@ Lisp_Object gui_item = allocate_gui_item (); Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); struct gcpro gcpro1, gcpro2, gcpro3; - Emchar accel; + Ichar accel; Extbyte *itemext; GCPRO3 (gui_item, path, *accel_list); @@ -394,7 +394,7 @@ Lisp_Object gui_item = gui_parse_item_keywords (item); Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); struct gcpro gcpro1, gcpro2; - Emchar accel; + Ichar accel; Extbyte *itemext; GCPRO2 (gui_item, *accel_list); @@ -672,7 +672,7 @@ } int -mswindows_char_is_accelerator (struct frame *f, Emchar ch) +mswindows_char_is_accelerator (struct frame *f, Ichar ch) { Lisp_Object hash = FRAME_MSWINDOWS_MENU_HASH_TABLE (f); @@ -733,7 +733,9 @@ /* We simply ignore return value. In any case, we construct the bar on the fly */ - run_hook (Qactivate_menubar_hook); + run_hook_trapping_problems + ("Error in activate-menubar-hook", Qactivate_menubar_hook, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); update_frame_menubar_maybe (f); @@ -812,7 +814,12 @@ /* We cannot pass hmenu as a lisp object. Use static var */ wm_initmenu_menu = hmenu; wm_initmenu_frame = frm; - return mswindows_protect_modal_loop (unsafe_handle_wm_initmenupopup, Qnil); + /* Allow runaway filter code, e.g. custom, to be aborted. We are + usually called from next_event_internal(), which has turned off + quit checking to read the C-g as an event. */ + return mswindows_protect_modal_loop ("Error during menu handling", + unsafe_handle_wm_initmenupopup, Qnil, + UNINHIBIT_QUIT); } Lisp_Object @@ -822,7 +829,9 @@ if (GetMenu (FRAME_MSWINDOWS_HANDLE (f)) == hmenu) { wm_initmenu_frame = f; - return mswindows_protect_modal_loop (unsafe_handle_wm_initmenu, Qnil); + return mswindows_protect_modal_loop ("Error during menu handling", + unsafe_handle_wm_initmenu, Qnil, + UNINHIBIT_QUIT); } return Qt; } diff --text -u 'xemacs-21.5.6/src/menubar-x.c' 'xemacs-21.5.7/src/menubar-x.c' Index: ././src/menubar-x.c --- ././src/menubar-x.c Sun Mar 31 17:28:45 2002 +++ ././src/menubar-x.c Fri Jun 21 06:18:37 2002 @@ -38,16 +38,16 @@ #include "buffer.h" #include "commands.h" /* zmacs_regions */ -#include "device.h" +#include "device-impl.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "gui.h" #include "keymap.h" #include "menubar.h" #include "opaque.h" -#include "window.h" +#include "window-impl.h" -#include "console-x.h" +#include "console-x-impl.h" #include "gui-x.h" #include "EmacsFrame.h" @@ -117,7 +117,7 @@ if (STRINGP (desc)) { - Intbyte *string_chars = XSTRING_DATA (desc); + Ibyte *string_chars = XSTRING_DATA (desc); wv->type = (separator_string_p (string_chars) ? SEPARATOR_TYPE : TEXT_TYPE); if (wv->type == SEPARATOR_TYPE) @@ -219,8 +219,7 @@ if (filter_p || depth == 0) { #endif - desc = call1_trapping_errors ("Error in menubar filter", - hook_fn, desc); + desc = call1 (hook_fn, desc); if (UNBOUNDP (desc)) desc = Qnil; #if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF @@ -253,7 +252,7 @@ title_wv->enabled = 1; title_wv->next = sep_wv; sep_wv->type = SEPARATOR_TYPE; - sep_wv->value = menu_separator_style_and_to_external ((Intbyte *) "=="); + sep_wv->value = menu_separator_style_and_to_external ((Ibyte *) "=="); sep_wv->next = 0; wv->contents = title_wv; @@ -358,45 +357,56 @@ return wv; } - -#if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF -int in_menu_callback; +struct menu_item_descriptor_to_widget_value +{ + Lisp_Object desc; + int menu_type, deep_p, filter_p; + widget_value *wv; +}; static Lisp_Object -restore_in_menu_callback (Lisp_Object val) +protected_menu_item_descriptor_to_widget_value_1 (void *gack) { - in_menu_callback = XINT (val); + struct menu_item_descriptor_to_widget_value *midtwv = + (struct menu_item_descriptor_to_widget_value *) gack; + + midtwv->wv = menu_item_descriptor_to_widget_value (midtwv->desc, + midtwv->menu_type, + midtwv->deep_p, + midtwv->filter_p); return Qnil; } -#endif /* LWLIB_MENUBARS_LUCID || LWLIB_MENUBARS_MOTIF */ -#if 0 -/* #### Sort of a hack needed to process Vactivate_menubar_hook - correctly wrt buffer-local values. A correct solution would - involve adding a callback mechanism to run_hook(). This function - is currently unused. */ -static int -my_run_hook (Lisp_Object hooksym, int allow_global_p) -{ - /* This function can GC */ - Lisp_Object tail; - Lisp_Object value = Fsymbol_value (hooksym); - int changes = 0; +/* Inside of the pre_activate_callback, we absolutely need to protect + against errors, esp. but not exclusively in the filter code. (We do + other evalling, too.) We also need to reenable quit checking, which + was disabled by next_event_internal() so as to read C-g as an + event. */ - if (!NILP (value) && (!CONSP (value) || EQ (XCAR (value), Qlambda))) - return !EQ (call0 (value), Qt); +static widget_value * +protected_menu_item_descriptor_to_widget_value (Lisp_Object desc, + int menu_type, int deep_p, + int filter_p) +{ + struct menu_item_descriptor_to_widget_value midtwv; + + midtwv.desc = desc; + midtwv.menu_type = menu_type; + midtwv.deep_p = deep_p; + midtwv.filter_p = filter_p; + + if (UNBOUNDP + (call_trapping_problems + (Qmenubar, "Error during menu callback", UNINHIBIT_QUIT, 0, + protected_menu_item_descriptor_to_widget_value_1, &midtwv))) + return 0; - EXTERNAL_LIST_LOOP (tail, value) - { - if (allow_global_p && EQ (XCAR (tail), Qt)) - changes |= my_run_hook (Fdefault_value (hooksym), 0); - if (!EQ (call0 (XCAR (tail)), Qt)) - changes = 1; - } - return changes; + return midtwv.wv; } -#endif +#if defined (LWLIB_MENUBARS_LUCID) || (defined LWLIB_MENUBARS_MOTIF) +int in_menu_callback; +#endif /* The order in which callbacks are run is funny to say the least. It's sometimes tricky to avoid running a callback twice, and to @@ -448,7 +458,7 @@ widget_value *wv; assert (hack_wv->type == INCREMENTAL_TYPE); - VOID_TO_LISP (submenu_desc, hack_wv->call_data); + submenu_desc = VOID_TO_LISP (hack_wv->call_data); /* * #### Fix the menu code so this isn't necessary. @@ -457,12 +467,9 @@ * crash later when the code gets confused at the state * changes. */ - count = specpdl_depth (); - record_unwind_protect (restore_in_menu_callback, - make_int (in_menu_callback)); - in_menu_callback = 1; - wv = menu_item_descriptor_to_widget_value (submenu_desc, SUBMENU_TYPE, - 1, 0); + count = internal_bind_int (&in_menu_callback, 1); + wv = (protected_menu_item_descriptor_to_widget_value + (submenu_desc, SUBMENU_TYPE, 1, 0)); unbind_to (count); if (!wv) @@ -485,13 +492,6 @@ return; else { -#if 0 /* Unused, see comment below. */ - int any_changes; - - /* #### - this menubar update mechanism is expensively anti-social and - the activate-menubar-hook is now mostly obsolete. */ - any_changes = my_run_hook (Qactivate_menubar_hook, 1); - /* #### - It is necessary to *ALWAYS* call set_frame_menubar() now that incremental menus are implemented. If a subtree of a menu has been updated incrementally (a destructive operation), then that subtree @@ -500,13 +500,10 @@ It is difficult to undo the destructive operation in lwlib because a pointer back to lisp data needs to be hidden away somewhere. So that an INCREMENTAL_TYPE widget_value can be recreated... Hmmmmm. */ - if (any_changes || - !XFRAME_MENUBAR_DATA (f)->menubar_contents_up_to_date) - set_frame_menubar (f, 1, 0); -#else - run_hook (Qactivate_menubar_hook); + run_hook_trapping_problems + ("Error in activate-menubar-hook", Qactivate_menubar_hook, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); set_frame_menubar (f, 1, 0); -#endif DEVICE_X_MOUSE_TIMESTAMP (XDEVICE (FRAME_DEVICE (f))) = DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (XDEVICE (FRAME_DEVICE (f))) = x_focus_timestamp_really_sucks_fix_me_better; @@ -994,7 +991,7 @@ i++; write_fmt_string (Qexternal_debugging_output, "OPERATE (%d): ",i); print_internal (t, Qexternal_debugging_output, 1); - write_c_string ("\n", Qexternal_debugging_output); + write_c_string (Qexternal_debugging_output, "\n"); t = XEVENT_NEXT (t); } } @@ -1027,7 +1024,7 @@ while (entries) { Lisp_Object accel; - VOID_TO_LISP (accel, entries->accel); + accel = VOID_TO_LISP (entries->accel); if (entries->name && !NILP (accel)) { if (event_matches_key_specifier_p (XEVENT (evee), accel)) @@ -1260,7 +1257,7 @@ while (val) { Lisp_Object accel; - VOID_TO_LISP (accel, val->accel); + accel = VOID_TO_LISP (val->accel); if (val->name && !NILP (accel)) { Fsetcar (last, accel); diff --text -u 'xemacs-21.5.6/src/menubar.c' 'xemacs-21.5.7/src/menubar.c' Index: ././src/menubar.c --- ././src/menubar.c Sun Mar 31 17:28:46 2002 +++ ././src/menubar.c Fri Jun 21 06:18:37 2002 @@ -1,7 +1,7 @@ /* Implements an elisp-programmable menubar. Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems and INS Engineering Corp. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -34,14 +34,14 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" -#include "frame.h" +#include "device-impl.h" +#include "frame-impl.h" #include "gui.h" #include "keymap.h" #include "menubar.h" #include "redisplay.h" #include "specifier.h" -#include "window.h" +#include "window-impl.h" int menubar_show_keybindings; Lisp_Object Vmenubar_configuration; @@ -331,22 +331,22 @@ struct buffer *buf = decode_buffer (buffer, 0); Charcount end; int i; - Intbyte *name_data; - Intbyte *string_result; - Intbyte *string_result_ptr; - Emchar elt; + Ibyte *name_data; + Ibyte *string_result; + Ibyte *string_result_ptr; + Ichar elt; int expecting_underscore = 0; CHECK_STRING (name); - end = XSTRING_CHAR_LENGTH (name); + end = string_char_length (name); name_data = XSTRING_DATA (name); - string_result = (Intbyte *) alloca (end * MAX_EMCHAR_LEN); + string_result = (Ibyte *) ALLOCA (end * MAX_ICHAR_LEN); string_result_ptr = string_result; for (i = 0; i < end; i++) { - elt = charptr_emchar (name_data); + elt = itext_ichar (name_data); elt = DOWNCASE (buf, elt); if (expecting_underscore) { @@ -355,20 +355,20 @@ { case '%': /* Allow `%%' to mean `%'. */ - string_result_ptr += set_charptr_emchar (string_result_ptr, '%'); + string_result_ptr += set_itext_ichar (string_result_ptr, '%'); break; case '_': break; default: - string_result_ptr += set_charptr_emchar (string_result_ptr, '%'); - string_result_ptr += set_charptr_emchar (string_result_ptr, elt); + string_result_ptr += set_itext_ichar (string_result_ptr, '%'); + string_result_ptr += set_itext_ichar (string_result_ptr, elt); } } else if (elt == '%') expecting_underscore = 1; else - string_result_ptr += set_charptr_emchar (string_result_ptr, elt); - INC_CHARPTR (name_data); + string_result_ptr += set_itext_ichar (string_result_ptr, elt); + INC_IBYTEPTR (name_data); } if (string_result_ptr - string_result == XSTRING_LENGTH (name) diff --text -u 'xemacs-21.5.6/src/menubar.h' 'xemacs-21.5.7/src/menubar.h' Index: ././src/menubar.h --- ././src/menubar.h Fri Apr 13 03:24:02 2001 +++ ././src/menubar.h Fri Jun 21 06:18:37 2002 @@ -31,7 +31,7 @@ void free_frame_menubars (struct frame *f); Lisp_Object menu_parse_submenu_keywords (Lisp_Object desc, Lisp_Object gui_item); -Lisp_Object current_frame_menubar (const struct frame* f); +Lisp_Object current_frame_menubar (const struct frame *f); EXFUN (Fmenu_find_real_submenu, 2); @@ -55,7 +55,7 @@ /* #### kluuuuuuuuuuuuuuuuuuuuuuuuuuuudge! The author of the accelerator code didn't know what the hell he was doing. Someone needs to abstract this properly. */ -#if defined(HAVE_X_WINDOWS) && defined(LWLIB_MENUBARS_LUCID) +#if defined (HAVE_X_WINDOWS) && defined (LWLIB_MENUBARS_LUCID) extern int x_kludge_lw_menu_active (void); struct command_builder; Lisp_Object command_builder_find_menu_accelerator (struct command_builder @@ -65,6 +65,10 @@ extern int in_menu_callback; #endif + +extern int popup_menu_up_p; +extern int menubar_show_keybindings; +extern int popup_menu_titles; #endif /* HAVE_MENUBARS */ diff --text -u 'xemacs-21.5.6/src/minibuf.c' 'xemacs-21.5.7/src/minibuf.c' Index: ././src/minibuf.c --- ././src/minibuf.c Fri Mar 29 13:48:10 2002 +++ ././src/minibuf.c Fri Jun 21 06:18:38 2002 @@ -33,10 +33,10 @@ #include "commands.h" #include "console-stream.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "insdel.h" #include "redisplay.h" -#include "window.h" +#include "window-impl.h" /* Depth in minibuffer invocations. */ int minibuf_level; @@ -97,7 +97,7 @@ { Lisp_Object victim = unwind_data; unwind_data = XCDR (unwind_data); - free_cons (XCONS (victim)); + free_cons (victim); } /* If cursor is on the minibuffer line, @@ -206,7 +206,7 @@ if IGNORE_CASE is true. */ Charcount -scmp_1 (const Intbyte *s1, const Intbyte *s2, Charcount len, +scmp_1 (const Ibyte *s1, const Ibyte *s2, Charcount len, int ignore_case) { Charcount l = len; @@ -215,14 +215,14 @@ { while (l) { - Emchar c1 = DOWNCASE (0, charptr_emchar (s1)); - Emchar c2 = DOWNCASE (0, charptr_emchar (s2)); + Ichar c1 = DOWNCASE (0, itext_ichar (s1)); + Ichar c2 = DOWNCASE (0, itext_ichar (s2)); if (c1 == c2) { l--; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); } else break; @@ -230,11 +230,11 @@ } else { - while (l && charptr_emchar (s1) == charptr_emchar (s2)) + while (l && itext_ichar (s1) == itext_ichar (s2)) { l--; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); } } @@ -245,7 +245,7 @@ int -regexp_ignore_completion_p (const Intbyte *nonreloc, +regexp_ignore_completion_p (const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length) { @@ -298,8 +298,8 @@ To do so, there should probably be a map_obarray_or_alist_or_hash_table function which would be used by - both Ftry_completion and Fall_completions. But would the - additional funcalls slow things down? */ + both Ftry_completion and Fall_completions. [[ But would the + additional funcalls slow things down? ]] Seriously doubtful. --ben */ DEFUN ("try-completion", Ftry_completion, 2, 3, 0, /* Return common substring of all completions of STRING in COLLECTION. @@ -355,7 +355,7 @@ bestmatch = Qnil; blength = 0; - slength = XSTRING_CHAR_LENGTH (string); + slength = string_char_length (string); /* If COLLECTION is not a list, set TAIL just for gc pro. */ tail = collection; @@ -418,7 +418,7 @@ if (STRINGP (eltstring)) { - Charcount eltlength = XSTRING_CHAR_LENGTH (eltstring); + Charcount eltlength = string_char_length (eltstring); if (slength <= eltlength && (0 > scmp (XSTRING_DATA (eltstring), XSTRING_DATA (string), @@ -562,7 +562,7 @@ return call3 (collection, string, predicate, Qt); allmatches = Qnil; - slength = XSTRING_CHAR_LENGTH (string); + slength = string_char_length (string); /* If COLLECTION is not a list, set TAIL just for gc pro. */ tail = collection; @@ -618,12 +618,12 @@ /* Is this element a possible completion? */ if (STRINGP (eltstring) - && (slength <= XSTRING_CHAR_LENGTH (eltstring)) + && (slength <= string_char_length (eltstring)) /* Reject alternatives that start with space unless the input starts with space. */ - && ((XSTRING_CHAR_LENGTH (string) > 0 && - XSTRING_CHAR (string, 0) == ' ') - || XSTRING_CHAR (eltstring, 0) != ' ') + && ((string_char_length (string) > 0 && + string_ichar (string, 0) == ' ') + || string_ichar (eltstring, 0) != ' ') && (0 > scmp (XSTRING_DATA (eltstring), XSTRING_DATA (string), slength))) @@ -649,7 +649,7 @@ implement some braindamage in FSF which we aren't including. --cet */ #if 0 -xxDEFUN ("minibuffer-prompt", Fminibuffer_prompt, 0, 0, 0, /* +DEFUN ("minibuffer-prompt", Fminibuffer_prompt, 0, 0, 0, /* Return the prompt string of the currently-active minibuffer. If no minibuffer is active, return nil. */ @@ -658,7 +658,7 @@ return Fcopy_sequence (Vminibuf_prompt); } -xxDEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width, 0, 0, 0, /* +DEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width, 0, 0, 0, /* Return the display width of the minibuffer prompt. */ ()) @@ -708,7 +708,7 @@ } void -echo_area_append (struct frame *f, const Intbyte *nonreloc, Lisp_Object reloc, +echo_area_append (struct frame *f, const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length, Lisp_Object label) { @@ -756,12 +756,12 @@ { if (STRINGP (reloc)) nonreloc = XSTRING_DATA (reloc); - write_string_1 (nonreloc + offset, length, Qexternal_debugging_output); + write_string_1 (Qexternal_debugging_output, nonreloc + offset, length); } } void -echo_area_message (struct frame *f, const Intbyte *nonreloc, +echo_area_message (struct frame *f, const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length, Lisp_Object label) { @@ -805,7 +805,7 @@ /* Dump an informative message to the echo area. This function takes a string in internal format. */ void -message_internal (const Intbyte *nonreloc, Lisp_Object reloc, +message_internal (const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length) { /* This function can call lisp */ @@ -815,7 +815,7 @@ } void -message_append_internal (const Intbyte *nonreloc, Lisp_Object reloc, +message_append_internal (const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length) { /* This function can call lisp */ @@ -829,7 +829,7 @@ on the format string; message_no_translate() does not. */ static void -message_1 (const CIntbyte *fmt, va_list args) +message_1 (const CIbyte *fmt, va_list args) { /* This function can call lisp */ if (fmt) @@ -847,7 +847,7 @@ } static void -message_append_1 (const CIntbyte *fmt, va_list args) +message_append_1 (const CIbyte *fmt, va_list args) { /* This function can call lisp */ if (fmt) diff --text -u 'xemacs-21.5.6/src/mule-ccl.c' 'xemacs-21.5.7/src/mule-ccl.c' Index: ././src/mule-ccl.c --- ././src/mule-ccl.c Fri Mar 29 13:48:11 2002 +++ ././src/mule-ccl.c Wed Jun 5 18:56:31 2002 @@ -1,5 +1,6 @@ /* CCL (Code Conversion Language) interpreter. Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. + Copyright (C) 2002 Ben Wing. Licensed to the Free Software Foundation. This file is part of XEmacs. @@ -727,23 +728,23 @@ } \ else \ { \ - Intbyte work[MAX_EMCHAR_LEN]; \ + Ibyte work[MAX_ICHAR_LEN]; \ int len; \ - len = non_ascii_set_charptr_emchar (work, ch); \ + len = non_ascii_set_itext_ichar (work, ch); \ Dynarr_add_many (destination, work, len); \ } \ } \ else \ { \ - if (!CHAR_MULTIBYTE_P(ch)) \ + if (!ichar_multibyte_p(ch)) \ { \ Dynarr_add (destination, ch); \ } \ else \ { \ - Intbyte work[MAX_EMCHAR_LEN]; \ + Ibyte work[MAX_ICHAR_LEN]; \ int len; \ - len = non_ascii_set_charptr_emchar (work, ch); \ + len = non_ascii_set_itext_ichar (work, ch); \ Dynarr_add_many (destination, work, len); \ } \ } \ @@ -754,7 +755,7 @@ cannot handle a multibyte string except for Control-1 characters. */ #define CCL_WRITE_STRING(len) \ do { \ - Intbyte work[MAX_EMCHAR_LEN]; \ + Ibyte work[MAX_ICHAR_LEN]; \ int ch, bytes; \ if (!destination) \ CCL_INVALID_CMD; \ @@ -782,7 +783,7 @@ } \ else \ { \ - bytes = non_ascii_set_charptr_emchar (work, ch); \ + bytes = non_ascii_set_itext_ichar (work, ch); \ Dynarr_add_many (destination, work, len); \ } \ } \ @@ -793,13 +794,13 @@ { \ ch = ((XINT (ccl_prog[ic + (i / 3)])) \ >> ((2 - (i % 3)) * 8)) & 0xFF; \ - if (!CHAR_MULTIBYTE_P(ch)) \ + if (!ichar_multibyte_p(ch)) \ { \ Dynarr_add (destination, ch); \ } \ else \ { \ - bytes = non_ascii_set_charptr_emchar (work, ch); \ + bytes = non_ascii_set_itext_ichar (work, ch); \ Dynarr_add_many (destination, work, len); \ } \ } \ @@ -827,7 +828,7 @@ /* Set C to the character code made from CHARSET and CODE. This is - like MAKE_CHAR but check the validity of CHARSET and CODE. If they + like make_ichar but check the validity of CHARSET and CODE. If they are not valid, set C to (CODE & 0xFF) because that is usually the case that CCL_ReadMultibyteChar2 read an invalid code and it set CODE to that invalid byte. */ @@ -847,7 +848,7 @@ \ if ((code) >= 256) \ c2 = c1, c1 = ((code) >> 7) & 0x7F; \ - (c) = MAKE_CHAR (charset, c1, c2); \ + (c) = make_ichar (charset, c1, c2); \ } \ else \ (c) = (code) & 0xFF; \ @@ -1350,7 +1351,7 @@ i = reg[RRR]; /* charset */ if (i == LEADING_BYTE_ASCII) i = reg[rrr] & 0xFF; - else if (XCHARSET_DIMENSION (CHARSET_BY_LEADING_BYTE (i)) == 1) + else if (XCHARSET_DIMENSION (charset_by_leading_byte (i)) == 1) i = (((i - FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7) | (reg[rrr] & 0x7F)); else if (i < MAX_LEADING_BYTE_OFFICIAL_2) diff --text -u 'xemacs-21.5.6/src/mule-charset.c' 'xemacs-21.5.7/src/mule-charset.c' Index: ././src/mule-charset.c --- ././src/mule-charset.c Mon Apr 1 12:58:44 2002 +++ ././src/mule-charset.c Fri Jun 21 06:18:38 2002 @@ -34,6 +34,7 @@ #include "faces.h" #include "lstream.h" #include "mule-ccl.h" +#include "objects.h" /* The various pre-defined charsets. */ @@ -204,7 +205,7 @@ static Lisp_Object make_charset (int id, Lisp_Object name, int rep_bytes, int type, int columns, int graphic, - Intbyte final, int direction, Lisp_Object short_name, + Ibyte final, int direction, Lisp_Object short_name, Lisp_Object long_name, Lisp_Object doc, Lisp_Object reg, int overwrite) { @@ -470,7 +471,7 @@ (name, doc_string, props)) { int id, dimension = 1, chars = 94, graphic = 0, columns = -1; - Intbyte final = 0; + Ibyte final = 0; int direction = CHARSET_LEFT_TO_RIGHT; int type; Lisp_Object registry = Qnil; @@ -591,7 +592,7 @@ else type = (chars == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96; - existing_charset = CHARSET_BY_ATTRIBUTES (type, final, direction); + existing_charset = charset_by_attributes (type, final, direction); if (!NILP (existing_charset) && !XCHARSET (existing_charset)->temporary) invalid_argument @@ -606,7 +607,7 @@ if (temporary) { - Intbyte tempname[80]; + Ibyte tempname[80]; qxesprintf (tempname, "___temporary___%d__", id); name = intern_int (tempname); @@ -632,7 +633,7 @@ { Lisp_Object revdircs = - CHARSET_BY_ATTRIBUTES (type, final, + charset_by_attributes (type, final, direction == CHARSET_LEFT_TO_RIGHT ? CHARSET_RIGHT_TO_LEFT : CHARSET_LEFT_TO_RIGHT); if (!NILP (revdircs)) @@ -654,7 +655,7 @@ { Lisp_Object new_charset = Qnil; int id, dimension, columns, graphic; - Intbyte final; + Ibyte final; int direction, type; Lisp_Object registry, doc_string, short_name, long_name; Lisp_Charset *cs; @@ -752,12 +753,12 @@ if (di == -1) { - obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_LEFT_TO_RIGHT); + obj = charset_by_attributes (type, fi, CHARSET_LEFT_TO_RIGHT); if (NILP (obj)) - obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_RIGHT_TO_LEFT); + obj = charset_by_attributes (type, fi, CHARSET_RIGHT_TO_LEFT); } else - obj = CHARSET_BY_ATTRIBUTES (type, fi, di); + obj = charset_by_attributes (type, fi, di); if (CHARSETP (obj)) return XCHARSET_NAME (obj); @@ -856,20 +857,6 @@ XCHARSET_CCL_PROGRAM (charset) = ccl_program; face_property_was_changed (Vdefault_face, Qfont, Qglobal); return Qnil; -} - -static void -invalidate_charset_font_caches (Lisp_Object charset) -{ - /* Invalidate font cache entries for charset on all devices. */ - Lisp_Object devcons, concons, hash_table; - DEVICE_LOOP_NO_BREAK (devcons, concons) - { - struct device *d = XDEVICE (XCAR (devcons)); - hash_table = Fgethash (charset, d->charset_font_cache, Qunbound); - if (!UNBOUNDP (hash_table)) - Fclrhash (hash_table); - } } /* Japanese folks may want to (set-charset-registry 'ascii "jisx0201") */ diff --text -u 'xemacs-21.5.6/src/mule-coding.c' 'xemacs-21.5.7/src/mule-coding.c' Index: ././src/mule-coding.c --- ././src/mule-coding.c Sun Mar 31 17:28:46 2002 +++ ././src/mule-coding.c Wed Jun 5 18:56:33 2002 @@ -76,16 +76,25 @@ /* Is this the first byte of a Shift-JIS two-byte char? */ -#define BYTE_SHIFT_JIS_TWO_BYTE_1_P(c) \ - (((c) >= 0x81 && (c) <= 0x9F) || ((c) >= 0xE0 && (c) <= 0xEF)) +inline static int +byte_shift_jis_two_byte_1_p (int c) +{ + return (c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xEF); +} /* Is this the second byte of a Shift-JIS two-byte char? */ -#define BYTE_SHIFT_JIS_TWO_BYTE_2_P(c) \ - (((c) >= 0x40 && (c) <= 0x7E) || ((c) >= 0x80 && (c) <= 0xFC)) +inline static int +byte_shift_jis_two_byte_2_p (int c) +{ + return (c >= 0x40 && c <= 0x7E) || (c >= 0x80 && c <= 0xFC); +} -#define BYTE_SHIFT_JIS_KATAKANA_P(c) \ - ((c) >= 0xA1 && (c) <= 0xDF) +inline static int +byte_shift_jis_katakana_p (int c) +{ + return c >= 0xA1 && c <= 0xDF; +} /* Convert Shift-JIS data to internal format. */ @@ -105,9 +114,9 @@ if (ch) { /* Previous character was first byte of Shift-JIS Kanji char. */ - if (BYTE_SHIFT_JIS_TWO_BYTE_2_P (c)) + if (byte_shift_jis_two_byte_2_p (c)) { - Intbyte e1, e2; + Ibyte e1, e2; Dynarr_add (dst, LEADING_BYTE_JAPANESE_JISX0208); DECODE_SHIFT_JIS (ch, c, e1, e2); @@ -123,9 +132,9 @@ } else { - if (BYTE_SHIFT_JIS_TWO_BYTE_1_P (c)) + if (byte_shift_jis_two_byte_1_p (c)) ch = c; - else if (BYTE_SHIFT_JIS_KATAKANA_P (c)) + else if (byte_shift_jis_katakana_p (c)) { Dynarr_add (dst, LEADING_BYTE_KATAKANA_JISX0201); Dynarr_add (dst, c); @@ -142,13 +151,13 @@ { while (n--) { - Intbyte c = *src++; - if (BYTE_ASCII_P (c)) + Ibyte c = *src++; + if (byte_ascii_p (c)) { Dynarr_add (dst, c); ch = 0; } - else if (INTBYTE_LEADING_BYTE_P (c)) + else if (ibyte_leading_byte_p (c)) ch = (c == LEADING_BYTE_KATAKANA_JISX0201 || c == LEADING_BYTE_JAPANESE_JISX0208_1978 || c == LEADING_BYTE_JAPANESE_JISX0208) ? c : 0; @@ -193,12 +202,12 @@ CHECK_INT (XCDR (code)); s1 = XINT (XCAR (code)); s2 = XINT (XCDR (code)); - if (BYTE_SHIFT_JIS_TWO_BYTE_1_P (s1) && - BYTE_SHIFT_JIS_TWO_BYTE_2_P (s2)) + if (byte_shift_jis_two_byte_1_p (s1) && + byte_shift_jis_two_byte_2_p (s2)) { DECODE_SHIFT_JIS (s1, s2, c1, c2); - return make_char (MAKE_CHAR (Vcharset_japanese_jisx0208, - c1 & 0x7F, c2 & 0x7F)); + return make_char (make_ichar (Vcharset_japanese_jisx0208, + c1 & 0x7F, c2 & 0x7F)); } else return Qnil; @@ -214,7 +223,7 @@ int c1, c2, s1, s2; CHECK_CHAR_COERCE_INT (character); - BREAKUP_CHAR (XCHAR (character), charset, c1, c2); + BREAKUP_ICHAR (XCHAR (character), charset, c1, c2); if (EQ (charset, Vcharset_japanese_jisx0208)) { ENCODE_SHIFT_JIS (c1 | 0x80, c2 | 0x80, s1, s2); @@ -336,13 +345,19 @@ contains frequently used characters and the latter contains less frequently used characters. */ -#define BYTE_BIG5_TWO_BYTE_1_P(c) \ - ((c) >= 0xA1 && (c) <= 0xFE) +inline static int +byte_big5_two_byte_1_p (int c) +{ + return c >= 0xA1 && c <= 0xFE; +} /* Is this the second byte of a Shift-JIS two-byte char? */ -#define BYTE_BIG5_TWO_BYTE_2_P(c) \ - (((c) >= 0x40 && (c) <= 0x7E) || ((c) >= 0xA1 && (c) <= 0xFE)) +inline static int +byte_big5_two_byte_2_p (int c) +{ + return (c >= 0x40 && c <= 0x7E) || (c >= 0xA1 && c <= 0xFE); +} /* Number of Big5 characters which have the same code in 1st byte. */ @@ -434,9 +449,9 @@ if (ch) { /* Previous character was first byte of Big5 char. */ - if (BYTE_BIG5_TWO_BYTE_2_P (c)) + if (byte_big5_two_byte_2_p (c)) { - Intbyte b1, b2, b3; + Ibyte b1, b2, b3; DECODE_BIG5 (ch, c, b1, b2, b3); Dynarr_add (dst, b1); Dynarr_add (dst, b2); @@ -451,7 +466,7 @@ } else { - if (BYTE_BIG5_TWO_BYTE_1_P (c)) + if (byte_big5_two_byte_1_p (c)) ch = c; else DECODE_ADD_BINARY_CHAR (c, dst); @@ -465,13 +480,13 @@ { while (n--) { - Intbyte c = *src++; - if (BYTE_ASCII_P (c)) + Ibyte c = *src++; + if (byte_ascii_p (c)) { /* ASCII. */ Dynarr_add (dst, c); } - else if (INTBYTE_LEADING_BYTE_P (c)) + else if (ibyte_leading_byte_p (c)) { if (c == LEADING_BYTE_CHINESE_BIG5_1 || c == LEADING_BYTE_CHINESE_BIG5_2) @@ -507,19 +522,19 @@ return orign; } -Emchar +Ichar decode_big5_char (int b1, int b2) { - if (BYTE_BIG5_TWO_BYTE_1_P (b1) && - BYTE_BIG5_TWO_BYTE_2_P (b2)) + if (byte_big5_two_byte_1_p (b1) && + byte_big5_two_byte_2_p (b2)) { int leading_byte; Lisp_Object charset; int c1, c2; DECODE_BIG5 (b1, b2, leading_byte, c1, c2); - charset = CHARSET_BY_LEADING_BYTE (leading_byte); - return MAKE_CHAR (charset, c1 & 0x7F, c2 & 0x7F); + charset = charset_by_leading_byte (leading_byte); + return make_ichar (charset, c1 & 0x7F, c2 & 0x7F); } else return -1; @@ -537,7 +552,7 @@ */ (code)) { - Emchar ch; + Ichar ch; CHECK_CONS (code); CHECK_INT (XCAR (code)); @@ -561,7 +576,7 @@ int c1, c2, b1, b2; CHECK_CHAR_COERCE_INT (character); - BREAKUP_CHAR (XCHAR (character), charset, c1, c2); + BREAKUP_ICHAR (XCHAR (character), charset, c1, c2); if (EQ (charset, Vcharset_chinese_big5_1) || EQ (charset, Vcharset_chinese_big5_2)) { @@ -1208,9 +1223,9 @@ } static Lisp_Object -charset_by_attributes_or_create_one (int type, Intbyte final, int dir) +charset_by_attributes_or_create_one (int type, Ibyte final, int dir) { - Lisp_Object charset = CHARSET_BY_ATTRIBUTES (type, final, dir); + Lisp_Object charset = charset_by_attributes (type, final, dir); if (NILP (charset)) { @@ -1787,23 +1802,23 @@ break; case ISO_ESC_END_COMPOSITE: { - Intbyte comstr[MAX_EMCHAR_LEN]; + Ibyte comstr[MAX_ICHAR_LEN]; Bytecount len; - Emchar emch = lookup_composite_char (Dynarr_atp (dst, 0), + Ichar emch = lookup_composite_char (Dynarr_atp (dst, 0), Dynarr_length (dst)); dst = real_dst; - len = set_charptr_emchar (comstr, emch); + len = set_itext_ichar (comstr, emch); Dynarr_add_many (dst, comstr, len); break; } #else case ISO_ESC_START_COMPOSITE: { - Intbyte comstr[MAX_EMCHAR_LEN]; + Ibyte comstr[MAX_ICHAR_LEN]; Bytecount len; - Emchar emch = MAKE_CHAR (Vcharset_composite, c - '0' + ' ', + Ichar emch = make_ichar (Vcharset_composite, c - '0' + ' ', 0); - len = set_charptr_emchar (comstr, emch); + len = set_itext_ichar (comstr, emch); Dynarr_add_many (dst, comstr, len); break; } @@ -1845,7 +1860,7 @@ } ch = 0; } - else if (BYTE_C0_P (c) || BYTE_C1_P (c)) + else if (byte_c0_p (c) || byte_c1_p (c)) { /* Control characters */ /***** Error-handling *****/ @@ -1885,7 +1900,7 @@ /* Now determine the charset. */ reg = ((flags & ISO_STATE_SS2) ? 2 : (flags & ISO_STATE_SS3) ? 3 - : !BYTE_ASCII_P (c) ? data->register_right + : !byte_ascii_p (c) ? data->register_right : data->register_left); charset = data->charset[reg]; @@ -2086,11 +2101,11 @@ /* Convert internally-formatted data to ISO2022 format. */ static Bytecount -iso2022_encode (struct coding_stream *str, const Intbyte *src, +iso2022_encode (struct coding_stream *str, const Ibyte *src, unsigned_char_dynarr *dst, Bytecount n) { unsigned char charmask; - Intbyte c; + Ibyte c; unsigned char char_boundary; unsigned int ch = str->ch; Lisp_Object codesys = str->codesys; @@ -2106,7 +2121,7 @@ /* flags for handling composite chars. We do a little switcheroo on the source while we're outputting the composite char. */ Bytecount saved_n = 0; - const Intbyte *saved_src = NULL; + const Ibyte *saved_src = NULL; int in_composite = 0; #endif /* ENABLE_COMPOSITE_CHARS */ @@ -2121,7 +2136,7 @@ { c = *src++; - if (BYTE_ASCII_P (c)) + if (byte_ascii_p (c)) { /* Processing ASCII character */ ch = 0; @@ -2169,11 +2184,11 @@ char_boundary = 1; } - else if (INTBYTE_LEADING_BYTE_P (c) || INTBYTE_LEADING_BYTE_P (ch)) + else if (ibyte_leading_byte_p (c) || ibyte_leading_byte_p (ch)) { /* Processing Leading Byte */ ch = 0; - charset = CHARSET_BY_LEADING_BYTE (c); - if (LEADING_BYTE_PREFIX_P (c)) + charset = charset_by_leading_byte (c); + if (leading_byte_prefix_p (c)) ch = c; else if (!EQ (charset, Vcharset_control_1) && !EQ (charset, Vcharset_composite)) @@ -2318,7 +2333,7 @@ } else { - Emchar emch = MAKE_CHAR (Vcharset_composite, + Ichar emch = make_ichar (Vcharset_composite, ch & 0x7F, c & 0x7F); Lisp_Object lstr = composite_char_string (emch); saved_n = n; @@ -2650,16 +2665,16 @@ { int i; - write_c_string ("(", printcharfun); + write_c_string (printcharfun, "("); for (i = 0; i < 4; i++) { Lisp_Object charset = coding_system_charset (cs, i); if (i > 0) - write_c_string (", ", printcharfun); + write_c_string (printcharfun, ", "); write_fmt_string (printcharfun, "g%d=", i); print_internal (CHARSETP (charset) ? XCHARSET_NAME (charset) : charset, printcharfun, 0); if (XCODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT (cs, i)) - write_c_string ("(force)", printcharfun); + write_c_string (printcharfun, "(force)"); } #define FROB(prop) \ @@ -2691,7 +2706,7 @@ { write_fmt_string_lisp (printcharfun, ", output-charset-conversion=%s", 1, val); } - write_c_string (")", printcharfun); + write_c_string (printcharfun, ")"); } } @@ -2785,7 +2800,7 @@ data->saw_single_shift_just_now = 0; } if (!(data->flags & ISO_STATE_ESCAPE) - && (BYTE_C0_P (c) || BYTE_C1_P (c))) + && (byte_c0_p (c) || byte_c1_p (c))) { /* control chars */ switch (c) { @@ -2807,8 +2822,8 @@ } } - if ((data->flags & ISO_STATE_ESCAPE) || BYTE_C0_P (c) - || BYTE_C1_P (c)) + if ((data->flags & ISO_STATE_ESCAPE) || byte_c0_p (c) + || byte_c1_p (c)) { switch (parse_iso2022_esc (Qnil, data->iso, c, &data->flags, 0)) diff --text -u 'xemacs-21.5.6/src/mule-wnnfns.c' 'xemacs-21.5.7/src/mule-wnnfns.c' Index: ././src/mule-wnnfns.c --- ././src/mule-wnnfns.c Fri Mar 29 13:48:13 2002 +++ ././src/mule-wnnfns.c Wed Jun 5 18:56:35 2002 @@ -361,7 +361,7 @@ return Qnil; } size = XSTRING_LENGTH (lname) > 1024 ? 1026 : XSTRING_LENGTH (lname) + 2; - envname = alloca (size); + envname = ALLOCA (size); strncpy (envname, (char *) XSTRING_DATA (lname), size-2); envname[size-2] = '\0'; if (NILP (hname)) hostname = ""; @@ -370,7 +370,7 @@ CHECK_STRING (hname); size = XSTRING_LENGTH(hname) > 1024 ? 1025 : XSTRING_LENGTH(hname) + 1; - hostname = alloca (size); + hostname = ALLOCA (size); strncpy (hostname, (char *) XSTRING_DATA (hname), size-1); hostname[size-1] = '\0'; } @@ -517,7 +517,7 @@ fname and comment must be ASCII strings! */ val = Fcons (Fcons (make_int (dicinfo->dic_no), - list4 (make_string ((Intbyte *) (dicinfo->fname), + list4 (make_string ((Ibyte *) (dicinfo->fname), strlen (dicinfo->fname)), make_string (comment, strlen ((char *) comment)), make_int (dicinfo->gosuu), @@ -1190,7 +1190,7 @@ if ((snum = check_wnn_server_type ()) == -1) return Qnil; if (!wnnfns_buf[snum]) return Qnil; if (jl_fuzokugo_get (wnnfns_buf[snum], fname) < 0) return Qnil; - return make_string ((Intbyte *) fname, strlen (fname)); + return make_string ((Ibyte *) fname, strlen (fname)); } @@ -1981,7 +1981,7 @@ while ((ch = *mp++) != 0) { - if (INTBYTE_LEADING_BYTE_P (ch)) + if (ibyte_leading_byte_p (ch)) { switch (ch) { @@ -2009,7 +2009,7 @@ mp++; break; default: /* ignore this character */ - mp += REP_BYTES_BY_FIRST_BYTE(ch) - 1; + mp += rep_bytes_by_first_byte(ch) - 1; } } else diff --text -u 'xemacs-21.5.6/src/nas.c' 'xemacs-21.5.7/src/nas.c' Index: ././src/nas.c --- ././src/nas.c Sun Jun 10 19:42:32 2001 +++ ././src/nas.c Sun May 5 20:32:07 2002 @@ -165,9 +165,7 @@ if (setjmp (AuXtErrorJump)) { EMACS_SIGNAL (SIGPIPE, old_sigpipe); -#ifdef emacs start_interrupts (); -#endif return "error in NAS"; } #endif @@ -177,13 +175,9 @@ AuDefaultErrorHandler = CatchErrorAndJump; #endif -#ifdef emacs stop_interrupts (); -#endif aud = AuOpenServer (server, 0, NULL, 0, NULL, &err_message); -#ifdef emacs start_interrupts (); -#endif if (!aud) { #ifdef ROBUST_PLAY diff --text -u 'xemacs-21.5.6/src/ndir.h' 'xemacs-21.5.7/src/ndir.h' Index: ././src/ndir.h --- ././src/ndir.h Wed Mar 13 17:52:54 2002 +++ ././src/ndir.h Wed Jun 5 18:56:36 2002 @@ -48,7 +48,7 @@ #ifdef WIN32_NATIVE -DIR *mswindows_opendir (const Intbyte *filename); +DIR *mswindows_opendir (const Ibyte *filename); int mswindows_closedir (DIR *dirp); struct direct *mswindows_readdir (DIR *dirp); diff --text -u 'xemacs-21.5.6/src/nt.c' 'xemacs-21.5.7/src/nt.c' Index: ././src/nt.c --- ././src/nt.c Mon Apr 1 12:58:44 2002 +++ ././src/nt.c Fri Jun 21 06:18:38 2002 @@ -39,13 +39,14 @@ #include "lisp.h" #include "buffer.h" +#include "process.h" -#include "systime.h" -#include "syssignal.h" -#include "sysproc.h" +#include "sysdir.h" #include "sysfile.h" +#include "sysproc.h" #include "syspwd.h" -#include "sysdir.h" +#include "syssignal.h" +#include "systime.h" #include "syswindows.h" @@ -113,7 +114,7 @@ } struct passwd * -getpwnam (const Intbyte *name) +getpwnam (const Ibyte *name) { struct passwd *pw; @@ -239,16 +240,16 @@ /* Set dir from environment variables. */ the_passwd.pw_dir = (char *) qxestrdup (get_home_directory ()); /* We used to set pw_shell here, but the order is wrong (SHELL gets - initted in callproc.c, called later in the init process) and pw_shell + initted in process.c, called later in the init process) and pw_shell is not used anywhere. */ } /* Parse the root part of file name, if present. Return length and - optionally store pointer to Intbyte after root. */ + optionally store pointer to Ibyte after root. */ static Bytecount -parse_root (Intbyte *name, Intbyte **pPath) +parse_root (Ibyte *name, Ibyte **pPath) { - Intbyte *start = name; + Ibyte *start = name; if (name == NULL) return 0; @@ -283,8 +284,8 @@ } /* Get long base name for name; name is assumed to be absolute. */ -static Intbyte * -get_long_basename (Intbyte *name) +static Ibyte * +get_long_basename (Ibyte *name) { WIN32_FIND_DATAW find_data; HANDLE dir_handle; @@ -298,7 +299,7 @@ dir_handle = qxeFindFirstFile (nameext, &find_data); if (dir_handle != INVALID_HANDLE_VALUE) { - Intbyte *fileint; + Ibyte *fileint; TSTR_TO_C_STRING_MALLOC (find_data.cFileName, fileint); FindClose (dir_handle); @@ -308,12 +309,12 @@ } /* Get long name for file, if possible (assumed to be absolute). */ -Intbyte * -mswindows_get_long_filename (Intbyte *name) +Ibyte * +mswindows_get_long_filename (Ibyte *name) { - Intbyte *full = mswindows_canonicalize_filename (name); - Intbyte *p; - Intbyte *q; + Ibyte *full = mswindows_canonicalize_filename (name); + Ibyte *p; + Ibyte *q; DECLARE_EISTRING (o); Bytecount len; @@ -323,7 +324,7 @@ while (p != NULL && *p) { - Intbyte *component; + Ibyte *component; q = p; p = qxestrchr (q, '\\'); @@ -351,9 +352,9 @@ } static int -is_unc_volume (const Intbyte *filename) +is_unc_volume (const Ibyte *filename) { - const Intbyte *ptr = filename; + const Ibyte *ptr = filename; if (!IS_DIRECTORY_SEP (ptr[0]) || !IS_DIRECTORY_SEP (ptr[1]) || !ptr[2]) return 0; @@ -369,7 +370,7 @@ #define REG_ROOT "SOFTWARE\\XEmacs\\XEmacs" static LPBYTE -nt_get_resource (Intbyte *key, LPDWORD lpdwtype) +nt_get_resource (Ibyte *key, LPDWORD lpdwtype) { LPBYTE lpvalue; HKEY hrootkey = NULL; @@ -419,7 +420,7 @@ } void -init_environment (void) +init_mswindows_environment (void) { /* Check for environment variables and use registry if they don't exist */ /* Emacs 20.6 sets default values for these; not necessary here because @@ -476,18 +477,18 @@ if (dwType == REG_EXPAND_SZ) { Extbyte *buf = NULL; - Intbyte *envval; + Ibyte *envval; Charcount cch; cch = qxeExpandEnvironmentStrings ((Extbyte *) lpval, buf, 0); - buf = (Extbyte *) alloca (cch * XETCHAR_SIZE); + buf = (Extbyte *) ALLOCA (cch * XETCHAR_SIZE); qxeExpandEnvironmentStrings ((Extbyte *) lpval, buf, cch); TSTR_TO_C_STRING (buf, envval); eputenv (env_vars[i], envval); } else if (dwType == REG_SZ) { - Intbyte *envval; + Ibyte *envval; TSTR_TO_C_STRING (lpval, envval); eputenv (env_vars[i], envval); @@ -514,7 +515,7 @@ Lisp_Object str = XCAR (tail); if (STRINGP (str)) { - Intbyte *dat = XSTRING_DATA (str); + Ibyte *dat = XSTRING_DATA (str); if (qxestrncasecmp (dat, "PATH=", 5) == 0) memcpy (dat, "PATH=", 5); else if (qxestrncasecmp (dat, "COMSPEC=", 8) == 0) @@ -564,12 +565,12 @@ DWORD timestamp; /* actual volume info */ - Intbyte *root_dir; + Ibyte *root_dir; DWORD serialnum; DWORD maxcomp; DWORD flags; - Intbyte *name; - Intbyte *type; + Ibyte *name; + Ibyte *type; } volume_info_data; /* Global referenced by various functions. */ @@ -593,7 +594,7 @@ static volume_info_data *volume_cache = NULL; static volume_info_data * -lookup_volume_info (Intbyte *root_dir) +lookup_volume_info (Ibyte *root_dir) { volume_info_data *info; @@ -604,7 +605,7 @@ } static void -add_volume_info (Intbyte *root_dir, volume_info_data *info) +add_volume_info (Ibyte *root_dir, volume_info_data *info) { info->root_dir = qxestrdup (root_dir); info->next = volume_cache; @@ -616,10 +617,10 @@ performance penalty (~2ms on 486 for local drives, 7.5ms for local cdrom drive, ~5-10ms or more for remote drives on LAN). */ static volume_info_data * -get_cached_volume_information (Intbyte *root_dir) +get_cached_volume_information (Ibyte *root_dir) { volume_info_data *info; - Intbyte *default_root; + Ibyte *default_root; /* NULL for root_dir means use root from current directory. */ if (root_dir == NULL) @@ -660,7 +661,7 @@ if (isalpha (root_dir[0]) && !fixed [DRIVE_INDEX (root_dir[0])]) { Extbyte remote_name[256 * XETCHAR_SIZE]; - Intbyte drive[3] = { root_dir[0], ':' }; + Ibyte drive[3] = { root_dir[0], ':' }; Extbyte *driveext; C_STRING_TO_TSTR (drive, driveext); @@ -717,12 +718,12 @@ /* Get information on the volume where name is held; set path pointer to start of pathname in name (past UNC header\volume header if present). */ static int -get_volume_info (const Intbyte *name, const Intbyte **pPath) +get_volume_info (const Ibyte *name, const Ibyte **pPath) { /* We probably only need a couple of bytes, but let's be generous in case this function gets changed */ - Intbyte *temp = alloca_array (Intbyte, qxestrlen (name) + 10); - Intbyte *rootname = NULL; /* default to current volume */ + Ibyte *temp = alloca_array (Ibyte, qxestrlen (name) + 10); + Ibyte *rootname = NULL; /* default to current volume */ volume_info_data *info; if (name == NULL) @@ -739,7 +740,7 @@ } else if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1])) { - Intbyte *str = temp; + Ibyte *str = temp; int slashes = 4; rootname = temp; do @@ -772,9 +773,9 @@ predates Windows 95!) */ static int -is_exec (const Intbyte *name) +is_exec (const Ibyte *name) { - Intbyte *p = qxestrrchr (name, '.'); + Ibyte *p = qxestrrchr (name, '.'); return (p != NULL && (qxestrcasecmp (p, ".exe") == 0 || qxestrcasecmp (p, ".com") == 0 || qxestrcasecmp (p, ".bat") == 0 || @@ -788,18 +789,18 @@ struct direct dir_static; /* simulated directory contents */ static HANDLE dir_find_handle = INVALID_HANDLE_VALUE; /* dir_is_fat deleted */ -static Intbyte *dir_pathname; +static Ibyte *dir_pathname; static WIN32_FIND_DATAW dir_find_data; /* Support shares on a network resource as subdirectories of a read-only root directory. */ static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE; -static HANDLE open_unc_volume (const Intbyte *); -static Intbyte *read_unc_volume (HANDLE); +static HANDLE open_unc_volume (const Ibyte *); +static Ibyte *read_unc_volume (HANDLE); static int close_unc_volume (HANDLE); DIR * -mswindows_opendir (const Intbyte *filename) +mswindows_opendir (const Ibyte *filename) { DIR *dirp; @@ -852,7 +853,7 @@ struct direct * mswindows_readdir (DIR *dirp) { - Intbyte *val; + Ibyte *val; int need_to_free = 0; if (wnet_enum_handle != INVALID_HANDLE_VALUE) @@ -865,7 +866,7 @@ else if (dir_find_handle == INVALID_HANDLE_VALUE) { DECLARE_EISTRING (filename); - Emchar lastch; + Ichar lastch; eicpy_rawz (filename, dir_pathname); lastch = eigetch_char (filename, eicharlen (filename) - 1); @@ -916,7 +917,7 @@ } static HANDLE -open_unc_volume (const Intbyte *path) +open_unc_volume (const Ibyte *path) { NETRESOURCEW nr; HANDLE henum; @@ -940,13 +941,13 @@ return INVALID_HANDLE_VALUE; } -static Intbyte * +static Ibyte * read_unc_volume (HANDLE henum) { int count; int result; Extbyte buf[16384]; - Intbyte *ptr; + Ibyte *ptr; Bytecount bufsize = sizeof (buf); count = 1; @@ -966,11 +967,11 @@ /* WNetEnumResource returns \\resource\share...skip forward to "share". */ TSTR_TO_C_STRING (((LPNETRESOURCEW) buf)->lpRemoteName, ptr); - INC_CHARPTR (ptr); - INC_CHARPTR (ptr); - while (*ptr && !IS_DIRECTORY_SEP (charptr_emchar (ptr))) - INC_CHARPTR (ptr); - INC_CHARPTR (ptr); + INC_IBYTEPTR (ptr); + INC_IBYTEPTR (ptr); + while (*ptr && !IS_DIRECTORY_SEP (itext_ichar (ptr))) + INC_IBYTEPTR (ptr); + INC_IBYTEPTR (ptr); return qxestrdup (ptr); } @@ -985,7 +986,7 @@ } static DWORD -unc_volume_file_attributes (const Intbyte *path) +unc_volume_file_attributes (const Ibyte *path) { HANDLE henum; DWORD attrs; @@ -1002,7 +1003,7 @@ } int -mswindows_access (const Intbyte *path, int mode) +mswindows_access (const Ibyte *path, int mode) { DWORD attributes; @@ -1051,7 +1052,7 @@ /* #### NT 5.0 has a function CreateHardLink to do this directly, and it may do more things. */ int -mswindows_link (const Intbyte *old, const Intbyte *new) +mswindows_link (const Ibyte *old, const Ibyte *new) { HANDLE fileh; int result = -1; @@ -1125,10 +1126,10 @@ /* sys_open() merged into sysdep.c sys_open() */ int -mswindows_rename (const Intbyte *oldname, const Intbyte *newname) +mswindows_rename (const Ibyte *oldname, const Ibyte *newname) { int result; - Intbyte *temp; + Ibyte *temp; /* MoveFile on Windows 95 doesn't correctly change the short file name alias in a number of circumstances (it is not easy to predict when @@ -1146,18 +1147,18 @@ /* XEmacs: We sprintf() part of OLDNAME into part of OLDNAME + a number, so the following calculation should certainly be enough. */ - temp = qxestrcpy (alloca_intbytes (2 * qxestrlen (oldname) + 100), oldname); + temp = qxestrcpy (alloca_ibytes (2 * qxestrlen (oldname) + 100), oldname); if (mswindows_windows9x_p) { - Intbyte *o; - Intbyte *p; + Ibyte *o; + Ibyte *p; int i = 0; if (o = qxestrrchr (oldname, '\\')) o++; else - o = (Intbyte *) oldname; + o = (Ibyte *) oldname; if (p = qxestrrchr (temp, '\\')) p++; @@ -1199,7 +1200,7 @@ result = rename (tempext, newext); if (result < 0 - && errno == EEXIST + && (errno == EEXIST || errno == EACCES) && _chmod (newext, 0666) == 0 && _unlink (newext) == 0) result = rename (tempext, newext); @@ -1209,7 +1210,7 @@ } int -mswindows_unlink (const Intbyte *path) +mswindows_unlink (const Ibyte *path) { Extbyte *pathout; @@ -1429,7 +1430,7 @@ else { #if 0 /* no way of knowing the filename */ - Intbyte *p = qxestrrchr (name, '.'); + Ibyte *p = qxestrrchr (name, '.'); if (p != NULL && (qxestrcasecmp (p, ".exe") == 0 || qxestrcasecmp (p, ".com") == 0 || @@ -1448,9 +1449,9 @@ replace it with our own. This also allows us to calculate consistent inode values without hacks in the main Emacs code. */ int -mswindows_stat (const Intbyte *path, struct stat *buf) +mswindows_stat (const Ibyte *path, struct stat *buf) { - Intbyte *name, *r; + Ibyte *name, *r; WIN32_FIND_DATAW wfd; HANDLE fh; DWORD fake_inode; @@ -1458,6 +1459,7 @@ Bytecount len; int rootdir = FALSE; Extbyte *nameext; + int errm; if (path == NULL || buf == NULL) { @@ -1465,7 +1467,9 @@ return -1; } - name = qxestrcpy (alloca_intbytes (qxestrlen (path) + 10), path); + name = qxestrcpy (alloca_ibytes (qxestrlen (path) + 10), path); + errm = SetErrorMode (SEM_FAILCRITICALERRORS + | SEM_NOOPENFILEERRORBOX); get_volume_info (name, &path); /* must be valid filename, no wild cards or other invalid characters */ @@ -1507,10 +1511,11 @@ else if (rootdir) { if (!IS_DIRECTORY_SEP (name[len-1])) - qxestrcat (name, (Intbyte *) "\\"); + qxestrcat (name, (Ibyte *) "\\"); C_STRING_TO_TSTR (name, nameext); if (qxeGetDriveType (nameext) < 2) { + SetErrorMode (errm); errno = ENOENT; return -1; } @@ -1541,7 +1546,7 @@ && qxestrncasecmp_i18n (dir_pathname, name, len) == 0 && IS_DIRECTORY_SEP (name[len]) && qxestrcasecmp_i18n (name + len + 1, - (Intbyte *) dir_static.d_name) == 0) + (Ibyte *) dir_static.d_name) == 0) { /* This was the last entry returned by readdir. */ wfd = dir_find_data; @@ -1552,6 +1557,7 @@ fh = qxeFindFirstFile (nameext, &wfd); if (fh == INVALID_HANDLE_VALUE) { + SetErrorMode (errm); errno = ENOENT; return -1; } @@ -1621,6 +1627,8 @@ } } + SetErrorMode (errm); + #if 0 /* XEmacs: Removed the fake-inodes code here, which was if 0'd out. If you want it, look in w32.c in Emacs 20.6. */ @@ -1732,11 +1740,11 @@ #endif } -Intbyte * +Ibyte * mswindows_getdcwd (int drivelet) { Extbyte *cwdext; - Intbyte *cwd; + Ibyte *cwd; if (XEUNICODE_P) cwdext = (Extbyte *) _wgetdcwd (drivelet, NULL, 0); @@ -1747,99 +1755,13 @@ return cwd; } -void -init_ntproc (void) -{ - /* Initial preparation for subprocess support: replace our standard - handles with non-inheritable versions. */ - { - HANDLE parent; - HANDLE stdin_save = INVALID_HANDLE_VALUE; - HANDLE stdout_save = INVALID_HANDLE_VALUE; - HANDLE stderr_save = INVALID_HANDLE_VALUE; - - parent = GetCurrentProcess (); - - /* ignore errors when duplicating and closing; typically the - handles will be invalid when running as a gui program. */ - DuplicateHandle (parent, - GetStdHandle (STD_INPUT_HANDLE), - parent, - &stdin_save, - 0, - FALSE, - DUPLICATE_SAME_ACCESS); - - DuplicateHandle (parent, - GetStdHandle (STD_OUTPUT_HANDLE), - parent, - &stdout_save, - 0, - FALSE, - DUPLICATE_SAME_ACCESS); - - DuplicateHandle (parent, - GetStdHandle (STD_ERROR_HANDLE), - parent, - &stderr_save, - 0, - FALSE, - DUPLICATE_SAME_ACCESS); - - retry_fclose (stdin); - retry_fclose (stdout); - retry_fclose (stderr); - - if (stdin_save != INVALID_HANDLE_VALUE) - _open_osfhandle ((long) stdin_save, O_TEXT); - else - _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY); - _fdopen (0, "r"); - - if (stdout_save != INVALID_HANDLE_VALUE) - _open_osfhandle ((long) stdout_save, O_TEXT); - else - _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); - _fdopen (1, "w"); - - if (stderr_save != INVALID_HANDLE_VALUE) - _open_osfhandle ((long) stderr_save, O_TEXT); - else - _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); - _fdopen (2, "w"); - } - - /* determine which drives are fixed, for get_cached_volume_information */ - { - /* GetDriveType must have trailing backslash. */ - Intbyte drive[] = "A:\\"; - - /* Loop over all possible drive letters */ - while (*drive <= 'Z') - { - Extbyte *driveext; - - C_STRING_TO_TSTR (drive, driveext); - - /* Record if this drive letter refers to a fixed drive. */ - fixed_drives[DRIVE_INDEX (*drive)] = - (qxeGetDriveType (driveext) == DRIVE_FIXED); - - (*drive)++; - } - - /* Reset the volume info cache. */ - volume_cache = NULL; - } -} - /*--------------------------------------------------------------------*/ /* Memory-mapped files */ /*--------------------------------------------------------------------*/ int -open_input_file (file_data *p_file, const Intbyte *filename) +open_input_file (file_data *p_file, const Ibyte *filename) { /* Synched with FSF 20.6. We fixed some warnings. */ HANDLE file; @@ -1875,7 +1797,7 @@ } int -open_output_file (file_data *p_file, const Intbyte *filename, +open_output_file (file_data *p_file, const Ibyte *filename, unsigned long size) { /* Synched with FSF 20.6. We fixed some warnings. */ @@ -1941,12 +1863,12 @@ #endif void -mswindows_executable_type (const Intbyte *filename, int *is_dos_app, +mswindows_executable_type (const Ibyte *filename, int *is_dos_app, int *is_cygnus_app) { /* Synched with FSF 20.6. We added MINGW stuff and casts. */ file_data executable; - Intbyte *p; + Ibyte *p; /* Default values in case we can't tell for sure. */ *is_dos_app = FALSE; @@ -2037,14 +1959,14 @@ { Extbyte *dllname_ext = (Extbyte *) RVA_TO_PTR (imports->Name, section, executable); - Intbyte *dllname; + Ibyte *dllname; EXTERNAL_TO_C_STRING (dllname_ext, dllname, Qbinary); /* The exact name of the cygwin dll has changed with various releases, but hopefully this will be reasonably future proof. */ - if (qxestrncasecmp (dllname, (Intbyte *) "cygwin", 6) == 0) + if (qxestrncasecmp (dllname, (Ibyte *) "cygwin", 6) == 0) { *is_cygnus_app = TRUE; break; @@ -2080,7 +2002,7 @@ { Extbyte shortname[MAX_PATH * MAX_XETCHAR_SIZE]; Extbyte *fileext; - Intbyte *shortint; + Ibyte *shortint; CHECK_STRING (filename); @@ -2107,7 +2029,7 @@ */ (filename)) { - Intbyte *longname, *canon; + Ibyte *longname, *canon; Lisp_Object ret; CHECK_STRING (filename); @@ -2123,6 +2045,96 @@ xfree (canon); xfree (longname); return ret; +} + + +void +init_nt (void) +{ + /* Initial preparation for subprocess support: replace our standard + handles with non-inheritable versions. + + #### Do we still need this? This is left over from the old process + support. */ + { + HANDLE parent; + HANDLE stdin_save = INVALID_HANDLE_VALUE; + HANDLE stdout_save = INVALID_HANDLE_VALUE; + HANDLE stderr_save = INVALID_HANDLE_VALUE; + + parent = GetCurrentProcess (); + + /* ignore errors when duplicating and closing; typically the + handles will be invalid when running as a gui program. */ + DuplicateHandle (parent, + GetStdHandle (STD_INPUT_HANDLE), + parent, + &stdin_save, + 0, + FALSE, + DUPLICATE_SAME_ACCESS); + + DuplicateHandle (parent, + GetStdHandle (STD_OUTPUT_HANDLE), + parent, + &stdout_save, + 0, + FALSE, + DUPLICATE_SAME_ACCESS); + + DuplicateHandle (parent, + GetStdHandle (STD_ERROR_HANDLE), + parent, + &stderr_save, + 0, + FALSE, + DUPLICATE_SAME_ACCESS); + + retry_fclose (stdin); + retry_fclose (stdout); + retry_fclose (stderr); + + if (stdin_save != INVALID_HANDLE_VALUE) + _open_osfhandle ((long) stdin_save, O_TEXT); + else + _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY); + _fdopen (0, "r"); + + if (stdout_save != INVALID_HANDLE_VALUE) + _open_osfhandle ((long) stdout_save, O_TEXT); + else + _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); + _fdopen (1, "w"); + + if (stderr_save != INVALID_HANDLE_VALUE) + _open_osfhandle ((long) stderr_save, O_TEXT); + else + _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); + _fdopen (2, "w"); + } + + /* determine which drives are fixed, for get_cached_volume_information */ + { + /* GetDriveType must have trailing backslash. */ + Ibyte drive[] = "A:\\"; + + /* Loop over all possible drive letters */ + while (*drive <= 'Z') + { + Extbyte *driveext; + + C_STRING_TO_TSTR (drive, driveext); + + /* Record if this drive letter refers to a fixed drive. */ + fixed_drives[DRIVE_INDEX (*drive)] = + (qxeGetDriveType (driveext) == DRIVE_FIXED); + + (*drive)++; + } + + /* Reset the volume info cache. */ + volume_cache = NULL; + } } void diff --text -u 'xemacs-21.5.6/src/ntheap.c' 'xemacs-21.5.7/src/ntheap.c' Index: ././src/ntheap.c --- ././src/ntheap.c Wed Mar 13 17:52:54 2002 +++ ././src/ntheap.c Sun Apr 14 21:42:21 2002 @@ -26,9 +26,12 @@ incomplete synching, so beware.) */ +/* This file has been Mule-ized, Ben Wing, 4-13-02. */ + #include #include "lisp.h" +#include "sysdep.h" #include "syswindows.h" /* This gives us the page size and the size of the allocation unit on NT. */ @@ -49,39 +52,39 @@ } /* Round ADDRESS up to be aligned with ALIGN. */ -unsigned char * -round_to_next (unsigned char *address, unsigned long align) +UChar_Binary * +round_to_next (UChar_Binary *address, unsigned long align) { unsigned long tmp; tmp = (unsigned long) address; tmp = (tmp + align - 1) / align; - return (unsigned char *) (tmp * align); + return (UChar_Binary *) (tmp * align); } /* Info for keeping track of our heap. */ -unsigned char *data_region_base = UNINIT_PTR; -unsigned char *data_region_end = UNINIT_PTR; -unsigned char *real_data_region_end = UNINIT_PTR; +UChar_Binary *data_region_base = UNINIT_PTR; +UChar_Binary *data_region_end = UNINIT_PTR; +UChar_Binary *real_data_region_end = UNINIT_PTR; unsigned long data_region_size = UNINIT_LONG; unsigned long reserved_heap_size = UNINIT_LONG; /* The start of the data segment. */ -unsigned char * +UChar_Binary * get_data_start (void) { return data_region_base; } /* The end of the data segment. */ -unsigned char * +UChar_Binary * get_data_end (void) { return data_region_end; } -static unsigned char * +static UChar_Binary * allocate_heap (void) { /* The base address for our GNU malloc heap is chosen in conjunction @@ -145,7 +148,7 @@ PAGE_NOACCESS); #endif - return (unsigned char*) ptr; + return (UChar_Binary *) ptr; } @@ -174,7 +177,7 @@ if (size < 0) { int new_size; - unsigned char *new_data_region_end; + UChar_Binary *new_data_region_end; size = -size; @@ -185,7 +188,7 @@ /* We can only decommit full pages, so allow for partial deallocation [cga]. */ new_data_region_end = (data_region_end - size); - new_data_region_end = (unsigned char *) + new_data_region_end = (UChar_Binary *) ((long) (new_data_region_end + syspage_mask) & ~syspage_mask); new_size = real_data_region_end - new_data_region_end; real_data_region_end = new_data_region_end; @@ -214,19 +217,19 @@ /* We really only commit full pages, so record where the real end of committed memory is [cga]. */ - real_data_region_end = (unsigned char *) + real_data_region_end = (UChar_Binary *) ((long) (data_region_end + syspage_mask) & ~syspage_mask); } return result; } -#if !defined (CANNOT_DUMP) && !defined(HEAP_IN_DATA) && !defined(PDUMP) +#if !defined (CANNOT_DUMP) && !defined (HEAP_IN_DATA) && !defined (PDUMP) /* Recreate the heap from the data that was dumped to the executable. EXECUTABLE_PATH tells us where to find the executable. */ void -recreate_heap (char *executable_path) +recreate_heap (Extbyte *executable_path) { /* First reserve the upper part of our heap. (We reserve first because there have been problems in the past where doing the @@ -236,36 +239,43 @@ void *tmp; MEMORY_BASIC_INFORMATION info; DWORD size; - unsigned char* base = get_heap_end (); - unsigned char* end = base + get_reserved_heap_size () - get_committed_heap_size (); + UChar_Binary *base = get_heap_end (); + UChar_Binary *end = + base + get_reserved_heap_size () - get_committed_heap_size (); VirtualQuery (base, &info, sizeof (info)); if (info.State != MEM_FREE) - { - /* Oops, something has already reserved or commited it, nothing we can do but exit */ - char buf[256]; - sprintf (buf, - "XEmacs cannot start because the memory region required by the heap is not available.\n" - "(BaseAddress = 0x%lx, AllocationBase = 0x%lx, Size = 0x%lx, State = %s, Type = %s)", - info.BaseAddress, info.AllocationBase, info.RegionSize, - info.State == MEM_COMMIT ? "COMMITED" : "RESERVED", - info.Type == MEM_IMAGE ? "IMAGE" : info.Type == MEM_MAPPED ? "MAPPED" : "PRIVATE"); - MessageBoxA (NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP); - exit(1); - } + { + /* Oops, something has already reserved or commited it, nothing + we can do but exit */ + Extbyte buf[256]; + sprintf (buf, + "XEmacs cannot start because the memory region required " + "by the heap is not available.\n" + "(BaseAddress = 0x%lx, AllocationBase = 0x%lx, " + "Size = 0x%lx, State = %s, Type = %s)", + info.BaseAddress, info.AllocationBase, info.RegionSize, + info.State == MEM_COMMIT ? "COMMITED" : "RESERVED", + info.Type == MEM_IMAGE ? "IMAGE" : + info.Type == MEM_MAPPED ? "MAPPED" : "PRIVATE"); + MessageBoxA (NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP); + exit(1); + } /* Now try and reserve as much as possible */ size = min (info.RegionSize, (DWORD) (end - base)); tmp = VirtualAlloc (base, size, MEM_RESERVE, PAGE_NOACCESS); if (!tmp) - { - /* Can't reserve it, nothing we can do but exit */ - char buf[256]; - sprintf (buf, - "XEmacs cannot start because it couldn't reserve space required for the heap.\n" - "(VirtualAlloc at 0x%lx of 0x%lx failed (%d))", base, size, GetLastError()); - MessageBoxA (NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP); - exit (1); - } + { + /* Can't reserve it, nothing we can do but exit */ + Extbyte buf[256]; + sprintf (buf, + "XEmacs cannot start because it couldn't reserve space " + "required for the heap.\n" + "(VirtualAlloc at 0x%lx of 0x%lx failed (%d))", + base, size, GetLastError()); + MessageBoxA (NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP); + exit (1); + } /* We read in the data for the .bss section from the executable first and map in the heap from the executable second to prevent diff --text -u /dev/null 'xemacs-21.5.7/src/objects-gtk-impl.h' Index: ././src/objects-gtk-impl.h --- ././src/objects-gtk-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/objects-gtk-impl.h Fri Jun 21 06:18:38 2002 @@ -0,0 +1,62 @@ +/* Gtk-specific Lisp objects. + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995, 1996 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ +/* Gtk version by William Perry */ + +#ifndef _XEMACS_OBJECTS_GTK_IMPL_H_ +#define _XEMACS_OBJECTS_GTK_IMPL_H_ + +#include "objects-impl.h" +#include "objects-gtk.h" + +#ifdef HAVE_GTK + +/***************************************************************************** + Color-Instance + ****************************************************************************/ + +struct gtk_color_instance_data +{ + GdkColor *color; + char dealloc_on_gc; +}; + +#define GTK_COLOR_INSTANCE_DATA(c) ((struct gtk_color_instance_data *) (c)->data) +#define COLOR_INSTANCE_GTK_COLOR(c) (GTK_COLOR_INSTANCE_DATA (c)->color) +#define COLOR_INSTANCE_GTK_DEALLOC(c) (GTK_COLOR_INSTANCE_DATA (c)->dealloc_on_gc) + +/***************************************************************************** + Font-Instance + ****************************************************************************/ + +struct gtk_font_instance_data +{ + /* Gtk-specific information */ + GdkFont *font; +}; + +#define GTK_FONT_INSTANCE_DATA(f) ((struct gtk_font_instance_data *) (f)->data) +#define FONT_INSTANCE_GTK_FONT(f) (GTK_FONT_INSTANCE_DATA (f)->font) + +#endif /* HAVE_GTK */ +#endif /* _XEMACS_OBJECTS_GTK_IMPL_H_ */ diff --text -u 'xemacs-21.5.6/src/objects-gtk.c' 'xemacs-21.5.7/src/objects-gtk.c' Index: ././src/objects-gtk.c --- ././src/objects-gtk.c Sun Mar 31 17:28:49 2002 +++ ././src/objects-gtk.c Fri Jun 21 06:18:38 2002 @@ -2,7 +2,7 @@ Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1995 Tinker Systems. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. Copyright (C) 1995 Sun Microsystems, Inc. This file is part of XEmacs. @@ -30,13 +30,13 @@ #include #include "lisp.h" -#include "console-gtk.h" -#include "objects-gtk.h" - #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "insdel.h" +#include "console-gtk-impl.h" +#include "objects-gtk-impl.h" + /* sigh */ #include @@ -72,7 +72,7 @@ } int -gtk_parse_nearest_color (struct device *d, GdkColor *color, Intbyte *name, +gtk_parse_nearest_color (struct device *d, GdkColor *color, Ibyte *name, Bytecount len, Error_Behavior errb) { GdkColormap *cmap; @@ -235,7 +235,6 @@ /* Don't allocate the data until we're sure that we will succeed, or the finalize method may get fucked. */ f->data = xnew (struct gtk_font_instance_data); - FONT_INSTANCE_GTK_TRUENAME (f) = Qnil; FONT_INSTANCE_GTK_FONT (f) = gf; f->ascent = gf->ascent; f->descent = gf->descent; @@ -306,12 +305,6 @@ } static void -gtk_mark_font_instance (struct Lisp_Font_Instance *f) -{ - mark_object (FONT_INSTANCE_GTK_TRUENAME (f)); -} - -static void gtk_print_font_instance (struct Lisp_Font_Instance *f, Lisp_Object printcharfun, int escapeflag) @@ -341,18 +334,18 @@ static Lisp_Object gtk_font_instance_truename (struct Lisp_Font_Instance *f, Error_Behavior errb) { - if (NILP (FONT_INSTANCE_GTK_TRUENAME (f))) + if (NILP (FONT_INSTANCE_TRUENAME (f))) { - FONT_INSTANCE_GTK_TRUENAME (f) = __get_gtk_font_truename (FONT_INSTANCE_GTK_FONT (f), 1); + FONT_INSTANCE_TRUENAME (f) = __get_gtk_font_truename (FONT_INSTANCE_GTK_FONT (f), 1); - if (NILP (FONT_INSTANCE_GTK_TRUENAME (f))) + if (NILP (FONT_INSTANCE_TRUENAME (f))) { /* Ok, just this once, return the font name as the truename. (This is only used by Fequal() right now.) */ return f->name; } } - return (FONT_INSTANCE_GTK_TRUENAME (f)); + return (FONT_INSTANCE_TRUENAME (f)); } static Lisp_Object @@ -379,9 +372,13 @@ static int gtk_font_spec_matches_charset (struct device *d, Lisp_Object charset, - const Intbyte *nonreloc, Lisp_Object reloc, - Bytecount offset, Bytecount length) + const Ibyte *nonreloc, Lisp_Object reloc, + Bytecount offset, Bytecount length, + int stage) { + if (stage) + return 0; + if (UNBOUNDP (charset)) return 1; /* Hack! Short font names don't have the registry in them, @@ -391,7 +388,7 @@ */ if (EQ (charset, Vcharset_ascii)) { - const Intbyte *the_nonreloc = nonreloc; + const Ibyte *the_nonreloc = nonreloc; int i; Bytecount the_length = length; @@ -403,7 +400,7 @@ { for (i = 0;; i++) { - const Intbyte *new_nonreloc = (const Intbyte *) + const Ibyte *new_nonreloc = (const Ibyte *) memchr (the_nonreloc, '-', the_length); if (!new_nonreloc) break; @@ -456,7 +453,6 @@ CONSOLE_HAS_METHOD (gtk, valid_color_name_p); CONSOLE_HAS_METHOD (gtk, initialize_font_instance); - CONSOLE_HAS_METHOD (gtk, mark_font_instance); CONSOLE_HAS_METHOD (gtk, print_font_instance); CONSOLE_HAS_METHOD (gtk, finalize_font_instance); CONSOLE_HAS_METHOD (gtk, font_instance_truename); @@ -484,7 +480,8 @@ /* find a font spec that matches font spec FONT and also matches (the registry of) CHARSET. */ static Lisp_Object -gtk_find_charset_font (Lisp_Object device, Lisp_Object font, Lisp_Object charset) +gtk_find_charset_font (Lisp_Object device, Lisp_Object font, + Lisp_Object charset, int stage) { char **names; int count = 0; @@ -492,6 +489,9 @@ const char *patternext; int i; + if (stage) + return Qnil; + TO_EXTERNAL_FORMAT (LISP_STRING, font, C_STRING_ALLOCA, patternext, Qbinary); names = XListFonts (GDK_DISPLAY (), @@ -499,13 +499,13 @@ /* #### This code seems awfully bogus -- mrb */ for (i = 0; i < count; i ++) { - const Intbyte *intname; + const Ibyte *intname; Bytecount intlen; TO_INTERNAL_FORMAT (C_STRING, names[i], ALLOCA, (intname, intlen), Qctext); if (gtk_font_spec_matches_charset (XDEVICE (device), charset, - intname, Qnil, 0, -1)) + intname, Qnil, 0, -1, 0)) { result = make_string ((char *) intname, intlen); break; @@ -518,7 +518,7 @@ /* Check for a short font name. */ if (NILP (result) && gtk_font_spec_matches_charset (XDEVICE (device), charset, 0, - font, 0, -1)) + font, 0, -1, 0)) return font; return result; diff --text -u 'xemacs-21.5.6/src/objects-gtk.h' 'xemacs-21.5.7/src/objects-gtk.h' Index: ././src/objects-gtk.h --- ././src/objects-gtk.h Thu Sep 20 15:29:08 2001 +++ ././src/objects-gtk.h Fri Jun 21 06:18:39 2002 @@ -34,35 +34,14 @@ Color-Instance ****************************************************************************/ -struct gtk_color_instance_data -{ - GdkColor *color; - char dealloc_on_gc; -}; - -#define GTK_COLOR_INSTANCE_DATA(c) ((struct gtk_color_instance_data *) (c)->data) -#define COLOR_INSTANCE_GTK_COLOR(c) (GTK_COLOR_INSTANCE_DATA (c)->color) -#define COLOR_INSTANCE_GTK_DEALLOC(c) (GTK_COLOR_INSTANCE_DATA (c)->dealloc_on_gc) - int allocate_nearest_color (GdkColormap *screen_colormap, GdkVisual *visual, GdkColor *color_def); -int gtk_parse_nearest_color (struct device *d, GdkColor *color, Intbyte *name, +int gtk_parse_nearest_color (struct device *d, GdkColor *color, Ibyte *name, Bytecount len, Error_Behavior errb); /***************************************************************************** Font-Instance ****************************************************************************/ - -struct gtk_font_instance_data -{ - /* Gtk-specific information */ - Lisp_Object truename; - GdkFont *font; -}; - -#define GTK_FONT_INSTANCE_DATA(f) ((struct gtk_font_instance_data *) (f)->data) -#define FONT_INSTANCE_GTK_FONT(f) (GTK_FONT_INSTANCE_DATA (f)->font) -#define FONT_INSTANCE_GTK_TRUENAME(f) (GTK_FONT_INSTANCE_DATA (f)->truename) #endif /* HAVE_GTK */ #endif /* _XEMACS_OBJECTS_GTK_H_ */ diff --text -u /dev/null 'xemacs-21.5.7/src/objects-impl.h' Index: ././src/objects-impl.h --- ././src/objects-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/objects-impl.h Fri Jun 21 06:18:39 2002 @@ -0,0 +1,154 @@ +/* Generic object functions -- header implementation. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995, 1996, 2002 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +#ifndef INCLUDED_objects_impl_h_ +#define INCLUDED_objects_impl_h_ + +#include "specifier.h" +#include "objects.h" + +/***************************************************************************** + * Color Specifier Object * + *****************************************************************************/ + +struct color_specifier +{ + Lisp_Object face; /* face this is attached to, or nil */ + Lisp_Object face_property; /* property of that face */ +}; + +#define COLOR_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, color) +#define COLOR_SPECIFIER_FACE(g) (COLOR_SPECIFIER_DATA (g)->face) +#define COLOR_SPECIFIER_FACE_PROPERTY(g) \ + (COLOR_SPECIFIER_DATA (g)->face_property) + +DECLARE_SPECIFIER_TYPE (color); +#define XCOLOR_SPECIFIER(x) XSPECIFIER_TYPE (x, color) +#define COLOR_SPECIFIERP(x) SPECIFIER_TYPEP (x, color) +#define CHECK_COLOR_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, color) +#define CONCHECK_COLOR_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, color) + +/***************************************************************************** + * Font Specifier Object * + *****************************************************************************/ + +struct font_specifier +{ + Lisp_Object face; /* face this is attached to, or nil */ + Lisp_Object face_property; /* property of that face */ +}; + +#define FONT_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, font) +#define FONT_SPECIFIER_FACE(g) (FONT_SPECIFIER_DATA (g)->face) +#define FONT_SPECIFIER_FACE_PROPERTY(g) \ + (FONT_SPECIFIER_DATA (g)->face_property) + +DECLARE_SPECIFIER_TYPE (font); +#define XFONT_SPECIFIER(x) XSPECIFIER_TYPE (x, font) +#define FONT_SPECIFIERP(x) SPECIFIER_TYPEP (x, font) +#define CHECK_FONT_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, font) +#define CONCHECK_FONT_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, font) + +/***************************************************************************** + * Face Boolean Specifier Object * + *****************************************************************************/ + +struct face_boolean_specifier +{ + Lisp_Object face; /* face this is attached to, or nil */ + Lisp_Object face_property; /* property of that face */ +}; + +#define FACE_BOOLEAN_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, face_boolean) +#define FACE_BOOLEAN_SPECIFIER_FACE(g) (FACE_BOOLEAN_SPECIFIER_DATA (g)->face) +#define FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY(g) \ + (FACE_BOOLEAN_SPECIFIER_DATA (g)->face_property) + +DECLARE_SPECIFIER_TYPE (face_boolean); +extern Lisp_Object Qface_boolean; +#define XFACE_BOOLEAN_SPECIFIER(x) XSPECIFIER_TYPE (x, face_boolean) +#define FACE_BOOLEAN_SPECIFIERP(x) SPECIFIER_TYPEP (x, face_boolean) +#define CHECK_FACE_BOOLEAN_SPECIFIER(x) \ + CHECK_SPECIFIER_TYPE (x, face_boolean) +#define CONCHECK_FACE_BOOLEAN_SPECIFIER(x) \ + CONCHECK_SPECIFIER_TYPE (x, face_boolean) + +/**************************************************************************** + * Color Instance Object * + ****************************************************************************/ + +struct Lisp_Color_Instance +{ + struct lcrecord_header header; + Lisp_Object name; + Lisp_Object device; + + /* console-type-specific data */ + void *data; +}; + +#define COLOR_INSTANCE_NAME(c) ((c)->name) +#define COLOR_INSTANCE_DEVICE(c) ((c)->device) + +/**************************************************************************** + * Font Instance Object * + ****************************************************************************/ + +struct Lisp_Font_Instance +{ + struct lcrecord_header header; + Lisp_Object name; /* the instantiator used to create the font instance */ + Lisp_Object truename; /* used by the device-specific methods; we need to + call them to get the truename (#### in reality, + they all probably just store the truename here + if they know it, and nil otherwise; we should + check this and enforce it as a general policy) */ + Lisp_Object device; + + unsigned short ascent; /* extracted from `font', or made up */ + unsigned short descent; + unsigned short width; + unsigned short height; + int proportional_p; + + /* console-type-specific data */ + void *data; +}; + +#define FONT_INSTANCE_NAME(f) ((f)->name) +#define FONT_INSTANCE_TRUENAME(f) ((f)->name) +#define FONT_INSTANCE_DEVICE(f) ((f)->device) +#define FONT_INSTANCE_ASCENT(f) ((f)->ascent) +#define FONT_INSTANCE_DESCENT(f) ((f)->descent) +#define FONT_INSTANCE_WIDTH(f) ((f)->width) +#define FONT_INSTANCE_HEIGHT(f) ((f)->height) + +#define XFONT_INSTANCE_NAME(f) FONT_INSTANCE_NAME (XFONT_INSTANCE (f)) +#define XFONT_INSTANCE_TRUENAME(f) FONT_INSTANCE_TRUENAME (XFONT_INSTANCE (f)) +#define XFONT_INSTANCE_DEVICE(f) FONT_INSTANCE_DEVICE (XFONT_INSTANCE (f)) +#define XFONT_INSTANCE_ASCENT(f) FONT_INSTANCE_ASCENT (XFONT_INSTANCE (f)) +#define XFONT_INSTANCE_DESCENT(f) FONT_INSTANCE_DESCENT (XFONT_INSTANCE (f)) +#define XFONT_INSTANCE_WIDTH(f) FONT_INSTANCE_WIDTH (XFONT_INSTANCE (f)) +#define XFONT_INSTANCE_HEIGHT(f) FONT_INSTANCE_HEIGHT (XFONT_INSTANCE (f)) + +#endif /* INCLUDED_objects_impl_h_ */ diff --text -u /dev/null 'xemacs-21.5.7/src/objects-msw-impl.h' Index: ././src/objects-msw-impl.h --- ././src/objects-msw-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/objects-msw-impl.h Fri Jun 21 06:18:39 2002 @@ -0,0 +1,75 @@ +/* mswindows-specific Lisp objects -- header implementation. + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995, 1996, 2002 Ben Wing. + Copyright (C) 1997, Jonathan Harris. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +/* Authorship: + + Ultimately based on FSF. + Rewritten by Ben Wing. + Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. + */ + + +#ifndef INCLUDED_objects_msw_impl_h_ +#define INCLUDED_objects_msw_impl_h_ + +#include "objects-impl.h" +#include "objects-msw.h" + +struct mswindows_color_instance_data +{ + COLORREF color; +}; + +#define MSWINDOWS_COLOR_INSTANCE_DATA(c) \ + ((struct mswindows_color_instance_data *) (c)->data) +#define COLOR_INSTANCE_MSWINDOWS_COLOR(c) \ + (MSWINDOWS_COLOR_INSTANCE_DATA (c)->color) + +/* The four HFONTS are for the 4 (underlined, strikethrough) + combinations. Only the one at index 0, neither underlined nor + struk through is created with the font instance. Other fonts are + created as necessary during redisplay, using the one at index 0 + as prototype */ +#define MSWINDOWS_NUM_FONT_VARIANTS 4 +struct mswindows_font_instance_data +{ + HFONT hfont [MSWINDOWS_NUM_FONT_VARIANTS]; +}; + +#define MSWINDOWS_FONT_INSTANCE_DATA(c) \ + ((struct mswindows_font_instance_data *) (c)->data) + +#define FONT_INSTANCE_MSWINDOWS_HFONT_I(c,i) \ + (MSWINDOWS_FONT_INSTANCE_DATA(c)->hfont[(i)]) + +#define FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT(c,under,strike) \ + FONT_INSTANCE_MSWINDOWS_HFONT_I (c, (!!(strike)<<1)|!!(under)) + +/* If font creation during redisplay fails, then the following + value is used to prevent future attempts to create this font. + Redisplay uses the "main" font when encounters this value */ +#define MSWINDOWS_BAD_HFONT ((HFONT)INVALID_HANDLE_VALUE) + +#endif /* INCLUDED_objects_msw_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/objects-msw.c' 'xemacs-21.5.7/src/objects-msw.c' Index: ././src/objects-msw.c --- ././src/objects-msw.c Sun Mar 31 17:28:49 2002 +++ ././src/objects-msw.c Fri Jun 21 06:18:39 2002 @@ -38,12 +38,12 @@ #include #include "lisp.h" -#include "console-msw.h" -#include "objects-msw.h" +#include "console-msw-impl.h" +#include "objects-msw-impl.h" #include "buffer.h" #include "charset.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "insdel.h" #include "opaque.h" @@ -751,8 +751,8 @@ {"Black" , FW_BLACK} }; -/* Default charset first, no synonyms allowed because these names are - * matched against the names reported by win32 by match_font() */ +/* Default charset must be listed first, no synonyms allowed because these + * names are matched against the names reported by win32 by match_font() */ static const fontmap_t charset_map[] = { {"Western" , ANSI_CHARSET}, /* Latin 1 */ @@ -915,7 +915,7 @@ /************************************************************************/ static int -hexval (Intbyte c) +hexval (Ibyte c) { /* assumes ASCII and isxdigit (c) */ if (c >= 'a') @@ -927,7 +927,7 @@ } COLORREF -mswindows_string_to_color (const Intbyte *name) +mswindows_string_to_color (const Ibyte *name) { int i; @@ -939,7 +939,7 @@ for (i = 1; i < qxestrlen (name); i++) { - if (!BYTE_ASCII_P (name[i]) || !isxdigit ((int) name[i])) + if (!byte_ascii_p (name[i]) || !isxdigit ((int) name[i])) return (COLORREF) -1; } if (qxestrlen (name) == 7) @@ -968,7 +968,7 @@ { unsigned int r, g, b; - if (sscanf ((CIntbyte *) name, "rgb:%04x/%04x/%04x", &r, &g, &b) == 3) + if (sscanf ((CIbyte *) name, "rgb:%04x/%04x/%04x", &r, &g, &b) == 3) { int len = qxestrlen (name); if (len == 18) @@ -990,8 +990,8 @@ } else if (*name) /* Can't be an empty string */ { - Intbyte *nospaces = (Intbyte *) alloca (qxestrlen (name) + 1); - Intbyte *c = nospaces; + Ibyte *nospaces = (Ibyte *) ALLOCA (qxestrlen (name) + 1); + Ibyte *c = nospaces; while (*name) if (*name != ' ') *c++ = *name++; @@ -1032,10 +1032,10 @@ * the corresponding field in the other pattern is either identical or blank. */ static int -match_font (Intbyte *pattern1, Intbyte *pattern2, - Intbyte *fontname) +match_font (Ibyte *pattern1, Ibyte *pattern2, + Ibyte *fontname) { - Intbyte *c1 = pattern1, *c2 = pattern2, *e1 = 0, *e2 = 0; + Ibyte *c1 = pattern1, *c2 = pattern2, *e1 = 0, *e2 = 0; int i; if (fontname) @@ -1093,10 +1093,10 @@ font_enum_callback_2 (ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEXW *lpntme, int FontType, struct font_enum_t *font_enum) { - Intbyte fontname[MSW_FONTSIZE * 2 * MAX_EMCHAR_LEN]; /* should be enough :)*/ + Ibyte fontname[MSW_FONTSIZE * 2 * MAX_ICHAR_LEN]; /* should be enough :)*/ Lisp_Object fontname_lispstr; int i; - Intbyte *facename; + Ibyte *facename; /* * The enumerated font weights are not to be trusted because: @@ -1110,7 +1110,7 @@ * those fonts that do get enumerated with different weights. */ TSTR_TO_C_STRING (lpelfe->elfLogFont.lfFaceName, facename); - if (charptr_emchar (facename) == '@') + if (itext_ichar (facename) == '@') /* This is a font for writing vertically. We ignore it. */ return 1; @@ -1142,8 +1142,14 @@ /* Add the font name to the list if not already there */ fontname_lispstr = build_intstring (fontname); - if (NILP (Fmember (fontname_lispstr, font_enum->list))) - font_enum->list = Fcons (fontname_lispstr, font_enum->list); + if (NILP (Fassoc (fontname_lispstr, font_enum->list))) + font_enum->list = + Fcons (Fcons (fontname_lispstr, + /* TMPF_FIXED_PITCH is backwards from what you expect! + If set, it means NOT fixed pitch. */ + (lpntme->ntmTm.tmPitchAndFamily & TMPF_FIXED_PITCH) ? + Qnil : Qt), + font_enum->list); return 1; } @@ -1159,6 +1165,94 @@ (LPARAM) font_enum, 0); } +/* Function for sorting lists of fonts as obtained from + mswindows_enumerate_fonts(). These come in a known format: + "family::::charset" for TrueType fonts, "family::size::charset" + otherwise. */ + +static int +sort_font_list_function (Lisp_Object obj1, Lisp_Object obj2, + Lisp_Object pred) +{ + Ibyte *font1, *font2; + Ibyte *c1, *c2; + int t1, t2; + + /* + 1. fixed over proportional. + 2. Western over other charsets. + 3. TrueType over non-TrueType. + 4. Within non-TrueType, sizes closer to 10pt over sizes farther from 10pt. + 5. Courier New over other families. + */ + + /* The sort function should return > 0 if OBJ1 < OBJ2, < 0 otherwise. + NOTE: This is backwards from the way qsort() works. */ + + t1 = !NILP (XCDR (obj1)); + t2 = !NILP (XCDR (obj2)); + + if (t1 && !t2) + return 1; + if (t2 && !t1) + return -1; + + font1 = XSTRING_DATA (XCAR (obj1)); + font2 = XSTRING_DATA (XCAR (obj2)); + + c1 = qxestrrchr (font1, ':'); + c2 = qxestrrchr (font2, ':'); + + t1 = !qxestrcasecmp_c (c1 + 1, "western"); + t2 = !qxestrcasecmp_c (c2 + 1, "western"); + + if (t1 && !t2) + return 1; + if (t2 && !t1) + return -1; + + c1 -= 2; + c2 -= 2; + t1 = *c1 == ':'; + t2 = *c2 == ':'; + + if (t1 && !t2) + return 1; + if (t2 && !t1) + return -1; + + if (!t1 && !t2) + { + while (isdigit (*c1)) + c1--; + while (isdigit (*c2)) + c2--; + + t1 = qxeatoi (c1 + 1) - 10; + t2 = qxeatoi (c2 + 1) - 10; + + if (abs (t1) < abs (t2)) + return 1; + else if (abs (t2) < abs (t1)) + return -1; + else if (t1 < t2) + /* Prefer a smaller font over a larger one just as far away + because the smaller one won't upset the total line height if it's + just a few chars. */ + return 1; + } + + t1 = !qxestrncasecmp_c (font1, "courier new:", 12); + t2 = !qxestrncasecmp_c (font2, "courier new:", 12); + + if (t1 && !t2) + return 1; + if (t2 && !t1) + return -1; + + return -1; +} + /* * Enumerate the available on the HDC fonts and return a list of string * font names. @@ -1182,7 +1276,7 @@ qxeEnumFontFamiliesEx (hdc, &logfont, (FONTENUMPROCW) font_enum_callback_1, (LPARAM) (&font_enum), 0); - return font_enum.list; + return list_sort (font_enum.list, Qnil, sort_font_list_function); } static HFONT @@ -1320,20 +1414,36 @@ static void mswindows_finalize_font_instance (Lisp_Font_Instance *f); -static HFONT -create_hfont_from_font_spec (const Intbyte *namestr, - HDC hdc, - Lisp_Object name_for_errors, - Lisp_Object device_font_list, - Error_Behavior errb) +/* Parse the font spec in NAMESTR. Maybe issue errors, according to ERRB; + NAME_FOR_ERRORS is the Lisp string to use when issuing errors. Store + the five parts of the font spec into the given strings, which should be + declared as + + Ibyte fontname[LF_FACESIZE], weight[LF_FACESIZE], points[8]; + Ibyte effects[LF_FACESIZE], charset[LF_FACESIZE]; + + If LOGFONT is given, store the necessary information in LOGFONT to + create a font object. If LOGFONT is given, HDC must also be given; + else, NULL can be given for both. + + Return 1 if ok, 0 if error. + */ +static int +parse_font_spec (const Ibyte *namestr, + HDC hdc, + Lisp_Object name_for_errors, + Error_Behavior errb, + LOGFONTW *logfont, + Ibyte *fontname, + Ibyte *weight, + Ibyte *points, + Ibyte *effects, + Ibyte *charset) { - LOGFONTW logfont; int fields, i; int pt; - Intbyte fontname[LF_FACESIZE], weight[LF_FACESIZE], *style, points[8]; - Intbyte effects[LF_FACESIZE], charset[LF_FACESIZE]; - Intbyte *c; - HFONT hfont; + Ibyte *style; + Ibyte *c; /* * mswindows fonts look like: @@ -1348,7 +1458,16 @@ * Courier New:Bold Italic:10:underline strikeout:western */ - fields = sscanf ((CIntbyte *) namestr, "%31[^:]:%31[^:]:%7[^:]:%31[^:]:%31s", + fontname[0] = 0; + weight[0] = 0; + points[0] = 0; + effects[0] = 0; + charset[0] = 0; + + if (logfont) + xzero (*logfont); + + fields = sscanf ((CIbyte *) namestr, "%31[^:]:%31[^:]:%7[^:]:%31[^:]:%31s", fontname, weight, points, effects, charset); /* This function is implemented in a fairly ad-hoc manner. @@ -1361,7 +1480,7 @@ { maybe_signal_error (Qinvalid_argument, "Invalid font", name_for_errors, Qfont, errb); - return NULL; + return 0; } if (fields > 0 && qxestrlen (fontname)) @@ -1369,14 +1488,12 @@ Extbyte *extfontname; C_STRING_TO_TSTR (fontname, extfontname); - xetcsncpy ((Extbyte *) logfont.lfFaceName, extfontname, LF_FACESIZE - 1); - logfont.lfFaceName[LF_FACESIZE - 1] = 0; - } - else - { - maybe_signal_error (Qinvalid_argument, "Must specify a font name", - name_for_errors, Qfont, errb); - return NULL; + if (logfont) + { + xetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname, + LF_FACESIZE - 1); + logfont->lfFaceName[LF_FACESIZE - 1] = 0; + } } /* weight */ @@ -1385,31 +1502,33 @@ /* Maybe split weight into weight and style */ if ((c = qxestrchr (weight, ' '))) - { - *c = '\0'; - style = c + 1; - } + { + *c = '\0'; + style = c + 1; + } else style = NULL; for (i = 0; i < countof (fontweight_map); i++) if (!qxestrcasecmp_c (weight, fontweight_map[i].name)) { - logfont.lfWeight = fontweight_map[i].value; + if (logfont) + logfont->lfWeight = fontweight_map[i].value; break; } if (i == countof (fontweight_map)) /* No matching weight */ { if (!style) { - logfont.lfWeight = FW_REGULAR; + if (logfont) + logfont->lfWeight = FW_REGULAR; style = weight; /* May have specified style without weight */ } else { maybe_signal_error (Qinvalid_constant, "Invalid font weight", name_for_errors, Qfont, errb); - return NULL; + return 0; } } @@ -1417,41 +1536,59 @@ { /* #### what about oblique? */ if (qxestrcasecmp_c (style, "italic") == 0) - logfont.lfItalic = TRUE; + { + if (logfont) + logfont->lfItalic = TRUE; + } else { maybe_signal_error (Qinvalid_constant, "Invalid font weight or style", name_for_errors, Qfont, errb); - return NULL; + return 0; } /* Glue weight and style together again */ if (weight != style) *c = ' '; } - else - logfont.lfItalic = FALSE; + else if (logfont) + logfont->lfItalic = FALSE; - if (fields < 3) - pt = 10; /* #### Should we reject strings that don't specify a size? */ - else if ((pt = qxeatoi (points)) == 0) + if (fields < 3 || !qxestrcmp_c (points, "")) + ; + else if (points[0] == '0' || + qxestrspn (points, "0123456789") < qxestrlen (points)) { maybe_signal_error (Qinvalid_argument, "Invalid font pointsize", name_for_errors, Qfont, errb); - return NULL; + return 0; } + else + { + pt = qxeatoi (points); - /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform SDK */ - logfont.lfHeight = -MulDiv (pt, GetDeviceCaps (hdc, LOGPIXELSY), 72); - logfont.lfWidth = 0; + if (logfont) + { + /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform + SDK */ + logfont->lfHeight = -MulDiv (pt, GetDeviceCaps (hdc, LOGPIXELSY), + 72); + logfont->lfWidth = 0; + } + } /* Effects */ - logfont.lfUnderline = FALSE; - logfont.lfStrikeOut = FALSE; + if (logfont) + { + logfont->lfUnderline = FALSE; + logfont->lfStrikeOut = FALSE; + } + if (fields >= 4 && effects[0] != '\0') { - Intbyte *effects2; + Ibyte *effects2; + int underline = FALSE, strikeout = FALSE; /* Maybe split effects into effects and effects2 */ if ((c = qxestrchr (effects, ' '))) @@ -1463,43 +1600,47 @@ effects2 = NULL; if (qxestrcasecmp_c (effects, "underline") == 0) - logfont.lfUnderline = TRUE; + underline = TRUE; else if (qxestrcasecmp_c (effects, "strikeout") == 0) - logfont.lfStrikeOut = TRUE; + strikeout = TRUE; else { maybe_signal_error (Qinvalid_constant, "Invalid font effect", name_for_errors, Qfont, errb); - return NULL; + return 0; } if (effects2 && effects2[0] != '\0') { if (qxestrcasecmp_c (effects2, "underline") == 0) - logfont.lfUnderline = TRUE; + underline = TRUE; else if (qxestrcasecmp_c (effects2, "strikeout") == 0) - logfont.lfStrikeOut = TRUE; + strikeout = TRUE; else { maybe_signal_error (Qinvalid_constant, "Invalid font effect", name_for_errors, Qfont, errb); - return NULL; + return 0; } } - /* Regenerate sanitised effects string */ - if (logfont.lfUnderline) + /* Regenerate sanitized effects string */ + if (underline) { - if (logfont.lfStrikeOut) + if (strikeout) qxestrcpy_c (effects, "underline strikeout"); else qxestrcpy_c (effects, "underline"); } - else if (logfont.lfStrikeOut) + else if (strikeout) qxestrcpy_c (effects, "strikeout"); + + if (logfont) + { + logfont->lfUnderline = underline; + logfont->lfStrikeOut = strikeout; + } } - else - effects[0] = '\0'; /* Charset */ /* charset can be specified even if earlier fields haven't been */ @@ -1511,76 +1652,173 @@ qxestrncpy (charset, c + 1, LF_FACESIZE); charset[LF_FACESIZE - 1] = '\0'; } - else - qxestrcpy_c (charset, charset_map[0].name); } - for (i = 0; i < countof (charset_map); i++) - if (!qxestrcasecmp_c (charset, charset_map[i].name)) - { - logfont.lfCharSet = charset_map[i].value; - break; - } - - if (i == countof (charset_map)) /* No matching charset */ + /* NOTE: If you give a blank charset spec, we will normally not get here + under Mule unless we explicitly call `make-font-instance'! This is + because the C code instantiates fonts using particular charsets, by + way of specifier_matching_instance(). Before instantiating the font, + font_instantiate() calls the devmeth find_matching_font(), which gets + a truename font spec with the registry (i.e. the charset spec) filled + in appropriately to the charset. */ + if (!qxestrcmp_c (charset, "")) + ; + else { - maybe_signal_error (Qinvalid_argument, "Invalid charset", - name_for_errors, Qfont, errb); - return NULL; + for (i = 0; i < countof (charset_map); i++) + if (!qxestrcasecmp_c (charset, charset_map[i].name)) + { + if (logfont) + logfont->lfCharSet = charset_map[i].value; + break; + } + + if (i == countof (charset_map)) /* No matching charset */ + { + maybe_signal_error (Qinvalid_argument, "Invalid charset", + name_for_errors, Qfont, errb); + return 0; + } } - /* Misc crud */ - logfont.lfEscapement = logfont.lfOrientation = 0; + if (logfont) + { + /* Misc crud */ #if 1 - logfont.lfOutPrecision = OUT_DEFAULT_PRECIS; - logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; - logfont.lfQuality = DEFAULT_QUALITY; + logfont->lfOutPrecision = OUT_DEFAULT_PRECIS; + logfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; + logfont->lfQuality = DEFAULT_QUALITY; #else - logfont.lfOutPrecision = OUT_STROKE_PRECIS; - logfont.lfClipPrecision = CLIP_STROKE_PRECIS; - logfont.lfQuality = PROOF_QUALITY; + logfont->lfOutPrecision = OUT_STROKE_PRECIS; + logfont->lfClipPrecision = CLIP_STROKE_PRECIS; + logfont->lfQuality = PROOF_QUALITY; #endif - /* Default to monospaced if the specified fontname doesn't exist. */ - logfont.lfPitchAndFamily = FF_MODERN; + /* Default to monospaced if the specified fontname doesn't exist. */ + logfont->lfPitchAndFamily = FF_MODERN; + } + + return 1; +} + +/* + mswindows fonts look like: + [fontname[:style[:pointsize[:effects]]]][:charset] + A maximal mswindows font spec looks like: + Courier New:Bold Italic:10:underline strikeout:Western + + A missing weight/style field is the same as Regular, and a missing + effects field is left alone, and means no effects; but a missing + fontname, pointsize or charset field means any will do. We prefer + Courier New, 10, Western. See sort function above. */ + +static HFONT +create_hfont_from_font_spec (const Ibyte *namestr, + HDC hdc, + Lisp_Object name_for_errors, + Lisp_Object device_font_list, + Error_Behavior errb, + Lisp_Object *truename_ret) +{ + LOGFONTW logfont; + HFONT hfont; + Ibyte fontname[LF_FACESIZE], weight[LF_FACESIZE], points[8]; + Ibyte effects[LF_FACESIZE], charset[LF_FACESIZE]; + Ibyte truename[MSW_FONTSIZE]; + Ibyte truername[MSW_FONTSIZE]; + + /* Windows will silently substitute a default font if the fontname + specifies a non-existent font. This is bad for screen fonts because + it doesn't allow higher-level code to see the error and to act + appropriately. For instance complex_vars_of_faces() sets up a + fallback list of fonts for the default face. Instead, we look at all + the possibilities and pick one that works, handling missing pointsize + and charset fields appropriately. + + For printer fonts, we used to go ahead and let Windows choose the + font, and for those devices, then, DEVICE_FONT_LIST would be nil. + However, this causes problems with the font-matching code below, which + needs a list of fonts so it can pick the right one for Mule. - /* Windows will silently substitute a default font if the fontname specifies - a non-existent font. This is bad for screen fonts because it doesn't - allow higher-level code to see the error and to act appropriately. - For instance complex_vars_of_faces() sets up a fallback list of fonts - for the default face. */ + Thus, the code below to handle a nil DEVICE_FONT_LIST is not currently + used. */ if (!NILP (device_font_list)) { - Lisp_Object fonttail; - Intbyte truename[MSW_FONTSIZE]; + Lisp_Object fonttail = Qnil; - qxesprintf (truename, "%s:%s:%d:%s:%s", fontname, weight, pt, effects, - charset); - LIST_LOOP (fonttail, device_font_list) + if (!parse_font_spec (namestr, 0, name_for_errors, + errb, 0, fontname, weight, points, + effects, charset)) + return 0; + + /* The fonts in the device font list always specify fontname and + charset, but often times not the size; so if we don't have the + size specified either, do a round with size 10 so we'll always end + up with a size in the truename (if we fail this one but succeed + the next one, we'll have chosen a non-TrueType font, and in those + cases the size is specified in the font list item. */ + + if (!points[0]) { - if (match_font (XSTRING_DATA (XCAR (fonttail)), truename, - NULL)) - break; + qxesprintf (truename, "%s:%s:10:%s:%s", + fontname, weight, effects, charset); + + LIST_LOOP (fonttail, device_font_list) + { + if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))), + truename, truername)) + break; + } } + + if (NILP (fonttail)) + { + qxesprintf (truename, "%s:%s:%s:%s:%s", + fontname, weight, points, effects, charset); + + LIST_LOOP (fonttail, device_font_list) + { + if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))), + truename, truername)) + break; + } + } + if (NILP (fonttail)) { maybe_signal_error (Qinvalid_argument, "No matching font", name_for_errors, Qfont, errb); - return NULL; + return 0; } - } + + if (!parse_font_spec (truername, hdc, name_for_errors, + ERROR_ME_DEBUG_WARN, &logfont, fontname, weight, + points, effects, charset)) + signal_error (Qinternal_error, "Bad value in device font list?", + build_intstring (truername)); + } + else if (!parse_font_spec (namestr, hdc, name_for_errors, + errb, &logfont, fontname, weight, points, + effects, charset)) + return 0; if ((hfont = qxeCreateFontIndirect (&logfont)) == NULL) { maybe_signal_error (Qgui_error, "Couldn't create font", name_for_errors, Qfont, errb); - return NULL; + return 0; } + /* #### Truename will not have all its fields filled in when we have no + list of fonts. Doesn't really matter now, since we always have one. + See above. */ + qxesprintf (truename, "%s:%s:%s:%s:%s", fontname, weight, + points, effects, charset); + + *truename_ret = build_intstring (truename); return hfont; } - /* * This is a work horse for both mswindows_initialize_font_instance and * msprinter_initialize_font_instance. @@ -1592,12 +1830,14 @@ { HFONT hfont, hfont2; TEXTMETRICW metrics; - Intbyte *namestr = XSTRING_DATA (name); + Ibyte *namestr = XSTRING_DATA (name); + Lisp_Object truename; hfont = create_hfont_from_font_spec (namestr, hdc, name, device_font_list, - errb); + errb, &truename); + f->truename = truename; f->data = xnew_and_zero (struct mswindows_font_instance_data); - FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f,0,0) = hfont; + FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0) = hfont; /* Some underlined fonts have the descent of one pixel more than their non-underlined counterparts. Font variants though are assumed to have @@ -1698,9 +1938,10 @@ LIST_LOOP (fonttail, font_list) { - Intbyte fontname[MSW_FONTSIZE]; + Ibyte fontname[MSW_FONTSIZE]; - if (match_font (XSTRING_DATA (XCAR (fonttail)), XSTRING_DATA (pattern), + if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))), + XSTRING_DATA (pattern), fontname)) result = Fcons (build_intstring (fontname), result); } @@ -1708,118 +1949,91 @@ return Fnreverse (result); } -/* Fill in missing parts of a font spec. This is primarily intended as a - * helper function for the functions below. - * mswindows fonts look like: - * fontname[:[weight][ style][:pointsize[:effects]]][:charset] - * A minimal mswindows font spec looks like: - * Courier New - * A maximal mswindows font spec looks like: - * Courier New:Bold Italic:10:underline strikeout:Western - * Missing parts of the font spec should be filled in with these values: - * Courier New:Regular:10::Western */ static Lisp_Object mswindows_font_instance_truename (Lisp_Font_Instance *f, Error_Behavior errb) { - /* #### does not handle charset at end!!! charset can be given even - when previous fields are not. - - #### does not canonicalize given fields! needs to be merged - with initialize_font_instance(). */ - - int nsep = 0; - Intbyte *ptr = (Intbyte *) XSTRING_DATA (f->name); - Intbyte *name = (Intbyte *) alloca (XSTRING_LENGTH (f->name) + 19); - - qxestrcpy (name, ptr); - - while ((ptr = qxestrchr (ptr, ':')) != 0) - { - ptr++; - nsep++; - } - - switch (nsep) - { - case 0: - qxestrcat_c (name, ":Regular:10::Western"); - break; - case 1: - qxestrcat_c (name, ":10::Western"); - break; - case 2: - qxestrcat_c (name, "::Western"); - break; - case 3: - qxestrcat_c (name, ":Western"); - break; - default:; - } - - return build_intstring (name); + return f->truename; } #ifdef MULE static int -mswindows_font_spec_matches_charset_stage_1 (const Intbyte *font_charset, - Lisp_Object charset) +mswindows_font_spec_matches_charset_stage_1 (struct device *d, + Lisp_Object charset, + const Ibyte *nonreloc, + Lisp_Object reloc, + Bytecount offset, + Bytecount length) { - int i, ms_charset = 0; - CHARSETINFO info; - int font_code_page; - Lisp_Object charset_code_page; + int i; + Lisp_Object charset_registry; + const Ibyte *font_charset; + const Ibyte *the_nonreloc = nonreloc; + const Ibyte *c; + Bytecount the_length = length; - /* Get code page from the font spec */ - - for (i = 0; i < countof (charset_map); i++) - if (qxestrcasecmp_c (font_charset, charset_map[i].name) == 0) - { - ms_charset = charset_map[i].value; - break; - } - if (i == countof (charset_map)) - return 0; + if (UNBOUNDP (charset)) + return 1; - /* For border-glyph use */ - if (ms_charset == SYMBOL_CHARSET) - ms_charset = ANSI_CHARSET; + if (!the_nonreloc) + the_nonreloc = XSTRING_DATA (reloc); + fixup_internal_substring (nonreloc, reloc, offset, &the_length); + the_nonreloc += offset; - if (!TranslateCharsetInfo ((DWORD *) ms_charset, &info, TCI_SRCCHARSET)) + c = the_nonreloc; + for (i = 0; i < 4; i++) + { + Ibyte *newc = (Ibyte *) memchr (c, ':', the_length); + if (!newc) + break; + newc++; + the_length -= (newc - c); + c = newc; + } + + if (i < 4) return 0; - font_code_page = info.ciACP; + font_charset = c; + + /* For border-glyph use */ + if (!qxestrcasecmp_c (font_charset, "symbol")) + font_charset = (const Ibyte *) "western"; /* Get code page for the charset */ - charset_code_page = Fmswindows_charset_code_page (charset); - if (!INTP (charset_code_page)) + charset_registry = Fmswindows_charset_registry (charset); + if (!STRINGP (charset_registry)) return 0; - return font_code_page == XINT (charset_code_page); + return !qxestrcasecmp (XSTRING_DATA (charset_registry), font_charset); } -static int -mswindows_font_spec_matches_charset (struct device *d, Lisp_Object charset, - const Intbyte *nonreloc, - Lisp_Object reloc, - Bytecount offset, Bytecount length) -{ - const Intbyte *the_nonreloc = nonreloc; - int i; - const Intbyte *c; - Bytecount the_length = length; +/* -/* The idea is that, when trying to find a suitable font for a character, - we first see if the character comes from one of the known charsets - listed above; if so, we try to find a font which is declared as being of - that charset (that's the last element of the font spec). If so, this - means that the font is specifically designed for the charset, and we - prefer it. However, there are only a limited number of defined - charsets, and new ones aren't being defined; so if we fail the first - stage, we search through each font looking at the Unicode subranges it - supports, to see if the character comes from that subrange. +1. handle standard mapping and inheritance vectors properly in Face-frob-property. +2. finish impl of mswindows-charset-registry. +3. see if everything works under fixup, now that i copied the stuff over. +4. consider generalizing Face-frob-property to frob-specifier. +5. maybe extract some of the flets out of Face-frob-property as useful specifier frobbing. +6. eventually this stuff's got to be checked in!!!! */ +static int +mswindows_font_spec_matches_charset_stage_2 (struct device *d, + Lisp_Object charset, + const Ibyte *nonreloc, + Lisp_Object reloc, + Bytecount offset, + Bytecount length) +{ + const Ibyte *the_nonreloc = nonreloc; + FONTSIGNATURE fs; + FONTSIGNATURE *fsp = &fs; + struct gcpro gcpro1; + Lisp_Object fontsig; + Bytecount the_length = length; + int i; + if (UNBOUNDP (charset)) return 1; @@ -1828,137 +2042,169 @@ fixup_internal_substring (nonreloc, reloc, offset, &the_length); the_nonreloc += offset; - c = the_nonreloc; - for (i = 0; i < 4; i++) + /* Get the list of Unicode subranges corresponding to the font. This + is contained inside of FONTSIGNATURE data, obtained by calling + GetTextCharsetInfo on a font object, which we need to create from the + spec. See if the FONTSIGNATURE data is already cached. If not, get + it and cache it. */ + if (!STRINGP (reloc) || the_nonreloc != XSTRING_DATA (reloc)) + reloc = build_intstring (the_nonreloc); + GCPRO1 (reloc); + fontsig = Fgethash (reloc, Vfont_signature_data, Qunbound); + + if (!UNBOUNDP (fontsig)) { - Intbyte *newc = (Intbyte *) memchr (c, ':', the_length); - if (!newc) - break; - newc++; - the_length -= (newc - c); - c = newc; + fsp = (FONTSIGNATURE *) XOPAQUE_DATA (fontsig); + UNGCPRO; } + else + { + HDC hdc = CreateCompatibleDC (NULL); + Lisp_Object font_list = DEVICE_MSWINDOWS_FONTLIST (d); + Lisp_Object truename; + HFONT hfont = create_hfont_from_font_spec (the_nonreloc, hdc, Qnil, + font_list, + ERROR_ME_DEBUG_WARN, + &truename); - if (i >= 4 && mswindows_font_spec_matches_charset_stage_1 (c, charset)) - return 1; + if (!hfont || !(hfont = (HFONT) SelectObject (hdc, hfont))) + { + nope: + DeleteDC (hdc); + UNGCPRO; + return 0; + } + + if (GetTextCharsetInfo (hdc, &fs, 0) == DEFAULT_CHARSET) + { + SelectObject (hdc, hfont); + goto nope; + } + SelectObject (hdc, hfont); + DeleteDC (hdc); + Fputhash (reloc, make_opaque (&fs, sizeof (fs)), Vfont_signature_data); + UNGCPRO; + } - /* Stage 2. */ { - FONTSIGNATURE fs; - FONTSIGNATURE *fsp = &fs; - struct gcpro gcpro1; - Lisp_Object fontsig; - - /* Get the list of Unicode subranges corresponding to the font. This - is contained inside of FONTSIGNATURE data, obtained by calling - GetTextCharsetInfo on a font object, which we need to create from the - spec. See if the FONTSIGNATURE data is already cached. If not, get - it and cache it. */ - if (!STRINGP (reloc) || the_nonreloc != XSTRING_DATA (reloc)) - reloc = build_intstring (the_nonreloc); - GCPRO1 (reloc); - fontsig = Fgethash (reloc, Vfont_signature_data, Qunbound); + int lowlim, highlim; + int dim, j, cp = -1; - if (!UNBOUNDP (fontsig)) + /* Try to find a Unicode char in the charset. #### This is somewhat + bogus. See below. + + #### Cache me baby!!!!!!!!!!!!! + */ + get_charset_limits (charset, &lowlim, &highlim); + dim = XCHARSET_DIMENSION (charset); + + if (dim == 1) { - fsp = (FONTSIGNATURE *) XOPAQUE_DATA (fontsig); - UNGCPRO; + for (i = lowlim; i <= highlim; i++) + if ((cp = ichar_to_unicode (make_ichar (charset, i, 0))) >= 0) + break; } else { - HDC hdc = CreateCompatibleDC (NULL); - Lisp_Object font_list = DEVICE_MSWINDOWS_FONTLIST (d); - HFONT hfont = create_hfont_from_font_spec (the_nonreloc, hdc, Qnil, - font_list, - ERROR_ME_DEBUG_WARN); + for (i = lowlim; i <= highlim; i++) + for (j = lowlim; j <= highlim; j++) + if ((cp = ichar_to_unicode (make_ichar (charset, i, j))) >= 0) + break; + } + + if (cp < 0) + return 0; - if (!hfont || !(hfont = (HFONT) SelectObject (hdc, hfont))) - { - nope: - DeleteDC (hdc); - UNGCPRO; - return 0; - } - - if (GetTextCharsetInfo (hdc, &fs, 0) == DEFAULT_CHARSET) + /* Check to see, for each subrange supported by the font, + whether the Unicode char is within that subrange. If any match, + the font supports the char (whereby, the charset, bogusly). */ + + for (i = 0; i < 128; i++) + { + if (fsp->fsUsb[i >> 5] & (1 << (i & 32))) { - SelectObject (hdc, hfont); - goto nope; + for (j = 0; j < unicode_subrange_table[i].no_subranges; j++) + if (cp >= unicode_subrange_table[i].subranges[j].start && + cp <= unicode_subrange_table[i].subranges[j].end) + return 1; } - SelectObject (hdc, hfont); - DeleteDC (hdc); - Fputhash (reloc, make_opaque (&fs, sizeof (fs)), Vfont_signature_data); - UNGCPRO; } - { - int lowlim, highlim; - int dim, j, cp = -1; + return 0; + } +} - /* Try to find a Unicode char in the charset. #### This is somewhat - bogus. We should really be doing these checks on the char level, - not the charset level. There's no guarantee that a charset covers - a single Unicode range. Furthermore, this is extremely wasteful. - We should be doing this when we're about to redisplay and already - have the Unicode codepoints in hand. - - #### Cache me baby!!!!!!!!!!!!! - */ - get_charset_limits (charset, &lowlim, &highlim); - dim = XCHARSET_DIMENSION (charset); +/* + Given a truename font spec, does it match CHARSET? - if (dim == 1) - { - for (i = lowlim; i <= highlim; i++) - if ((cp = char_to_unicode (MAKE_CHAR (charset, i, 0))) >= 0) - break; - } - else - { - for (i = lowlim; i <= highlim; i++) - for (j = lowlim; j <= highlim; j++) - if ((cp = char_to_unicode (MAKE_CHAR (charset, i, j))) >= 0) - break; - } - - if (cp < 0) - return 0; + We try two stages: - /* Check to see, for each subrange supported by the font, - whether the Unicode char is within that subrange. If any match, - the font supports the char (whereby, the charset, bogusly). */ - - for (i = 0; i < 128; i++) - { - if (fsp->fsUsb[i >> 5] & (1 << (i & 32))) - { - for (j = 0; j < unicode_subrange_table[i].no_subranges; j++) - if (cp >= unicode_subrange_table[i].subranges[j].start && - cp <= unicode_subrange_table[i].subranges[j].end) - return 1; - } - } + -- First see if the charset corresponds to one of the predefined Windows + charsets; if so, we see if the registry (that's the last element of the + font spec) is that same charset. If so, this means that the font is + specifically designed for the charset, and we prefer it. + + -- However, there are only a limited number of defined Windows charsets, + and new ones aren't being defined; so if we fail the first stage, we find + a character from the charset with a Unicode equivalent, and see if the + font can display this character. we do that by retrieving the Unicode + ranges that the font supports, to see if the character comes from that + subrange. + + #### Note: We really want to be doing all these checks at the character + level, not the charset level. There's no guarantee that a charset covers + a single Unicode range. Furthermore, this is extremely wasteful. We + should be doing this when we're about to redisplay and already have the + Unicode codepoints in hand. +*/ - return 0; - } - } +static int +mswindows_font_spec_matches_charset (struct device *d, Lisp_Object charset, + const Ibyte *nonreloc, + Lisp_Object reloc, + Bytecount offset, Bytecount length, + int stage) +{ + return stage ? + mswindows_font_spec_matches_charset_stage_2 (d, charset, nonreloc, + reloc, offset, length) + : mswindows_font_spec_matches_charset_stage_1 (d, charset, nonreloc, + reloc, offset, length); } -/* find a font spec that matches font spec FONT and also matches + +/* Find a font spec that matches font spec FONT and also matches (the registry of) CHARSET. */ + static Lisp_Object mswindows_find_charset_font (Lisp_Object device, Lisp_Object font, - Lisp_Object charset) + Lisp_Object charset, int stage) { Lisp_Object fontlist, fonttail; + /* If FONT specifies a particular charset, this will only list fonts with + that charset; otherwise, it will list fonts with all charsets. */ fontlist = mswindows_list_fonts (font, device); - LIST_LOOP (fonttail, fontlist) + + if (!stage) + { + LIST_LOOP (fonttail, fontlist) + { + if (mswindows_font_spec_matches_charset_stage_1 + (XDEVICE (device), charset, 0, XCAR (fonttail), 0, -1)) + return XCAR (fonttail); + } + } + else { - if (mswindows_font_spec_matches_charset - (XDEVICE (device), charset, 0, XCAR (fonttail), 0, -1)) - return XCAR (fonttail); + LIST_LOOP (fonttail, fontlist) + { + if (mswindows_font_spec_matches_charset_stage_2 + (XDEVICE (device), charset, 0, XCAR (fonttail), 0, -1)) + return XCAR (fonttail); + } } + return Qnil; } diff --text -u 'xemacs-21.5.6/src/objects-msw.h' 'xemacs-21.5.7/src/objects-msw.h' Index: ././src/objects-msw.h --- ././src/objects-msw.h Wed Mar 13 17:52:55 2002 +++ ././src/objects-msw.h Fri Jun 21 06:18:39 2002 @@ -1,7 +1,7 @@ /* mswindows-specific Lisp objects. Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. Copyright (C) 1997, Jonathan Harris. This file is part of XEmacs. @@ -36,43 +36,7 @@ #include "objects.h" -struct mswindows_color_instance_data -{ - COLORREF color; -}; - -#define MSWINDOWS_COLOR_INSTANCE_DATA(c) \ - ((struct mswindows_color_instance_data *) (c)->data) -#define COLOR_INSTANCE_MSWINDOWS_COLOR(c) \ - (MSWINDOWS_COLOR_INSTANCE_DATA (c)->color) - -/* The four HFONTS are for the 4 (underlined, strikethrough) - combinations. Only the one at index 0, neither underlined nor - struk through is created with the font instance. Other fonts are - created as necessary during redisplay, using the one at index 0 - as prototype */ -#define MSWINDOWS_NUM_FONT_VARIANTS 4 -struct mswindows_font_instance_data -{ - HFONT hfont [MSWINDOWS_NUM_FONT_VARIANTS]; -}; - -#define MSWINDOWS_FONT_INSTANCE_DATA(c) \ - ((struct mswindows_font_instance_data *) (c)->data) - -#define FONT_INSTANCE_MSWINDOWS_HFONT_I(c,i) \ - (MSWINDOWS_FONT_INSTANCE_DATA(c)->hfont[(i)]) - -#define FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT(c,under,strike) \ - FONT_INSTANCE_MSWINDOWS_HFONT_I (c, (!!(strike)<<1)|!!(under)) - -/* If font creation during redisplay fails, then the following - value is used to prevent future attempts to create this font. - Redisplay uses the "main" font when encounters this value */ -#define MSWINDOWS_BAD_HFONT ((HFONT)INVALID_HANDLE_VALUE) - HFONT mswindows_get_hfont (Lisp_Font_Instance *f, int under, int strike); - Lisp_Object mswindows_color_to_string (COLORREF color); #endif /* INCLUDED_objects_msw_h_ */ diff --text -u /dev/null 'xemacs-21.5.7/src/objects-tty-impl.h' Index: ././src/objects-tty-impl.h --- ././src/objects-tty-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/objects-tty-impl.h Fri Jun 21 06:18:39 2002 @@ -0,0 +1,50 @@ +/* TTY-specific Lisp objects. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995 Ben Wing + +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 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. */ + +/* Synched up with: Not in FSF. */ + +#ifndef INCLUDED_objects_tty_impl_h_ +#define INCLUDED_objects_tty_impl_h_ + +#include "objects-impl.h" +#include "objects-tty.h" + +struct tty_color_instance_data +{ + Lisp_Object symbol; /* so we don't have to constantly call Fintern() */ +}; + +#define TTY_COLOR_INSTANCE_DATA(c) \ + ((struct tty_color_instance_data *) (c)->data) + +#define COLOR_INSTANCE_TTY_SYMBOL(c) (TTY_COLOR_INSTANCE_DATA (c)->symbol) + +struct tty_font_instance_data +{ + Lisp_Object charset; +}; + +#define TTY_FONT_INSTANCE_DATA(c) \ + ((struct tty_font_instance_data *) (c)->data) + +#define FONT_INSTANCE_TTY_CHARSET(c) (TTY_FONT_INSTANCE_DATA (c)->charset) + +#endif /* INCLUDED_objects_tty_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/objects-tty.c' 'xemacs-21.5.7/src/objects-tty.c' Index: ././src/objects-tty.c --- ././src/objects-tty.c Fri Mar 29 13:48:15 2002 +++ ././src/objects-tty.c Fri Jun 21 06:18:39 2002 @@ -24,9 +24,9 @@ #include #include "lisp.h" -#include "console-tty.h" +#include "console-tty-impl.h" #include "insdel.h" -#include "objects-tty.h" +#include "objects-tty-impl.h" #include "device.h" #include "charset.h" @@ -215,7 +215,7 @@ tty_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name, Lisp_Object device, Error_Behavior errb) { - Intbyte *str = XSTRING_DATA (name); + Ibyte *str = XSTRING_DATA (name); Lisp_Object charset = Qnil; if (qxestrncmp_c (str, "normal", 6)) @@ -282,10 +282,14 @@ static int tty_font_spec_matches_charset (struct device *d, Lisp_Object charset, - const Intbyte *nonreloc, Lisp_Object reloc, - Bytecount offset, Bytecount length) + const Ibyte *nonreloc, Lisp_Object reloc, + Bytecount offset, Bytecount length, + int stage) { - const Intbyte *the_nonreloc = nonreloc; + const Ibyte *the_nonreloc = nonreloc; + + if (stage) + return 0; if (!the_nonreloc) the_nonreloc = XSTRING_DATA (reloc); @@ -294,7 +298,7 @@ if (UNBOUNDP (charset)) return !memchr (the_nonreloc, '/', length); - the_nonreloc = (const Intbyte *) memchr (the_nonreloc, '/', length); + the_nonreloc = (const Ibyte *) memchr (the_nonreloc, '/', length); if (!the_nonreloc) return 0; the_nonreloc++; @@ -308,14 +312,17 @@ (the registry of) CHARSET. */ static Lisp_Object tty_find_charset_font (Lisp_Object device, Lisp_Object font, - Lisp_Object charset) + Lisp_Object charset, int stage) { - Intbyte *fontname = XSTRING_DATA (font); + Ibyte *fontname = XSTRING_DATA (font); + + if (stage) + return Qnil; if (strchr ((const char *) fontname, '/')) { if (tty_font_spec_matches_charset (XDEVICE (device), charset, 0, - font, 0, -1)) + font, 0, -1, 0)) return font; return Qnil; } diff --text -u 'xemacs-21.5.6/src/objects-tty.h' 'xemacs-21.5.7/src/objects-tty.h' Index: ././src/objects-tty.h --- ././src/objects-tty.h Fri Apr 13 03:24:09 2001 +++ ././src/objects-tty.h Fri Jun 21 06:18:40 2002 @@ -26,26 +26,6 @@ #include "objects.h" -struct tty_color_instance_data -{ - Lisp_Object symbol; /* so we don't have to constantly call Fintern() */ -}; - -#define TTY_COLOR_INSTANCE_DATA(c) \ - ((struct tty_color_instance_data *) (c)->data) - -#define COLOR_INSTANCE_TTY_SYMBOL(c) (TTY_COLOR_INSTANCE_DATA (c)->symbol) - -struct tty_font_instance_data -{ - Lisp_Object charset; -}; - -#define TTY_FONT_INSTANCE_DATA(c) \ - ((struct tty_font_instance_data *) (c)->data) - -#define FONT_INSTANCE_TTY_CHARSET(c) (TTY_FONT_INSTANCE_DATA (c)->charset) - extern Lisp_Object Vtty_color_alist, Vtty_dynamic_color_bg; extern Lisp_Object Vtty_dynamic_color_fg; diff --text -u /dev/null 'xemacs-21.5.7/src/objects-x-impl.h' Index: ././src/objects-x-impl.h --- ././src/objects-x-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/objects-x-impl.h Fri Jun 21 06:18:40 2002 @@ -0,0 +1,64 @@ +/* X-specific Lisp objects. + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995, 1996, 2002 Ben Wing. + +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 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. */ + +/* Synched up with: Not in FSF. */ + +/* This file Mule-ized (more like Mule-verified) by Ben Wing, 7-10-00. */ + +#ifndef INCLUDED_objects_x_impl_h_ +#define INCLUDED_objects_x_impl_h_ + +#include "objects-impl.h" +#include "objects-x.h" + +#ifdef HAVE_X_WINDOWS + +/***************************************************************************** + Color-Instance + ****************************************************************************/ + +struct x_color_instance_data +{ + XColor color; + char dealloc_on_gc; +}; + +#define X_COLOR_INSTANCE_DATA(c) ((struct x_color_instance_data *) (c)->data) +#define COLOR_INSTANCE_X_COLOR(c) (X_COLOR_INSTANCE_DATA (c)->color) +#define COLOR_INSTANCE_X_DEALLOC(c) (X_COLOR_INSTANCE_DATA (c)->dealloc_on_gc) + +/***************************************************************************** + Font-Instance + ****************************************************************************/ + +struct x_font_instance_data +{ + /* X-specific information */ + XFontStruct *font; +}; + +#define X_FONT_INSTANCE_DATA(f) ((struct x_font_instance_data *) (f)->data) +#define FONT_INSTANCE_X_FONT(f) (X_FONT_INSTANCE_DATA (f)->font) + +#endif /* HAVE_X_WINDOWS */ + +#endif /* INCLUDED_objects_x_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/objects-x.c' 'xemacs-21.5.7/src/objects-x.c' Index: ././src/objects-x.c --- ././src/objects-x.c Sun Mar 31 17:28:51 2002 +++ ././src/objects-x.c Fri Jun 21 06:18:40 2002 @@ -31,13 +31,13 @@ #include #include "lisp.h" -#include "console-x.h" -#include "objects-x.h" - #include "charset.h" -#include "device.h" +#include "device-impl.h" #include "insdel.h" +#include "console-x-impl.h" +#include "objects-x-impl.h" + int x_handle_non_fully_specified_fonts; @@ -390,7 +390,6 @@ /* Don't allocate the data until we're sure that we will succeed, or the finalize method may get fucked. */ f->data = xnew (struct x_font_instance_data); - FONT_INSTANCE_X_TRUENAME (f) = Qnil; FONT_INSTANCE_X_FONT (f) = xf; f->ascent = xf->ascent; f->descent = xf->descent; @@ -455,12 +454,6 @@ } static void -x_mark_font_instance (Lisp_Font_Instance *f) -{ - mark_object (FONT_INSTANCE_X_TRUENAME (f)); -} - -static void x_print_font_instance (Lisp_Font_Instance *f, Lisp_Object printcharfun, int escapeflag) @@ -775,17 +768,17 @@ { struct device *d = XDEVICE (f->device); - if (NILP (FONT_INSTANCE_X_TRUENAME (f))) + if (NILP (FONT_INSTANCE_TRUENAME (f))) { Display *dpy = DEVICE_X_DISPLAY (d); { Extbyte *nameext; LISP_STRING_TO_EXTERNAL (f->name, nameext, Qx_font_name_encoding); - FONT_INSTANCE_X_TRUENAME (f) = + FONT_INSTANCE_TRUENAME (f) = x_font_truename (dpy, nameext, FONT_INSTANCE_X_FONT (f)); } - if (NILP (FONT_INSTANCE_X_TRUENAME (f))) + if (NILP (FONT_INSTANCE_TRUENAME (f))) { Lisp_Object font_instance = wrap_font_instance (f); @@ -797,7 +790,7 @@ return f->name; } } - return FONT_INSTANCE_X_TRUENAME (f); + return FONT_INSTANCE_TRUENAME (f); } static Lisp_Object @@ -813,7 +806,7 @@ { Lisp_Object name, value; Atom atom = props [i].name; - Intbyte *name_str = 0; + Ibyte *name_str = 0; Bytecount name_len; Extbyte *namestrext = XGetAtomName (dpy, atom); @@ -834,17 +827,17 @@ atom == DEVICE_XATOM_SPACING (d) || atom == DEVICE_XATOM_CHARSET_REGISTRY (d) || atom == DEVICE_XATOM_CHARSET_ENCODING (d) || - !intbyte_strcmp (name_str, "CHARSET_COLLECTIONS") || - !intbyte_strcmp (name_str, "FONTNAME_REGISTRY") || - !intbyte_strcmp (name_str, "CLASSIFICATION") || - !intbyte_strcmp (name_str, "COPYRIGHT") || - !intbyte_strcmp (name_str, "DEVICE_FONT_NAME") || - !intbyte_strcmp (name_str, "FULL_NAME") || - !intbyte_strcmp (name_str, "MONOSPACED") || - !intbyte_strcmp (name_str, "QUALITY") || - !intbyte_strcmp (name_str, "RELATIVE_SET") || - !intbyte_strcmp (name_str, "RELATIVE_WEIGHT") || - !intbyte_strcmp (name_str, "STYLE"))) + !qxestrcmp_c (name_str, "CHARSET_COLLECTIONS") || + !qxestrcmp_c (name_str, "FONTNAME_REGISTRY") || + !qxestrcmp_c (name_str, "CLASSIFICATION") || + !qxestrcmp_c (name_str, "COPYRIGHT") || + !qxestrcmp_c (name_str, "DEVICE_FONT_NAME") || + !qxestrcmp_c (name_str, "FULL_NAME") || + !qxestrcmp_c (name_str, "MONOSPACED") || + !qxestrcmp_c (name_str, "QUALITY") || + !qxestrcmp_c (name_str, "RELATIVE_SET") || + !qxestrcmp_c (name_str, "RELATIVE_WEIGHT") || + !qxestrcmp_c (name_str, "STYLE"))) { Extbyte *val_str = XGetAtomName (dpy, props [i].card32); @@ -883,9 +876,13 @@ static int x_font_spec_matches_charset (struct device *d, Lisp_Object charset, - const Intbyte *nonreloc, Lisp_Object reloc, - Bytecount offset, Bytecount length) + const Ibyte *nonreloc, Lisp_Object reloc, + Bytecount offset, Bytecount length, + int stage) { + if (stage) + return 0; + if (UNBOUNDP (charset)) return 1; /* Hack! Short font names don't have the registry in them, @@ -895,7 +892,7 @@ */ if (EQ (charset, Vcharset_ascii)) { - const Intbyte *the_nonreloc = nonreloc; + const Ibyte *the_nonreloc = nonreloc; int i; Bytecount the_length = length; @@ -907,7 +904,7 @@ { for (i = 0;; i++) { - const Intbyte *new_nonreloc = (const Intbyte *) + const Ibyte *new_nonreloc = (const Ibyte *) memchr (the_nonreloc, '-', the_length); if (!new_nonreloc) break; @@ -933,7 +930,8 @@ /* find a font spec that matches font spec FONT and also matches (the registry of) CHARSET. */ static Lisp_Object -x_find_charset_font (Lisp_Object device, Lisp_Object font, Lisp_Object charset) +x_find_charset_font (Lisp_Object device, Lisp_Object font, Lisp_Object charset, + int stage) { Extbyte **names; int count = 0; @@ -941,6 +939,9 @@ const Extbyte *patternext; int i; + if (stage) + return Qnil; + LISP_STRING_TO_EXTERNAL (font, patternext, Qx_font_name_encoding); names = XListFonts (DEVICE_X_DISPLAY (XDEVICE (device)), @@ -948,14 +949,14 @@ /* #### This code seems awfully bogus -- mrb */ for (i = 0; i < count; i ++) { - const Intbyte *intname; + const Ibyte *intname; Bytecount intlen; TO_INTERNAL_FORMAT (C_STRING, names[i], ALLOCA, (intname, intlen), Qx_font_name_encoding); if (x_font_spec_matches_charset (XDEVICE (device), charset, - intname, Qnil, 0, -1)) + intname, Qnil, 0, -1, 0)) { result = make_string (intname, intlen); break; @@ -968,7 +969,7 @@ /* Check for a short font name. */ if (NILP (result) && x_font_spec_matches_charset (XDEVICE (device), charset, 0, - font, 0, -1)) + font, 0, -1, 0)) return font; return result; @@ -1000,7 +1001,6 @@ CONSOLE_HAS_METHOD (x, valid_color_name_p); CONSOLE_HAS_METHOD (x, initialize_font_instance); - CONSOLE_HAS_METHOD (x, mark_font_instance); CONSOLE_HAS_METHOD (x, print_font_instance); CONSOLE_HAS_METHOD (x, finalize_font_instance); CONSOLE_HAS_METHOD (x, font_instance_truename); diff --text -u 'xemacs-21.5.6/src/objects-x.h' 'xemacs-21.5.7/src/objects-x.h' Index: ././src/objects-x.h --- ././src/objects-x.h Fri Apr 13 03:24:09 2001 +++ ././src/objects-x.h Fri Jun 21 06:18:40 2002 @@ -1,7 +1,7 @@ /* X-specific Lisp objects. Copyright (C) 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. This file is part of XEmacs. @@ -31,38 +31,8 @@ #ifdef HAVE_X_WINDOWS -/***************************************************************************** - Color-Instance - ****************************************************************************/ - -struct x_color_instance_data -{ - XColor color; - char dealloc_on_gc; -}; - -#define X_COLOR_INSTANCE_DATA(c) ((struct x_color_instance_data *) (c)->data) -#define COLOR_INSTANCE_X_COLOR(c) (X_COLOR_INSTANCE_DATA (c)->color) -#define COLOR_INSTANCE_X_DEALLOC(c) (X_COLOR_INSTANCE_DATA (c)->dealloc_on_gc) - int allocate_nearest_color (Display *display, Colormap screen_colormap, Visual *visual, XColor *color_def); - -/***************************************************************************** - Font-Instance - ****************************************************************************/ - -struct x_font_instance_data -{ - /* X-specific information */ - Lisp_Object truename; - XFontStruct *font; -}; - -#define X_FONT_INSTANCE_DATA(f) ((struct x_font_instance_data *) (f)->data) -#define FONT_INSTANCE_X_FONT(f) (X_FONT_INSTANCE_DATA (f)->font) -#define FONT_INSTANCE_X_TRUENAME(f) (X_FONT_INSTANCE_DATA (f)->truename) - #endif /* HAVE_X_WINDOWS */ #endif /* INCLUDED_objects_x_h_ */ diff --text -u 'xemacs-21.5.6/src/objects.c' 'xemacs-21.5.7/src/objects.c' Index: ././src/objects.c --- ././src/objects.c Sun Mar 31 17:28:51 2002 +++ ././src/objects.c Sun Jun 23 02:14:45 2002 @@ -26,12 +26,12 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "faces.h" #include "frame.h" #include "glyphs.h" -#include "objects.h" +#include "objects-impl.h" #include "specifier.h" #include "window.h" @@ -238,6 +238,7 @@ Lisp_Font_Instance *f = XFONT_INSTANCE (obj); mark_object (f->name); + mark_object (f->truename); if (!NILP (f->device)) /* Vthe_null_font_instance */ MAYBE_DEVMETH (XDEVICE (f->device), mark_font_instance, (f)); @@ -325,6 +326,7 @@ f = alloc_lcrecord_type (Lisp_Font_Instance, &lrecord_font_instance); f->name = name; + f->truename = Qnil; f->device = device; f->data = 0; @@ -665,20 +667,55 @@ #ifdef MULE -int +/* Given a truename font spec (i.e. the font spec should have its registry + field filled in), does it support displaying characters from CHARSET? */ + +static int font_spec_matches_charset (struct device *d, Lisp_Object charset, - const Intbyte *nonreloc, Lisp_Object reloc, - Bytecount offset, Bytecount length) + const Ibyte *nonreloc, Lisp_Object reloc, + Bytecount offset, Bytecount length, + int stage) { return DEVMETH_OR_GIVEN (d, font_spec_matches_charset, - (d, charset, nonreloc, reloc, offset, length), + (d, charset, nonreloc, reloc, offset, length, + stage), 1); } static void font_validate_matchspec (Lisp_Object matchspec) { - Fget_charset (matchspec); + CHECK_CONS (matchspec); + Fget_charset (XCAR (matchspec)); +} + +void +initialize_charset_font_caches (struct device *d) +{ + /* Note that the following tables are bi-level. */ + d->charset_font_cache_stage_1 = + make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); + d->charset_font_cache_stage_2 = + make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); +} + +void +invalidate_charset_font_caches (Lisp_Object charset) +{ + /* Invalidate font cache entries for charset on all devices. */ + Lisp_Object devcons, concons, hash_table; + DEVICE_LOOP_NO_BREAK (devcons, concons) + { + struct device *d = XDEVICE (XCAR (devcons)); + hash_table = Fgethash (charset, d->charset_font_cache_stage_1, + Qunbound); + if (!UNBOUNDP (hash_table)) + Fclrhash (hash_table); + hash_table = Fgethash (charset, d->charset_font_cache_stage_2, + Qunbound); + if (!UNBOUNDP (hash_table)) + Fclrhash (hash_table); + } } #endif /* MULE */ @@ -694,10 +731,15 @@ Lisp_Object device = DOMAIN_DEVICE (domain); struct device *d = XDEVICE (device); Lisp_Object instance; + Lisp_Object charset = Qnil; + int stage = 0; #ifdef MULE if (!UNBOUNDP (matchspec)) - matchspec = Fget_charset (matchspec); + { + charset = Fget_charset (XCAR (matchspec)); + stage = NILP (XCDR (matchspec)) ? 0 : 1; + } #endif if (FONT_INSTANCEP (instantiator)) @@ -706,10 +748,10 @@ || EQ (device, XFONT_INSTANCE (instantiator)->device)) { #ifdef MULE - if (font_spec_matches_charset (d, matchspec, 0, + if (font_spec_matches_charset (d, charset, 0, Ffont_instance_truename (instantiator), - 0, -1)) + 0, -1, stage)) return instantiator; #else return instantiator; @@ -721,7 +763,14 @@ if (STRINGP (instantiator)) { #ifdef MULE - if (!UNBOUNDP (matchspec)) + Lisp_Object cache = stage ? d->charset_font_cache_stage_2 : + d->charset_font_cache_stage_1; +#else + Lisp_Object cache = d->font_instance_cache; +#endif + +#ifdef MULE + if (!NILP (charset)) { /* The instantiator is a font spec that could match many different fonts. We need to find one of those fonts @@ -731,14 +780,13 @@ iterate over all possible fonts, and a regexp match on each one. So we cache the results. */ Lisp_Object matching_font = Qunbound; - Lisp_Object hash_table = Fgethash (matchspec, d->charset_font_cache, - Qunbound); + Lisp_Object hash_table = Fgethash (charset, cache, Qunbound); if (UNBOUNDP (hash_table)) { /* need to make a sub hash table. */ hash_table = make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQUAL); - Fputhash (matchspec, hash_table, d->charset_font_cache); + Fputhash (charset, hash_table, cache); } else matching_font = Fgethash (instantiator, hash_table, Qunbound); @@ -748,7 +796,7 @@ /* make sure we cache the failures, too. */ matching_font = DEVMETH_OR_GIVEN (d, find_charset_font, - (device, instantiator, matchspec), + (device, instantiator, charset, stage), instantiator); Fputhash (instantiator, matching_font, hash_table); } @@ -759,13 +807,13 @@ #endif /* MULE */ /* First, look to see if we can retrieve a cached value. */ - instance = Fgethash (instantiator, d->font_instance_cache, Qunbound); + instance = Fgethash (instantiator, cache, Qunbound); /* Otherwise, make a new one. */ if (UNBOUNDP (instance)) { /* make sure we cache the failures, too. */ instance = Fmake_font_instance (instantiator, device, Qt); - Fputhash (instantiator, instance, d->font_instance_cache); + Fputhash (instantiator, instance, cache); } return NILP (instance) ? Qunbound : instance; @@ -775,7 +823,7 @@ assert (XVECTOR_LENGTH (instantiator) == 1); return (face_property_matching_instance (Fget_face (XVECTOR_DATA (instantiator)[0]), Qfont, - matchspec, domain, ERROR_ME, 0, depth)); + charset, domain, ERROR_ME, 0, depth)); } else if (NILP (instantiator)) return Qunbound; @@ -1094,6 +1142,7 @@ Lisp_Font_Instance *f = alloc_lcrecord_type (Lisp_Font_Instance, &lrecord_font_instance); f->name = Qnil; + f->truename = Qnil; f->device = Qnil; f->data = 0; diff --text -u 'xemacs-21.5.6/src/objects.h' 'xemacs-21.5.7/src/objects.h' Index: ././src/objects.h --- ././src/objects.h Fri Mar 29 13:48:16 2002 +++ ././src/objects.h Fri Jun 21 06:18:40 2002 @@ -1,6 +1,6 @@ -/* Generic object functions. +/* Generic object functions -- interface. Copyright (C) 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. This file is part of XEmacs. @@ -24,103 +24,12 @@ #ifndef INCLUDED_objects_h_ #define INCLUDED_objects_h_ -#include "specifier.h" - void finalose (void *ptr); -/***************************************************************************** - * Color Specifier Object * - *****************************************************************************/ - -struct color_specifier -{ - Lisp_Object face; /* face this is attached to, or nil */ - Lisp_Object face_property; /* property of that face */ -}; - -#define COLOR_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, color) -#define COLOR_SPECIFIER_FACE(g) (COLOR_SPECIFIER_DATA (g)->face) -#define COLOR_SPECIFIER_FACE_PROPERTY(g) \ - (COLOR_SPECIFIER_DATA (g)->face_property) - -DECLARE_SPECIFIER_TYPE (color); -#define XCOLOR_SPECIFIER(x) XSPECIFIER_TYPE (x, color) -#define COLOR_SPECIFIERP(x) SPECIFIER_TYPEP (x, color) -#define CHECK_COLOR_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, color) -#define CONCHECK_COLOR_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, color) - -void set_color_attached_to (Lisp_Object obj, Lisp_Object face, - Lisp_Object property); - -/***************************************************************************** - * Font Specifier Object * - *****************************************************************************/ - -struct font_specifier -{ - Lisp_Object face; /* face this is attached to, or nil */ - Lisp_Object face_property; /* property of that face */ -}; - -#define FONT_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, font) -#define FONT_SPECIFIER_FACE(g) (FONT_SPECIFIER_DATA (g)->face) -#define FONT_SPECIFIER_FACE_PROPERTY(g) \ - (FONT_SPECIFIER_DATA (g)->face_property) - -DECLARE_SPECIFIER_TYPE (font); -#define XFONT_SPECIFIER(x) XSPECIFIER_TYPE (x, font) -#define FONT_SPECIFIERP(x) SPECIFIER_TYPEP (x, font) -#define CHECK_FONT_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, font) -#define CONCHECK_FONT_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, font) - -void set_font_attached_to (Lisp_Object obj, Lisp_Object face, - Lisp_Object property); - -/***************************************************************************** - * Face Boolean Specifier Object * - *****************************************************************************/ - -struct face_boolean_specifier -{ - Lisp_Object face; /* face this is attached to, or nil */ - Lisp_Object face_property; /* property of that face */ -}; - -#define FACE_BOOLEAN_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, face_boolean) -#define FACE_BOOLEAN_SPECIFIER_FACE(g) (FACE_BOOLEAN_SPECIFIER_DATA (g)->face) -#define FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY(g) \ - (FACE_BOOLEAN_SPECIFIER_DATA (g)->face_property) - -DECLARE_SPECIFIER_TYPE (face_boolean); -extern Lisp_Object Qface_boolean; -#define XFACE_BOOLEAN_SPECIFIER(x) XSPECIFIER_TYPE (x, face_boolean) -#define FACE_BOOLEAN_SPECIFIERP(x) SPECIFIER_TYPEP (x, face_boolean) -#define CHECK_FACE_BOOLEAN_SPECIFIER(x) \ - CHECK_SPECIFIER_TYPE (x, face_boolean) -#define CONCHECK_FACE_BOOLEAN_SPECIFIER(x) \ - CONCHECK_SPECIFIER_TYPE (x, face_boolean) - -void set_face_boolean_attached_to (Lisp_Object obj, Lisp_Object face, - Lisp_Object property); - /**************************************************************************** * Color Instance Object * ****************************************************************************/ -EXFUN (Fmake_color_instance, 3); - -extern Lisp_Object Vthe_null_color_instance; - -struct Lisp_Color_Instance -{ - struct lcrecord_header header; - Lisp_Object name; - Lisp_Object device; - - /* console-type-specific data */ - void *data; -}; - DECLARE_LRECORD (color_instance, Lisp_Color_Instance); #define XCOLOR_INSTANCE(x) XRECORD (x, color_instance, Lisp_Color_Instance) #define wrap_color_instance(p) wrap_record (p, color_instance) @@ -128,13 +37,20 @@ #define CHECK_COLOR_INSTANCE(x) CHECK_RECORD (x, color_instance) #define CONCHECK_COLOR_INSTANCE(x) CONCHECK_RECORD (x, color_instance) -#define COLOR_INSTANCE_NAME(c) ((c)->name) -#define COLOR_INSTANCE_DEVICE(c) ((c)->device) +EXFUN (Fmake_color_instance, 3); + +extern Lisp_Object Vthe_null_color_instance; + +void set_color_attached_to (Lisp_Object obj, Lisp_Object face, + Lisp_Object property); /**************************************************************************** * Font Instance Object * ****************************************************************************/ +void initialize_charset_font_caches (struct device *d); +void invalidate_charset_font_caches (Lisp_Object charset); + DECLARE_LRECORD (font_instance, Lisp_Font_Instance); #define XFONT_INSTANCE(x) XRECORD (x, font_instance, Lisp_Font_Instance) #define wrap_font_instance(p) wrap_record (p, font_instance) @@ -142,13 +58,6 @@ #define CHECK_FONT_INSTANCE(x) CHECK_RECORD (x, font_instance) #define CONCHECK_FONT_INSTANCE(x) CONCHECK_RECORD (x, font_instance) -#ifdef MULE -int font_spec_matches_charset (struct device *d, Lisp_Object charset, - const Intbyte *nonreloc, - Lisp_Object reloc, Bytecount offset, - Bytecount length); -#endif - EXFUN (Fmake_font_instance, 3); EXFUN (Ffont_instance_name, 1); EXFUN (Ffont_instance_p, 1); @@ -156,27 +65,14 @@ extern Lisp_Object Vthe_null_font_instance; -struct Lisp_Font_Instance -{ - struct lcrecord_header header; - Lisp_Object name; - Lisp_Object device; - - unsigned short ascent; /* extracted from `font', or made up */ - unsigned short descent; - unsigned short width; - unsigned short height; - int proportional_p; - - /* console-type-specific data */ - void *data; -}; - -#define FONT_INSTANCE_NAME(f) ((f)->name) -#define FONT_INSTANCE_DEVICE(f) ((f)->device) -#define FONT_INSTANCE_ASCENT(f) ((f)->ascent) -#define FONT_INSTANCE_DESCENT(f) ((f)->descent) -#define FONT_INSTANCE_WIDTH(f) ((f)->width) -#define FONT_INSTANCE_HEIGHT(f) ((f)->height) +void set_font_attached_to (Lisp_Object obj, Lisp_Object face, + Lisp_Object property); + +/***************************************************************************** + * Face Boolean Specifier Object * + *****************************************************************************/ + +void set_face_boolean_attached_to (Lisp_Object obj, Lisp_Object face, + Lisp_Object property); #endif /* INCLUDED_objects_h_ */ diff --text -u 'xemacs-21.5.6/src/opaque.c' 'xemacs-21.5.7/src/opaque.c' Index: ././src/opaque.c --- ././src/opaque.c Sun Mar 31 17:28:52 2002 +++ ././src/opaque.c Tue May 28 17:44:57 2002 @@ -55,8 +55,7 @@ inline static Bytecount aligned_sizeof_opaque (Bytecount opaque_size) { - return ALIGN_SIZE (offsetof (Lisp_Opaque, data) + opaque_size, - ALIGNOF (max_align_t)); + return MAX_ALIGN_SIZE (offsetof (Lisp_Opaque, data) + opaque_size); } static Bytecount @@ -153,7 +152,7 @@ Lisp_Object make_opaque_ptr (void *val) { - Lisp_Object res = allocate_managed_lcrecord(Vopaque_ptr_free_list); + Lisp_Object res = allocate_managed_lcrecord (Vopaque_ptr_free_list); set_opaque_ptr (res, val); return res; } diff --text -u 'xemacs-21.5.6/src/postgresql.c' 'xemacs-21.5.7/src/postgresql.c' Index: ././src/postgresql.c --- ././src/postgresql.c Fri Mar 29 13:48:17 2002 +++ ././src/postgresql.c Fri Jun 21 06:18:40 2002 @@ -98,8 +98,10 @@ #include "lisp.h" #include "sysdep.h" + #include "buffer.h" #include "postgresql.h" +#include "process.h" #ifdef RUNNING_XEMACS_21_1 /* handle interface changes */ #define PG_OS_CODING FORMAT_FILENAME @@ -220,7 +222,7 @@ if (print_readably) printing_unreadable_object ("%s", buf); else - write_c_string (buf, printcharfun); + write_c_string (printcharfun, buf); } static Lisp_PGconn * @@ -333,7 +335,7 @@ if (print_readably) printing_unreadable_object ("%s", buf); else - write_c_string (buf, printcharfun); + write_c_string (printcharfun, buf); } #undef RESULT_TUPLES_FMT @@ -1794,7 +1796,7 @@ void init_postgresql_from_environment (void) { - Intbyte *p; + Ibyte *p; #define FROB(envvar, var) \ if ((p = egetenv (envvar))) \ diff --text -u 'xemacs-21.5.6/src/print.c' 'xemacs-21.5.7/src/print.c' Index: ././src/print.c --- ././src/print.c Wed Apr 3 19:47:51 2002 +++ ././src/print.c Fri Jun 21 06:18:41 2002 @@ -38,15 +38,15 @@ #include "backtrace.h" #include "buffer.h" #include "bytecode.h" -#include "device.h" +#include "device-impl.h" #include "extents.h" #include "frame.h" #include "insdel.h" #include "lstream.h" #include "opaque.h" -#include "console-tty.h" -#include "console-stream.h" +#include "console-tty-impl.h" +#include "console-stream-impl.h" #ifdef WIN32_NATIVE #include "console-msw.h" #endif @@ -116,7 +116,7 @@ FILE *termscript; /* Stdio stream being used for copy of all output. */ -static void write_string_to_alternate_debugging_output (Intbyte *str, +static void write_string_to_alternate_debugging_output (Ibyte *str, Bytecount len); @@ -127,7 +127,7 @@ static void write_string_to_stdio_stream (FILE *stream, struct console *con, - const Intbyte *ptr, Bytecount len, + const Ibyte *ptr, Bytecount len, int must_flush) { Extbyte *extptr = 0; @@ -207,15 +207,15 @@ mswindows_output_console_string(). */ static void -std_handle_out_va (FILE *stream, const CIntbyte *fmt, va_list args, +std_handle_out_va (FILE *stream, const CIbyte *fmt, va_list args, int debug_output_as_well) { - Intbyte kludge[8192]; + Ibyte kludge[8192]; Bytecount kludgelen; if (initialized && !inhibit_non_essential_printing_operations) fmt = GETTEXT (fmt); - vsprintf ((CIntbyte *) kludge, fmt, args); + vsprintf ((CIbyte *) kludge, fmt, args); kludgelen = qxestrlen (kludge); write_string_to_stdio_stream (stream, 0, kludge, kludgelen, 1); @@ -236,7 +236,7 @@ conversion in such cases. */ void -stderr_out (const CIntbyte *fmt, ...) +stderr_out (const CIbyte *fmt, ...) { va_list args; va_start (args, fmt); @@ -248,7 +248,7 @@ window under MS Windows). Works like stderr_out(). */ void -stdout_out (const CIntbyte *fmt, ...) +stdout_out (const CIbyte *fmt, ...) { va_list args; va_start (args, fmt); @@ -262,7 +262,7 @@ Works like stderr_out(). */ void -debug_out (const CIntbyte *fmt, ...) +debug_out (const CIbyte *fmt, ...) { va_list args; va_start (args, fmt); @@ -271,7 +271,7 @@ } DOESNT_RETURN -fatal (const CIntbyte *fmt, ...) +fatal (const CIbyte *fmt, ...) { va_list args; va_start (args, fmt); @@ -302,7 +302,7 @@ */ static void -output_string (Lisp_Object function, const Intbyte *nonreloc, +output_string (Lisp_Object function, const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount len) { /* This function can GC */ @@ -312,7 +312,7 @@ other functions that take both a nonreloc and a reloc, or things may get confused and an assertion failure in fixup_internal_substring() may get triggered. */ - const Intbyte *newnonreloc = nonreloc; + const Ibyte *newnonreloc = nonreloc; struct gcpro gcpro1, gcpro2; /* Emacs won't print while GCing, but an external debugger might */ @@ -343,7 +343,7 @@ we inhibit GC. */ if (len < 65536) { - Intbyte *copied = alloca_array (Intbyte, len); + Ibyte *copied = alloca_array (Ibyte, len); memcpy (copied, newnonreloc + offset, len); Lstream_write (XLSTREAM (function), copied, len); } @@ -416,7 +416,7 @@ { for (iii = ccoff; iii < cclen + ccoff; iii++) { - call1 (function, make_char (XSTRING_CHAR (reloc, iii))); + call1 (function, make_char (string_ichar (reloc, iii))); if (STRINGP (reloc)) newnonreloc = XSTRING_DATA (reloc); } @@ -426,7 +426,7 @@ for (iii = ccoff; iii < cclen + ccoff; iii++) { call1 (function, - make_char (charptr_emchar_n (newnonreloc, iii))); + make_char (itext_ichar_n (newnonreloc, iii))); } } } @@ -526,10 +526,6 @@ } } -/* Used for printing a single-byte character (*not* any Emchar). */ -#define write_char_internal(string_of_length_1, stream) \ - output_string (stream, (const Intbyte *) (string_of_length_1), \ - Qnil, 0, 1) /* Write internal-format data to STREAM. See output_string() for interpretation of STREAM. @@ -544,7 +540,7 @@ canonicalize_printcharfun() (i.e. Qnil means stdout, not Vstandard_output, etc.) */ void -write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream) +write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size) { /* This function can GC */ #ifdef ERROR_CHECK_TEXT @@ -554,32 +550,32 @@ } void -write_string (const Intbyte *str, Lisp_Object stream) +write_string (Lisp_Object stream, const Ibyte *str) { /* This function can GC */ - write_string_1 (str, qxestrlen (str), stream); + write_string_1 (stream, str, qxestrlen (str)); } void -write_c_string (const CIntbyte *str, Lisp_Object stream) +write_c_string (Lisp_Object stream, const CIbyte *str) { /* This function can GC */ - write_string_1 ((const Intbyte *) str, strlen (str), stream); + write_string_1 (stream, (const Ibyte *) str, strlen (str)); } void -write_eistring (const Eistring *ei, Lisp_Object stream) +write_eistring (Lisp_Object stream, const Eistring *ei) { - write_string_1 (eidata (ei), eilen (ei), stream); + write_string_1 (stream, eidata (ei), eilen (ei)); } /* Write a printf-style string to STREAM; see output_string(). */ void -write_fmt_string (Lisp_Object stream, const CIntbyte *fmt, ...) +write_fmt_string (Lisp_Object stream, const CIbyte *fmt, ...) { va_list va; - Intbyte *str; + Ibyte *str; Bytecount len; int count; @@ -587,7 +583,7 @@ str = emacs_vsprintf_malloc (fmt, va, &len); va_end (va); count = record_unwind_protect_freeing (str); - write_string_1 (str, len, stream); + write_string_1 (stream, str, len); unbind_to (count); } @@ -598,12 +594,12 @@ This would require some rewriting of the doprnt() functions, though. */ void -write_fmt_string_lisp (Lisp_Object stream, const CIntbyte *fmt, int nargs, ...) +write_fmt_string_lisp (Lisp_Object stream, const CIbyte *fmt, int nargs, ...) { Lisp_Object *args = alloca_array (Lisp_Object, nargs); va_list va; int i; - Intbyte *str; + Ibyte *str; Bytecount len; int count; @@ -613,17 +609,17 @@ va_end (va); str = emacs_vsprintf_malloc_lisp (fmt, Qnil, nargs, args, &len); count = record_unwind_protect_freeing (str); - write_string_1 (str, len, stream); + write_string_1 (stream, str, len); unbind_to (count); } void -stderr_out_lisp (const CIntbyte *fmt, int nargs, ...) +stderr_out_lisp (const CIbyte *fmt, int nargs, ...) { Lisp_Object *args = alloca_array (Lisp_Object, nargs); va_list va; int i; - Intbyte *str; + Ibyte *str; Bytecount len; int count; @@ -633,7 +629,7 @@ va_end (va); str = emacs_vsprintf_malloc_lisp (fmt, Qnil, nargs, args, &len); count = record_unwind_protect_freeing (str); - write_string_1 (str, len, Qexternal_debugging_output); + write_string_1 (Qexternal_debugging_output, str, len); unbind_to (count); } @@ -645,11 +641,11 @@ (character, stream)) { /* This function can GC */ - Intbyte str[MAX_EMCHAR_LEN]; + Ibyte str[MAX_ICHAR_LEN]; Bytecount len; CHECK_CHAR_COERCE_INT (character); - len = set_charptr_emchar (str, XCHAR (character)); + len = set_itext_ichar (str, XCHAR (character)); output_string (canonicalize_printcharfun (stream), str, Qnil, 0, len); return character; } @@ -745,7 +741,7 @@ (stream)) { /* This function can GC */ - write_char_internal ("\n", canonicalize_printcharfun (stream)); + write_c_string (canonicalize_printcharfun (stream), "\n"); return Qt; } @@ -831,9 +827,9 @@ GCPRO2 (object, stream); stream = print_prepare (stream, &frame); - write_char_internal ("\n", stream); + write_c_string (stream, "\n"); print_internal (object, stream, 1); - write_char_internal ("\n", stream); + write_c_string (stream, "\n"); print_finish (stream, frame); UNGCPRO; return object; @@ -909,7 +905,7 @@ } while (!NILP (tail)) { - write_c_string (first ? ": " : ", ", stream); + write_c_string (stream, first ? ": " : ", "); /* Most errors have an explanatory string as their first argument, and it looks better not to put the quotes around it. */ print_internal (Fcar (tail), stream, @@ -929,7 +925,7 @@ error_throw: if (NILP (method)) { - write_c_string (GETTEXT ("Peculiar error "), stream); + write_c_string (stream, GETTEXT ("Peculiar error ")); print_internal (error_object, stream, 1); return; } @@ -995,7 +991,7 @@ void float_to_string (char *buf, double data) { - Intbyte *cp, c; + Ibyte *cp, c; int width; if (NILP (Vfloat_output_format) @@ -1040,7 +1036,7 @@ representation of that form not be corrupted by the printer. */ { - Intbyte *s = (Intbyte *) buf; /* don't use signed chars here! + Ibyte *s = (Ibyte *) buf; /* don't use signed chars here! isdigit() can't hack them! */ if (*s == '-') s++; for (; *s; s++) @@ -1193,17 +1189,17 @@ if (max < len) last = max; } - write_c_string (start, printcharfun); + write_c_string (printcharfun, start); for (i = 0; i < last; i++) { Lisp_Object elt = XVECTOR_DATA (obj)[i]; - if (i != 0) write_char_internal (" ", printcharfun); + if (i != 0) write_c_string (printcharfun, " "); print_internal (elt, printcharfun, escapeflag); } UNGCPRO; if (last != len) - write_c_string (" ...", printcharfun); - write_c_string (end, printcharfun); + write_c_string (printcharfun, " ..."); + write_c_string (printcharfun, end); } void @@ -1224,14 +1220,14 @@ { obj = XCAR (XCDR (obj)); GCPRO2 (obj, printcharfun); - write_char_internal ("\'", printcharfun); + write_c_string (printcharfun, "\'"); UNGCPRO; print_internal (obj, printcharfun, escapeflag); return; } GCPRO2 (obj, printcharfun); - write_char_internal ("(", printcharfun); + write_c_string (printcharfun, "("); { int len; @@ -1244,20 +1240,20 @@ obj = XCDR (obj), len++) { if (len > 0) - write_char_internal (" ", printcharfun); + write_c_string (printcharfun, " "); if (EQ (obj, tortoise) && len > 0) { if (print_readably) printing_unreadable_object ("circular list"); else - write_c_string ("... ", printcharfun); + write_c_string (printcharfun, "... "); break; } if (len & 1) tortoise = XCDR (tortoise); if (len > max) { - write_c_string ("...", printcharfun); + write_c_string (printcharfun, "..."); break; } print_internal (XCAR (obj), printcharfun, escapeflag); @@ -1265,12 +1261,12 @@ } if (!LISTP (obj)) { - write_c_string (" . ", printcharfun); + write_c_string (printcharfun, " . "); print_internal (obj, printcharfun, escapeflag); } UNGCPRO; - write_char_internal (")", printcharfun); + write_c_string (printcharfun, ")"); return; } @@ -1285,7 +1281,7 @@ { /* We distinguish between Bytecounts and Charcounts, to make Vprint_string_length work correctly under Mule. */ - Charcount size = XSTRING_CHAR_LENGTH (obj); + Charcount size = string_char_length (obj); Charcount max = size; Bytecount bcmax = XSTRING_LENGTH (obj); struct gcpro gcpro1, gcpro2; @@ -1308,16 +1304,16 @@ /* This deals with GC-relocation and Mule. */ output_string (printcharfun, 0, obj, 0, bcmax); if (max < size) - write_c_string (" ...", printcharfun); + write_c_string (printcharfun, " ..."); } else { Bytecount i, last = 0; - write_char_internal ("\"", printcharfun); + write_c_string (printcharfun, "\""); for (i = 0; i < bcmax; i++) { - Intbyte ch = XSTRING_BYTE (obj, i); + Ibyte ch = string_byte (obj, i); if (ch == '\"' || ch == '\\' || (ch == '\n' && print_escape_newlines)) { @@ -1328,14 +1324,17 @@ } if (ch == '\n') { - write_c_string ("\\n", printcharfun); + write_c_string (printcharfun, "\\n"); } else { - write_char_internal ("\\", printcharfun); + Ibyte temp[2]; + write_c_string (printcharfun, "\\"); /* This is correct for Mule because the character is either \ or " */ - write_char_internal (XSTRING_DATA (obj) + i, printcharfun); + temp[0] = string_byte (obj, i); + temp[1] = '\0'; + write_string (printcharfun, temp); } last = i + 1; } @@ -1346,8 +1345,8 @@ bcmax - last); } if (max < size) - write_c_string (" ...", printcharfun); - write_char_internal ("\"", printcharfun); + write_c_string (printcharfun, " ..."); + write_c_string (printcharfun, "\""); } UNGCPRO; } @@ -1472,7 +1471,7 @@ char buf[DECIMAL_PRINT_SIZE (long) + 1]; *buf = '#'; long_to_string (buf + 1, i); - write_c_string (buf, printcharfun); + write_c_string (printcharfun, buf); return; } } @@ -1490,7 +1489,7 @@ { char buf[DECIMAL_PRINT_SIZE (EMACS_INT)]; long_to_string (buf, XINT (obj)); - write_c_string (buf, printcharfun); + write_c_string (printcharfun, buf); break; } @@ -1498,7 +1497,7 @@ { /* God intended that this be #\..., you know. */ char buf[16]; - Emchar ch = XCHAR (obj); + Ichar ch = XCHAR (obj); char *p = buf; *p++ = '?'; if (ch < 32) @@ -1547,14 +1546,14 @@ else if (ch < 160) { *p++ = '\\', *p++ = '^'; - p += set_charptr_emchar ((Intbyte *) p, ch + 64); + p += set_itext_ichar ((Ibyte *) p, ch + 64); } else { - p += set_charptr_emchar ((Intbyte *) p, ch); + p += set_itext_ichar ((Ibyte *) p, ch); } - output_string (printcharfun, (Intbyte *) buf, Qnil, 0, p - buf); + output_string (printcharfun, (Ibyte *) buf, Qnil, 0, p - buf); break; } @@ -1571,7 +1570,7 @@ && print_depth > XINT (Vprint_level)) { GCPRO2 (obj, printcharfun); - write_c_string ("...", printcharfun); + write_c_string (printcharfun, "..."); UNGCPRO; break; } @@ -1596,12 +1595,11 @@ if (print_readably) signal_error (Qinternal_error, "printing illegal data type #o%03o", make_int (XTYPE (obj))); - write_c_string ("#", - printcharfun); + (printcharfun, + " Save your buffers immediately and please report this bug>"); #endif /* not ERROR_CHECK_TYPES */ break; } @@ -1618,7 +1616,7 @@ char pigbuf[350]; /* see comments in float_to_string */ float_to_string (pigbuf, XFLOAT_DATA (obj)); - write_c_string (pigbuf, printcharfun); + write_c_string (printcharfun, pigbuf); } #endif /* LISP_FLOAT_TYPE */ @@ -1655,9 +1653,9 @@ Lisp_Object tem = Fassq (obj, Vprint_gensym_alist); if (CONSP (tem)) { - write_char_internal ("#", printcharfun); + write_c_string (printcharfun, "#"); print_internal (XCDR (tem), printcharfun, escapeflag); - write_char_internal ("#", printcharfun); + write_c_string (printcharfun, "#"); UNGCPRO; return; } @@ -1675,17 +1673,17 @@ tem = make_int (1); Vprint_gensym_alist = Fcons (Fcons (obj, tem), Vprint_gensym_alist); - write_char_internal ("#", printcharfun); + write_c_string (printcharfun, "#"); print_internal (tem, printcharfun, escapeflag); - write_char_internal ("=", printcharfun); + write_c_string (printcharfun, "="); } } - write_c_string ("#:", printcharfun); + write_c_string (printcharfun, "#:"); } /* Does it look like an integer or a float? */ { - Intbyte *data = XSTRING_DATA (name); + Ibyte *data = XSTRING_DATA (name); Bytecount confusing = 0; if (size == 0) @@ -1717,7 +1715,7 @@ confusing = isfloat_string ((char *) data); #endif if (confusing) - write_char_internal ("\\", printcharfun); + write_c_string (printcharfun, "\\"); } { @@ -1726,7 +1724,7 @@ for (i = 0; i < size; i++) { - switch (XSTRING_BYTE (name, i)) + switch (string_byte (name, i)) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: @@ -1742,7 +1740,7 @@ case '[': case ']' : case '?' : if (i > last) output_string (printcharfun, 0, name, last, i - last); - write_char_internal ("\\", printcharfun); + write_c_string (printcharfun, "\\"); last = i; } } @@ -1766,18 +1764,18 @@ */ (character)) { - Intbyte str[MAX_EMCHAR_LEN]; + Ibyte str[MAX_ICHAR_LEN]; Bytecount len; CHECK_CHAR_COERCE_INT (character); - len = set_charptr_emchar (str, XCHAR (character)); + len = set_itext_ichar (str, XCHAR (character)); write_string_to_alternate_debugging_output (str, len); return character; } static void -write_string_to_alternate_debugging_output (Intbyte *str, Bytecount len) +write_string_to_alternate_debugging_output (Ibyte *str, Bytecount len) { int extlen; const Extbyte *extptr; @@ -1844,11 +1842,11 @@ print_unbuffered); else { - Intbyte str[MAX_EMCHAR_LEN]; + Ibyte str[MAX_ICHAR_LEN]; Bytecount len; CHECK_CHAR_COERCE_INT (char_or_string); - len = set_charptr_emchar (str, XCHAR (char_or_string)); + len = set_itext_ichar (str, XCHAR (char_or_string)); write_string_to_stdio_stream (file, con, str, len, print_unbuffered); } @@ -1887,7 +1885,13 @@ debug_print_no_newline (Lisp_Object debug_print_obj) { /* This function can GC */ - int specdepth = internal_bind_int (&print_depth, 0); + + /* by doing this, we trick various things that are non-essential + but might cause crashes into not getting executed. */ + int specdepth = + internal_bind_int (&inhibit_non_essential_printing_operations, 1); + + internal_bind_int (&print_depth, 0); internal_bind_int (&print_readably, debug_print_readably != -1 ? debug_print_readably : 0); internal_bind_int (&print_unbuffered, print_unbuffered + 1); @@ -1922,7 +1926,13 @@ debug_backtrace (void) { /* This function can GC */ - int specdepth = internal_bind_int (&print_depth, 0); + + /* by doing this, we trick various things that are non-essential + but might cause crashes into not getting executed. */ + int specdepth = + internal_bind_int (&inhibit_non_essential_printing_operations, 1); + + internal_bind_int (&print_depth, 0); internal_bind_int (&print_readably, 0); internal_bind_int (&print_unbuffered, print_unbuffered + 1); if (debug_print_length > 0) diff --text -u 'xemacs-21.5.6/src/process-nt.c' 'xemacs-21.5.7/src/process-nt.c' Index: ././src/process-nt.c --- ././src/process-nt.c Sun Mar 31 17:28:53 2002 +++ ././src/process-nt.c Wed Jun 5 18:56:48 2002 @@ -34,9 +34,9 @@ #include "process.h" #include "procimpl.h" -#include "syssignal.h" #include "sysfile.h" #include "sysproc.h" +#include "syssignal.h" /* Bound by win32-native.el */ Lisp_Object Qmswindows_construct_process_command_line; @@ -50,6 +50,7 @@ HANDLE h_process; DWORD dwProcessId; HWND hwnd; /* console window */ + int selected_for_exit_notify; }; /* Control whether create_child causes the process to inherit Emacs' @@ -69,8 +70,23 @@ /* Process helpers */ /*-----------------------------------------------------------------------*/ -/* This one breaks process abstraction. Prototype is in console-msw.h, - used by select_process method in event-msw.c */ +/* These break process abstraction. Prototypes in console-msw.h, + used by select_process method in event-msw.c. + + If called the first time on a process, return the process handle, so we + can select on it and receive exit notification. "First time only" so we + don't select the same process multiple times if someone turns off and on + the receipt of process data. */ + +HANDLE +get_nt_process_handle_only_first_time (Lisp_Process *p) +{ + if (NT_DATA (p)->selected_for_exit_notify) + return INVALID_HANDLE_VALUE; + NT_DATA (p)->selected_for_exit_notify = 1; + return (NT_DATA (p)->h_process); +} + HANDLE get_nt_process_handle (Lisp_Process *p) { @@ -111,11 +127,11 @@ * The memory in other process is allocated by creating a suspended * thread. Initial stack of that thread is used as the memory * block. The thread entry point is the routine ExitThread in - * kernel32.dll, so the allocated memory is freed just by resuming the + * kernel32.dll, so the allocated memory is freed just by resuming the * thread, which immediately terminates after that. */ -static int +static int alloc_process_memory (HANDLE h_process, Bytecount size, process_memory *pmc) { @@ -319,9 +335,9 @@ HMODULE h_kernel = qxeGetModuleHandle (XETEXT ("kernel32")); int close_process = 0; DWORD retval; - + assert (h_kernel != NULL); - + if (cp) { pid = cp->dwProcessId; @@ -332,7 +348,7 @@ close_process = 1; /* Try to open the process with required privileges */ h_process = OpenProcess (PROCESS_CREATE_THREAD - | PROCESS_QUERY_INFORMATION + | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE, FALSE, pid); @@ -352,7 +368,7 @@ d.adr_ExitProcess = (void (WINAPI *) (UINT)) GetProcAddress (h_kernel, "ExitProcess"); assert (d.adr_ExitProcess); - retval = run_in_other_process (h_process, + retval = run_in_other_process (h_process, (LPTHREAD_START_ROUTINE) sigkill_proc, &d, sizeof (d)); break; @@ -365,7 +381,7 @@ GetProcAddress (h_kernel, "GenerateConsoleCtrlEvent"); assert (d.adr_GenerateConsoleCtrlEvent); d.event = CTRL_C_EVENT; - retval = run_in_other_process (h_process, + retval = run_in_other_process (h_process, (LPTHREAD_START_ROUTINE) sigint_proc, &d, sizeof (d)); break; @@ -387,7 +403,7 @@ { HMODULE h_kernel = qxeGetModuleHandle (XETEXT ("kernel32")); sig_enable_data d; - + assert (h_kernel != NULL); d.adr_SetConsoleCtrlHandler = (BOOL (WINAPI *) (LPVOID, BOOL)) @@ -396,8 +412,6 @@ run_in_other_process (h_process, (LPTHREAD_START_ROUTINE)sig_enable_proc, &d, sizeof (d)); } - -#pragma warning (default : 4113) /* ---------------------------- the 95 way ------------------------------- */ @@ -434,7 +448,7 @@ HANDLE h_process; int close_process = 0; int rc = 1; - + if (cp) { pid = cp->dwProcessId; @@ -451,7 +465,7 @@ if (!h_process) return 0; } - + if (signo == SIGINT) { if (NILP (Vmswindows_start_process_share_console) && cp && cp->hwnd) @@ -620,7 +634,7 @@ && signo != SIGHUP) invalid_constant ("Signal number not supported", make_int (signo)); } - + /*-----------------------------------------------------------------------*/ /* Process methods */ /*-----------------------------------------------------------------------*/ @@ -658,6 +672,16 @@ WSAStartup (MAKEWORD (1,1), &wsa_data); } +/* + * Fork off a subprocess. P is a pointer to newly created subprocess + * object. If this function signals, the caller is responsible for + * deleting (and finalizing) the process object. + * + * The method must return PID of the new process, a (positive??? ####) number + * which fits into Lisp_Int. No return value indicates an error, the method + * must signal an error instead. + */ + static DOESNT_RETURN mswindows_report_winsock_error (const char *string, Lisp_Object data, int errnum) @@ -676,8 +700,8 @@ int mswindows_compare_env (const void *strp1, const void *strp2) { - const Intbyte *str1 = *(const Intbyte **)strp1, - *str2 = *(const Intbyte **)strp2; + const Ibyte *str1 = *(const Ibyte **)strp1, + *str2 = *(const Ibyte **)strp2; while (*str1 && *str2 && *str1 != '=' && *str2 != '=') { @@ -709,11 +733,12 @@ static int nt_create_process (Lisp_Process *p, Lisp_Object *argv, int nargv, - Lisp_Object program, Lisp_Object cur_dir) + Lisp_Object program, Lisp_Object cur_dir, + int separate_err) { /* Synched up with sys_spawnve in FSF 20.6. Significantly different but still synchable. */ - HANDLE hmyshove, hmyslurp, hprocin, hprocout, hprocerr; + HANDLE hmyshove, hmyslurp, hmyslurp_err, hprocin, hprocout, hprocerr; Extbyte *command_line; BOOL do_io, windowed; Extbyte *proc_env; @@ -726,7 +751,7 @@ /* SHGetFileInfo tends to return ERROR_FILE_NOT_FOUND on most errors. This leads to bogus error message. */ DWORD image_type; - Intbyte *p = qxestrrchr (XSTRING_DATA (program), '.'); + Ibyte *p = qxestrrchr (XSTRING_DATA (program), '.'); if (p != NULL && (qxestrcasecmp (p, ".exe") == 0 || qxestrcasecmp (p, ".com") == 0 || @@ -761,23 +786,26 @@ process is a console one, or if it is windowed but windowed_process_io is non-zero */ do_io = !windowed || windowed_process_io ; - + if (do_io) { /* Create two unidirectional named pipes */ HANDLE htmp; SECURITY_ATTRIBUTES sa; - sa.nLength = sizeof(sa); + sa.nLength = sizeof (sa); sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = NULL; CreatePipe (&hprocin, &hmyshove, &sa, 0); CreatePipe (&hmyslurp, &hprocout, &sa, 0); - /* Duplicate the stdout handle for use as stderr */ - DuplicateHandle(GetCurrentProcess(), hprocout, GetCurrentProcess(), - &hprocerr, 0, TRUE, DUPLICATE_SAME_ACCESS); + if (separate_err) + CreatePipe (&hmyslurp_err, &hprocerr, &sa, 0); + else + /* Duplicate the stdout handle for use as stderr */ + DuplicateHandle(GetCurrentProcess(), hprocout, GetCurrentProcess(), + &hprocerr, 0, TRUE, DUPLICATE_SAME_ACCESS); /* Stupid Win32 allows to create a pipe with *both* ends either inheritable or not. We need process ends inheritable, and local @@ -790,6 +818,13 @@ &htmp, 0, FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS); hmyslurp = htmp; + if (separate_err) + { + DuplicateHandle (GetCurrentProcess(), hmyslurp_err, + GetCurrentProcess(), &htmp, 0, FALSE, + DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS); + hmyslurp_err = htmp; + } } /* Convert an argv vector into Win32 style command line by a call to @@ -825,11 +860,11 @@ Vprocess_environment terminated by 2 nuls. */ { - Intbyte **env; + Ibyte **env; REGISTER Lisp_Object tem; - REGISTER Intbyte **new_env; + REGISTER Ibyte **new_env; REGISTER int new_length = 0, i; - + for (tem = Vprocess_environment; (CONSP (tem) && STRINGP (XCAR (tem))); @@ -841,30 +876,30 @@ which we have superseded by gnuserv.c. (#### Does it work under MS Windows?) - sprintf (ppid_env_var_buffer, "EM_PARENT_PROCESS_ID=%d", + sprintf (ppid_env_var_buffer, "EM_PARENT_PROCESS_ID=%d", GetCurrentProcessId ()); arglen += strlen (ppid_env_var_buffer) + 1; numenv++; */ - + /* new_length + 1 to include terminating 0. */ - env = new_env = alloca_array (Intbyte *, new_length + 1); - + env = new_env = alloca_array (Ibyte *, new_length + 1); + /* Copy the Vprocess_environment strings into new_env. */ for (tem = Vprocess_environment; (CONSP (tem) && STRINGP (XCAR (tem))); tem = XCDR (tem)) { - Intbyte **ep = env; - Intbyte *string = XSTRING_DATA (XCAR (tem)); + Ibyte **ep = env; + Ibyte *string = XSTRING_DATA (XCAR (tem)); /* See if this string duplicates any string already in the env. If so, don't put it in. When an env var has multiple definitions, we keep the definition that comes first in process-environment. */ for (; ep != new_env; ep++) { - Intbyte *p = *ep, *q = string; + Ibyte *p = *ep, *q = string; while (1) { if (*q == 0) @@ -881,10 +916,10 @@ duplicate: ; } *new_env = 0; - + /* Sort the environment variables */ new_length = new_env - env; - qsort (env, new_length, sizeof (Intbyte *), mswindows_compare_env); + qsort (env, new_length, sizeof (Ibyte *), mswindows_compare_env); { DECLARE_EISTRING (envout); @@ -908,17 +943,17 @@ while leaving the real app name as argv[0]. */ if (is_dos_app) { - cmdname = (Intbyte *) alloca (PATH_MAX); + cmdname = (Ibyte *) ALLOCA (PATH_MAX); if (egetenv ("CMDPROXY")) qxestrcpy (cmdname, egetenv ("CMDPROXY")); else { qxestrcpy (cmdname, XSTRING_DATA (Vinvocation_directory)); - qxestrcat (cmdname, (Intbyte *) "cmdproxy.exe"); + qxestrcat (cmdname, (Ibyte *) "cmdproxy.exe"); } } #endif - + /* Create process */ { STARTUPINFOW si; @@ -969,7 +1004,7 @@ CloseHandle (hprocout); CloseHandle (hprocerr); } - + /* Handle process creation failure */ if (err) { @@ -977,6 +1012,8 @@ { CloseHandle (hmyshove); CloseHandle (hmyslurp); + if (separate_err) + CloseHandle (hmyslurp_err); } mswindows_report_process_error ("Error starting", @@ -988,7 +1025,9 @@ { NT_DATA(p)->h_process = pi.hProcess; NT_DATA(p)->dwProcessId = pi.dwProcessId; - init_process_io_handles (p, (void *)hmyslurp, (void *)hmyshove, 0); + init_process_io_handles (p, (void *) hmyslurp, (void *) hmyshove, + separate_err ? (void *) hmyslurp_err + : (void *) -1, 0); } else { @@ -1007,12 +1046,12 @@ } } -/* +/* * This method is called to update status fields of the process * structure. If the process has not existed, this method is expected * to do nothing. * - * The method is called only for real child processes. + * The method is called only for real child processes. */ static void @@ -1056,7 +1095,7 @@ /* use a reasonable-sized buffer (somewhere around the size of the stream buffer) so as to avoid inundating the stream with blocked data. */ - Intbyte chunkbuf[512]; + Ibyte chunkbuf[512]; Bytecount chunklen; while (1) @@ -1219,7 +1258,7 @@ WSACancelAsyncRequest (hasync); KillTimer (hwnd, SOCK_TIMER_ID); DestroyWindow (hwnd); - REALLY_QUIT; + QUIT; } } qxeDispatchMessage (&msg); @@ -1306,7 +1345,7 @@ unsigned long nonblock = 1; ioctlsocket (s, FIONBIO, &nonblock); } - + retval = connect (s, (struct sockaddr *) &address, sizeof (address)); if (retval != NO_ERROR && WSAGetLastError() != WSAEWOULDBLOCK) { @@ -1354,7 +1393,7 @@ WSAAsyncSelect (s, hwnd, XM_SOCKREPLY, 0); KillTimer (hwnd, SOCK_TIMER_ID); DestroyWindow (hwnd); - REALLY_QUIT; + QUIT; } } DispatchMessage (&msg); @@ -1378,7 +1417,7 @@ if (QUITP) { closesocket (s); - REALLY_QUIT; + QUIT; } /* Poll for quit every 250 ms */ diff --text -u 'xemacs-21.5.6/src/process-unix.c' 'xemacs-21.5.7/src/process-unix.c' Index: ././src/process-unix.c --- ././src/process-unix.c Mon Apr 1 12:58:46 2002 +++ ././src/process-unix.c Wed Jun 5 18:56:49 2002 @@ -51,10 +51,11 @@ #include "file-coding.h" #include +#include "sysdir.h" #include "sysfile.h" #include "sysproc.h" +#include "syssignal.h" #include "systime.h" -#include "syssignal.h" /* Always include before systty.h */ #include "systty.h" #include "syswait.h" @@ -77,6 +78,9 @@ int connected_via_filedesc_p; /* Descriptor by which we read from this process. -1 for dead process */ int infd; + /* Descriptor by which we read stderr from this process. -1 for + dead process */ + int errfd; /* Descriptor for the tty which this process is using. -1 if we didn't record it (on some systems, there's no need). */ int subtty; @@ -86,7 +90,7 @@ char pty_flag; }; -#define UNIX_DATA(p) ((struct unix_process_data*)((p)->process_data)) +#define UNIX_DATA(p) ((struct unix_process_data*) ((p)->process_data)) @@ -126,17 +130,18 @@ to get rid of irrelevant descriptors. */ static int -close_process_descs_mapfun (const void* key, void* contents, void* arg) +close_process_descs_mapfun (const void *key, void *contents, void *arg) { - Lisp_Object proc; - CVOID_TO_LISP (proc, contents); - event_stream_delete_stream_pair (XPROCESS(proc)->pipe_instream, - XPROCESS(proc)->pipe_outstream); + Lisp_Object proc = VOID_TO_LISP (contents); + USID vaffan, culo; + + event_stream_delete_io_streams (XPROCESS (proc)->pipe_instream, + XPROCESS (proc)->pipe_outstream, + XPROCESS (proc)->pipe_errstream, + &vaffan, &culo); return 0; } -/* #### This function is currently called from child_setup - in callproc.c. It should become static though - kkm */ void close_process_descs (void) { @@ -186,11 +191,11 @@ XPROCESS (proc)->pid = Fcons (infd, name); XPROCESS (proc)->buffer = buffer; - init_process_io_handles (XPROCESS (proc), (void*)inch, (void*)XINT (outfd), - 0); + init_process_io_handles (XPROCESS (proc), (void *) inch, + (void *) XINT (outfd), (void *) -1, 0); UNIX_DATA (XPROCESS (proc))->connected_via_filedesc_p = 1; - event_stream_select_process (XPROCESS (proc)); + event_stream_select_process (XPROCESS (proc), 1, 1); return proc; } @@ -201,7 +206,7 @@ #ifndef MAX_PTYNAME_LEN #define MAX_PTYNAME_LEN 64 #endif -static Intbyte pty_name[MAX_PTYNAME_LEN]; +static Ibyte pty_name[MAX_PTYNAME_LEN]; /* Open an available pty, returning a file descriptor. Return -1 on failure. @@ -223,8 +228,8 @@ grovelling code in allocate_pty_the_old_fashioned_way(). */ int master_fd = -1; const Extbyte *slave_name = NULL; - const CIntbyte *clone = NULL; - static const CIntbyte * const clones[] = + const CIbyte *clone = NULL; + static const CIbyte * const clones[] = /* Different pty master clone devices */ { "/dev/ptmx", /* Various systems */ @@ -278,7 +283,7 @@ for (i = 0; i < countof (clones); i++) { clone = clones[i]; - master_fd = qxe_open ((Intbyte *) clone, + master_fd = qxe_open ((Ibyte *) clone, O_RDWR | O_NONBLOCK | OPEN_BINARY, 0); if (master_fd >= 0) goto have_master; @@ -306,7 +311,7 @@ have_slave_name: { - Intbyte *slaveint; + Ibyte *slaveint; EXTERNAL_TO_C_STRING (slave_name, slaveint, Qfile_name); qxestrncpy (pty_name, slaveint, sizeof (pty_name)); @@ -512,7 +517,7 @@ #endif /* !USE_GETADDRINFO */ static void -set_socket_nonblocking_maybe (int fd, int port, const char* proto) +set_socket_nonblocking_maybe (int fd, int port, const char *proto) { #ifdef PROCESS_IO_BLOCKING Lisp_Object tail; @@ -720,17 +725,18 @@ process_signal_char (int tty_fd, int signo) { /* If it's not a tty, pray that these default values work */ - if (! isatty (tty_fd)) { + if (! isatty (tty_fd)) + { #define CNTL(ch) (037 & (ch)) - switch (signo) - { - case SIGINT: return CNTL ('C'); - case SIGQUIT: return CNTL ('\\'); + switch (signo) + { + case SIGINT: return CNTL ('C'); + case SIGQUIT: return CNTL ('\\'); #ifdef SIGTSTP - case SIGTSTP: return CNTL ('Z'); + case SIGTSTP: return CNTL ('Z'); #endif - } - } + } + } #ifdef HAVE_TERMIOS /* TERMIOS is the latest and bestest, and seems most likely to work. @@ -805,6 +811,7 @@ UNIX_DATA(p)->connected_via_filedesc_p = 0; UNIX_DATA(p)->infd = -1; + UNIX_DATA(p)->errfd = -1; UNIX_DATA(p)->subtty = -1; UNIX_DATA(p)->tty_name = Qnil; UNIX_DATA(p)->pty_flag = 0; @@ -843,9 +850,197 @@ */ static void -unix_init_process_io_handles (Lisp_Process *p, void* in, void* out, int flags) +unix_init_process_io_handles (Lisp_Process *p, void *in, void *out, void *err, + int flags) +{ + UNIX_DATA(p)->infd = (int) in; + UNIX_DATA(p)->errfd = (int) err; +} + +/* Move the file descriptor FD so that its number is not less than MIN. * + The original file descriptor remains open. */ +static int +relocate_fd (int fd, int min) +{ + if (fd >= min) + return fd; + else + { + int newfd = dup (fd); + if (newfd == -1) + { + Ibyte *errmess; + GET_STRERROR (errmess, errno); + stderr_out ("Error while setting up child: %s\n", errmess); + _exit (1); + } + return relocate_fd (newfd, min); + } +} + +/* This is the last thing run in a newly forked inferior process. + Copy descriptors IN, OUT and ERR + as descriptors STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO. + Initialize inferior's priority, pgrp, connected dir and environment. + then exec another program based on new_argv. + + XEmacs: We've removed the SET_PGRP argument because it's already + done by the callers of child_setup. + + CURRENT_DIR is an elisp string giving the path of the current + directory the subprocess should have. Since we can't really signal + a decent error from within the child (#### not quite correct in + XEmacs?), this should be verified as an executable directory by the + parent. */ + +static void +child_setup (int in, int out, int err, Ibyte **new_argv, + Lisp_Object current_dir) { - UNIX_DATA(p)->infd = (int)in; + Ibyte **env; + Ibyte *pwd; + +#ifdef SET_EMACS_PRIORITY + if (emacs_priority != 0) + nice (- emacs_priority); +#endif + +#if !defined (NO_SUBPROCESSES) + /* Close Emacs's descriptors that this process should not have. */ + close_process_descs (); +#endif /* not NO_SUBPROCESSES */ + close_load_descs (); + + /* [[Note that use of alloca is always safe here. It's obvious for systems + that do not have true vfork or that have true (stack) alloca. + If using vfork and C_ALLOCA it is safe because that changes + the superior's static variables as if the superior had done alloca + and will be cleaned up in the usual way.]] -- irrelevant because + XEmacs does not use vfork. */ + { + REGISTER Bytecount i; + + i = XSTRING_LENGTH (current_dir); + pwd = alloca_array (Ibyte, i + 6); + memcpy (pwd, "PWD=", 4); + memcpy (pwd + 4, XSTRING_DATA (current_dir), i); + i += 4; + if (!IS_DIRECTORY_SEP (pwd[i - 1])) + pwd[i++] = DIRECTORY_SEP; + pwd[i] = 0; + + /* [[We can't signal an Elisp error here; we're in a vfork. Since + the callers check the current directory before forking, this + should only return an error if the directory's permissions + are changed between the check and this chdir, but we should + at least check.]] -- irrelevant because XEmacs does not use vfork. */ + if (qxe_chdir (pwd + 4) < 0) + { + /* Don't report the chdir error, or ange-ftp.el doesn't work. */ + /* (FSFmacs does _exit (errno) here.) */ + pwd = 0; + } + else + { + /* Strip trailing "/". Cretinous *[]&@$#^%@#$% Un*x */ + /* leave "//" (from FSF) */ + while (i > 6 && IS_DIRECTORY_SEP (pwd[i - 1])) + pwd[--i] = 0; + } + } + + /* Set `env' to a vector of the strings in Vprocess_environment. */ + /* + 2 to include PWD and terminating 0. */ + env = alloca_array (Ibyte *, XINT (Flength (Vprocess_environment)) + 2); + { + REGISTER Lisp_Object tail; + Ibyte **new_env = env; + + /* If we have a PWD envvar and we know the real current directory, + pass one down, but with corrected value. */ + if (pwd && egetenv ("PWD")) + *new_env++ = pwd; + + /* Copy the Vprocess_environment strings into new_env. */ + for (tail = Vprocess_environment; + CONSP (tail) && STRINGP (XCAR (tail)); + tail = XCDR (tail)) + { + Ibyte **ep = env; + Ibyte *envvar = XSTRING_DATA (XCAR (tail)); + + /* See if envvar duplicates any string already in the env. + If so, don't put it in. + When an env var has multiple definitions, + we keep the definition that comes first in process-environment. */ + for (; ep != new_env; ep++) + { + Ibyte *p = *ep, *q = envvar; + while (1) + { + if (*q == 0) + /* The string is malformed; might as well drop it. */ + goto duplicate; + if (*q != *p) + break; + if (*q == '=') + goto duplicate; + p++, q++; + } + } + if (pwd && !qxestrncmp ((Ibyte *) "PWD=", envvar, 4)) + { + *new_env++ = pwd; + pwd = 0; + } + else + *new_env++ = envvar; + + duplicate: ; + } + + *new_env = 0; + } + + /* Make sure that in, out, and err are not actually already in + descriptors zero, one, or two; this could happen if Emacs is + started with its standard in, out, or error closed, as might + happen under X. */ + in = relocate_fd (in, 3); + out = relocate_fd (out, 3); + err = relocate_fd (err, 3); + + /* Set the standard input/output channels of the new process. */ + retry_close (STDIN_FILENO); + retry_close (STDOUT_FILENO); + retry_close (STDERR_FILENO); + + dup2 (in, STDIN_FILENO); + dup2 (out, STDOUT_FILENO); + dup2 (err, STDERR_FILENO); + + retry_close (in); + retry_close (out); + retry_close (err); + + /* I can't think of any reason why child processes need any more + than the standard 3 file descriptors. It would be cleaner to + close just the ones that need to be, but the following brute + force approach is certainly effective, and not too slow. + + #### Who the hell added this? We already close the descriptors + by using close_process_descs()!!! --ben */ + { + int fd; + for (fd = 3; fd <= 64; fd++) + retry_close (fd); + } + + /* we've wrapped execve; it translates its arguments */ + qxe_execve (new_argv[0], new_argv, env); + + stdout_out ("Can't exec program %s\n", new_argv[0]); + _exit (1); } /* @@ -861,14 +1056,17 @@ static int unix_create_process (Lisp_Process *p, Lisp_Object *argv, int nargv, - Lisp_Object program, Lisp_Object cur_dir) + Lisp_Object program, Lisp_Object cur_dir, + int separate_err) { int pid; int inchannel = -1; int outchannel = -1; + int errchannel = -1; /* Use volatile to protect variables from being clobbered by longjmp. */ volatile int forkin = -1; volatile int forkout = -1; + volatile int forkerr = -1; volatile int pty_flag = 0; if (!NILP (Vprocess_connection_type)) @@ -887,24 +1085,34 @@ #if !defined(USG) /* On USG systems it does not work to open the pty's tty here and then close and reopen it in the child. */ -#ifdef O_NOCTTY +# ifdef O_NOCTTY /* Don't let this terminal become our controlling terminal (in case we don't have one). */ forkout = forkin = qxe_open (pty_name, O_RDWR | O_NOCTTY | OPEN_BINARY, 0); -#else +# else forkout = forkin = qxe_open (pty_name, O_RDWR | OPEN_BINARY, 0); -#endif +# endif if (forkin < 0) goto io_failure; #endif /* not USG */ - UNIX_DATA(p)->pty_flag = pty_flag = 1; + UNIX_DATA (p)->pty_flag = pty_flag = 1; } else if (create_bidirectional_pipe (&inchannel, &outchannel, &forkin, &forkout) < 0) goto io_failure; + if (separate_err) + { + int sv[2]; + + if (pipe (sv) < 0) + goto io_failure; + forkerr = sv[1]; + errchannel = sv[0]; + } + #if 0 /* Replaced by close_process_descs */ set_exclusive_use (inchannel); @@ -912,13 +1120,16 @@ #endif set_descriptor_non_blocking (inchannel); + if (errchannel >= 0) + set_descriptor_non_blocking (errchannel); /* Record this as an active process, with its channels. As a result, child_setup will close Emacs's side of the pipes. */ - init_process_io_handles (p, (void*)inchannel, (void*)outchannel, + init_process_io_handles (p, (void *) inchannel, (void *) outchannel, + (void *) errchannel, pty_flag ? STREAM_PTY_FLUSHING : 0); /* Record the tty descriptor used in the subprocess. */ - UNIX_DATA(p)->subtty = forkin; + UNIX_DATA (p)->subtty = forkin; { pid = fork (); @@ -927,6 +1138,7 @@ /**** Now we're in the child process ****/ int xforkin = forkin; int xforkout = forkout; + int xforkerr = forkerr; /* Disconnect the current controlling terminal, pursuant to making the pty be the controlling terminal of the process. @@ -967,11 +1179,12 @@ /* SunOS has TIOCSCTTY but the close/open method also works. */ -# if defined (USG) || !defined (TIOCSCTTY) +#if defined (USG) || !defined (TIOCSCTTY) /* Now close the pty (if we had it open) and reopen it. This makes the pty the controlling terminal of the subprocess. */ - /* I wonder if retry_close (qxe_open (pty_name, ...)) would work? */ + /* I wonder if retry_close (qxe_open (pty_name, ...)) would + work? */ if (xforkin >= 0) retry_close (xforkin); xforkout = xforkin = qxe_open (pty_name, O_RDWR | OPEN_BINARY, 0); @@ -982,20 +1195,20 @@ retry_write (1, "\n", 1); _exit (1); } -# endif /* USG or not TIOCSCTTY */ +#endif /* USG or not TIOCSCTTY */ /* Miscellaneous setup required for some systems. Must be done before using tc* functions on xforkin. This guarantees that isatty(xforkin) is true. */ -# if defined (HAVE_ISASTREAM) && defined (I_PUSH) +#if defined (HAVE_ISASTREAM) && defined (I_PUSH) if (isastream (xforkin)) { -# if defined (I_FIND) -# define stream_module_pushed(fd, module) (ioctl (fd, I_FIND, module) == 1) -# else -# define stream_module_pushed(fd, module) 0 -# endif +# if defined (I_FIND) +# define stream_module_pushed(fd, module) (ioctl (fd, I_FIND, module) == 1) +# else +# define stream_module_pushed(fd, module) 0 +# endif if (! stream_module_pushed (xforkin, "ptem")) ioctl (xforkin, I_PUSH, "ptem"); if (! stream_module_pushed (xforkin, "ldterm")) @@ -1003,18 +1216,18 @@ if (! stream_module_pushed (xforkin, "ttcompat")) ioctl (xforkin, I_PUSH, "ttcompat"); } -# endif /* HAVE_ISASTREAM */ +#endif /* defined (HAVE_ISASTREAM) && defined (I_PUSH) */ -# ifdef TIOCSCTTY +#ifdef TIOCSCTTY /* We ignore the return value because faith@cs.unc.edu says that is necessary on Linux. */ assert (isatty (xforkin)); ioctl (xforkin, TIOCSCTTY, 0); -# endif /* TIOCSCTTY */ +#endif /* TIOCSCTTY */ /* Change the line discipline. */ -# if defined (HAVE_TERMIOS) && defined (LDISC1) +#if defined (HAVE_TERMIOS) && defined (LDISC1) { struct termios t; assert (isatty (xforkin)); @@ -1023,7 +1236,7 @@ if (tcsetattr (xforkin, TCSANOW, &t) < 0) perror ("create_process/tcsetattr LDISC1 failed\n"); } -# elif defined (NTTYDISC) && defined (TIOCSETD) +#elif defined (NTTYDISC) && defined (TIOCSETD) { /* Use new line discipline. TIOCSETD is accepted and ignored on Sys5.4 systems with ttcompat. */ @@ -1031,7 +1244,7 @@ assert (isatty (xforkin)); ioctl (xforkin, TIOCSETD, &ldisc); } -# endif /* TIOCSETD & NTTYDISC */ +#endif /* TIOCSETD & NTTYDISC */ /* Make our process group be the foreground group of our new controlling terminal. */ @@ -1059,7 +1272,7 @@ EMACS_SIGNAL (SIGQUIT, SIG_DFL); { - Intbyte **new_argv = alloca_array (Intbyte *, nargv + 2); + Ibyte **new_argv = alloca_array (Ibyte *, nargv + 2); int i; /* Nothing below here GCs so our string pointers shouldn't move. */ @@ -1071,7 +1284,8 @@ } new_argv[i + 1] = 0; - child_setup (xforkin, xforkout, xforkout, new_argv, cur_dir); + child_setup (xforkin, xforkout, separate_err ? xforkerr : xforkout, + new_argv, cur_dir); } } /**** End of child code ****/ @@ -1081,15 +1295,20 @@ if (pid < 0) { + /* Note: The caller set up an unwind-protect to automatically delete + the process if we fail. This will correctly deselect and close + inchannel, outchannel, and errchannel. */ int save_errno = errno; close_descriptor_pair (forkin, forkout); + if (separate_err) + retry_close (forkerr); errno = save_errno; report_process_error ("Doing fork", Qunbound); } /* #### dmoore - why is this commented out, otherwise we leave subtty = forkin, but then we close forkin just below. */ - /* UNIX_DATA(p)->subtty = -1; */ + /* UNIX_DATA (p)->subtty = -1; */ /* If the subfork execv fails, and it exits, this close hangs. I don't know why. @@ -1098,6 +1317,8 @@ close_safely (forkin); if (forkin != forkout && forkout >= 0) retry_close (forkout); + if (separate_err) + retry_close (forkerr); UNIX_DATA (p)->tty_name = pty_flag ? build_intstring (pty_name) : Qnil; @@ -1108,11 +1329,12 @@ we're waiting for an event, when status_notify() is called). */ return pid; -io_failure: + io_failure: { int save_errno = errno; close_descriptor_pair (forkin, forkout); close_descriptor_pair (inchannel, outchannel); + close_descriptor_pair (forkerr, errchannel); errno = save_errno; report_process_error ("Opening pty or pipe", Qunbound); RETURN_NOT_REACHED (0) @@ -1124,15 +1346,15 @@ static int unix_tooltalk_connection_p (Lisp_Process *p) { - return UNIX_DATA(p)->connected_via_filedesc_p; + return UNIX_DATA (p)->connected_via_filedesc_p; } /* This is called to set process' virtual terminal size */ static int -unix_set_window_size (Lisp_Process* p, int cols, int rows) +unix_set_window_size (Lisp_Process *p, int cols, int rows) { - return set_window_size (UNIX_DATA(p)->infd, cols, rows); + return set_window_size (UNIX_DATA (p)->infd, cols, rows); } /* @@ -1145,7 +1367,7 @@ #ifdef HAVE_WAITPID static void -unix_update_status_if_terminated (Lisp_Process* p) +unix_update_status_if_terminated (Lisp_Process *p) { int w; #ifdef SIGCHLD @@ -1182,7 +1404,7 @@ return; } -#ifdef EMACS_BLOCK_SIGNAL +#ifdef EMACS_BLOCK_SIGNAL EMACS_BLOCK_SIGNAL (SIGCHLD); #endif for (i = 0; i < exited_processes_index; i++) @@ -1215,7 +1437,7 @@ /* If process has terminated, stop waiting for its output. */ if (WIFSIGNALED (w) || WIFEXITED (w)) { - if (!NILP(p->pipe_instream)) + if (!NILP (p->pipe_instream)) { /* We can't just call event_stream->unselect_process_cb (p) here, because that calls XtRemoveInput, which is not @@ -1225,6 +1447,7 @@ } } } +#ifdef NEED_SYNC_PROCESS_CODE else { /* There was no asynchronous process found for that id. Check @@ -1242,6 +1465,7 @@ synch_process_death = signal_name (WTERMSIG (w)); } } +#endif /* NEED_SYNC_PROCESS_CODE */ } exited_processes_index = 0; @@ -1265,7 +1489,7 @@ } static void -unix_send_process (Lisp_Object proc, struct lstream* lstream) +unix_send_process (Lisp_Object proc, struct lstream *lstream) { /* Use volatile to protect variables from being clobbered by longjmp. */ SIGTYPE (*volatile old_sigpipe) (int) = 0; @@ -1285,7 +1509,7 @@ /* use a reasonable-sized buffer (somewhere around the size of the stream buffer) so as to avoid inundating the stream with blocked data. */ - Intbyte chunkbuf[512]; + Ibyte chunkbuf[512]; Bytecount chunklen; while (1) @@ -1367,10 +1591,10 @@ character in init_process_io_handles but here it simply screws things up. */ #if 0 - Intbyte eof_char = get_eof_char (XPROCESS (proc)); + Ibyte eof_char = get_eof_char (XPROCESS (proc)); send_process (proc, Qnil, &eof_char, 0, 1); #else - send_process (proc, Qnil, (const Intbyte *) "\004", 0, 1); + send_process (proc, Qnil, (const Ibyte *) "\004", 0, 1); #endif return 1; } @@ -1381,31 +1605,34 @@ * inactive state. * * The return value is a unique stream ID, as returned by - * event_stream_delete_stream_pair + * event_stream_delete_io_streams * - * In the lack of this method, only event_stream_delete_stream_pair + * In the lack of this method, only event_stream_delete_io_streams * is called on both I/O streams of the process. * * The UNIX version guards this by ignoring possible SIGPIPE. */ -static USID -unix_deactivate_process (Lisp_Process *p) +static void +unix_deactivate_process (Lisp_Process *p, + USID *in_usid, + USID *err_usid) { SIGTYPE (*old_sigpipe) (int) = 0; - USID usid; if (UNIX_DATA(p)->infd >= 0) flush_pending_output (UNIX_DATA(p)->infd); + if (UNIX_DATA(p)->errfd >= 0) + flush_pending_output (UNIX_DATA(p)->errfd); /* closing the outstream could result in SIGPIPE, so ignore it. */ old_sigpipe = (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, SIG_IGN); - usid = event_stream_delete_stream_pair (p->pipe_instream, p->pipe_outstream); + event_stream_delete_io_streams (p->pipe_instream, p->pipe_outstream, + p->pipe_errstream, in_usid, err_usid); EMACS_SIGNAL (SIGPIPE, old_sigpipe); UNIX_DATA(p)->infd = -1; - - return usid; + UNIX_DATA(p)->errfd = -1; } /* If the subtty field of the process data is not filled in, do so now. */ @@ -1456,6 +1683,7 @@ case SIGQUIT: case SIGKILL: flush_pending_output (d->infd); + flush_pending_output (d->errfd); break; } @@ -1504,10 +1732,10 @@ /* If possible, send signals to the entire pgrp by sending an input character to it. */ { - char sigchar = process_signal_char (d->subtty, signo); + Ibyte sigchar = process_signal_char (d->subtty, signo); if (sigchar) { - send_process (proc, Qnil, (Intbyte *) &sigchar, 0, 1); + send_process (proc, Qnil, &sigchar, 0, 1); return; } } @@ -1605,11 +1833,11 @@ retval = getaddrinfo (ext_host, NULL, &hints, &res); if (retval != 0) { - CIntbyte *gai_error; + CIbyte *gai_err; - EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_error, + EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, Qstrerror_encoding); - maybe_signal_error (Qio_error, gai_error, host, + maybe_signal_error (Qio_error, gai_err, host, Qprocess, ERROR_ME_DEBUG_WARN); canonname = host; } @@ -1701,11 +1929,11 @@ retval = getaddrinfo (ext_host, portstring, &hints, &res); if (retval != 0) { - CIntbyte *gai_error; + CIbyte *gai_err; - EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_error, + EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, Qstrerror_encoding); - signal_error (Qio_error, gai_error, list2 (host, service)); + signal_error (Qio_error, gai_err, list2 (host, service)); } /* address loop */ @@ -1785,7 +2013,7 @@ #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS speed_up_interrupts (); #endif - REALLY_QUIT; + QUIT; /* In case something really weird happens ... */ #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS slow_down_interrupts (); @@ -1805,7 +2033,8 @@ if (retval == -1 && errno != EISCONN) { xerrno = errno; - if (errno == EINTR) + + if (errno == EINTR || errno == EINPROGRESS || errno == EALREADY) goto loop; if (errno == EADDRINUSE && retry < 20) { @@ -1819,7 +2048,7 @@ at this point so we can use `sleep'. (Again, this was not conditionalized on FreeBSD. - Let's not mess up systems without the problem. --ben) + Let's not mess up systems without the problem. --ben) */ sleep (1); #endif @@ -1920,8 +2149,8 @@ static void unix_open_multicast_group (Lisp_Object name, Lisp_Object dest, - Lisp_Object port, Lisp_Object ttl, void** vinfd, - void** voutfd) + Lisp_Object port, Lisp_Object ttl, void **vinfd, + void **voutfd) { struct ip_mreq imr; struct sockaddr_in sa; @@ -2017,7 +2246,7 @@ #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS speed_up_interrupts (); #endif - REALLY_QUIT; + QUIT; /* In case something really weird happens ... */ #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS slow_down_interrupts (); @@ -2033,10 +2262,11 @@ { int xerrno = errno; - if (errno == EINTR) + if (errno == EINTR || errno == EINPROGRESS || errno == EALREADY) goto loop; if (errno == EADDRINUSE && retry < 20) { +#ifdef __FreeBSD__ /* A delay here is needed on some FreeBSD systems, and it is harmless, since this retrying takes time anyway and should be infrequent. @@ -2044,6 +2274,7 @@ slowed down so it can't be used here. Async timers should already be disabled at this point so we can use `sleep'. */ sleep (1); +#endif retry++; goto loop; } diff --text -u 'xemacs-21.5.6/src/process.c' 'xemacs-21.5.7/src/process.c' Index: ././src/process.c --- ././src/process.c Mon Apr 1 12:58:46 2002 +++ ././src/process.c Wed Jun 5 18:56:51 2002 @@ -21,18 +21,23 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This file has been Mule-ized except for `start-process-internal', - `open-network-stream-internal' and `open-multicast-group-internal'. */ +/* This file has been Mule-ized. */ /* This file has been split into process.c and process-unix.c by Kirill M. Katsnelson , so please bash him and not - the original author(s) */ + the original author(s). -#include + Non-synch-subprocess stuff (mostly process environment) moved from + callproc.c, 4-3-02, Ben Wing. -#if !defined (NO_SUBPROCESSES) + callproc.c deleted entirely 5-23-02, Ben Wing. Good riddance! +*/ -/* The entire file is within this conditional */ +#include + +#if defined (NO_SUBPROCESSES) +#error "We don't support this anymore." +#endif #include "lisp.h" @@ -48,16 +53,17 @@ #include "opaque.h" #include "process.h" #include "procimpl.h" +#include "sysdep.h" #include "window.h" #include "sysfile.h" #include "sysproc.h" +#include "syssignal.h" #include "systime.h" -#include "syssignal.h" /* Always include before systty.h */ #include "systty.h" #include "syswait.h" -Lisp_Object Qprocessp, Qprocess_live_p; +Lisp_Object Qprocessp, Qprocess_live_p, Qprocess_readable_p; /* Process methods */ struct process_methods the_process_methods; @@ -98,25 +104,38 @@ /* Nonzero means delete a process right away if it exits. */ int delete_exited_processes; -/* Hash table which maps USIDs as returned by create_stream_pair_cb to +/* Hash table which maps USIDs as returned by create_io_streams_cb to process objects. Processes are not GC-protected through this! */ struct hash_table *usid_to_process; /* List of process objects. */ Lisp_Object Vprocess_list; -extern Lisp_Object Vlisp_EXEC_SUFFIXES; Lisp_Object Vnull_device; /* Cons of coding systems used to initialize process I/O on a newly- created process. */ Lisp_Object Vdefault_process_coding_system; +/* Same for a network connection. */ +Lisp_Object Vdefault_network_coding_system; Lisp_Object Qprocess_error; Lisp_Object Qnetwork_error; Fixnum debug_process_io; +Lisp_Object Vshell_file_name; + +/* The environment to pass to all subprocesses when they are started. + This is in the semi-bogus format of ("VAR=VAL" "VAR2=VAL2" ... ) + */ +Lisp_Object Vprocess_environment; + +/* Make sure egetenv() not called too soon */ +int env_initted; + +Lisp_Object Vlisp_EXEC_SUFFIXES; + static Lisp_Object @@ -127,14 +146,19 @@ mark_object (process->name); mark_object (process->command); mark_object (process->filter); + mark_object (process->stderr_filter); mark_object (process->sentinel); mark_object (process->buffer); mark_object (process->mark); + mark_object (process->stderr_buffer); + mark_object (process->stderr_mark); mark_object (process->pid); mark_object (process->pipe_instream); mark_object (process->pipe_outstream); + mark_object (process->pipe_errstream); mark_object (process->coding_instream); mark_object (process->coding_outstream); + mark_object (process->coding_errstream); return process->status_symbol; } @@ -153,14 +177,15 @@ else { int netp = network_connection_p (object); - write_c_string ((netp ? GETTEXT ("#name, printcharfun, 1); - write_c_string ((netp ? " " : " pid "), printcharfun); + write_c_string (printcharfun, (netp ? " " : " pid ")); print_internal (process->pid, printcharfun, 1); write_fmt_string_lisp (printcharfun, " state:%S", 1, process->status_symbol); MAYBE_PROCMETH (print_process_data, (process, printcharfun)); - write_c_string (">", printcharfun); + write_c_string (printcharfun, ">"); } } @@ -200,15 +225,20 @@ /* This function returns low-level streams, connected directly to the child process, rather than en/decoding streams */ void -get_process_streams (Lisp_Process *p, Lisp_Object *instr, Lisp_Object *outstr) +get_process_streams (Lisp_Process *p, Lisp_Object *instr, Lisp_Object *outstr, + Lisp_Object *errstr) { assert (p); - assert (NILP (p->pipe_instream) || LSTREAMP(p->pipe_instream)); - assert (NILP (p->pipe_outstream) || LSTREAMP(p->pipe_outstream)); + assert (NILP (p->pipe_instream) || LSTREAMP (p->pipe_instream)); + assert (NILP (p->pipe_outstream) || LSTREAMP (p->pipe_outstream)); + assert (NILP (p->pipe_errstream) || LSTREAMP (p->pipe_errstream)); *instr = p->pipe_instream; *outstr = p->pipe_outstream; + *errstr = p->pipe_errstream; } +/* Given a USID referring to either a process's instream or errstream, + return the associated process. */ Lisp_Process * get_process_from_usid (USID usid) { @@ -219,7 +249,7 @@ if (gethash ((const void*)usid, usid_to_process, &vval)) { Lisp_Object process; - CVOID_TO_LISP (process, vval); + process = VOID_TO_LISP (vval); return XPROCESS (process); } else @@ -227,15 +257,16 @@ } int -get_process_selected_p (Lisp_Process *p) +get_process_selected_p (Lisp_Process *p, int do_err) { - return p->selected; + return do_err ? p->err_selected : p->in_selected; } void -set_process_selected_p (Lisp_Process *p, int selected_p) +set_process_selected_p (Lisp_Process *p, int in_selected, int err_selected) { - p->selected = !!selected_p; + p->in_selected = !!in_selected; + p->err_selected = !!err_selected; } int @@ -269,6 +300,29 @@ ? Qt : Qnil; } +#if 0 +/* This is a reasonable definition for this new primitive. Kyle sez: + + "The patch looks OK to me except for the creation and exporting of the + Fprocess_readable_p function. I don't think a new Lisp function + should be created until we know something actually needs it. If + we later want to give process-readable-p different semantics it + may be hard to do it and stay compatible with what we hastily + create today." + + He's right, not yet. Let's discuss the semantics on XEmacs Design + before enabling this. +*/ +DEFUN ("process-readable-p", Fprocess_readable_p, 1, 1, 0, /* +Return t if OBJECT is a process from which input may be available. +*/ + (object)) +{ + return PROCESSP (object) && PROCESS_READABLE_P (XPROCESS (object)) + ? Qt : Qnil; +} +#endif + DEFUN ("process-list", Fprocess_list, 0, 0, 0, /* Return a list of all processes. */ @@ -451,22 +505,29 @@ p->command = Qnil; p->filter = Qnil; + p->stderr_filter = Qnil; p->sentinel = Qnil; p->buffer = Qnil; p->mark = Fmake_marker (); + p->stderr_buffer = Qnil; + p->stderr_mark = Fmake_marker (); p->pid = Qnil; p->status_symbol = Qrun; p->exit_code = 0; p->core_dumped = 0; p->filter_does_read = 0; p->kill_without_query = 0; - p->selected = 0; + p->separate_stderr = 0; + p->in_selected = 0; + p->err_selected = 0; p->tick = 0; p->update_tick = 0; p->pipe_instream = Qnil; p->pipe_outstream = Qnil; + p->pipe_errstream = Qnil; p->coding_instream = Qnil; p->coding_outstream = Qnil; + p->coding_errstream = Qnil; p->process_data = 0; MAYBE_PROCMETH (alloc_process_data, (p)); @@ -478,19 +539,34 @@ } void -init_process_io_handles (Lisp_Process *p, void* in, void* out, int flags) +init_process_io_handles (Lisp_Process *p, void* in, void* out, void* err, + int flags) { - USID usid; + USID in_usid, err_usid; Lisp_Object incode, outcode; - if (!CONSP (Vdefault_process_coding_system) || - NILP (incode = (find_coding_system_for_text_file - (Fcar (Vdefault_process_coding_system), 1))) || - NILP (outcode = (find_coding_system_for_text_file - (Fcdr (Vdefault_process_coding_system), 0)))) - signal_error (Qinvalid_state, - "Bogus value for `default-process-coding-system'", - Vdefault_process_coding_system); + if (flags & STREAM_NETWORK_CONNECTION) + { + if (!CONSP (Vdefault_network_coding_system) || + NILP (incode = (find_coding_system_for_text_file + (Fcar (Vdefault_network_coding_system), 1))) || + NILP (outcode = (find_coding_system_for_text_file + (Fcdr (Vdefault_network_coding_system), 0)))) + signal_error (Qinvalid_state, + "Bogus value for `default-network-coding-system'", + Vdefault_network_coding_system); + } + else + { + if (!CONSP (Vdefault_process_coding_system) || + NILP (incode = (find_coding_system_for_text_file + (Fcar (Vdefault_process_coding_system), 1))) || + NILP (outcode = (find_coding_system_for_text_file + (Fcdr (Vdefault_process_coding_system), 0)))) + signal_error (Qinvalid_state, + "Bogus value for `default-process-coding-system'", + Vdefault_process_coding_system); + } if (!NILP (Vcoding_system_for_read) && NILP (incode = (find_coding_system_for_text_file @@ -506,28 +582,41 @@ "Bogus value for `coding-system-for-write'", Vcoding_system_for_write); - usid = event_stream_create_stream_pair (in, out, - &p->pipe_instream, - &p->pipe_outstream, - flags); + event_stream_create_io_streams (in, out, err, + &p->pipe_instream, + &p->pipe_outstream, + &p->pipe_errstream, + &in_usid, &err_usid, + flags); - if (usid == USID_ERROR) + if (in_usid == USID_ERROR || err_usid == USID_ERROR) signal_error (Qprocess_error, "Setting up communication with subprocess", - Qunbound); + wrap_process (p)); + + if (in_usid != USID_DONTHASH) + { + Lisp_Object process = Qnil; + process = wrap_process (p); + puthash ((const void*) in_usid, LISP_TO_VOID (process), usid_to_process); + } - if (usid != USID_DONTHASH) + if (err_usid != USID_DONTHASH) { Lisp_Object process = Qnil; process = wrap_process (p); - puthash ((const void *) usid, LISP_TO_VOID (process), usid_to_process); + puthash ((const void*) err_usid, LISP_TO_VOID (process), + usid_to_process); } - MAYBE_PROCMETH (init_process_io_handles, (p, in, out, flags)); + MAYBE_PROCMETH (init_process_io_handles, (p, in, out, err, flags)); p->coding_instream = make_coding_input_stream (XLSTREAM (p->pipe_instream), incode, CODING_DECODE, 0); - Lstream_set_character_mode (XLSTREAM (p->coding_instream)); + if (!NILP (p->pipe_errstream)) + p->coding_errstream = + make_coding_input_stream + (XLSTREAM (p->pipe_errstream), incode, CODING_DECODE, 0); p->coding_outstream = make_coding_output_stream (XLSTREAM (p->pipe_outstream), outcode, CODING_ENCODE, 0); @@ -535,7 +624,8 @@ static void create_process (Lisp_Object process, Lisp_Object *argv, int nargv, - Lisp_Object program, Lisp_Object cur_dir) + Lisp_Object program, Lisp_Object cur_dir, + int separate_err) { Lisp_Process *p = XPROCESS (process); int pid; @@ -545,11 +635,12 @@ p->status_symbol = Qrun; p->exit_code = 0; - pid = PROCMETH (create_process, (p, argv, nargv, program, cur_dir)); + pid = PROCMETH (create_process, (p, argv, nargv, program, cur_dir, + separate_err)); p->pid = make_int (pid); - if (PROCESS_LIVE_P (p)) - event_stream_select_process (p); + if (PROCESS_READABLE_P (p)) + event_stream_select_process (p, 1, 1); } /* This function is the unwind_protect form for Fstart_process_internal. If @@ -567,24 +658,41 @@ } DEFUN ("start-process-internal", Fstart_process_internal, 3, MANY, 0, /* -Start a program in a subprocess. Return the process object for it. +Internal function to start a program in a subprocess. +Lisp callers should use `start-process' instead. + +Returns the process object for it. Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS NAME is name for process. It is modified if necessary to make it unique. BUFFER is the buffer or (buffer-name) to associate with the process. Process output goes at end of that buffer, unless you specify an output stream or filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated - with any buffer + with any buffer. +BUFFER can also have the form (REAL-BUFFER STDERR-BUFFER); in that case, + REAL-BUFFER says what to do with standard output, as above, + while STDERR-BUFFER says what to do with standard error in the child. + STDERR-BUFFER may be nil (discard standard error output, unless a stderr + filter is set). Note that if you do not use this form at process creation, + stdout and stderr will be mixed in the output buffer, and this cannot be + changed, even by setting a stderr filter. Third arg is program file name. It is searched for as in the shell. Remaining arguments are strings to give program as arguments. -INCODE and OUTCODE specify the coding-system objects used in input/output - from/to the process. + +Read and write coding systems for the process are determined from +`coding-system-for-read' and `coding-system-for-write' (intended as +overriding coding systems to be *bound* by Lisp code, not set), or +from `default-process-coding-system' if either or both are nil. You can +change the coding systems later on using `set-process-coding-system', +`set-process-input-coding-system', or `set-process-output-coding-system'. + +See also `set-process-filter' and `set-process-stderr-filter'. */ (int nargs, Lisp_Object *args)) { /* This function can call lisp */ - /* !!#### This function has not been Mule-ized */ - Lisp_Object buffer, name, program, process, current_dir; + Lisp_Object buffer, stderr_buffer, name, program, process, current_dir; + int separate_stderr; Lisp_Object tem; int speccount = specpdl_depth (); struct gcpro gcpro1, gcpro2, gcpro3; @@ -597,8 +705,28 @@ /* Protect against various file handlers doing GCs below. */ GCPRO3 (buffer, program, current_dir); + if (CONSP (buffer)) + { + if (!CONSP (XCDR (buffer))) + invalid_argument ("Invalid BUFFER argument to `start-process'", + buffer); + if (!NILP (XCDR (XCDR (buffer)))) + invalid_argument ("Invalid BUFFER argument to `start-process'", + buffer); + stderr_buffer = XCAR (XCDR (buffer)); + buffer = XCAR (buffer); + separate_stderr = 1; + } + else + { + stderr_buffer = Qnil; + separate_stderr = 0; + } + if (!NILP (buffer)) buffer = Fget_buffer_create (buffer); + if (!NILP (stderr_buffer)) + stderr_buffer = Fget_buffer_create (stderr_buffer); CHECK_STRING (name); CHECK_STRING (program); @@ -628,9 +756,9 @@ #endif /* 0 */ /* If program file name is not absolute, search our path for it */ - if (!IS_DIRECTORY_SEP (XSTRING_BYTE (program, 0)) + if (!IS_DIRECTORY_SEP (string_byte (program, 0)) && !(XSTRING_LENGTH (program) > 1 - && IS_DEVICE_SEP (XSTRING_BYTE (program, 1)))) + && IS_DEVICE_SEP (string_byte (program, 1)))) { struct gcpro ngcpro1; @@ -665,13 +793,17 @@ process = make_process_internal (name); XPROCESS (process)->buffer = buffer; - XPROCESS (process)->command = Flist (nargs - 2, - args + 2); + XPROCESS (process)->stderr_buffer = stderr_buffer; + XPROCESS (process)->separate_stderr = separate_stderr; + XPROCESS (process)->command = Flist (nargs - 2, args + 2); /* Make the process marker point into the process buffer (if any). */ if (!NILP (buffer)) Fset_marker (XPROCESS (process)->mark, make_int (BUF_ZV (XBUFFER (buffer))), buffer); + if (!NILP (stderr_buffer)) + Fset_marker (XPROCESS (process)->stderr_mark, + make_int (BUF_ZV (XBUFFER (stderr_buffer))), stderr_buffer); /* If an error occurs and we can't start the process, we want to remove it from the process list. This means that each error @@ -679,7 +811,8 @@ itself; it's all taken care of here. */ record_unwind_protect (start_process_unwind, process); - create_process (process, args + 3, nargs - 3, program, current_dir); + create_process (process, args + 3, nargs - 3, program, current_dir, + separate_stderr); UNGCPRO; return unbind_to_1 (speccount, process); @@ -769,9 +902,10 @@ XPROCESS (process)->pid = Fcons (service, host); XPROCESS (process)->buffer = buffer; init_process_io_handles (XPROCESS (process), (void *) inch, (void *) outch, + (void *) -1, STREAM_NETWORK_CONNECTION); - event_stream_select_process (XPROCESS (process)); + event_stream_select_process (XPROCESS (process), 1, 1); UNGCPRO; NUNGCPRO; @@ -818,10 +952,11 @@ XPROCESS (process)->pid = Fcons (port, dest); XPROCESS (process)->buffer = buffer; - init_process_io_handles (XPROCESS (process), (void*)inch, (void*)outch, + init_process_io_handles (XPROCESS (process), (void *) inch, (void *) outch, + (void *) -1, STREAM_NETWORK_CONNECTION); - event_stream_select_process (XPROCESS (process)); + event_stream_select_process (XPROCESS (process), 1, 1); UNGCPRO; return process; @@ -856,6 +991,54 @@ /* Process I/O */ /************************************************************************/ +/* Set up PROCESS's buffer for insertion of process data at PROCESS's + mark. + + Sets the current buffer to PROCESS's buffer, inhibits read only, + remembers current point, sets point to PROCESS'S mark, widens if + necessary. +*/ +static int +process_setup_for_insertion (Lisp_Object process, int read_stderr) +{ + Lisp_Process *p = XPROCESS (process); + int spec = specpdl_depth (); + Lisp_Object buffer = read_stderr ? p->stderr_buffer : p->buffer; + Lisp_Object mark = read_stderr ? p->stderr_mark : p->mark; + struct buffer *buf = XBUFFER (buffer); + Charbpos output_pt; + + if (buf != current_buffer) + { + record_unwind_protect (save_current_buffer_restore, + Fcurrent_buffer ()); + set_buffer_internal (buf); + } + + record_unwind_protect (save_excursion_restore, save_excursion_save ()); + specbind (Qinhibit_read_only, Qt); + + /* Insert new output into buffer + at the current end-of-output marker, + thus preserving logical ordering of input and output. */ + if (XMARKER (mark)->buffer) + output_pt = marker_position (mark); + else + output_pt = BUF_ZV (buf); + + /* If the output marker is outside of the visible region, save + the restriction and widen. */ + if (! (BUF_BEGV (buf) <= output_pt && output_pt <= BUF_ZV (buf))) + { + record_unwind_protect (save_restriction_restore, + save_restriction_save (buf)); + Fwiden (wrap_buffer (buf)); + } + + BUF_SET_PT (buf, output_pt); + return spec; +} + /* Read pending output from the process channel, starting with our buffered-ahead character if we have one. Yield number of characters read. @@ -865,13 +1048,16 @@ you must call it repeatedly until it returns zero. */ Charcount -read_process_output (Lisp_Object process) +read_process_output (Lisp_Object process, int read_stderr) { /* This function can GC */ Bytecount nbytes, nchars; - Intbyte chars[1025]; + Ibyte chars[1025]; Lisp_Object outstream; Lisp_Process *p = XPROCESS (process); + Lisp_Object filter = read_stderr ? p->stderr_filter : p->filter; + Lisp_Object buffer = read_stderr ? p->stderr_buffer : p->buffer; + Lisp_Object mark = read_stderr ? p->stderr_mark : p->mark; /* If there is a lot of output from the subprocess, the loop in execute_internal_event() might call read_process_output() more @@ -881,25 +1067,29 @@ Really, the loop in execute_internal_event() should check itself for a process-filter change, like in status_notify(); but the struct Lisp_Process is not exported outside of this file. */ - if (!PROCESS_LIVE_P (p)) - return -1; /* already closed */ + if (!PROCESS_READABLE_P (p)) + { + errno = 0; + return -1; /* already closed */ + } - if (!NILP (p->filter) && (p->filter_does_read)) + if (!NILP (filter) && (p->filter_does_read)) { Lisp_Object filter_result; /* Some weird FSFmacs crap here with - Vdeactivate_mark and current_buffer->keymap */ - running_asynch_code = 1; - filter_result = call2_trapping_errors ("Error in process filter", - p->filter, process, Qnil); - running_asynch_code = 0; - restore_match_data (); + Vdeactivate_mark and current_buffer->keymap. + Some FSF junk with running_asynch_code, to preserve the match + data. Not necessary because we don't call process filters + asynchronously (i.e. from within QUIT). */ + /* Don't catch errors here; we're not in any critical code. */ + filter_result = call2 (filter, process, Qnil); CHECK_INT (filter_result); return XINT (filter_result); } - nbytes = Lstream_read (XLSTREAM (DATA_INSTREAM (p)), chars, + nbytes = Lstream_read (read_stderr ? XLSTREAM (DATA_ERRSTREAM (p)) : + XLSTREAM (DATA_INSTREAM (p)), chars, sizeof (chars) - 1); if (nbytes <= 0) return nbytes; @@ -912,63 +1102,25 @@ /* !!#### if the coding system changed as a result of reading, we need to change the output coding system accordingly. */ nchars = bytecount_to_charcount (chars, nbytes); - outstream = p->filter; + outstream = filter; if (!NILP (outstream)) { - /* We used to bind inhibit-quit to t here, but - call2_trapping_errors() does that for us. */ - running_asynch_code = 1; - call2_trapping_errors ("Error in process filter", - outstream, process, make_string (chars, nbytes)); - running_asynch_code = 0; - restore_match_data (); + /* Some FSF junk with running_asynch_code, to preserve the match + data. Not necessary because we don't call process filters + asynchronously (i.e. from within QUIT). */ + /* Don't catch errors here; we're not in any critical code. */ + call2 (outstream, process, make_string (chars, nbytes)); return nchars; } /* If no filter, write into buffer if it isn't dead. */ - if (!NILP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) + if (!NILP (buffer) && BUFFER_LIVE_P (XBUFFER (buffer))) { - Lisp_Object old_read_only = Qnil; - Charbpos old_point; - Charbpos old_begv; - Charbpos old_zv; - struct gcpro gcpro1, gcpro2; - struct buffer *buf = XBUFFER (p->buffer); - - GCPRO2 (process, old_read_only); - - old_point = BUF_PT (buf); - old_begv = BUF_BEGV (buf); - old_zv = BUF_ZV (buf); - old_read_only = buf->read_only; - buf->read_only = Qnil; - - /* Insert new output into buffer - at the current end-of-output marker, - thus preserving logical ordering of input and output. */ - if (XMARKER (p->mark)->buffer) - BUF_SET_PT (buf, - charbpos_clip_to_bounds (old_begv, marker_position (p->mark), - old_zv)); - else - BUF_SET_PT (buf, old_zv); + struct gcpro gcpro1; + struct buffer *buf = XBUFFER (buffer); + int spec = process_setup_for_insertion (process, read_stderr); - /* If the output marker is outside of the visible region, save - the restriction and widen. */ - if (! (BUF_BEGV (buf) <= BUF_PT (buf) && - BUF_PT (buf) <= BUF_ZV (buf))) - Fwiden (p->buffer); - - /* Make sure opoint floats ahead of any new text, just as point - would. */ - if (BUF_PT (buf) <= old_point) - old_point += nchars; - - /* Insert after old_begv, but before old_zv. */ - if (BUF_PT (buf) < old_begv) - old_begv += nchars; - if (BUF_PT (buf) <= old_zv) - old_zv += nchars; + GCPRO1 (process); #if 0 /* This screws up initial display of the window. jla */ @@ -981,34 +1133,31 @@ buffer_insert_raw_string (buf, chars, nbytes); #endif - Fset_marker (p->mark, make_int (BUF_PT (buf)), p->buffer); + Fset_marker (mark, make_int (BUF_PT (buf)), buffer); MARK_MODELINE_CHANGED; - - /* If the restriction isn't what it should be, set it. */ - if (old_begv != BUF_BEGV (buf) || old_zv != BUF_ZV (buf)) - { - Fwiden(p->buffer); - old_begv = charbpos_clip_to_bounds (BUF_BEG (buf), - old_begv, - BUF_Z (buf)); - old_zv = charbpos_clip_to_bounds (BUF_BEG (buf), - old_zv, - BUF_Z (buf)); - Fnarrow_to_region (make_int (old_begv), make_int (old_zv), - p->buffer); - } - - buf->read_only = old_read_only; - old_point = charbpos_clip_to_bounds (BUF_BEGV (buf), - old_point, - BUF_ZV (buf)); - BUF_SET_PT (buf, old_point); - + unbind_to (spec); UNGCPRO; } return nchars; } + +int +process_has_separate_stderr (Lisp_Object process) +{ + return XPROCESS (process)->separate_stderr; +} + +DEFUN ("process-has-separate-stderr-p", Fprocess_has_separate_stderr_p, 1, 1, + 0, /* +Return non-nil if process has stderr separate from stdout. +*/ + (process)) +{ + CHECK_PROCESS (process); + return process_has_separate_stderr (process) ? Qt : Qnil; +} + /* Sending data to subprocess */ @@ -1022,7 +1171,7 @@ void send_process (Lisp_Object process, - Lisp_Object relocatable, const Intbyte *nonrelocatable, + Lisp_Object relocatable, const Ibyte *nonrelocatable, int start, int len) { /* This function can GC */ @@ -1094,6 +1243,33 @@ return XPROCESS (process)->buffer; } +DEFUN ("set-process-stderr-buffer", Fset_process_stderr_buffer, 2, 2, 0, /* +Set stderr buffer associated with PROCESS to BUFFER (a buffer, or nil). +*/ + (process, buffer)) +{ + CHECK_PROCESS (process); + if (!XPROCESS (process)->separate_stderr) + invalid_change ("stdout and stderr not separate", process); + if (!NILP (buffer)) + CHECK_BUFFER (buffer); + XPROCESS (process)->stderr_buffer = buffer; + return buffer; +} + +DEFUN ("process-stderr-buffer", Fprocess_stderr_buffer, 1, 1, 0, /* +Return the stderr buffer PROCESS is associated with. +Output from the stderr of PROCESS is inserted in this buffer +unless PROCESS has a stderr filter. +*/ + (process)) +{ + CHECK_PROCESS (process); + if (!XPROCESS (process)->separate_stderr) + invalid_change ("stdout and stderr not separate", process); + return XPROCESS (process)->stderr_buffer; +} + DEFUN ("process-mark", Fprocess_mark, 1, 1, 0, /* Return the marker for the end of the last output from PROCESS. */ @@ -1103,23 +1279,58 @@ return XPROCESS (process)->mark; } +DEFUN ("process-stderr-mark", Fprocess_stderr_mark, 1, 1, 0, /* +Return the marker for the end of the last stderr output from PROCESS. +*/ + (process)) +{ + CHECK_PROCESS (process); + if (!XPROCESS (process)->separate_stderr) + invalid_operation ("stdout and stderr not separate", process); + return XPROCESS (process)->stderr_mark; +} + void -set_process_filter (Lisp_Object process, Lisp_Object filter, int filter_does_read) +set_process_filter (Lisp_Object process, Lisp_Object filter, + int filter_does_read, int set_stderr) { CHECK_PROCESS (process); - if (PROCESS_LIVE_P (XPROCESS (process))) { - if (EQ (filter, Qt)) - event_stream_unselect_process (XPROCESS (process)); - else - event_stream_select_process (XPROCESS (process)); - } + if (set_stderr && !XPROCESS (process)->separate_stderr) + invalid_change ("stdout and stderr not separate", process); + if (PROCESS_READABLE_P (XPROCESS (process))) + { + if (EQ (filter, Qt)) + event_stream_unselect_process (XPROCESS (process), !set_stderr, + set_stderr); + else + event_stream_select_process (XPROCESS (process), !set_stderr, + set_stderr); + } - XPROCESS (process)->filter = filter; + if (set_stderr) + XPROCESS (process)->stderr_filter = filter; + else + XPROCESS (process)->filter = filter; XPROCESS (process)->filter_does_read = filter_does_read; } DEFUN ("set-process-filter", Fset_process_filter, 2, 2, 0, /* Give PROCESS the filter function FILTER; nil means no filter. +t means stop accepting output from the process. (If process was created +with +When a process has a filter, each time it does output +the entire string of output is passed to the filter. +The filter gets two arguments: the process and the string of output. +If the process has a filter, its buffer is not used for output. +*/ + (process, filter)) +{ + set_process_filter (process, filter, 0, 0); + return filter; +} + +DEFUN ("set-process-stderr-filter", Fset_process_stderr_filter, 2, 2, 0, /* +Give PROCESS the stderr filter function FILTER; nil means no filter. t means stop accepting output from the process. When a process has a filter, each time it does output the entire string of output is passed to the filter. @@ -1128,7 +1339,7 @@ */ (process, filter)) { - set_process_filter (process, filter, 0); + set_process_filter (process, filter, 0, 1); return filter; } @@ -1142,14 +1353,26 @@ return XPROCESS (process)->filter; } +DEFUN ("process-stderr-filter", Fprocess_stderr_filter, 1, 1, 0, /* +Return the filter function of PROCESS; nil if none. +See `set-process-stderr-filter' for more info on filter functions. +*/ + (process)) +{ + CHECK_PROCESS (process); + if (!XPROCESS (process)->separate_stderr) + invalid_operation ("stdout and stderr not separate", process); + return XPROCESS (process)->stderr_filter; +} + DEFUN ("process-send-region", Fprocess_send_region, 3, 4, 0, /* Send current contents of the region between START and END as input to PROCESS. PROCESS may be a process or the name of a process, or a buffer or the name of a buffer, in which case the buffer's process is used. If it is nil, the current buffer's process is used. BUFFER specifies the buffer to look in; if nil, the current buffer is used. -If STRING is more than 100 or so characters long, it may be sent in -several chunks. This may happen even for shorter strings. Output +If the region is more than 100 or so characters long, it may be sent in +several chunks. This may happen even for shorter regions. Output from processes can arrive in between chunks. */ (process, start, end, buffer)) @@ -1197,7 +1420,7 @@ (process)) { process = get_process (process); - CHECK_LIVE_PROCESS (process); + CHECK_READABLE_PROCESS (process); return (coding_stream_detected_coding_system (XLSTREAM (XPROCESS (process)->coding_instream))); } @@ -1219,7 +1442,7 @@ (process)) { process = get_process (process); - CHECK_LIVE_PROCESS (process); + CHECK_READABLE_PROCESS (process); return Fcons (coding_stream_detected_coding_system (XLSTREAM (XPROCESS (process)->coding_instream)), coding_stream_coding_system @@ -1235,7 +1458,7 @@ { codesys = get_coding_system_for_text_file (codesys, 1); process = get_process (process); - CHECK_LIVE_PROCESS (process); + CHECK_READABLE_PROCESS (process); set_coding_stream_coding_system (XLSTREAM (XPROCESS (process)->coding_instream), codesys); @@ -1283,9 +1506,8 @@ static Lisp_Object exec_sentinel_unwind (Lisp_Object datum) { - Lisp_Cons *d = XCONS (datum); - XPROCESS (d->car)->sentinel = d->cdr; - free_cons (d); + XPROCESS (XCAR (datum))->sentinel = XCDR (datum); + free_cons (datum); return Qnil; } @@ -1303,16 +1525,20 @@ /* Some weird FSFmacs crap here with Vdeactivate_mark and current_buffer->keymap */ + /* Some FSF junk with running_asynch_code, to preserve the match + data. Not necessary because we don't call process filters + asynchronously (i.e. from within QUIT). */ + /* Zilch the sentinel while it's running, to avoid recursive invocations; - assure that it gets restored no matter how the sentinel exits. */ + assure that it gets restored no matter how the sentinel exits. + + (#### Why is this necessary? Probably another relic of asynchronous + calling of process filters/sentinels.) */ p->sentinel = Qnil; - record_unwind_protect (exec_sentinel_unwind, noseeum_cons (process, sentinel)); - /* We used to bind inhibit-quit to t here, but call2_trapping_errors() - does that for us. */ - running_asynch_code = 1; - call2_trapping_errors ("Error in process sentinel", sentinel, process, reason); - running_asynch_code = 0; - restore_match_data (); + record_unwind_protect (exec_sentinel_unwind, + noseeum_cons (process, sentinel)); + /* Don't catch errors here; we're not in any critical code. */ + call2 (sentinel, process, reason); unbind_to (speccount); } @@ -1379,7 +1605,7 @@ else string2 = build_string ("\n"); set_string_char (string, 0, - DOWNCASE (0, XSTRING_CHAR (string, 0))); + DOWNCASE (0, string_ichar (string, 0))); return concat2 (string, string2); } else if (EQ (symbol, Qexit)) @@ -1400,7 +1626,7 @@ /* Tell status_notify() to check for terminated processes. We do this because on some systems we sometimes miss SIGCHLD calls. (Not sure - why.) */ + why.) This is also used under Mswin. */ void kick_status_notify (void) @@ -1464,7 +1690,10 @@ /* If process is still active, read any output that remains. */ while (!EQ (p->filter, Qt) - && read_process_output (process) > 0) + && read_process_output (process, 0) > 0) + ; + while (p->separate_stderr && !EQ (p->stderr_filter, Qt) + && read_process_output (process, 1) > 0) ; /* Get the text to use for the message. */ @@ -1487,48 +1716,23 @@ exec_sentinel (process, msg); /* Don't bother with a message in the buffer when a process becomes runnable. */ - else if (!EQ (symbol, Qrun) && !NILP (p->buffer)) + else if (!EQ (symbol, Qrun) && !NILP (p->buffer) && + /* Avoid error if buffer is deleted + (probably that's why the process is dead, too) */ + BUFFER_LIVE_P (XBUFFER (p->buffer))) { - Lisp_Object old_read_only = Qnil; - Lisp_Object old = Fcurrent_buffer (); - Charbpos opoint; - struct gcpro ngcpro1, ngcpro2; - - /* Avoid error if buffer is deleted - (probably that's why the process is dead, too) */ - if (!BUFFER_LIVE_P (XBUFFER (p->buffer))) - continue; - - NGCPRO2 (old, old_read_only); - Fset_buffer (p->buffer); - opoint = BUF_PT (current_buffer); - /* Insert new output into buffer - at the current end-of-output marker, - thus preserving logical ordering of input and output. */ - if (XMARKER (p->mark)->buffer) - BUF_SET_PT (current_buffer, marker_position (p->mark)); - else - BUF_SET_PT (current_buffer, BUF_ZV (current_buffer)); - if (BUF_PT (current_buffer) <= opoint) - opoint += (XSTRING_CHAR_LENGTH (msg) - + XSTRING_CHAR_LENGTH (p->name) - + 10); + struct gcpro ngcpro1; + int spec = process_setup_for_insertion (process, 0); - old_read_only = current_buffer->read_only; - current_buffer->read_only = Qnil; + NGCPRO1 (process); buffer_insert_c_string (current_buffer, "\nProcess "); Finsert (1, &p->name); buffer_insert_c_string (current_buffer, " "); Finsert (1, &msg); - current_buffer->read_only = old_read_only; Fset_marker (p->mark, make_int (BUF_PT (current_buffer)), p->buffer); - opoint = charbpos_clip_to_bounds(BUF_BEGV (XBUFFER (p->buffer)), - opoint, - BUF_ZV (XBUFFER (p->buffer))); - BUF_SET_PT (current_buffer, opoint); - Fset_buffer (old); + unbind_to (spec); NUNGCPRO; } } @@ -1600,7 +1804,7 @@ return XINT (signal_); else { - Intbyte *name; + Ibyte *name; CHECK_SYMBOL (signal_); name = XSTRING_DATA (XSYMBOL (signal_)->name); @@ -1912,8 +2116,11 @@ { if (!NILP (DATA_OUTSTREAM (XPROCESS (process)))) { + USID humpty, dumpty; Lstream_close (XLSTREAM (DATA_OUTSTREAM (XPROCESS (process)))); - event_stream_delete_stream_pair (Qnil, XPROCESS (process)->pipe_outstream); + event_stream_delete_io_streams (Qnil, + XPROCESS (process)->pipe_outstream, + Qnil, &humpty, &dumpty); XPROCESS (process)->pipe_outstream = Qnil; XPROCESS (process)->coding_outstream = Qnil; } @@ -1931,7 +2138,7 @@ deactivate_process (Lisp_Object process) { Lisp_Process *p = XPROCESS (process); - USID usid; + USID in_usid, err_usid; /* It's possible that we got as far in the process-creation process as creating the descriptors but didn't get so @@ -1939,37 +2146,44 @@ case, p->pid is nil: p->pid is set at the same time that the process is selected for input. */ /* #### The comment does not look correct. event_stream_unselect_process - is guarded by process->selected, so this is not a problem. - kkm*/ + is guarded by process->*_selected, so this is not a problem. - kkm*/ /* Must call this before setting the streams to nil */ - event_stream_unselect_process (p); + event_stream_unselect_process (p, 1, 1); if (!NILP (DATA_OUTSTREAM (p))) Lstream_close (XLSTREAM (DATA_OUTSTREAM (p))); if (!NILP (DATA_INSTREAM (p))) Lstream_close (XLSTREAM (DATA_INSTREAM (p))); + if (!NILP (DATA_ERRSTREAM (p))) + Lstream_close (XLSTREAM (DATA_ERRSTREAM (p))); /* Provide minimal implementation for deactivate_process if there's no process-specific one */ if (HAS_PROCMETH_P (deactivate_process)) - usid = PROCMETH (deactivate_process, (p)); + PROCMETH (deactivate_process, (p, &in_usid, &err_usid)); else - usid = event_stream_delete_stream_pair (p->pipe_instream, - p->pipe_outstream); - - if (usid != USID_DONTHASH) - remhash ((const void*)usid, usid_to_process); + event_stream_delete_io_streams (p->pipe_instream, + p->pipe_outstream, + p->pipe_errstream, + &in_usid, &err_usid); + + if (in_usid != USID_DONTHASH) + remhash ((const void*)in_usid, usid_to_process); + if (err_usid != USID_DONTHASH) + remhash ((const void*)err_usid, usid_to_process); p->pipe_instream = Qnil; p->pipe_outstream = Qnil; + p->pipe_errstream = Qnil; p->coding_instream = Qnil; p->coding_outstream = Qnil; + p->coding_errstream = Qnil; } static void remove_process (Lisp_Object process) { Vprocess_list = delq_no_quit (process, Vprocess_list); - Fset_marker (XPROCESS (process)->mark, Qnil, Qnil); deactivate_process (process); } @@ -2048,11 +2262,189 @@ return XPROCESS (process)->kill_without_query ? Qt : Qnil; } + +#if 0 + +DEFUN ("process-connection", Fprocess_connection, 0, 1, 0, /* +Return the connection type of `PROCESS'. This can be nil (pipe), +t or pty (pty) or stream (socket connection). +*/ + (process)) +{ + return XPROCESS (process)->type; +} + +#endif /* 0 */ + + +static int +getenv_internal (const Ibyte *var, + Bytecount varlen, + Ibyte **value, + Bytecount *valuelen) +{ + Lisp_Object scan; + + assert (env_initted); + + for (scan = Vprocess_environment; CONSP (scan); scan = XCDR (scan)) + { + Lisp_Object entry = XCAR (scan); + + if (STRINGP (entry) + && XSTRING_LENGTH (entry) > varlen + && string_byte (entry, varlen) == '=' +#ifdef WIN32_NATIVE + /* NT environment variables are case insensitive. */ + && ! memicmp (XSTRING_DATA (entry), var, varlen) +#else /* not WIN32_NATIVE */ + && ! memcmp (XSTRING_DATA (entry), var, varlen) +#endif /* not WIN32_NATIVE */ + ) + { + *value = XSTRING_DATA (entry) + (varlen + 1); + *valuelen = XSTRING_LENGTH (entry) - (varlen + 1); + return 1; + } + } + + return 0; +} + +static void +putenv_internal (const Ibyte *var, + Bytecount varlen, + const Ibyte *value, + Bytecount valuelen) +{ + Lisp_Object scan; + + assert (env_initted); + + for (scan = Vprocess_environment; CONSP (scan); scan = XCDR (scan)) + { + Lisp_Object entry = XCAR (scan); + + if (STRINGP (entry) + && XSTRING_LENGTH (entry) > varlen + && string_byte (entry, varlen) == '=' +#ifdef WIN32_NATIVE + /* NT environment variables are case insensitive. */ + && ! memicmp (XSTRING_DATA (entry), var, varlen) +#else /* not WIN32_NATIVE */ + && ! memcmp (XSTRING_DATA (entry), var, varlen) +#endif /* not WIN32_NATIVE */ + ) + { + XCAR (scan) = concat3 (make_string (var, varlen), + build_string ("="), + make_string (value, valuelen)); + return; + } + } + + Vprocess_environment = Fcons (concat3 (make_string (var, varlen), + build_string ("="), + make_string (value, valuelen)), + Vprocess_environment); +} + +/* NOTE: + + FSF has this as a Lisp function, as follows. Generally moving things + out of C and into Lisp is a good idea, but in this case the Lisp + function is used so early in the startup sequence that it would be ugly + to rearrange the early dumped code to accommodate this. + +(defun getenv (variable) + "Get the value of environment variable VARIABLE. +VARIABLE should be a string. Value is nil if VARIABLE is undefined in +the environment. Otherwise, value is a string. + +This function consults the variable `process-environment' +for its value." + (interactive (list (read-envvar-name "Get environment variable: " t))) + (let ((value (getenv-internal variable))) + (when (interactive-p) + (message "%s" (if value value "Not set"))) + value)) +*/ + +DEFUN ("getenv", Fgetenv, 1, 2, "sEnvironment variable: \np", /* +Return the value of environment variable VAR, as a string. +VAR is a string, the name of the variable. +When invoked interactively, prints the value in the echo area. +*/ + (var, interactivep)) +{ + Ibyte *value; + Bytecount valuelen; + Lisp_Object v = Qnil; + struct gcpro gcpro1; + + CHECK_STRING (var); + GCPRO1 (v); + if (getenv_internal (XSTRING_DATA (var), XSTRING_LENGTH (var), + &value, &valuelen)) + v = make_string (value, valuelen); + if (!NILP (interactivep)) + { + if (NILP (v)) + message ("%s not defined in environment", XSTRING_DATA (var)); + else + /* #### Should use Fprin1_to_string or Fprin1 to handle string + containing quotes correctly. */ + message ("\"%s\"", value); + } + RETURN_UNGCPRO (v); +} + +/* A version of getenv that consults Vprocess_environment, easily + callable from C. + + (At init time, Vprocess_environment is initialized from the + environment, stored in the global variable environ. [Note that + at startup time, `environ' should be the same as the envp parameter + passed to main(); however, later calls to putenv() may change + `environ', making the envp parameter inaccurate.] Calls to getenv() + and putenv() consult and modify `environ'. However, once + Vprocess_environment is initted, XEmacs C code should *NEVER* call + getenv() or putenv() directly, because (1) Lisp code that modifies + the environment only modifies Vprocess_environment, not `environ'; + and (2) Vprocess_environment is in internal format but `environ' + is in some external format, and getenv()/putenv() are not Mule- + encapsulated. + + WARNING: This value points into Lisp string data and thus will become + invalid after a GC. */ + +Ibyte * +egetenv (const CIbyte *var) +{ + /* This cannot GC -- 7-28-00 ben */ + Ibyte *value; + Bytecount valuelen; + + if (getenv_internal ((const Ibyte *) var, strlen (var), &value, &valuelen)) + return value; + else + return 0; +} + +void +eputenv (const CIbyte *var, const CIbyte *value) +{ + putenv_internal ((Ibyte *) var, strlen (var), (Ibyte *) value, + strlen (value)); +} + /* This is not named init_process in order to avoid a conflict with NS 3.3 */ void init_xemacs_process (void) { + /* This function can GC */ + MAYBE_PROCMETH (init_process, ()); Vprocess_list = Qnil; @@ -2061,21 +2453,61 @@ clrhash (usid_to_process); else usid_to_process = make_hash_table (32); -} -#if 0 + { + /* jwz: always initialize Vprocess_environment, so that egetenv() + works in temacs. */ + char **envp; + Vprocess_environment = Qnil; + for (envp = environ; envp && *envp; envp++) + Vprocess_environment = + Fcons (build_ext_string (*envp, Qnative), Vprocess_environment); + /* This gets set back to 0 in disksave_object_finalization() */ + env_initted = 1; + } -xxDEFUN ("process-connection", Fprocess_connection, 0, 1, 0, /* -Return the connection type of `PROCESS'. This can be nil (pipe), -t or pty (pty) or stream (socket connection). -*/ - (process)) -{ - return XPROCESS (process)->type; -} + { + /* Initialize shell-file-name from environment variables or best guess. */ +#ifdef WIN32_NATIVE + const Ibyte *shell = egetenv ("SHELL"); + if (!shell) shell = egetenv ("COMSPEC"); + /* Should never happen! */ + if (!shell) shell = + (Ibyte *) (GetVersion () & 0x80000000 ? "command" : "cmd"); +#else /* not WIN32_NATIVE */ + const Ibyte *shell = egetenv ("SHELL"); + if (!shell) shell = (Ibyte *) "/bin/sh"; +#endif + +#if 0 /* defined (WIN32_NATIVE) */ + /* BAD BAD BAD. We do not wanting to be passing an XEmacs-created + SHELL var down to some inferior Cygwin process, which might get + screwed up. + + There are a few broken apps (eterm/term.el, eterm/tshell.el, + os-utils/terminal.el, texinfo/tex-mode.el) where this will + cause problems. Those broken apps don't look at + shell-file-name, instead just at explicit-shell-file-name, + ESHELL and SHELL. They are apparently attempting to borrow + what `M-x shell' uses, but that latter also looks at + shell-file-name. What we want is for all of these apps to look + at shell-file-name, so that the user can change the value of + shell-file-name and everything will work out hunky-dorey. + */ + if (!egetenv ("SHELL")) + { + Ibyte *faux_var = alloca_array (Ibyte, 7 + qxestrlen (shell)); + qxesprintf (faux_var, "SHELL=%s", shell); + Vprocess_environment = Fcons (build_intstring (faux_var), + Vprocess_environment); + } #endif /* 0 */ + Vshell_file_name = build_intstring (shell); + } +} + void syms_of_process (void) { @@ -2087,7 +2519,10 @@ DEFSYMBOL (Qstop); DEFSYMBOL (Qopen); DEFSYMBOL (Qclosed); - +#if 0 + /* see comment at Fprocess_readable_p */ + DEFSYMBOL (&Qprocess_readable_p); +#endif DEFSYMBOL (Qtcp); DEFSYMBOL (Qudp); @@ -2100,6 +2535,10 @@ DEFSUBR (Fprocessp); DEFSUBR (Fprocess_live_p); +#if 0 + /* see comment at Fprocess_readable_p */ + DEFSUBR (Fprocess_readable_p); +#endif DEFSUBR (Fget_process); DEFSUBR (Fget_buffer_process); DEFSUBR (Fdelete_process); @@ -2109,11 +2548,17 @@ DEFSUBR (Fprocess_name); DEFSUBR (Fprocess_tty_name); DEFSUBR (Fprocess_command); + DEFSUBR (Fprocess_has_separate_stderr_p); DEFSUBR (Fset_process_buffer); + DEFSUBR (Fset_process_stderr_buffer); DEFSUBR (Fprocess_buffer); DEFSUBR (Fprocess_mark); + DEFSUBR (Fprocess_stderr_buffer); + DEFSUBR (Fprocess_stderr_mark); DEFSUBR (Fset_process_filter); DEFSUBR (Fprocess_filter); + DEFSUBR (Fset_process_stderr_filter); + DEFSUBR (Fprocess_stderr_filter); DEFSUBR (Fset_process_window_size); DEFSUBR (Fset_process_sentinel); DEFSUBR (Fprocess_sentinel); @@ -2144,6 +2589,7 @@ DEFSUBR (Fset_process_output_coding_system); DEFSUBR (Fprocess_coding_system); DEFSUBR (Fset_process_coding_system); + DEFSUBR (Fgetenv); } void @@ -2224,14 +2670,36 @@ /* This below will get its default set correctly in code-init.el. */ Vdefault_process_coding_system = Fcons (Qundecided, Qnil); + DEFVAR_LISP ("default-network-coding-system", + &Vdefault_network_coding_system /* +Cons of coding systems used for network I/O by default. +The car part is used for reading (decoding) data from a process, and +the cdr part is used for writing (encoding) data to a process. +*/ ); + Vdefault_network_coding_system = Fcons (Qundecided, Qnil); + #ifdef PROCESS_IO_BLOCKING DEFVAR_LISP ("network-stream-blocking-port-list", &network_stream_blocking_port_list /* List of port numbers or port names to set a blocking I/O mode with connection. -Nil value means to set a default(non-blocking) I/O mode. +Nil value means to set a default (non-blocking) I/O mode. The value takes effect when `open-network-stream-internal' is called. */ ); network_stream_blocking_port_list = Qnil; #endif /* PROCESS_IO_BLOCKING */ -} -#endif /* not NO_SUBPROCESSES */ + /* This function can GC */ + DEFVAR_LISP ("shell-file-name", &Vshell_file_name /* +*File name to load inferior shells from. +Initialized from the SHELL environment variable. +*/ ); + + DEFVAR_LISP ("process-environment", &Vprocess_environment /* +List of environment variables for subprocesses to inherit. +Each element should be a string of the form ENVVARNAME=VALUE. +The environment which Emacs inherits is placed in this variable +when Emacs starts. +*/ ); + + Vlisp_EXEC_SUFFIXES = build_string (EXEC_SUFFIXES); + staticpro (&Vlisp_EXEC_SUFFIXES); +} diff --text -u 'xemacs-21.5.6/src/process.h' 'xemacs-21.5.7/src/process.h' Index: ././src/process.h --- ././src/process.h Fri Mar 29 13:48:21 2002 +++ ././src/process.h Fri Jun 21 06:18:41 2002 @@ -1,5 +1,6 @@ /* Definitions for asynchronous process control in XEmacs. Copyright (C) 1985, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -32,7 +33,6 @@ #define kill_buffer_processes(x) 0 #define close_process_descs() 0 #define init_xemacs_process() 0 -void wait_without_blocking (void); #else /* not NO_SUBPROCESSES */ @@ -44,7 +44,8 @@ #define wrap_process(p) wrap_record (p, process) #define PROCESSP(x) RECORDP (x, process) #define CHECK_PROCESS(x) CHECK_RECORD (x, process) -#define PROCESS_LIVE_P(x) (!NILP ((x)->pipe_instream)) +#define PROCESS_LIVE_P(x) (EQ ((x)->status_symbol, Qrun)) +#define PROCESS_READABLE_P(x) (!NILP ((x)->pipe_instream)) #define CHECK_LIVE_PROCESS(x) do { \ CHECK_PROCESS (x); \ @@ -52,11 +53,27 @@ dead_wrong_type_argument (Qprocess_live_p, (x)); \ } while (0) -#ifdef emacs +#define CHECK_READABLE_PROCESS(x) do { \ + CHECK_PROCESS (x); \ + if (! PROCESS_READABLE_P (XPROCESS (x))) \ + dead_wrong_type_argument (Qprocess_readable_p, (x)); \ +} while (0) +EXFUN (Fdelete_process, 1); +EXFUN (Fget_buffer_process, 1); +EXFUN (Fget_process, 1); +EXFUN (Fprocess_status, 1); EXFUN (Fprocess_kill_without_query, 2); EXFUN (Fprocess_id, 1); +DECLARE_DOESNT_RETURN (report_process_error (const char *, Lisp_Object)); +DECLARE_DOESNT_RETURN (report_network_error (const char *, Lisp_Object)); +extern Lisp_Object Vlisp_EXEC_SUFFIXES; + +Ibyte *egetenv (const CIbyte *var); +void eputenv (const CIbyte *var, const CIbyte *value); +extern int env_initted; + extern Lisp_Object Qprocess_live_p; Lisp_Object connect_to_file_descriptor (Lisp_Object name, @@ -66,31 +83,18 @@ int connected_via_filedesc_p (Lisp_Process *p); void kill_buffer_processes (Lisp_Object buffer); void close_process_descs (void); - -void set_process_filter (Lisp_Object proc, - Lisp_Object filter, int filter_does_read); - -/* True iff we are about to fork off a synchronous process or if we - are waiting for it. */ -extern volatile int synch_process_alive; - -/* Nonzero => this is a string explaining death of synchronous subprocess. */ -extern const char *synch_process_death; - -/* If synch_process_death is zero, - this is exit code of synchronous subprocess. */ -extern int synch_process_retcode; - - +void set_process_filter (Lisp_Object proc, Lisp_Object filter, + int filter_does_read, + int set_stderr); void update_process_status (Lisp_Object p, Lisp_Object status_symbol, int exit_code, int core_dumped); - void get_process_streams (Lisp_Process *p, - Lisp_Object *instr, Lisp_Object *outstr); -int get_process_selected_p (Lisp_Process *p); -void set_process_selected_p (Lisp_Process *p, int selected_p); - + Lisp_Object *instr, Lisp_Object *outstr, + Lisp_Object *errstr); +int get_process_selected_p (Lisp_Process *p, int do_err); +void set_process_selected_p (Lisp_Process *p, int in_selected, + int err_selected); Lisp_Process *get_process_from_usid (USID usid); #ifdef HAVE_SOCKETS @@ -107,21 +111,10 @@ This is done while Emacs is waiting for keyboard input. */ void status_notify (void); void kick_status_notify (void); - void deactivate_process (Lisp_Object proc); - -#ifdef WIN32_NATIVE -int -#else -void -#endif -child_setup (int in, int out, int err, - Intbyte **new_argv, Lisp_Object current_dir); - -Charcount read_process_output (Lisp_Object proc); - +Charcount read_process_output (Lisp_Object proc, int read_stderr); +int process_has_separate_stderr (Lisp_Object proc); const char *signal_name (int signum); - Lisp_Object canonicalize_host_name (Lisp_Object host); #endif /* not NO_SUBPROCESSES */ @@ -137,7 +130,5 @@ #ifndef EXEC_SUFFIXES #define EXEC_SUFFIXES "" #endif - -#endif /* emacs */ #endif /* INCLUDED_process_h_ */ diff --text -u 'xemacs-21.5.6/src/procimpl.h' 'xemacs-21.5.7/src/procimpl.h' Index: ././src/procimpl.h --- ././src/procimpl.h Wed Mar 13 17:52:56 2002 +++ ././src/procimpl.h Wed Jun 5 18:56:52 2002 @@ -1,5 +1,6 @@ /* Processes implementation header Copyright (C) 1985, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -40,10 +41,11 @@ void (*finalize_process_data) (Lisp_Process *proc, int for_disksave); void (*alloc_process_data) (Lisp_Process *p); void (*init_process_io_handles) (Lisp_Process *p, - void* in, void* out, int flags); + void* in, void* out, void *err, int flags); int (*create_process) (Lisp_Process *p, Lisp_Object *argv, int nargv, - Lisp_Object program, Lisp_Object cur_dir); + Lisp_Object program, Lisp_Object cur_dir, + int separate_err); int (*tooltalk_connection_p) (Lisp_Process *p); #ifdef HAVE_SOCKETS void (*open_network_stream) (Lisp_Object name, Lisp_Object host, @@ -65,7 +67,9 @@ int (*kill_process_by_pid) (int pid, int sigcode); int (*process_send_eof) (Lisp_Object proc); Lisp_Object (*get_tty_name) (Lisp_Process *p); - USID (*deactivate_process) (Lisp_Process *p); + void (*deactivate_process) (Lisp_Process *p, + USID* in_usid, + USID* err_usid); void (*init_process) (void); }; @@ -98,12 +102,15 @@ /* (funcall FILTER PROC STRING) (if FILTER is non-nil) to dispose of a bunch of chars from the process all at once */ Lisp_Object filter; + /* (funcall FILTER PROC STRING) (if FILTER is non-nil) + to dispose of a bunch of chars from the stderr of process all at once */ + Lisp_Object stderr_filter; /* (funcall SENTINEL PROCESS) when process state changes */ Lisp_Object sentinel; - /* Buffer that output is going to */ - Lisp_Object buffer; + /* Buffer that output or stderr output is going to */ + Lisp_Object buffer, stderr_buffer; /* Marker set to end of last buffer-inserted output from this process */ - Lisp_Object mark; + Lisp_Object mark, stderr_mark; /* Lisp_Int of subprocess' PID, or a cons of service/host if this is really a network connection */ Lisp_Object pid; @@ -124,19 +131,23 @@ channel, rather than having a call to make_string. This only works if the filter is a subr. */ char filter_does_read; - /* Non-nil means kill silently if Emacs is exited. */ + /* Non-zero means kill silently if Emacs is exited. */ char kill_without_query; - char selected; + char in_selected, err_selected; /* Event-count of last event in which this process changed status. */ volatile int tick; /* Event-count of last such event reported. */ int update_tick; + /* Non-zero if stderr and stdout are separated. */ + char separate_stderr; /* Low level streams used in input and output, connected to child */ Lisp_Object pipe_instream; Lisp_Object pipe_outstream; + Lisp_Object pipe_errstream; /* Data end streams, decoding and encoding pipe_* streams */ Lisp_Object coding_instream; Lisp_Object coding_outstream; + Lisp_Object coding_errstream; /* Implementation dependent data */ void *process_data; @@ -145,6 +156,7 @@ /* Macros to refer to data connection streams */ #define DATA_INSTREAM(p) (p)->coding_instream #define DATA_OUTSTREAM(p) (p)->coding_outstream +#define DATA_ERRSTREAM(p) (p)->coding_errstream /* Random externs from process.c */ extern Lisp_Object Qrun, Qstop, Qopen, Qclosed; @@ -168,10 +180,10 @@ Lisp_Object make_process_internal (Lisp_Object name); void init_process_io_handles (Lisp_Process *p, void* in, - void* out, int flags); + void* out, void *err, int flags); void send_process (Lisp_Object proc, Lisp_Object relocatable, - const Intbyte *nonrelocatable, + const Ibyte *nonrelocatable, int start, int len); #endif /* INCLUDED_procimpl_h_ */ diff --text -u 'xemacs-21.5.6/src/profile.c' 'xemacs-21.5.7/src/profile.c' Index: ././src/profile.c --- ././src/profile.c Wed Mar 13 17:52:56 2002 +++ ././src/profile.c Tue May 28 17:44:59 2002 @@ -217,13 +217,6 @@ return Qnil; } -static Lisp_Object -profile_lock_unwind (Lisp_Object ignore) -{ - inside_profiling = 0; - return Qnil; -} - struct get_profiling_info_closure { Lisp_Object accum; @@ -240,7 +233,7 @@ = (struct get_profiling_info_closure *) void_closure; EMACS_INT val; - CVOID_TO_LISP (key, void_key); + key = VOID_TO_LISP (void_key); val = (EMACS_INT) void_val; closure->accum = Fcons (Fcons (key, make_int (val)), closure->accum); @@ -258,9 +251,7 @@ closure.accum = Qnil; if (big_profile_table) { - int count = specpdl_depth (); - record_unwind_protect (profile_lock_unwind, Qnil); - inside_profiling = 1; + int count = internal_bind_int ((int *) &inside_profiling, 1); maphash (get_profiling_info_maphash, big_profile_table, &closure); unbind_to (count); } @@ -274,7 +265,7 @@ { Lisp_Object key; - CVOID_TO_LISP (key, void_key); + key = VOID_TO_LISP (void_key); mark_object (key); return 0; } diff --text -u 'xemacs-21.5.6/src/rangetab.c' 'xemacs-21.5.7/src/rangetab.c' Index: ././src/rangetab.c --- ././src/rangetab.c Sun Mar 31 17:28:55 2002 +++ ././src/rangetab.c Sun May 5 20:32:15 2002 @@ -57,12 +57,12 @@ Lisp_Range_Table *rt = XRANGE_TABLE (obj); int i; - write_c_string ("#s(range-table data (", printcharfun); + write_c_string (printcharfun, "#s(range-table data ("); for (i = 0; i < Dynarr_length (rt->entries); i++) { struct range_table_entry *rte = Dynarr_atp (rt->entries, i); if (i > 0) - write_c_string (" ", printcharfun); + write_c_string (printcharfun, " "); if (rte->first == rte->last) write_fmt_string (printcharfun, "%ld ", (long) (rte->first)); else @@ -70,7 +70,7 @@ (long) (rte->last)); print_internal (rte->val, printcharfun, 1); } - write_c_string ("))", printcharfun); + write_c_string (printcharfun, "))"); } static int @@ -632,7 +632,7 @@ struct unified_range_table *un; range_table_entry_dynarr *rted = XRANGE_TABLE (rangetab)->entries; int total_needed = unified_range_table_bytes_needed (rangetab); - void *new_dest = ALIGN_PTR ((char *) dest + 4, ALIGNOF (EMACS_INT)); + void *new_dest = ALIGN_PTR ((char *) dest + 4, EMACS_INT); * (char *) dest = (char) ((char *) new_dest - (char *) dest); * ((unsigned char *) dest + 1) = total_needed & 0xFF; @@ -661,17 +661,12 @@ align_the_damn_table (void *unrangetab) { void *cur_dest = (char *) unrangetab + * (char *) unrangetab; -#if LONGBITS == 64 - if ((((long) cur_dest) & 7) != 0) -#else - if ((((int) cur_dest) & 3) != 0) -#endif + if (cur_dest != ALIGN_PTR (cur_dest, EMACS_INT)) { int count = (unified_range_table_bytes_used (unrangetab) - 4 - ALIGNOF (EMACS_INT)); /* Find the proper location, just like above. */ - void *new_dest = ALIGN_PTR ((char *) unrangetab + 4, - ALIGNOF (EMACS_INT)); + void *new_dest = ALIGN_PTR ((char *) unrangetab + 4, EMACS_INT); /* memmove() works in the presence of overlapping data. */ memmove (new_dest, cur_dest, count); * (char *) unrangetab = (char) ((char *) new_dest - (char *) unrangetab); diff --text -u 'xemacs-21.5.6/src/realpath.c' 'xemacs-21.5.7/src/realpath.c' Index: ././src/realpath.c --- ././src/realpath.c Wed Mar 13 17:52:56 2002 +++ ././src/realpath.c Wed Jun 5 18:56:53 2002 @@ -35,18 +35,37 @@ #define MAX_READLINKS 32 +#if defined (HAVE_SYS_PARAM_H) && !defined (WIN32_NATIVE) +#include +#endif + +#ifdef WIN32_NATIVE +#include +#endif + +#include /* for S_IFLNK */ + +#if defined(WIN32_NATIVE) || defined(CYGWIN) +#define WIN32_FILENAMES +#endif + /* First char after start of absolute filename. */ #define ABS_START(name) (name + ABS_LENGTH (name)) #if defined (WIN32_NATIVE) /* Length of start of absolute filename. */ # define ABS_LENGTH(name) (mswindows_abs_start (name)) -static int mswindows_abs_start (const Intbyte *name); +static int mswindows_abs_start (const Ibyte *name); # define readlink_and_correct_case mswindows_readlink_and_correct_case #else # ifdef CYGWIN -# define ABS_LENGTH(name) (IS_DIRECTORY_SEP (*name) ? \ - (IS_DIRECTORY_SEP (name[1]) ? 2 : 1) : 0) +# ifdef WIN32_FILENAMES +# define ABS_LENGTH(name) (mswindows_abs_start (name)) +static int mswindows_abs_start (const Ibyte * name); +# else +# define ABS_LENGTH(name) (IS_DIRECTORY_SEP (*name) ? \ + (IS_DIRECTORY_SEP (name[1]) ? 2 : 1) : 0) +# endif # define readlink_and_correct_case cygwin_readlink_and_correct_case # else # define ABS_LENGTH(name) (IS_DIRECTORY_SEP (*name) ? 1 : 0) @@ -62,14 +81,14 @@ are lower-cased. Directories must be given without trailing '/'. One day, this could read Win2K's reparse points. */ static int -mswindows_readlink_and_correct_case (const Intbyte *name, Intbyte *buf, +mswindows_readlink_and_correct_case (const Ibyte *name, Ibyte *buf, int size) { int len = 0; int err = 0; - const Intbyte *lastname; + const Ibyte *lastname; int count = 0; - const Intbyte *tmp; + const Ibyte *tmp; DECLARE_EISTRING (result); assert (*name); @@ -136,7 +155,7 @@ #ifdef CYGWIN /* Call readlink and try to find out the correct case for the file. */ static int -cygwin_readlink_and_correct_case (const Intbyte *name, Intbyte *buf, +cygwin_readlink_and_correct_case (const Ibyte *name, Ibyte *buf, int size) { int n = qxe_readlink (name, buf, size); @@ -144,8 +163,8 @@ { /* The file may exist, but isn't a symlink. Try to find the right name. */ - Intbyte *tmp = - (Intbyte *) alloca (cygwin_posix_to_win32_path_list_buf_size + Ibyte *tmp = + (Ibyte *) ALLOCA (cygwin_posix_to_win32_path_list_buf_size ((char *) name)); cygwin_posix_to_win32_path_list ((char *) name, (char *) tmp); n = mswindows_readlink_and_correct_case (tmp, buf, size); @@ -154,13 +173,13 @@ } #endif /* CYGWIN */ -#ifdef WIN32_NATIVE +#ifdef WIN32_FILENAMES #ifndef ELOOP #define ELOOP 10062 /* = WSAELOOP in winsock.h */ #endif /* Length of start of absolute filename. */ static int -mswindows_abs_start (const Intbyte *name) +mswindows_abs_start (const Ibyte *name) { if (isalpha (*name) && IS_DEVICE_SEP (name[1]) && IS_DIRECTORY_SEP (name[2])) @@ -175,15 +194,15 @@ /* Mule Note: This function works with and returns internally-formatted strings. */ -Intbyte * -qxe_realpath (const Intbyte *path, Intbyte *resolved_path) +Ibyte * +qxe_realpath (const Ibyte *path, Ibyte *resolved_path) { - Intbyte copy_path[PATH_MAX]; - Intbyte *new_path = resolved_path; - Intbyte *max_path; + Ibyte copy_path[PATH_MAX]; + Ibyte *new_path = resolved_path; + Ibyte *max_path; #if defined (HAVE_READLINK) || defined (WIN32_NATIVE) int readlinks = 0; - Intbyte link_path[PATH_MAX]; + Ibyte link_path[PATH_MAX]; int n; int abslen = ABS_LENGTH (path); #endif @@ -193,9 +212,11 @@ path = copy_path; max_path = copy_path + PATH_MAX - 2; -#ifdef WIN32_NATIVE + if (0) + ; +#ifdef WIN32_FILENAMES /* Check for c:/... or //server/... */ - if (abslen == 2 || abslen == 3) + else if (abslen == 2 || abslen == 3) { qxestrncpy (new_path, path, abslen); /* Make sure drive letter is lowercased. */ @@ -204,6 +225,8 @@ new_path += abslen; path += abslen; } +#endif +#ifdef WIN32_NATIVE /* No drive letter, but a beginning slash? Prepend drive letter. */ else if (abslen == 1) { @@ -212,7 +235,7 @@ path++; } /* Just a path name, prepend the current directory */ - else + else if (1) { get_initial_directory (new_path, PATH_MAX - 1); new_path += qxestrlen (new_path); @@ -221,7 +244,7 @@ } #else /* If it's a relative pathname use get_initial_directory for starters. */ - if (abslen == 0) + else if (abslen == 0) { get_initial_directory (new_path, PATH_MAX - 1); new_path += qxestrlen (new_path); diff --text -u 'xemacs-21.5.6/src/redisplay-gtk.c' 'xemacs-21.5.7/src/redisplay-gtk.c' Index: ././src/redisplay-gtk.c --- ././src/redisplay-gtk.c Fri Mar 29 13:48:22 2002 +++ ././src/redisplay-gtk.c Fri Jun 21 06:18:41 2002 @@ -2,6 +2,7 @@ Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1994 Lucid, Inc. Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -30,25 +31,26 @@ #include #include "lisp.h" -#include "console-gtk.h" -#include "gccache-gtk.h" -#include "glyphs-gtk.h" -#include "objects-gtk.h" - #include "buffer.h" #include "debug.h" +#include "device-impl.h" #include "faces.h" -#include "frame.h" +#include "file-coding.h" +#include "frame-impl.h" #include "gutter.h" #include "redisplay.h" #include "sysdep.h" #include "window.h" +#include "console-gtk-impl.h" +#include "gccache-gtk.h" +#include "glyphs-gtk.h" +#include "objects-gtk-impl.h" + #include "sysproc.h" /* for select() */ #ifdef MULE #include "mule-ccl.h" -#include "file-coding.h" /* for CCL conversion */ #endif #define CONST const @@ -103,7 +105,7 @@ al. (This means converting to one or two byte format, possibly tweaking the high bits, and possibly running a CCL program.) You must pre-allocate the space used and pass it in. (This is done so - you can alloca() the space.) You need to allocate (2 * len) bytes + you can ALLOCA () the space.) You need to allocate (2 * len) bytes of TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of RUN_STORAGE, where LEN is the length of the dynarr. @@ -112,7 +114,7 @@ static int separate_textual_runs (unsigned char *text_storage, struct textual_run *run_storage, - CONST Emchar *str, Charcount len) + CONST Ichar *str, Charcount len) { Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a possible valid charset when @@ -126,13 +128,13 @@ for (i = 0; i < len; i++) { - Emchar ch = str[i]; + Ichar ch = str[i]; Lisp_Object charset; int byte1, byte2; int dimension; int graphic; - BREAKUP_CHAR (ch, charset, byte1, byte2); + BREAKUP_ICHAR (ch, charset, byte1, byte2); dimension = XCHARSET_DIMENSION (charset); graphic = XCHARSET_GRAPHIC (charset); @@ -238,11 +240,11 @@ */ static int -gtk_text_width (struct frame *f, struct face_cachel *cachel, CONST Emchar *str, +gtk_text_width (struct frame *f, struct face_cachel *cachel, CONST Ichar *str, Charcount len) { int width_so_far = 0; - unsigned char *text_storage = (unsigned char *) alloca (2 * len); + unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len); struct textual_run *runs = alloca_array (struct textual_run, len); int nruns; int i; @@ -294,7 +296,7 @@ int cursor_width, int cursor_height) { struct frame *f = XFRAME (w->frame); - Emchar_dynarr *buf = Dynarr_new (Emchar); + Ichar_dynarr *buf = Dynarr_new (Ichar); Lisp_Object window; struct display_block *db = Dynarr_atp (dl->display_blocks, block); @@ -321,7 +323,7 @@ xpos = rb->xpos; width = 0; if (rb->type == RUNE_CHAR) - charset = CHAR_CHARSET (rb->object.chr.ch); + charset = ichar_charset (rb->object.chr.ch); } if (end < 0) @@ -334,7 +336,7 @@ if (rb->findex == findex && rb->type == RUNE_CHAR && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON - && EQ (charset, CHAR_CHARSET (rb->object.chr.ch))) + && EQ (charset, ichar_charset (rb->object.chr.ch))) { Dynarr_add (buf, rb->object.chr.ch); width += rb->width; @@ -357,7 +359,7 @@ { findex = rb->findex; xpos = rb->xpos; - charset = CHAR_CHARSET (rb->object.chr.ch); + charset = ichar_charset (rb->object.chr.ch); if (rb->cursor_type == CURSOR_ON) { @@ -421,8 +423,8 @@ struct display_box dbox; struct display_glyph_area dga; redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset, - start_pixpos, rb->width, - &dbox, &dga); + rb->object.dglyph.yoffset ,start_pixpos, + rb->width, &dbox, &dga); window = wrap_window (w); instance = glyph_image_instance (rb->object.dglyph.glyph, @@ -438,7 +440,7 @@ add_glyph_rune(). */ Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance); - convert_intbyte_string_into_emchar_dynarr + convert_ibyte_string_into_ichar_dynarr (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); gtk_output_string (w, dl, buf, xpos, @@ -626,7 +628,7 @@ DL Display line that this text is on. The values in the structure are used to determine the vertical position and clipping range of the text. - BUF Dynamic array of Emchars specifying what is actually to be + BUF Dynamic array of Ichars specifying what is actually to be drawn. XPOS X position in pixels where the text should start being drawn. XOFFSET Number of pixels to be chopped off the left side of the @@ -657,7 +659,7 @@ void gtk_output_string (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, int xoffset, int clip_start, + Ichar_dynarr *buf, int xpos, int xoffset, int clip_start, int width, face_index findex, int cursor, int cursor_start, int cursor_width, int cursor_height) { @@ -682,7 +684,7 @@ GdkGC *bgc, *gc; int height; int len = Dynarr_length (buf); - unsigned char *text_storage = (unsigned char *) alloca (2 * len); + unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len); struct textual_run *runs = alloca_array (struct textual_run, len); int nruns; int i; diff --text -u 'xemacs-21.5.6/src/redisplay-msw.c' 'xemacs-21.5.7/src/redisplay-msw.c' Index: ././src/redisplay-msw.c --- ././src/redisplay-msw.c Sun Mar 31 17:28:56 2002 +++ ././src/redisplay-msw.c Fri Jun 21 06:18:41 2002 @@ -40,18 +40,18 @@ #include "buffer.h" #include "charset.h" #include "debug.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "gutter.h" #include "redisplay.h" #include "sysdep.h" -#include "window.h" +#include "window-impl.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "glyphs-msw.h" -#include "objects-msw.h" +#include "objects-msw-impl.h" #define MSWINDOWS_EOL_CURSOR_WIDTH 5 @@ -84,7 +84,7 @@ static int separate_textual_runs (textual_run **run_storage_ptr, - const Emchar *str, Charcount len) + const Ichar *str, Charcount len) { static WCHAR *ext_storage; static int ext_storage_size; /* in WCHARS! */ @@ -99,15 +99,15 @@ if (len == 0) return 0; - prev_charset = CHAR_CHARSET (str[0]); + prev_charset = ichar_charset (str[0]); for (i = 1; i <= len; i++) { - if (i == len || !EQ (CHAR_CHARSET (str[i]), prev_charset)) + if (i == len || !EQ (ichar_charset (str[i]), prev_charset)) { int j; - Intbyte *int_storage = - alloca_intbytes (MAX_EMCHAR_LEN * (i - runbegin)); + Ibyte *int_storage = + alloca_ibytes (MAX_ICHAR_LEN * (i - runbegin)); int int_storage_ptr = 0; Extbyte *alloca_ext_storage; int nchars; @@ -115,7 +115,7 @@ int_storage_ptr = 0; for (j = runbegin; j < i; j++) int_storage_ptr += - set_charptr_emchar (int_storage + int_storage_ptr, str[j]); + set_itext_ichar (int_storage + int_storage_ptr, str[j]); TO_EXTERNAL_FORMAT (DATA, (int_storage, int_storage_ptr), ALLOCA, (alloca_ext_storage, nchars), Qmswindows_unicode); @@ -134,7 +134,7 @@ runs_so_far++; runbegin = i; if (i < len) - prev_charset = CHAR_CHARSET (str[i]); + prev_charset = ichar_charset (str[i]); } } @@ -282,6 +282,7 @@ struct display_glyph_area dga; redisplay_calculate_display_boxes (dl, rb->xpos, /*rb->object.dglyph.xoffset*/ 0, + /*rb->object.dglyph.yoffset*/ 0, start_pixpos, rb->width, &db, &dga); /* blank the background in the appropriate color */ @@ -306,7 +307,7 @@ ****************************************************************************/ static void mswindows_output_cursor (struct window *w, struct display_line *dl, int xpos, - int width, face_index findex, Emchar ch, int image_p) + int width, face_index findex, Ichar ch, int image_p) { struct frame *f = XFRAME (w->frame); struct device *d = XDEVICE (f->device); @@ -424,7 +425,7 @@ DL Display line that this text is on. The values in the structure are used to determine the vertical position and clipping range of the text. - BUF Dynamic array of Emchars specifying what is actually to be + BUF Dynamic array of Ichars specifying what is actually to be drawn. XPOS X position in pixels where the text should start being drawn. XOFFSET Number of pixels to be chopped off the left side of the @@ -437,7 +438,7 @@ ****************************************************************************/ static void mswindows_output_string (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, int xoffset, int clip_start, + Ichar_dynarr *buf, int xpos, int xoffset, int clip_start, int width, face_index findex, int cursor, int cursor_start, int cursor_width, int cursor_height) @@ -495,7 +496,7 @@ { struct display_box db; struct display_glyph_area dga; - redisplay_calculate_display_boxes (dl, xpos + xoffset, 0, + redisplay_calculate_display_boxes (dl, xpos + xoffset, 0, 0, clip_start, width, &db, &dga); /* blank the background in the appropriate color */ mswindows_update_dc (hdc, @@ -1023,7 +1024,7 @@ int cursor_width, int cursor_height) { struct frame *f = XFRAME (w->frame); - Emchar_dynarr *buf = Dynarr_new (Emchar); + Ichar_dynarr *buf = Dynarr_new (Ichar); Lisp_Object window; struct display_block *db = Dynarr_atp (dl->display_blocks, block); @@ -1046,7 +1047,7 @@ xpos = rb->xpos; width = 0; if (rb->type == RUNE_CHAR) - charset = CHAR_CHARSET (rb->object.chr.ch); + charset = ichar_charset (rb->object.chr.ch); if (end < 0) end = Dynarr_length (rba); @@ -1058,7 +1059,7 @@ if (rb->findex == findex && rb->type == RUNE_CHAR && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON - && EQ (charset, CHAR_CHARSET (rb->object.chr.ch))) + && EQ (charset, ichar_charset (rb->object.chr.ch))) { Dynarr_add (buf, rb->object.chr.ch); width += rb->width; @@ -1080,7 +1081,7 @@ { findex = rb->findex; xpos = rb->xpos; - charset = CHAR_CHARSET (rb->object.chr.ch); + charset = ichar_charset (rb->object.chr.ch); if (rb->cursor_type == CURSOR_ON) { @@ -1145,8 +1146,8 @@ struct display_glyph_area dga; redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset, - start_pixpos, rb->width, - &dbox, &dga); + rb->object.dglyph.yoffset, + start_pixpos, rb->width, &dbox, &dga); window = wrap_window (w); instance = glyph_image_instance (rb->object.dglyph.glyph, @@ -1289,7 +1290,7 @@ ****************************************************************************/ static int mswindows_text_width (struct frame *f, struct face_cachel *cachel, - const Emchar *str, Charcount len) + const Ichar *str, Charcount len) { HDC hdc = get_frame_dc (f, 0); int width_so_far = 0; diff --text -u 'xemacs-21.5.6/src/redisplay-output.c' 'xemacs-21.5.7/src/redisplay-output.c' Index: ././src/redisplay-output.c --- ././src/redisplay-output.c Sun Mar 31 17:28:57 2002 +++ ././src/redisplay-output.c Fri Jun 21 06:18:42 2002 @@ -2,7 +2,7 @@ Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1995, 1996, 2002 Ben Wing. Copyright (C) 1996 Chuck Thompson. - Copyright (C) 1999 Andy Piper. + Copyright (C) 1999, 2002 Andy Piper. This file is part of XEmacs. @@ -35,8 +35,8 @@ #include "buffer.h" #include "window.h" -#include "frame.h" -#include "device.h" +#include "frame-impl.h" +#include "device-impl.h" #include "glyphs.h" #include "redisplay.h" #include "faces.h" @@ -232,7 +232,10 @@ else if (crb->type == RUNE_DGLYPH && (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) || !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) || - crb->object.dglyph.xoffset != drb->object.dglyph.xoffset)) + crb->object.dglyph.xoffset != drb->object.dglyph.xoffset || + crb->object.dglyph.yoffset != drb->object.dglyph.yoffset || + crb->object.dglyph.ascent != drb->object.dglyph.ascent || + crb->object.dglyph.descent != drb->object.dglyph.descent)) return 0; /* Only check dirtiness if we know something has changed. */ else if (crb->type == RUNE_DGLYPH && @@ -302,6 +305,86 @@ return 1; } +#if 0 +void +compare_runes_2 (struct window *w, struct rune *crb, struct rune *drb) +{ + if (crb->type == DGLYPH) + { + if (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) || + !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) || + crb->object.dglyph.xoffset != drb->object.dglyph.xoffset || + crb->object.dglyph.yoffset != drb->object.dglyph.yoffset || + crb->object.dglyph.ascent != drb->object.dglyph.ascent || + crb->object.dglyph.descent != drb->object.dglyph.descent) + return 0; + /* Only check dirtiness if we know something has changed. */ + else if (XGLYPH_DIRTYP (crb->object.dglyph.glyph) || + crb->findex != drb->findex) + { + /* We need some way of telling redisplay_output_layout () that the + only reason we are outputting it is because something has + changed internally. That way we can optimize whether we need + to clear the layout first and also only output the components + that have changed. The image_instance dirty flag and + display_hash are no good to us because these will invariably + have been set anyway if the layout has changed. So it looks + like we need yet another change flag that we can set here and + then clear in redisplay_output_layout (). */ + Lisp_Object window, image; + Lisp_Image_Instance* ii; + window = wrap_window (w); + image = glyph_image_instance (crb->object.dglyph.glyph, + window, crb->object.dglyph.matchspec, + ERROR_ME_DEBUG_WARN, 1); + + if (!IMAGE_INSTANCEP (image)) + return 0; + ii = XIMAGE_INSTANCE (image); + + if (TEXT_IMAGE_INSTANCEP (image) && + (crb->findex != drb->findex || + WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))) + return 0; + + /* It is quite common for the two glyphs to be EQ since in many + cases they will actually be the same object. This does not + mean, however, that nothing has changed. We therefore need to + check the current hash of the glyph against the last recorded + display hash and the pending display items. See + update_widget () ^^#### which function?. */ + if (image_instance_changed (image) || + crb->findex != drb->findex || + WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)) + { + /* Now we are going to re-output the glyph, but since + this is for some internal reason not related to geometry + changes, send a hint to the output routines that they can + take some short cuts. This is most useful for + layouts. This flag should get reset by the output + routines. + + #### It is possible for us to get here when the + face_cachel is dirty. I do not know what the implications + of this are.*/ + IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1; + return 0; + } + else + return 1; + } + else if (crb->findex != drb->findex || + WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)) + return 0; + else + return 1; + } + else return !(memcmp (crb, drb, sizeof (*crb)) || + WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)); +} +#endif + + /***************************************************************************** get_next_display_block @@ -845,7 +928,7 @@ boolean indicating success or failure. ****************************************************************************/ -#define ADJ_CHARBPOS (rb->charbpos + dl->offset) +#define ADJ_CHARPOS (rb->charpos + dl->offset) #define ADJ_ENDPOS (rb->endpos + dl->offset) int @@ -885,13 +968,13 @@ if (rb->cursor_type == CURSOR_OFF) return 0; - else if (ADJ_CHARBPOS == new_point - || (ADJ_ENDPOS && (new_point >= ADJ_CHARBPOS) + else if (ADJ_CHARPOS == new_point + || (ADJ_ENDPOS && (new_point >= ADJ_CHARPOS) && (new_point <= ADJ_ENDPOS))) { w->last_point_x[CURRENT_DISP] = x; w->last_point_y[CURRENT_DISP] = y; - Fset_marker (w->last_point[CURRENT_DISP], make_int (ADJ_CHARBPOS), + Fset_marker (w->last_point[CURRENT_DISP], make_int (ADJ_CHARPOS), w->buffer); dl->cursor_elt = x; return 1; @@ -950,7 +1033,7 @@ int first = 0; int cur_dl, up; - if (ADJ_CHARBPOS < new_point) + if (ADJ_CHARPOS < new_point) { up = 1; cur_rb = x + 1; @@ -988,9 +1071,9 @@ if (rb->cursor_type != IGNORE_CURSOR && rb->cursor_type != NO_CURSOR && - (ADJ_CHARBPOS == new_point - || (ADJ_ENDPOS && (new_point >= ADJ_CHARBPOS) - && (new_point <= ADJ_CHARBPOS)))) + (ADJ_CHARPOS == new_point + || (ADJ_ENDPOS && (new_point >= ADJ_CHARPOS) + && (new_point <= ADJ_CHARPOS)))) { rb->cursor_type = CURSOR_ON; dl->cursor_elt = cur_rb; @@ -1002,7 +1085,7 @@ w->last_point_x[CURRENT_DISP] = cur_rb; w->last_point_y[CURRENT_DISP] = cur_dl; Fset_marker (w->last_point[CURRENT_DISP], - make_int (ADJ_CHARBPOS), w->buffer); + make_int (ADJ_CHARPOS), w->buffer); if (!no_output_end) { @@ -1027,7 +1110,7 @@ } return 0; } -#undef ADJ_CHARBPOS +#undef ADJ_CHARPOS #undef ADJ_ENDPOS /***************************************************************************** @@ -1313,7 +1396,7 @@ { Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance); Lisp_Object rest, window = DOMAIN_WINDOW (domain); - Emchar_dynarr *buf = Dynarr_new (Emchar); + Ichar_dynarr *buf = Dynarr_new (Ichar); struct window *w = XWINDOW (window); struct device *d = DOMAIN_XDEVICE (domain); int layout_height, layout_width; @@ -1349,17 +1432,22 @@ int edges = 0; enum edge_style style; int ypos = db->ypos; + int xpos = db->xpos; int height = dga->height; + int width = dga->width; - if (dga->xoffset >= 0) + /* The bevel_area routines always draw in from the specified + area so there is no need to adjust the displayed area to + make sure that the lines are visible. */ + if (dga->xoffset >= 0) edges |= EDGE_LEFT; - if (dga->width - dga->xoffset == layout_width) + if (dga->width - dga->xoffset == layout_width) edges |= EDGE_RIGHT; - if (dga->yoffset >= 0) + if (dga->yoffset >= 0) edges |= EDGE_TOP; if (dga->height - dga->yoffset == layout_height) edges |= EDGE_BOTTOM; - + if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in)) style = EDGE_ETCHED_IN; else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out)) @@ -1379,9 +1467,8 @@ style = EDGE_BEVEL_OUT; MAYBE_DEVMETH (d, bevel_area, - (w, findex, db->xpos, - ypos, - dga->width, height, 2, edges, style)); + (w, findex, xpos, ypos, width, height, + DEFAULT_WIDGET_SHADOW_WIDTH, edges, style)); } } @@ -1452,12 +1539,12 @@ unsigned char charsets[NUM_LEADING_BYTES]; struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex); - find_charsets_in_intbyte_string (charsets, + find_charsets_in_ibyte_string (charsets, XSTRING_DATA (string), XSTRING_LENGTH (string)); ensure_face_cachel_complete (cachel, window, charsets); - convert_intbyte_string_into_emchar_dynarr + convert_ibyte_string_into_ichar_dynarr (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); redisplay_normalize_display_box (&cdb, &cdga); @@ -1548,10 +1635,24 @@ dga->height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p); dga->width = IMAGE_INSTANCE_PIXMAP_WIDTH (p); +#ifdef DEBUG_REDISPLAY + printf ("redisplay_output_pixmap(request) \ +[%dx%d@%d+%d] in [%dx%d@%d+%d]\n", + db->width, db->height, db->xpos, db->ypos, + dga->width, dga->height, dga->xoffset, dga->yoffset); +#endif + /* This makes the glyph area fit into the display area. */ if (!redisplay_normalize_glyph_area (db, dga)) return; +#ifdef DEBUG_REDISPLAY + printf ("redisplay_output_pixmap(normalized) \ +[%dx%d@%d+%d] in [%dx%d@%d+%d]\n", + db->width, db->height, db->xpos, db->ypos, + dga->width, dga->height, dga->xoffset, dga->yoffset); +#endif + /* Clear the area the pixmap is going into. The pixmap itself will always take care of the full width. We don't want to clear where it is going to go in order to avoid flicker. So, all we have to @@ -1745,7 +1846,28 @@ redisplay_normalize_glyph_area redisplay_normalize_display_box - Calculate the visible box for displaying src in dest. + Calculate the visible box for displaying glyphsrc in dest. + + display_box and display_glyph_area are used to represent an area to + displayed and where to display it. Using these two structures all + combinations of clipping and position can be accommodated. + + dest - display_box + + xpos - absolute horizontal position of area. + + ypos - absolute vertical position of area. + + glyphsrc - display_glyph_area + + xoffset - horizontal offset of the glyph, +ve means display + the glyph with the x position offset by xoffset, -ve means + display starting xoffset into the glyph. + + yoffset - vertical offset of the glyph, +ve means display the + glyph with y position offset by yoffset, -ve means display + starting xoffset into the glyph. + ****************************************************************************/ int redisplay_normalize_glyph_area (struct display_box* dest, @@ -1773,28 +1895,51 @@ return 0; } - /* Horizontal offsets. This works because xoffset can be -ve as well as +ve */ + /* Horizontal offsets. This works because xoffset can be -ve as well + as +ve. When we enter this function the glyphsrc width and + height are set to the actual glyph width and height irrespective + of how much can be displayed. We are trying to clip both the + offset into the image and the rightmost bounding box. Its + possible for the glyph width to be much larger than the area we + are displaying into (e.g. a large glyph in a small frame). */ if (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width) { + /* glyphsrc offset is +ve we are trying to display offset from the + origin (the bounding box contains some space and then the + glyph). At most the width we want to display is dest->width - + glyphsrc->xoffset. */ if (glyphsrc->xoffset > 0) glyphsrc->width = dest->width - glyphsrc->xoffset; + /* glyphsrc offset is -ve we are trying to display hard up + against the dest corner inset into the glyphsrc by + xoffset.*/ + else if (glyphsrc->xoffset < 0) + { + glyphsrc->width += glyphsrc->xoffset; + glyphsrc->width = min (glyphsrc->width, dest->width); + } else glyphsrc->width = dest->width; } - if (glyphsrc->xoffset < 0) + else if (glyphsrc->xoffset < 0) glyphsrc->width += glyphsrc->xoffset; /* Vertical offsets. This works because yoffset can be -ve as well as +ve */ if (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height) { - if (glyphsrc->yoffset > 0) + if ((glyphsrc->yoffset > 0) && (dest->height > glyphsrc->yoffset)) glyphsrc->height = dest->height - glyphsrc->yoffset; + else if (glyphsrc->yoffset < 0) + { + glyphsrc->height += glyphsrc->yoffset; + glyphsrc->height = min (glyphsrc->height, dest->height); + } else glyphsrc->height = dest->height; } - if (glyphsrc->yoffset < 0) + else if (glyphsrc->yoffset < 0) glyphsrc->height += glyphsrc->yoffset; return 1; @@ -1879,8 +2024,8 @@ ****************************************************************************/ int redisplay_calculate_display_boxes (struct display_line *dl, int xpos, - int xoffset, int start_pixpos, int width, - struct display_box* dest, + int xoffset, int yoffset, int start_pixpos, + int width, struct display_box* dest, struct display_glyph_area* src) { dest->xpos = xpos; @@ -1889,10 +2034,11 @@ dest->height = DISPLAY_LINE_HEIGHT (dl); src->xoffset = -xoffset; - src->yoffset = -dl->top_clip; src->width = 0; src->height = 0; + src->yoffset = -dl->top_clip + yoffset; + if (start_pixpos >=0 && start_pixpos > xpos) { /* Oops, we're asking for a start outside of the displayable @@ -2079,10 +2225,10 @@ while (first_line <= last_line) { - Charcount old_len = (Dynarr_atp (cdla, first_line)->end_charbpos - - Dynarr_atp (cdla, first_line)->charbpos); - Charcount new_len = (Dynarr_atp (ddla, first_line)->end_charbpos - - Dynarr_atp (ddla, first_line)->charbpos); + Charcount old_len = (Dynarr_atp (cdla, first_line)->end_charpos - + Dynarr_atp (cdla, first_line)->charpos); + Charcount new_len = (Dynarr_atp (ddla, first_line)->end_charpos - + Dynarr_atp (ddla, first_line)->charpos); assert (Dynarr_length (cdla) == Dynarr_length (ddla)); diff --text -u 'xemacs-21.5.6/src/redisplay-tty.c' 'xemacs-21.5.7/src/redisplay-tty.c' Index: ././src/redisplay-tty.c --- ././src/redisplay-tty.c Sun Mar 31 17:28:58 2002 +++ ././src/redisplay-tty.c Fri Jun 21 06:18:42 2002 @@ -33,18 +33,20 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "lstream.h" #include "redisplay.h" #include "sysdep.h" #include "window.h" -#include "console-tty.h" -#include "objects-tty.h" +#include "console-tty-impl.h" +#include "objects-tty-impl.h" + +#include "syssignal.h" /* These headers #define all kinds of common words like "columns"... What a bunch of losers. If we were to include them, we'd have to @@ -78,14 +80,14 @@ } while (0) #define OUTPUT1_IF(c, a) OUTPUTN_IF (c, a, 1) -static void tty_output_emchar_dynarr (struct window *w, +static void tty_output_ichar_dynarr (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, + Ichar_dynarr *buf, int xpos, face_index findex, int cursor); -static void tty_output_intbyte_string (struct window *w, +static void tty_output_ibyte_string (struct window *w, struct display_line *dl, - Intbyte *str, Bytecount len, + Ibyte *str, Bytecount len, int xpos, face_index findex, int cursor); static void tty_turn_on_face (struct window *w, face_index findex); @@ -101,13 +103,13 @@ Non-Mule tty's don't have fonts (that we use at least), so everything is considered to be fixed width -- in other words, we return LEN. Under Mule, however, a character can still cover more than one - column, so we use emchar_string_displayed_columns(). + column, so we use ichar_string_displayed_columns(). ****************************************************************************/ static int -tty_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str, +tty_text_width (struct frame *f, struct face_cachel *cachel, const Ichar *str, Charcount len) { - return emchar_string_displayed_columns (str, len); + return ichar_string_displayed_columns (str, len); } /***************************************************************************** @@ -198,7 +200,7 @@ int cursor_height) { struct frame *f = XFRAME (w->frame); - Emchar_dynarr *buf = Dynarr_new (Emchar); + Ichar_dynarr *buf = Dynarr_new (Ichar); struct display_block *db = Dynarr_atp (dl->display_blocks, block); rune_dynarr *rba = db->runes; @@ -249,7 +251,7 @@ { if (Dynarr_length (buf)) { - tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); + tty_output_ichar_dynarr (w, dl, buf, xpos, findex, 0); xpos = rb->xpos; } Dynarr_reset (buf); @@ -264,7 +266,7 @@ /* Clear in case a cursor was formerly here. */ Dynarr_add (buf, ' '); - tty_output_emchar_dynarr (w, dl, buf, rb->xpos, + tty_output_ichar_dynarr (w, dl, buf, rb->xpos, DEFAULT_INDEX, 0); Dynarr_reset (buf); @@ -277,7 +279,7 @@ /* There is not a distinct eol cursor on tty's. */ Dynarr_add (buf, rb->object.chr.ch); - tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); + tty_output_ichar_dynarr (w, dl, buf, xpos, findex, 0); Dynarr_reset (buf); cmgoto (f, dl->ypos - 1, xpos); @@ -291,7 +293,7 @@ modeline and this will suffice for that. */ else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE) { - Emchar ch_to_add; + Ichar ch_to_add; int size = rb->width; if (rb->type == RUNE_BLANK) @@ -301,7 +303,7 @@ while (size--) Dynarr_add (buf, ch_to_add); - tty_output_emchar_dynarr (w, dl, buf, rb->xpos, findex, 0); + tty_output_ichar_dynarr (w, dl, buf, rb->xpos, findex, 0); if (xpos >= cursor_start && cursor_start < xpos + Dynarr_length (buf)) @@ -362,7 +364,7 @@ } if (Dynarr_length (buf)) - tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); + tty_output_ichar_dynarr (w, dl, buf, xpos, findex, 0); Dynarr_free (buf); } @@ -518,8 +520,8 @@ } static void -tty_output_intbyte_string (struct window *w, struct display_line *dl, - Intbyte *str, Bytecount len, int xpos, +tty_output_ibyte_string (struct window *w, struct display_line *dl, + Ibyte *str, Bytecount len, int xpos, face_index findex, int cursor) { struct frame *f = XFRAME (w->frame); @@ -532,53 +534,53 @@ tty_turn_on_face (w, findex); send_string_to_tty_console (c, str, len); - TTY_INC_CURSOR_X (c, intbyte_string_displayed_columns (str, len)); + TTY_INC_CURSOR_X (c, ibyte_string_displayed_columns (str, len)); /* Turn the face properties back off. */ tty_turn_off_face (w, findex); } -static Intbyte_dynarr *tty_output_emchar_dynarr_dynarr; +static Ibyte_dynarr *tty_output_ichar_dynarr_dynarr; /***************************************************************************** - tty_output_emchar_dynarr + tty_output_ichar_dynarr Given a string and a starting position, output that string in the given face. If cursor is true, draw a cursor around the string. ****************************************************************************/ static void -tty_output_emchar_dynarr (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, face_index findex, +tty_output_ichar_dynarr (struct window *w, struct display_line *dl, + Ichar_dynarr *buf, int xpos, face_index findex, int cursor) { - if (!tty_output_emchar_dynarr_dynarr) - tty_output_emchar_dynarr_dynarr = Dynarr_new (Intbyte); + if (!tty_output_ichar_dynarr_dynarr) + tty_output_ichar_dynarr_dynarr = Dynarr_new (Ibyte); else - Dynarr_reset (tty_output_emchar_dynarr_dynarr); + Dynarr_reset (tty_output_ichar_dynarr_dynarr); - convert_emchar_string_into_intbyte_dynarr (Dynarr_atp (buf, 0), + convert_ichar_string_into_ibyte_dynarr (Dynarr_atp (buf, 0), Dynarr_length (buf), - tty_output_emchar_dynarr_dynarr); + tty_output_ichar_dynarr_dynarr); - tty_output_intbyte_string (w, dl, - Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0), - Dynarr_length (tty_output_emchar_dynarr_dynarr), + tty_output_ibyte_string (w, dl, + Dynarr_atp (tty_output_ichar_dynarr_dynarr, 0), + Dynarr_length (tty_output_ichar_dynarr_dynarr), xpos, findex, cursor); } #if 0 -static Intbyte_dynarr *sidcs_dynarr; +static Ibyte_dynarr *sidcs_dynarr; static void substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string) { int i; - Intbyte *specdata = XSTRING_DATA (spec); + Ibyte *specdata = XSTRING_DATA (spec); Bytecount speclen = XSTRING_LENGTH (spec); if (!sidcs_dynarr) - sidcs_dynarr = Dynarr_new (Intbyte); + sidcs_dynarr = Dynarr_new (Ibyte); else Dynarr_reset (sidcs_dynarr); @@ -607,7 +609,7 @@ set_foreground_to (struct console *c, Lisp_Object sym) { Lisp_Object result; - Intbyte *escseq = 0; + Ibyte *escseq = 0; Bytecount escseqlen = 0; result = assq_no_quit (sym, Vtty_color_alist); @@ -637,7 +639,7 @@ set_background_to (struct console *c, Lisp_Object sym) { Lisp_Object result; - Intbyte *escseq = 0; + Ibyte *escseq = 0; Bytecount escseqlen = 0; result = assq_no_quit (sym, Vtty_color_alist); diff --text -u 'xemacs-21.5.6/src/redisplay-x.c' 'xemacs-21.5.7/src/redisplay-x.c' Index: ././src/redisplay-x.c --- ././src/redisplay-x.c Sun Mar 31 17:28:58 2002 +++ ././src/redisplay-x.c Fri Jun 21 06:18:42 2002 @@ -32,10 +32,10 @@ #include "buffer.h" #include "debug.h" -#include "device.h" +#include "device-impl.h" #include "faces.h" #include "file-coding.h" -#include "frame.h" +#include "frame-impl.h" #include "gutter.h" #include "redisplay.h" #include "sysdep.h" @@ -45,9 +45,9 @@ #include "mule-ccl.h" #endif -#include "console-x.h" +#include "console-x-impl.h" #include "glyphs-x.h" -#include "objects-x.h" +#include "objects-x-impl.h" #include "xgccache.h" #include "EmacsFrame.h" @@ -118,7 +118,7 @@ al. (This means converting to one or two byte format, possibly tweaking the high bits, and possibly running a CCL program.) You must pre-allocate the space used and pass it in. (This is done so - you can alloca() the space.) You need to allocate (2 * len) bytes + you can ALLOCA () the space.) You need to allocate (2 * len) bytes of TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of RUN_STORAGE, where LEN is the length of the dynarr. @@ -127,7 +127,7 @@ static int separate_textual_runs (unsigned char *text_storage, struct textual_run *run_storage, - const Emchar *str, Charcount len) + const Ichar *str, Charcount len) { Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a possible valid charset when @@ -141,13 +141,13 @@ for (i = 0; i < len; i++) { - Emchar ch = str[i]; + Ichar ch = str[i]; Lisp_Object charset; int byte1, byte2; int dimension; int graphic; - BREAKUP_CHAR (ch, charset, byte1, byte2); + BREAKUP_ICHAR (ch, charset, byte1, byte2); dimension = XCHARSET_DIMENSION (charset); graphic = XCHARSET_GRAPHIC (charset); @@ -245,11 +245,11 @@ */ static int -x_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str, +x_text_width (struct frame *f, struct face_cachel *cachel, const Ichar *str, Charcount len) { int width_so_far = 0; - unsigned char *text_storage = (unsigned char *) alloca (2 * len); + unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len); struct textual_run *runs = alloca_array (struct textual_run, len); int nruns; int i; @@ -322,7 +322,7 @@ int cursor_width, int cursor_height) { struct frame *f = XFRAME (w->frame); - Emchar_dynarr *buf = Dynarr_new (Emchar); + Ichar_dynarr *buf = Dynarr_new (Ichar); Lisp_Object window; struct display_block *db = Dynarr_atp (dl->display_blocks, block); @@ -345,7 +345,7 @@ findex = rb->findex; xpos = rb->xpos; if (rb->type == RUNE_CHAR) - charset = CHAR_CHARSET (rb->object.chr.ch); + charset = ichar_charset (rb->object.chr.ch); if (end < 0) end = Dynarr_length (rba); @@ -357,7 +357,7 @@ if (rb->findex == findex && rb->type == RUNE_CHAR && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON - && EQ (charset, CHAR_CHARSET (rb->object.chr.ch))) + && EQ (charset, ichar_charset (rb->object.chr.ch))) { Dynarr_add (buf, rb->object.chr.ch); width += rb->width; @@ -380,7 +380,7 @@ { findex = rb->findex; xpos = rb->xpos; - charset = CHAR_CHARSET (rb->object.chr.ch); + charset = ichar_charset (rb->object.chr.ch); if (rb->cursor_type == CURSOR_ON) { @@ -443,9 +443,10 @@ Lisp_Object instance; struct display_box dbox; struct display_glyph_area dga; + redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset, - start_pixpos, rb->width, - &dbox, &dga); + rb->object.dglyph.yoffset, start_pixpos, + rb->width, &dbox, &dga); window = wrap_window (w); instance = glyph_image_instance (rb->object.dglyph.glyph, @@ -746,7 +747,7 @@ DL Display line that this text is on. The values in the structure are used to determine the vertical position and clipping range of the text. - BUF Dynamic array of Emchars specifying what is actually to be + BUF Dynamic array of Ichars specifying what is actually to be drawn. XPOS X position in pixels where the text should start being drawn. XOFFSET Number of pixels to be chopped off the left side of the @@ -768,7 +769,7 @@ ****************************************************************************/ void x_output_string (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, int xoffset, int clip_start, + Ichar_dynarr *buf, int xpos, int xoffset, int clip_start, int width, face_index findex, int cursor, int cursor_start, int cursor_width, int cursor_height) { @@ -794,7 +795,7 @@ GC bgc, gc; int height; int len = Dynarr_length (buf); - unsigned char *text_storage = (unsigned char *) alloca (2 * len); + unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len); struct textual_run *runs = alloca_array (struct textual_run, len); int nruns; int i; diff --text -u 'xemacs-21.5.6/src/redisplay.c' 'xemacs-21.5.7/src/redisplay.c' Index: ././src/redisplay.c --- ././src/redisplay.c Sun Mar 31 17:28:59 2002 +++ ././src/redisplay.c Fri Jun 21 06:18:43 2002 @@ -33,31 +33,45 @@ /***************************************************************************** The Golden Rules of Redisplay - First: It Is Better To Be Correct Than Fast - Second: Thou Shalt Not Run Elisp From Within Redisplay - Third: It Is Better To Be Fast Than Not To Be + First: It Is Better To Be Correct Than Fast + Second: Thou Shalt Use Due Caution When Running Elisp From Within Redisplay + Third: It Is Better To Be Fast Than Not To Be ****************************************************************************/ +/* Note: The second rule used to prohibit running Elisp from within redisplay, + but that's not correct. + + Use + + callN_trapping_problems (..., INHIBIT_GC + | INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY) + + instead. + + --ben +*/ + #include #include "lisp.h" #include "buffer.h" #include "commands.h" #include "debug.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" -#include "extents.h" +#include "events.h" +#include "extents-impl.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "gutter.h" #include "insdel.h" #include "menubar.h" -#include "objects.h" +#include "objects-impl.h" #include "process.h" #include "redisplay.h" #include "toolbar.h" -#include "window.h" +#include "window-impl.h" #include "line-number.h" #include "file-coding.h" @@ -68,11 +82,11 @@ #endif /* HAVE_TTY */ /* Note: We have to be careful throughout this code to properly handle - and differentiate between Intbytes and Emchars. + and differentiate between Ibytes and Ichars. - Since strings are generally composed of Intbytes, I've taken the tack - that any contiguous set of Intbytes is called a "string", while - any contiguous set of Emchars is called an "array". */ + Since strings are generally composed of Ibytes, I've taken the tack + that any contiguous set of Ibytes is called a "string", while + any contiguous set of Ichars is called an "array". */ /* Return value to indicate a failure by an add_*_rune routine to add a rune, but no propagation information needs to be returned. */ @@ -91,7 +105,7 @@ /* The following structures are completely private to redisplay.c so we put them here instead of in a header file, for modularity. */ -/* NOTE: Bytebpos's not Charbpos's in this structure. */ +/* NOTE: Bytexpos's not Charxpos's in this structure. */ typedef struct position_redisplay_data_type { @@ -104,9 +118,9 @@ struct device *d; struct display_block *db; struct display_line *dl; - Emchar ch; /* Character that is to be added. This is + Ichar ch; /* Character that is to be added. This is used to communicate this information to - add_emchar_rune(). */ + add_ichar_rune(). */ Lisp_Object last_charset; /* The charset of the previous character. Used to optimize some lookups -- we only have to do some things when @@ -119,8 +133,13 @@ int font_is_bogus; /* If true, it means we couldn't instantiate the font for this charset, so we substitute ~'s from the ASCII charset. */ - Bytebpos bi_charbpos; - Bytebpos bi_endpos; + Bytexpos byte_charpos; /* Position of character we are processing. This + is a Bytexpos, meaning it refers to bytes (not + chars) and can refer to either buffers (1-based) + or strings (0-based). We need to be careful + when doing anything that references the text in + the buffer or string. */ + Bytexpos byte_endpos; /* ????? Unknown, under-used. */ int pixpos; int max_pixpos; int blank_width; /* Width of the blank that is to be added. @@ -130,11 +149,12 @@ This is also used rather cheesily to communicate the width of the eol-cursor-size blank that exists at the end of the line. - add_emchar_rune() is called cheesily with + add_ichar_rune() is called cheesily with the non-printing char '\n', which is stuck in the output routines with its width being BLANK_WIDTH. */ - Bytebpos bi_cursor_charbpos;/* This stores the buffer position of the cursor. */ + Bytexpos byte_cursor_charpos; /* This stores the buffer position of the + cursor. */ unsigned int cursor_type :3; int cursor_x; /* rune block cursor is at */ int start_col; /* Number of character columns (each column has @@ -143,11 +163,11 @@ scrolling, where a certain number of columns (those off the left side of the screen) need to be skipped before anything is displayed. */ - Bytebpos bi_start_col_enabled; + Bytexpos byte_start_col_enabled; int start_col_xoffset; /* Number of pixels that still need to - be skipped. This is used for - horizontal scrolling of glyphs, where we want - to be able to scroll over part of the glyph. */ + be skipped. This is used for + horizontal scrolling of glyphs, where we want + to be able to scroll over part of the glyph. */ int hscroll_glyph_width_adjust; /* how much the width of the hscroll glyph differs from space_width (w). @@ -161,18 +181,20 @@ struct extent_fragment *ef; face_index findex; - /* The height of a pixmap may either be predetermined if the user - has set a baseline value, or it may be dependent on whatever the - line ascent and descent values end up being, based just on font - information. In the first case we can immediately update the - values, thus their inclusion here. In the last case we cannot - determine the actual contribution to the line height until we - have finished laying out all text on the line. Thus we propagate - the max height of such pixmaps and do a final calculation after - all text has been added to the line. */ + /* The height of a pixmap may either be predetermined if the user has set a + baseline value, or it may be dependent on whatever the line ascent and + descent values end up being, based just on font and pixmap-ascent + information. In the first case we can immediately update the values, thus + their inclusion here. In the last case we cannot determine the actual + contribution to the line height until we have finished laying out all text + on the line. Thus we propagate the max height of such pixmaps and do a + final calculation (in calculate_baseline()) after all text has been added + to the line. */ int new_ascent; int new_descent; int max_pixmap_height; + int need_baseline_computation; + int end_glyph_width; /* Well, it is the kitchen sink after all ... */ Lisp_Object result_str; /* String where we put the result of generating a formatted string in the modeline. */ @@ -190,16 +212,25 @@ PROP_STRING, PROP_CHAR, PROP_MINIBUF_PROMPT, - PROP_BLANK + PROP_BLANK, + PROP_GLYPH }; /* Data that should be propagated to the next line. Either a single - Emchar or a string of Intbyte's. + Ichar, a string of Ibyte's or a glyph. The actual data that is propagated ends up as a Dynarr of these blocks. - #### It's unclean that both Emchars and Intbytes are here. + prop_blocks are used to indicate that data that was supposed to go + on the previous line couldn't actually be displayed. Generally this + shouldn't happen if we are clipping the end of lines. If we are + wrapping then we need to display the propagation data before moving + on. Its questionable whether we should wrap or clip glyphs in this + instance. Most e-lisp relies on clipping so we preserve this + behavior. + + #### It's unclean that both Ichars and Ibytes are here. */ typedef struct prop_block prop_block; @@ -211,14 +242,14 @@ { struct { - Intbyte *str; + Ibyte *str; Bytecount len; /* length of the string. */ } p_string; struct { - Emchar ch; - Bytebpos bi_cursor_charbpos; /* NOTE: is in Bytebposs */ + Ichar ch; + Bytebpos byte_cursor_charpos; /* NOTE: is in Bytebpos's */ unsigned int cursor_type :3; } p_char; @@ -227,6 +258,14 @@ int width; face_index findex; } p_blank; + + struct + { + /* Not used as yet, but could be used to wrap rather than clip glyphs. */ + int width; + Lisp_Object glyph; + } p_glyph; + } data; }; @@ -248,8 +287,9 @@ int pos_type, int allow_cursor, struct glyph_cachel *cachel); static Bytebpos create_text_block (struct window *w, struct display_line *dl, - Bytebpos bi_start_pos, prop_block_dynarr **prop, - int type); + Bytebpos byte_start_pos, + prop_block_dynarr **prop, + int type); static int create_overlay_glyph_block (struct window *w, struct display_line *dl); static void create_left_glyph_block (struct window *w, @@ -258,11 +298,15 @@ static void create_right_glyph_block (struct window *w, struct display_line *dl); static void redisplay_windows (Lisp_Object window, int skip_selected); -static void decode_mode_spec (struct window *w, Emchar spec, int type); +static void decode_mode_spec (struct window *w, Ichar spec, int type); static void free_display_line (struct display_line *dl); -static void update_line_start_cache (struct window *w, Charbpos from, Charbpos to, - Charbpos point, int no_regen); +static void update_line_start_cache (struct window *w, Charbpos from, + Charbpos to, Charbpos point, + int no_regen); static int point_visible (struct window *w, Charbpos point, int type); +static void calculate_yoffset (struct display_line *dl, + struct display_block *fixup); +static void calculate_baseline (pos_data *data); static void sledgehammer_check_redisplay_structs (void); @@ -304,7 +348,7 @@ /* This holds a string representing the text corresponding to a single modeline % spec. */ -static Intbyte_dynarr *mode_spec_intbyte_string; +static Ibyte_dynarr *mode_spec_ibyte_string; int in_display; /* 1 if in redisplay. */ @@ -475,13 +519,13 @@ /***************************************************************************/ static int -redisplay_text_width_emchar_string (struct window *w, int findex, - Emchar *str, Charcount len) +redisplay_text_width_ichar_string (struct window *w, int findex, + Ichar *str, Charcount len) { unsigned char charsets[NUM_LEADING_BYTES]; Lisp_Object window; - find_charsets_in_emchar_string (charsets, str, len); + find_charsets_in_ichar_string (charsets, str, len); window = wrap_window (w); ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window, charsets); @@ -490,51 +534,51 @@ WINDOW_FACE_CACHEL (w, findex), str, len)); } -static Emchar_dynarr *rtw_emchar_dynarr; +static Ichar_dynarr *rtw_ichar_dynarr; int redisplay_text_width_string (struct window *w, int findex, - Intbyte *nonreloc, Lisp_Object reloc, + Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount len) { - if (!rtw_emchar_dynarr) - rtw_emchar_dynarr = Dynarr_new (Emchar); - Dynarr_reset (rtw_emchar_dynarr); + if (!rtw_ichar_dynarr) + rtw_ichar_dynarr = Dynarr_new (Ichar); + Dynarr_reset (rtw_ichar_dynarr); fixup_internal_substring (nonreloc, reloc, offset, &len); if (STRINGP (reloc)) nonreloc = XSTRING_DATA (reloc); - convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); - return redisplay_text_width_emchar_string - (w, findex, Dynarr_atp (rtw_emchar_dynarr, 0), - Dynarr_length (rtw_emchar_dynarr)); + convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr); + return redisplay_text_width_ichar_string + (w, findex, Dynarr_atp (rtw_ichar_dynarr, 0), + Dynarr_length (rtw_ichar_dynarr)); } int redisplay_frame_text_width_string (struct frame *f, Lisp_Object face, - Intbyte *nonreloc, Lisp_Object reloc, + Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount len) { unsigned char charsets[NUM_LEADING_BYTES]; Lisp_Object frame; struct face_cachel cachel; - if (!rtw_emchar_dynarr) - rtw_emchar_dynarr = Dynarr_new (Emchar); - Dynarr_reset (rtw_emchar_dynarr); + if (!rtw_ichar_dynarr) + rtw_ichar_dynarr = Dynarr_new (Ichar); + Dynarr_reset (rtw_ichar_dynarr); fixup_internal_substring (nonreloc, reloc, offset, &len); if (STRINGP (reloc)) nonreloc = XSTRING_DATA (reloc); - convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); - find_charsets_in_intbyte_string (charsets, nonreloc, len); + convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr); + find_charsets_in_ibyte_string (charsets, nonreloc, len); reset_face_cachel (&cachel); cachel.face = face; frame = wrap_frame (f); ensure_face_cachel_complete (&cachel, frame, charsets); return DEVMETH (XDEVICE (FRAME_DEVICE (f)), - text_width, (f, &cachel, Dynarr_atp (rtw_emchar_dynarr, 0), - Dynarr_length (rtw_emchar_dynarr))); + text_width, (f, &cachel, Dynarr_atp (rtw_ichar_dynarr, 0), + Dynarr_length (rtw_ichar_dynarr))); } /* Return the display block from DL of the given TYPE. A display line @@ -680,6 +724,108 @@ return bounds; } +/* This takes a display_block and its containing line and corrects the yoffset + of each glyph in the block to cater for the ascent of the line as a + whole. Must be called *after* the line-ascent is known! */ + +static void +calculate_yoffset (struct display_line *dl, struct display_block *fixup) +{ + int i; + for (i=0; irunes); i++) + { + struct rune *r = Dynarr_atp (fixup->runes,i); + if (r->type == RUNE_DGLYPH) + { + if (r->object.dglyph.ascent < dl->ascent) + r->object.dglyph.yoffset = dl->ascent - r->object.dglyph.ascent + + r->object.dglyph.descent; + } + } +} + +/* Calculate the textual baseline (the ascent and descent values for the + display_line as a whole). + + If the baseline is completely blank, or contains no manually positioned + glyphs, then the textual baseline is simply the baseline of the default font. + (The `contains no manually positioned glyphs' part is actually done for + us by `add_ichar_rune'.) + + If the baseline contains pixmaps, and they're all manually positioned, then + the textual baseline location is constrained that way, and we need do no + work. + + If the baseline contains pixmaps, and at least one is automatically + positioned, then the textual ascent is the largest ascent on the line, and + the textual descent is the largest descent (which is how things are set up at + entry to this function anyway): except that if the max_ascent + max_descent + is too small for the height of the line (say you've adjusted the baseline of + a short glyph, and there's a tall one next to it), then take the ascent and + descent for the line individually from the largest of the explicitly set + ascent/descent, and the rescaled ascent/descent of the default font, scaled + such that the largest glyph will fit. + + This means that if you have a short glyph (but taller than the default + font's descent) forced right under the baseline, and a really tall + automatically positioned glyph, that the descent for the line is just big + enough for the manually positioned short glyph, and the tall one uses as + much of that space as the default font would were it as tall as the tall + glyph; but that the ascent is big enough for the tall glyph to fit. + + This behaviour means that under no circumstances will changing the baseline + of a short glyph cause a tall glyph to move around; nor will it move the + textual baseline more than necessary. (Changing a tall glyph's baseline + might move the text's baseline arbitrarily, of course.) */ + +static void +calculate_baseline (pos_data *data) +{ + /* Blank line: baseline is default font's baseline. */ + + if (!data->new_ascent && !data->new_descent) + { + /* We've got a blank line so initialize these values from the default + face. */ + default_face_font_info (data->window, &data->new_ascent, + &data->new_descent, 0, 0, 0); + } + + /* No automatically positioned glyphs? Return at once. */ + if (!data->need_baseline_computation) + return; + + /* Is the tallest glyph on the line automatically positioned? + If it's manually positioned, or it's automatically positioned + and there's enough room for it anyway, we need do no more work. */ + if (data->max_pixmap_height > data->new_ascent + data->new_descent) + { + int default_font_ascent, default_font_descent, default_font_height; + int scaled_default_font_ascent, scaled_default_font_descent; + + default_face_font_info (data->window, &default_font_ascent, + &default_font_descent, &default_font_height, + 0, 0); + + scaled_default_font_ascent = data->max_pixmap_height * + default_font_ascent / default_font_height; + + data->new_ascent = max (data->new_ascent, scaled_default_font_ascent); + + /* The ascent may have expanded now. Do we still need to grow the descent, + or are things big enough? + + The +1 caters for the baseline row itself. */ + if (data->max_pixmap_height > data->new_ascent + data->new_descent) + { + scaled_default_font_descent = (data->max_pixmap_height * + default_font_descent / default_font_height) + 1; + + data->new_descent = max (data->new_descent, scaled_default_font_descent); + } + } +} + /* Given a display line and a starting position, ensure that the contents of the display line accurately represent the visual representation of the buffer contents starting from the given @@ -692,7 +838,7 @@ Charbpos start_pos, prop_block_dynarr **prop, int type) { - Charbpos ret_charbpos; + Charbpos ret_charpos; int overlay_width; struct buffer *b = XBUFFER (WINDOW_BUFFER (w)); @@ -723,14 +869,14 @@ Bytebpos hacked_up_bytebpos = create_text_block (w, dl, charbpos_to_bytebpos (b, start_pos), prop, type); - if (hacked_up_bytebpos > BI_BUF_ZV (b)) - ret_charbpos = BUF_ZV (b) + 1; + if (hacked_up_bytebpos > BYTE_BUF_ZV (b)) + ret_charpos = BUF_ZV (b) + 1; else - ret_charbpos = bytebpos_to_charbpos (b, hacked_up_bytebpos); + ret_charpos = bytebpos_to_charbpos (b, hacked_up_bytebpos); } - dl->charbpos = start_pos; - if (dl->end_charbpos < dl->charbpos) - dl->end_charbpos = dl->charbpos; + dl->charpos = start_pos; + if (dl->end_charpos < dl->charpos) + dl->end_charpos = dl->charpos; if (MARKERP (Voverlay_arrow_position) && EQ (w->buffer, Fmarker_buffer (Voverlay_arrow_position)) @@ -756,9 +902,9 @@ /* In the future additional types of display blocks may be generated here. */ - w->last_redisplay_pos = ret_charbpos; + w->last_redisplay_pos = ret_charpos; - return ret_charbpos; + return ret_charpos; } /* Adds an hscroll glyph to a display block. If this is called, then @@ -766,7 +912,7 @@ Yes, there are multiple places where this function is called but that is the way it has to be. Each calling function has to deal - with bi_start_col_enabled a little differently depending on the + with byte_start_col_enabled a little differently depending on the object being worked with. */ static prop_block_dynarr * @@ -774,23 +920,23 @@ { struct glyph_block gb; prop_block_dynarr *retval; - Bytebpos bi_old_cursor_charbpos = data->bi_cursor_charbpos; + Bytebpos byte_old_cursor_charpos = data->byte_cursor_charpos; int old_cursor_type = data->cursor_type; - Bytebpos bi_old_charbpos = data->bi_charbpos; + Bytebpos byte_old_charpos = data->byte_charpos; if (data->cursor_type == CURSOR_ON - && data->bi_cursor_charbpos >= data->bi_start_col_enabled - && data->bi_cursor_charbpos <= data->bi_charbpos) + && data->byte_cursor_charpos >= data->byte_start_col_enabled + && data->byte_cursor_charpos <= data->byte_charpos) { - data->bi_cursor_charbpos = data->bi_start_col_enabled; + data->byte_cursor_charpos = data->byte_start_col_enabled; } else { data->cursor_type = NO_CURSOR; } - data->bi_endpos = data->bi_charbpos; - data->bi_charbpos = data->bi_start_col_enabled; + data->byte_endpos = data->byte_charpos; + data->byte_charpos = data->byte_start_col_enabled; gb.extent = Qnil; gb.glyph = Vhscroll_glyph; @@ -802,12 +948,12 @@ data->hscroll_glyph_width_adjust = data->pixpos - oldpixpos - space_width (XWINDOW (data->window)); } - data->bi_endpos = 0; - data->bi_cursor_charbpos = bi_old_cursor_charbpos; + data->byte_endpos = 0; + data->byte_cursor_charpos = byte_old_cursor_charpos; data->cursor_type = old_cursor_type; - data->bi_charbpos = bi_old_charbpos; + data->byte_charpos = byte_old_charpos; - data->bi_start_col_enabled = 0; + data->byte_start_col_enabled = 0; return retval; } @@ -815,10 +961,10 @@ to fit the rune on the display block (as determined by the MAX_PIXPOS) then it adds nothing and returns ADD_FAILED. If NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't allow the char's height - to affect the total line height. (See add_intbyte_string_runes()). */ + to affect the total line height. (See add_ibyte_string_runes()). */ static prop_block_dynarr * -add_emchar_rune_1 (pos_data *data, int no_contribute_to_line_height) +add_ichar_rune_1 (pos_data *data, int no_contribute_to_line_height) { struct rune rb, *crb; int width, local; @@ -831,7 +977,7 @@ return NULL; } - if (data->bi_start_col_enabled) + if (data->byte_start_col_enabled) { return add_hscroll_rune (data); } @@ -844,7 +990,7 @@ } else { - Lisp_Object charset = CHAR_CHARSET (data->ch); + Lisp_Object charset = ichar_charset (data->ch); if (!EQ (charset, data->last_charset) || data->findex != data->last_findex) { @@ -867,26 +1013,28 @@ fi = XFONT_INSTANCE (font_instance); if (!fi->proportional_p || data->font_is_bogus) { - Emchar ch = data->font_is_bogus ? '~' : data->ch; + Ichar ch = data->font_is_bogus ? '~' : data->ch; data->last_char_width = - redisplay_text_width_emchar_string (XWINDOW (data->window), + redisplay_text_width_ichar_string (XWINDOW (data->window), data->findex, &ch, 1); } else data->last_char_width = -1; + if (!no_contribute_to_line_height) { data->new_ascent = max (data->new_ascent, (int) fi->ascent); data->new_descent = max (data->new_descent, (int) fi->descent); } + data->last_charset = charset; data->last_findex = data->findex; } width = data->last_char_width; if (width < 0) /* proportional fonts */ - width = redisplay_text_width_emchar_string (XWINDOW (data->window), + width = redisplay_text_width_ichar_string (XWINDOW (data->window), data->findex, &data->ch, 1); } @@ -910,29 +1058,29 @@ crb->findex = data->findex; crb->xpos = data->pixpos; crb->width = width; - if (data->bi_charbpos) + if (data->byte_charpos) { if (NILP (data->string)) - crb->charbpos = + crb->charpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))), - data->bi_charbpos); + data->byte_charpos); else - crb->charbpos = - string_index_byte_to_char (data->string, data->bi_charbpos); + crb->charpos = + string_index_byte_to_char (data->string, data->byte_charpos); } else if (data->is_modeline) - crb->charbpos = data->modeline_charpos; + crb->charpos = data->modeline_charpos; else /* Text but not in buffer */ - crb->charbpos = 0; + crb->charpos = 0; crb->type = RUNE_CHAR; crb->object.chr.ch = data->font_is_bogus ? '~' : data->ch; crb->endpos = 0; if (data->cursor_type == CURSOR_ON) { - if (data->bi_charbpos == data->bi_cursor_charbpos) + if (data->byte_charpos == data->byte_cursor_charpos) { crb->cursor_type = CURSOR_ON; data->cursor_x = Dynarr_length (data->db->runes); @@ -962,12 +1110,12 @@ } static prop_block_dynarr * -add_emchar_rune (pos_data *data) +add_ichar_rune (pos_data *data) { - return add_emchar_rune_1 (data, 0); + return add_ichar_rune_1 (data, 0); } -/* Given a string C_STRING of length C_LENGTH, call add_emchar_rune for +/* Given a string C_STRING of length C_LENGTH, call add_ichar_rune for each character in the string. Propagate any left-over data unless NO_PROP is non-zero. If NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't allow this character to increase the total height of the line. (This is @@ -976,11 +1124,11 @@ whether glyph-contrib-p is true.) */ static prop_block_dynarr * -add_intbyte_string_runes (pos_data *data, Intbyte *c_string, +add_ibyte_string_runes (pos_data *data, Ibyte *c_string, Bytecount c_length, int no_prop, int no_contribute_to_line_height) { - Intbyte *pos, *end = c_string + c_length; + Ibyte *pos, *end = c_string + c_length; prop_block_dynarr *prop; /* #### This function is too simplistic. It needs to do the same @@ -991,11 +1139,11 @@ for (pos = c_string; pos < end;) { - Intbyte *old_pos = pos; + Ibyte *old_pos = pos; - data->ch = charptr_emchar (pos); + data->ch = itext_ichar (pos); - prop = add_emchar_rune_1 (data, no_contribute_to_line_height); + prop = add_ichar_rune_1 (data, no_contribute_to_line_height); if (prop) { @@ -1008,7 +1156,7 @@ prop = Dynarr_new (prop_block); pb.type = PROP_STRING; - pb.data.p_string.str = xnew_array (Intbyte, len); + pb.data.p_string.str = xnew_array (Ibyte, len); strncpy ((char *) pb.data.p_string.str, (char *) pos, len); pb.data.p_string.len = len; @@ -1016,7 +1164,7 @@ return prop; } } - INC_CHARPTR (pos); + INC_IBYTEPTR (pos); assert (pos <= end); /* #### Duplicate code from add_string_to_fstring_db_runes should we do more?*/ @@ -1075,19 +1223,19 @@ rb.findex = data->findex; rb.xpos = data->pixpos; rb.width = data->blank_width; - if (data->bi_charbpos) - rb.charbpos = + if (data->byte_charpos) + rb.charpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))), - data->bi_charbpos); + data->byte_charpos); else /* #### and this is really correct too? */ - rb.charbpos = 0; + rb.charpos = 0; rb.endpos = 0; rb.type = RUNE_BLANK; if (data->cursor_type == CURSOR_ON) { - if (data->bi_charbpos == data->bi_cursor_charbpos) + if (data->byte_charpos == data->byte_cursor_charpos) { rb.cursor_type = CURSOR_ON; data->cursor_x = Dynarr_length (data->db->runes); @@ -1114,7 +1262,7 @@ #define ADD_NEXT_OCTAL_RUNE_CHAR do \ { \ - if (add_failed || (add_failed = add_emchar_rune (data))) \ + if (add_failed || (add_failed = add_ichar_rune (data))) \ { \ struct prop_block pb; \ if (!prop) \ @@ -1130,12 +1278,11 @@ static prop_block_dynarr * add_octal_runes (pos_data *data) { - prop_block_dynarr *prop, *add_failed; - Emchar orig_char = data->ch; + prop_block_dynarr *add_failed, *prop = 0; + Ichar orig_char = data->ch; int orig_cursor_type = data->cursor_type; /* Initialize */ - prop = NULL; add_failed = NULL; if (data->start_col) @@ -1143,7 +1290,7 @@ if (!data->start_col) { - if (data->bi_start_col_enabled) + if (data->byte_start_col_enabled) { add_failed = add_hscroll_rune (data); } @@ -1195,7 +1342,7 @@ ADD_NEXT_OCTAL_RUNE_CHAR; data->cursor_type = orig_cursor_type; - return prop; + return NULL; } #undef ADD_NEXT_OCTAL_RUNE_CHAR @@ -1208,7 +1355,7 @@ if (!NILP (b->ctl_arrow)) { prop_block_dynarr *prop; - Emchar orig_char = data->ch; + Ichar orig_char = data->ch; int old_cursor_type = data->cursor_type; /* Initialize */ @@ -1219,7 +1366,7 @@ if (!data->start_col) { - if (data->bi_start_col_enabled) + if (data->byte_start_col_enabled) { prop_block_dynarr *retval; @@ -1249,7 +1396,7 @@ data->ch = orig_char ^ 0100; data->cursor_type = IGNORE_CURSOR; - if (add_emchar_rune (data)) + if (add_ichar_rune (data)) { struct prop_block pb; if (!prop) @@ -1277,7 +1424,7 @@ if (STRINGP (entry)) { - prop = add_intbyte_string_runes (data, + prop = add_ibyte_string_runes (data, XSTRING_DATA (entry), XSTRING_LENGTH (entry), 0, 0); @@ -1287,7 +1434,7 @@ if (data->start_col) data->start_col--; - if (!data->start_col && data->bi_start_col_enabled) + if (!data->start_col && data->byte_start_col_enabled) { prop = add_hscroll_rune (data); } @@ -1303,7 +1450,7 @@ else if (CHAR_OR_CHAR_INTP (entry)) { data->ch = XCHAR_OR_CHAR_INT (entry); - prop = add_emchar_rune (data); + prop = add_ichar_rune (data); } else if (CONSP (entry)) { @@ -1313,33 +1460,33 @@ { Lisp_Object format = XCAR (XCDR (entry)); Bytebpos len = XSTRING_LENGTH (format); - Intbyte *src = XSTRING_DATA (format), *end = src + len; - Intbyte *result = alloca_array (Intbyte, len); - Intbyte *dst = result; + Ibyte *src = XSTRING_DATA (format), *end = src + len; + Ibyte *result = alloca_array (Ibyte, len); + Ibyte *dst = result; while (src < end) { - Emchar c = charptr_emchar (src); - INC_CHARPTR (src); + Ichar c = itext_ichar (src); + INC_IBYTEPTR (src); if (c != '%' || src == end) - dst += set_charptr_emchar (dst, c); + dst += set_itext_ichar (dst, c); else { - c = charptr_emchar (src); - INC_CHARPTR (src); + c = itext_ichar (src); + INC_IBYTEPTR (src); switch (c) { /*case 'x': dst += long_to_string_base ((char *)dst, data->ch, 16); break;*/ case '%': - dst += set_charptr_emchar (dst, '%'); + dst += set_itext_ichar (dst, '%'); break; /* #### unimplemented */ } } } - prop = add_intbyte_string_runes (data, result, dst - result, 0, 0); + prop = add_ibyte_string_runes (data, result, dst - result, 0, 0); } } @@ -1400,7 +1547,7 @@ record? */ int elt; prop_block_dynarr *add_failed; - Bytebpos bi_old_cursor_charbpos = data->bi_cursor_charbpos; + Bytebpos byte_old_cursor_charpos = data->byte_cursor_charpos; int old_cursor_type = data->cursor_type; for (elt = 0; elt < Dynarr_length (*prop); elt++) @@ -1411,9 +1558,9 @@ { case PROP_CHAR: data->ch = pb->data.p_char.ch; - data->bi_cursor_charbpos = pb->data.p_char.bi_cursor_charbpos; + data->byte_cursor_charpos = pb->data.p_char.byte_cursor_charpos; data->cursor_type = pb->data.p_char.cursor_type; - add_failed = add_emchar_rune (data); + add_failed = add_ichar_rune (data); if (add_failed) goto oops_no_more_space; @@ -1422,53 +1569,53 @@ if (pb->data.p_string.str) xfree (pb->data.p_string.str); /* #### bogus bogus -- this doesn't do anything! - Should probably call add_intbyte_string_runes(), + Should probably call add_ibyte_string_runes(), once that function is fixed. */ break; case PROP_MINIBUF_PROMPT: { face_index old_findex = data->findex; - Bytebpos bi_old_charbpos = data->bi_charbpos; + Bytebpos byte_old_charpos = data->byte_charpos; data->findex = DEFAULT_INDEX; - data->bi_charbpos = 0; + data->byte_charpos = 0; data->cursor_type = NO_CURSOR; while (pb->data.p_string.len > 0) { - data->ch = charptr_emchar (pb->data.p_string.str); - add_failed = add_emchar_rune (data); + data->ch = itext_ichar (pb->data.p_string.str); + add_failed = add_ichar_rune (data); if (add_failed) { data->findex = old_findex; - data->bi_charbpos = bi_old_charbpos; + data->byte_charpos = byte_old_charpos; goto oops_no_more_space; } else { /* Complicated equivalent of ptr++, len-- */ - Intbyte *oldpos = pb->data.p_string.str; - INC_CHARPTR (pb->data.p_string.str); + Ibyte *oldpos = pb->data.p_string.str; + INC_IBYTEPTR (pb->data.p_string.str); pb->data.p_string.len -= pb->data.p_string.str - oldpos; } } data->findex = old_findex; /* ##### FIXME FIXME FIXME -- Upon successful return from - this function, data->bi_charbpos is automatically incremented. + this function, data->byte_charpos is automatically incremented. However, we don't want that to happen if we were adding the minibuffer prompt. */ { struct buffer *buf = XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))); /* #### Chuck fix this shit or I'm gonna scream! */ - if (bi_old_charbpos > BI_BUF_BEGV (buf)) - data->bi_charbpos = prev_bytebpos (buf, bi_old_charbpos); + if (byte_old_charpos > BYTE_BUF_BEGV (buf)) + data->byte_charpos = prev_bytebpos (buf, byte_old_charpos); else /* #### is this correct? Does anyone know? Does anyone care? Is this a cheesy hack or what? */ - data->bi_charbpos = BI_BUF_BEGV (buf) - 1; + data->byte_charpos = BYTE_BUF_BEGV (buf) - 1; } } break; @@ -1482,7 +1629,7 @@ data->findex = pb->data.p_blank.findex; data->blank_width = pb->data.p_blank.width; - data->bi_cursor_charbpos = 0; + data->byte_cursor_charpos = 0; data->cursor_type = IGNORE_CURSOR; if (data->pixpos + data->blank_width > data->max_pixpos) @@ -1515,7 +1662,7 @@ oops_no_more_space: - data->bi_cursor_charbpos = bi_old_cursor_charbpos; + data->byte_cursor_charpos = byte_old_cursor_charpos; data->cursor_type = old_cursor_type; if (elt < Dynarr_length (*prop)) { @@ -1568,6 +1715,7 @@ Lisp_Object face; Lisp_Object instance; face_index findex; + prop_block_dynarr *retval = 0; if (cachel) width = cachel->width; @@ -1579,7 +1727,6 @@ if (data->start_col || data->start_col_xoffset) { - prop_block_dynarr *retval; int glyph_char_width = width / space_width (w); /* If we still have not fully scrolled horizontally after @@ -1615,17 +1762,41 @@ if (data->pixpos + width > data->max_pixpos) { /* If this is the first object we are attempting to add to - the line then we ignore the horizontal_clip threshold. - Otherwise we will loop until the bottom of the window - continually failing to add this glyph because it is wider - than the window. We could alternatively just completely - ignore the glyph and proceed from there but I think that - this is a better solution. */ + the line then we ignore the horizontal_clip threshold. + Otherwise we will loop until the bottom of the window + continually failing to add this glyph because it is wider + than the window. We could alternatively just completely + ignore the glyph and proceed from there but I think that + this is a better solution. + + This does, however, create a different problem in that we + can end up adding the object to every single line, never + getting any further - for instance an extent with a long + start-glyph that covers multitple following + characters. */ if (Dynarr_length (data->db->runes) && data->max_pixpos - data->pixpos < horizontal_clip) return ADD_FAILED; - else + else { + struct prop_block pb; + + /* We need to account for the width of the end-of-line + glyph if there is nothing more in the line to display, + since we will not display it in this instance. It seems + kind of gross doing it here, but otherwise we have to + search the runes in create_text_block(). */ + if (data->ch == '\n') + data->max_pixpos += data->end_glyph_width; width = data->max_pixpos - data->pixpos; + /* Add the glyph we are displaying, but clipping, to the + propagation data so that we don't try and do it + again. */ + retval = Dynarr_new (prop_block); + pb.type = PROP_GLYPH; + pb.data.p_glyph.glyph = gb->glyph; + pb.data.p_glyph.width = width; + Dynarr_add (retval, pb); + } } if (cachel) @@ -1641,6 +1812,8 @@ baseline = glyph_baseline (gb->glyph, data->window); + rb.object.dglyph.descent = 0; /* Gets reset lower down, if it is known. */ + if (glyph_contrib_p (gb->glyph, data->window)) { /* A pixmap that has not had a baseline explicitly set. Its @@ -1648,6 +1821,7 @@ if (NILP (baseline)) { int height = ascent + descent; + data->need_baseline_computation = 1; data->max_pixmap_height = max (data->max_pixmap_height, height); } @@ -1670,6 +1844,9 @@ data->new_ascent = max (data->new_ascent, pix_ascent); data->new_descent = max (data->new_descent, pix_descent); + data->max_pixmap_height = max (data->max_pixmap_height, height); + + rb.object.dglyph.descent = pix_descent; } /* Otherwise something is screwed up. */ @@ -1689,44 +1866,47 @@ { Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance); face_index orig_findex = data->findex; - Bytebpos orig_charbpos = data->bi_charbpos; - Bytebpos orig_start_col_enabled = data->bi_start_col_enabled; + Bytebpos orig_charpos = data->byte_charpos; + Bytebpos orig_start_col_enabled = data->byte_start_col_enabled; data->findex = findex; - data->bi_start_col_enabled = 0; + data->byte_start_col_enabled = 0; if (!allow_cursor) - data->bi_charbpos = 0; - add_intbyte_string_runes (data, XSTRING_DATA (string), + data->byte_charpos = 0; + add_ibyte_string_runes (data, XSTRING_DATA (string), XSTRING_LENGTH (string), 0, 1); data->findex = orig_findex; - data->bi_charbpos = orig_charbpos; - data->bi_start_col_enabled = orig_start_col_enabled; - return NULL; + data->byte_charpos = orig_charpos; + data->byte_start_col_enabled = orig_start_col_enabled; + return retval; } rb.findex = findex; rb.xpos = data->pixpos; rb.width = width; - rb.charbpos = 0; /* glyphs are never "at" anywhere */ - if (data->bi_endpos) + rb.charpos = 0; /* glyphs are never "at" anywhere */ + if (data->byte_endpos) /* #### is this necessary at all? */ rb.endpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (w)), - data->bi_endpos); + data->byte_endpos); else rb.endpos = 0; rb.type = RUNE_DGLYPH; rb.object.dglyph.glyph = gb->glyph; rb.object.dglyph.extent = gb->extent; rb.object.dglyph.xoffset = xoffset; + rb.object.dglyph.ascent = ascent; + rb.object.dglyph.yoffset = 0; /* Until we know better, assume that it has + a normal (textual) baseline. */ if (allow_cursor) { - rb.charbpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (w)), - data->bi_charbpos); + rb.charpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (w)), + data->byte_charpos); if (data->cursor_type == CURSOR_ON) { - if (data->bi_charbpos == data->bi_cursor_charbpos) + if (data->byte_charpos == data->byte_cursor_charpos) { rb.cursor_type = CURSOR_ON; data->cursor_x = Dynarr_length (data->db->runes); @@ -1753,7 +1933,7 @@ Dynarr_add (data->db->runes, rb); data->pixpos += width; - return NULL; + return retval; } else { @@ -1782,7 +1962,7 @@ abort (); /* there are no unknown types */ } - return NULL; /* shut up compiler */ + return NULL; } /* Add all glyphs at position POS_TYPE that are contained in the given @@ -1820,12 +2000,12 @@ display line DL accurately represents the text on a line starting at the given position. - NOTE NOTE NOTE NOTE: This function works with and returns Bytebposs. + NOTE NOTE NOTE NOTE: This function works with and returns Bytebpos's. You must do appropriate conversion. */ static Bytebpos create_text_block (struct window *w, struct display_line *dl, - Bytebpos bi_start_pos, prop_block_dynarr **prop, + Bytebpos byte_start_pos, prop_block_dynarr **prop, int type) { struct frame *f = XFRAME (w->frame); @@ -1842,7 +2022,6 @@ is_surrogate_for_selected_frame (f)); int truncate_win = window_truncation_on (w); - int end_glyph_width; /* If the buffer's value of selective_display is an integer then only lines that start with less than selective_display columns of @@ -1893,7 +2072,7 @@ Since more than one display table is possible, you have great flexibility in mapping ranges of characters. */ - Emchar printable_min = (CHAR_OR_CHAR_INTP (b->ctl_arrow) + Ichar printable_min = (CHAR_OR_CHAR_INTP (b->ctl_arrow) ? XCHAR_OR_CHAR_INT (b->ctl_arrow) : ((EQ (b->ctl_arrow, Qt) || EQ (b->ctl_arrow, Qnil)) ? 255 : 160)); @@ -1930,7 +2109,7 @@ data.db = db; data.dl = dl; - data.bi_charbpos = bi_start_pos; + data.byte_charpos = byte_start_pos; data.pixpos = dl->bounds.left_in; data.last_charset = Qunbound; data.last_findex = DEFAULT_INDEX; @@ -1940,14 +2119,14 @@ glyph. Save the width of the end glyph for later use. */ data.max_pixpos = dl->bounds.right_in; if (truncate_win) - end_glyph_width = GLYPH_CACHEL_WIDTH (w, TRUN_GLYPH_INDEX); + data.end_glyph_width = GLYPH_CACHEL_WIDTH (w, TRUN_GLYPH_INDEX); else - end_glyph_width = GLYPH_CACHEL_WIDTH (w, CONT_GLYPH_INDEX); - data.max_pixpos -= end_glyph_width; + data.end_glyph_width = GLYPH_CACHEL_WIDTH (w, CONT_GLYPH_INDEX); + data.max_pixpos -= data.end_glyph_width; if (cursor_in_echo_area && MINI_WINDOW_P (w) && echo_area_active (f)) { - data.bi_cursor_charbpos = BI_BUF_ZV (b); + data.byte_cursor_charpos = BYTE_BUF_ZV (b); data.cursor_type = CURSOR_ON; } else if (MINI_WINDOW_P (w) && !active_minibuffer) @@ -1957,12 +2136,12 @@ d == XDEVICE(CONSOLE_SELECTED_DEVICE(XCONSOLE(DEVICE_CONSOLE(d))))&& f == XFRAME(DEVICE_SELECTED_FRAME(d))) { - data.bi_cursor_charbpos = BI_BUF_PT (b); + data.byte_cursor_charpos = BYTE_BUF_PT (b); data.cursor_type = CURSOR_ON; } else if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) { - data.bi_cursor_charbpos = bi_marker_position (w->pointm[type]); + data.byte_cursor_charpos = byte_marker_position (w->pointm[type]); data.cursor_type = CURSOR_ON; } else @@ -1971,7 +2150,7 @@ data.start_col = w->hscroll; data.start_col_xoffset = w->left_xoffset; - data.bi_start_col_enabled = (w->hscroll ? bi_start_pos : 0); + data.byte_start_col_enabled = (w->hscroll ? byte_start_pos : 0); data.hscroll_glyph_width_adjust = 0; /* We regenerate the line from the very beginning. */ @@ -2007,10 +2186,10 @@ && (active_minibuffer || !NILP (synch_minibuffers_value))) { /* #### This check probably should not be necessary. */ - if (data.bi_charbpos > BI_BUF_ZV (b)) + if (data.byte_charpos > BYTE_BUF_ZV (b)) { /* #### urk! More of this lossage! */ - data.bi_charbpos--; + data.byte_charpos--; goto done; } @@ -2018,32 +2197,47 @@ a continuation line then find the next line we are actually supposed to display. */ if (selective > 0 - && (data.bi_charbpos == BI_BUF_BEGV (b) - || BUF_FETCH_CHAR (b, prev_bytebpos (b, data.bi_charbpos)) == '\n')) + && (data.byte_charpos == BYTE_BUF_BEGV (b) + || BUF_FETCH_CHAR (b, prev_bytebpos (b, data.byte_charpos)) == '\n')) { - while (bi_spaces_at_point (b, data.bi_charbpos) >= selective) + while (byte_spaces_at_point (b, data.byte_charpos) >= selective) { - data.bi_charbpos = - bi_find_next_newline_no_quit (b, data.bi_charbpos, 1); - if (data.bi_charbpos >= BI_BUF_ZV (b)) + data.byte_charpos = + byte_find_next_newline_no_quit (b, data.byte_charpos, 1); + if (data.byte_charpos >= BYTE_BUF_ZV (b)) { - data.bi_charbpos = BI_BUF_ZV (b); + data.byte_charpos = BYTE_BUF_ZV (b); goto done; } } } /* Check for face changes. */ - if (initial || (!no_more_frags && data.bi_charbpos == data.ef->end)) + if (initial || (!no_more_frags && data.byte_charpos == data.ef->end)) { + Lisp_Object last_glyph = Qnil; + + /* Deal with glyphs that we have already displayed. The + theory is that if we end up with a PROP_GLYPH in the + propagation data then we are clipping the glyph and there + can be no propagation data before that point. The theory + works because we always recalculate the extent-fragments + for propagated data, we never actually propagate the + fragments that still need to be displayed. */ + if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) + { + last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph; + Dynarr_free (*prop); + *prop = 0; + } /* Now compute the face and begin/end-glyph information. */ data.findex = /* Remember that the extent-fragment routines deal in Bytebpos's. */ - extent_fragment_update (w, data.ef, data.bi_charbpos); + extent_fragment_update (w, data.ef, data.byte_charpos, last_glyph); get_display_tables (w, data.findex, &face_dt, &window_dt); - if (data.bi_charbpos == data.ef->end) + if (data.byte_charpos == data.ef->end) no_more_frags = 1; } initial = 0; @@ -2093,7 +2287,7 @@ /* If point is in an invisible region we place it on the next visible character. */ if (data.cursor_type == CURSOR_ON - && data.bi_charbpos == data.bi_cursor_charbpos) + && data.byte_charpos == data.byte_cursor_charpos) { data.cursor_type = NEXT_CURSOR; } @@ -2102,16 +2296,16 @@ if (data.start_col) data.start_col--; - if (data.bi_charbpos == BI_BUF_ZV (b)) + if (data.byte_charpos == BYTE_BUF_ZV (b)) goto done; else - INC_BYTEBPOS (b, data.bi_charbpos); + INC_BYTEBPOS (b, data.byte_charpos); } /* If there is propagation data, then it represents the current - buffer position being displayed. Add them and advance the - position counter. This might also add the minibuffer - prompt. */ + buffer position being displayed. Add them and advance the + position counter. This might also add the minibuffer + prompt. */ else if (*prop) { dl->used_prop_data = 1; @@ -2119,13 +2313,13 @@ if (*prop) goto done; /* gee, a really narrow window */ - else if (data.bi_charbpos == BI_BUF_ZV (b)) + else if (data.byte_charpos == BYTE_BUF_ZV (b)) goto done; - else if (data.bi_charbpos < BI_BUF_BEGV (b)) + else if (data.byte_charpos < BYTE_BUF_BEGV (b)) /* #### urk urk urk! Aborts are not very fun! Fix this please! */ - data.bi_charbpos = BI_BUF_BEGV (b); + data.byte_charpos = BYTE_BUF_BEGV (b); else - INC_BYTEBPOS (b, data.bi_charbpos); + INC_BYTEBPOS (b, data.byte_charpos); } /* If there are end glyphs, add them to the line. These are @@ -2133,32 +2327,72 @@ here rather than doing them at the end of handling the previous run so that glyphs at the beginning and end of a line are handled correctly. */ - else if (Dynarr_length (data.ef->end_glyphs) > 0) - { - *prop = add_glyph_runes (&data, END_GLYPHS); - if (*prop) - goto done; - } - - /* If there are begin glyphs, add them to the line. */ - else if (Dynarr_length (data.ef->begin_glyphs) > 0) + else if (Dynarr_length (data.ef->end_glyphs) > 0 + || Dynarr_length (data.ef->begin_glyphs) > 0) { - *prop = add_glyph_runes (&data, BEGIN_GLYPHS); - if (*prop) - goto done; + glyph_block_dynarr* tmpglyphs = 0; + /* #### I think this is safe, but could be wrong. */ + data.ch = BYTE_BUF_FETCH_CHAR (b, data.byte_charpos); + + if (Dynarr_length (data.ef->end_glyphs) > 0) + { + *prop = add_glyph_runes (&data, END_GLYPHS); + tmpglyphs = data.ef->end_glyphs; + } + + /* If there are begin glyphs, add them to the line. */ + if (!*prop && Dynarr_length (data.ef->begin_glyphs) > 0) + { + *prop = add_glyph_runes (&data, BEGIN_GLYPHS); + tmpglyphs = data.ef->begin_glyphs; + } + + if (*prop) + { + /* If we just clipped a glyph and we are at the end of a + line and there are more glyphs to display then do + appropriate processing to not get a continuation + glyph. */ + if (*prop != ADD_FAILED + && Dynarr_atp (*prop, 0)->type == PROP_GLYPH + && data.ch == '\n') + { + /* If there are no more glyphs then do the normal + processing. + + #### This doesn't actually work if the same glyph is + present more than once in the block. To solve + this we would have to carry the index around + which might be problematic since the fragment is + recalculated for each line. */ + if (EQ (Dynarr_end (tmpglyphs)->glyph, + Dynarr_atp (*prop, 0)->data.p_glyph.glyph)) + { + Dynarr_free (*prop); + *prop = 0; + } + else { + data.blank_width = DEVMETH (d, eol_cursor_width, ()); + add_ichar_rune (&data); /* discard prop data. */ + goto done; + } + } + else + goto done; + } } /* If at end-of-buffer, we've already processed begin and end-glyphs at this point and there's no text to process, so we're done. */ - else if (data.bi_charbpos == BI_BUF_ZV (b)) + else if (data.byte_charpos == BYTE_BUF_ZV (b)) goto done; else { Lisp_Object entry = Qnil; /* Get the character at the current buffer position. */ - data.ch = BI_BUF_FETCH_CHAR (b, data.bi_charbpos); + data.ch = BYTE_BUF_FETCH_CHAR (b, data.byte_charpos); if (!NILP (face_dt) || !NILP (window_dt)) entry = display_table_entry (data.ch, face_dt, window_dt); @@ -2179,11 +2413,11 @@ /* We aren't going to be adding an end glyph so give its space back in order to make sure that the cursor can fit. */ - data.max_pixpos += end_glyph_width; + data.max_pixpos += data.end_glyph_width; if (selective > 0 - && (bi_spaces_at_point - (b, next_bytebpos (b, data.bi_charbpos)) + && (byte_spaces_at_point + (b, next_bytebpos (b, data.byte_charpos)) >= selective)) { if (!NILP (b->selective_display_ellipses)) @@ -2202,33 +2436,33 @@ is the EOL cursor width and whose character is the non-printing character '\n'. */ data.blank_width = DEVMETH (d, eol_cursor_width, ()); - *prop = add_emchar_rune (&data); + *prop = add_ichar_rune (&data); } - /* We need to set data.bi_charbpos to the start of the + /* We need to set data.byte_charpos to the start of the next visible region in order to make this line appear to contain all of the invisible area. Otherwise, the line cache won't work correctly. */ - INC_BYTEBPOS (b, data.bi_charbpos); - while (bi_spaces_at_point (b, data.bi_charbpos) >= selective) + INC_BYTEBPOS (b, data.byte_charpos); + while (byte_spaces_at_point (b, data.byte_charpos) >= selective) { - data.bi_charbpos = - bi_find_next_newline_no_quit (b, data.bi_charbpos, 1); - if (data.bi_charbpos >= BI_BUF_ZV (b)) + data.byte_charpos = + byte_find_next_newline_no_quit (b, data.byte_charpos, 1); + if (data.byte_charpos >= BYTE_BUF_ZV (b)) { - data.bi_charbpos = BI_BUF_ZV (b); + data.byte_charpos = BYTE_BUF_ZV (b); break; } } - if (BI_BUF_FETCH_CHAR - (b, prev_bytebpos (b, data.bi_charbpos)) == '\n') - DEC_BYTEBPOS (b, data.bi_charbpos); + if (BYTE_BUF_FETCH_CHAR + (b, prev_bytebpos (b, data.byte_charpos)) == '\n') + DEC_BYTEBPOS (b, data.byte_charpos); } else { data.blank_width = DEVMETH (d, eol_cursor_width, ()); - *prop = add_emchar_rune (&data); + *prop = add_ichar_rune (&data); } goto done; @@ -2240,27 +2474,27 @@ line is done. */ else if (data.ch == (('M' & 037)) && selective == -1) { - Bytebpos bi_next_charbpos; + Bytebpos byte_next_charpos; /* Find the buffer position at the end of the line. */ - bi_next_charbpos = - bi_find_next_newline_no_quit (b, data.bi_charbpos, 1); - if (BI_BUF_FETCH_CHAR (b, prev_bytebpos (b, bi_next_charbpos)) + byte_next_charpos = + byte_find_next_newline_no_quit (b, data.byte_charpos, 1); + if (BYTE_BUF_FETCH_CHAR (b, prev_bytebpos (b, byte_next_charpos)) == '\n') - DEC_BYTEBPOS (b, bi_next_charbpos); + DEC_BYTEBPOS (b, byte_next_charpos); /* If the cursor is somewhere in the elided text make sure that the cursor gets drawn appropriately. */ if (data.cursor_type == CURSOR_ON - && (data.bi_cursor_charbpos >= data.bi_charbpos && - data.bi_cursor_charbpos < bi_next_charbpos)) + && (data.byte_cursor_charpos >= data.byte_charpos && + data.byte_cursor_charpos < byte_next_charpos)) { data.cursor_type = NEXT_CURSOR; } /* We won't be adding a truncation or continuation glyph so give up the room allocated for them. */ - data.max_pixpos += end_glyph_width; + data.max_pixpos += data.end_glyph_width; if (!NILP (b->selective_display_ellipses)) { @@ -2279,10 +2513,10 @@ need to do this before potentially adding a newline so that the cursor flag will get set correctly (if needed). */ - data.bi_charbpos = bi_next_charbpos; + data.byte_charpos = byte_next_charpos; if (NILP (b->selective_display_ellipses) - || data.bi_cursor_charbpos == bi_next_charbpos) + || data.byte_cursor_charpos == byte_next_charpos) { /* We have to at least add a newline character so that the cursor shows up properly. */ @@ -2291,15 +2525,15 @@ data.findex = DEFAULT_INDEX; data.start_col = 0; data.start_col_xoffset = 0; - data.bi_start_col_enabled = 0; + data.byte_start_col_enabled = 0; - add_emchar_rune (&data); + add_ichar_rune (&data); } /* This had better be a newline but doing it this way we'll see obvious incorrect results if it isn't. No need to abort here. */ - data.ch = BI_BUF_FETCH_CHAR (b, data.bi_charbpos); + data.ch = BYTE_BUF_FETCH_CHAR (b, data.byte_charpos); goto done; } @@ -2308,7 +2542,7 @@ just add it. */ else if (data.ch >= printable_min) { - *prop = add_emchar_rune (&data); + *prop = add_ichar_rune (&data); if (*prop) goto done; } @@ -2368,7 +2602,7 @@ often bites people who carelessly use `char' instead of `unsigned char'.) */ - else if (data.ch < 0x100 && iscntrl ((Intbyte) data.ch)) + else if (data.ch < 0x100 && iscntrl ((Ibyte) data.ch)) { *prop = add_control_char_runes (&data, b); @@ -2390,12 +2624,12 @@ then just add it. */ else { - *prop = add_emchar_rune (&data); + *prop = add_ichar_rune (&data); if (*prop) goto done; } - INC_BYTEBPOS (b, data.bi_charbpos); + INC_BYTEBPOS (b, data.byte_charpos); } } @@ -2403,15 +2637,15 @@ /* Determine the starting point of the next line if we did not hit the end of the buffer. */ - if (data.bi_charbpos < BI_BUF_ZV (b) + if (data.byte_charpos < BYTE_BUF_ZV (b) && (active_minibuffer || !NILP (synch_minibuffers_value))) { /* #### This check is not correct. If the line terminated due to a begin-glyph or end-glyph hitting window-end, then - data.ch will not point to the character at data.bi_charbpos. If + data.ch will not point to the character at data.byte_charpos. If you make the two changes mentioned at the top of this loop, you should be able to say '(if (*prop))'. That should also - make it possible to eliminate the data.bi_charbpos < BI_BUF_ZV (b) + make it possible to eliminate the data.byte_charpos < BYTE_BUF_ZV (b) check. */ /* The common case is that the line ended because we hit a newline. @@ -2423,19 +2657,19 @@ scrolled far enough so that nothing on this line is visible. We need to stick a truncation glyph at the beginning of the line in that case unless the line is completely blank. */ - if (data.bi_start_col_enabled) + if (data.byte_start_col_enabled) { if (data.cursor_type == CURSOR_ON) { - if (data.bi_cursor_charbpos >= bi_start_pos - && data.bi_cursor_charbpos <= data.bi_charbpos) - data.bi_cursor_charbpos = data.bi_charbpos; + if (data.byte_cursor_charpos >= byte_start_pos + && data.byte_cursor_charpos <= data.byte_charpos) + data.byte_cursor_charpos = data.byte_charpos; } data.findex = DEFAULT_INDEX; data.start_col = 0; - data.bi_start_col_enabled = 0; + data.byte_start_col_enabled = 0; - if (data.bi_charbpos != bi_start_pos) + if (data.byte_charpos != byte_start_pos) { struct glyph_block gb; @@ -2451,11 +2685,11 @@ data.ch = '\n'; data.blank_width = DEVMETH (d, eol_cursor_width, ()); - add_emchar_rune (&data); + add_ichar_rune (&data); } } - INC_BYTEBPOS (b, data.bi_charbpos); + INC_BYTEBPOS (b, data.byte_charpos); } /* Otherwise we have a buffer line which cannot fit on one display @@ -2469,16 +2703,16 @@ for the next newline. We also add the end-of-line glyph which we know will fit because we adjusted the right border before we starting laying out the line. */ - data.max_pixpos += end_glyph_width; + data.max_pixpos += data.end_glyph_width; data.findex = DEFAULT_INDEX; gb.extent = Qnil; if (truncate_win) { - Bytebpos bi_pos; + Bytebpos byte_pos; /* Now find the start of the next line. */ - bi_pos = bi_find_next_newline_no_quit (b, data.bi_charbpos, 1); + byte_pos = byte_find_next_newline_no_quit (b, data.byte_charpos, 1); /* If the cursor is past the truncation line then we make it appear on the truncation glyph. If we've hit @@ -2487,17 +2721,17 @@ newline. In that case the cursor should actually appear on the next line. */ if (data.cursor_type == CURSOR_ON - && data.bi_cursor_charbpos >= data.bi_charbpos - && (data.bi_cursor_charbpos < bi_pos || - (bi_pos == BI_BUF_ZV (b) - && (bi_pos == BI_BUF_BEGV (b) - || (BI_BUF_FETCH_CHAR (b, prev_bytebpos (b, bi_pos)) + && data.byte_cursor_charpos >= data.byte_charpos + && (data.byte_cursor_charpos < byte_pos || + (byte_pos == BYTE_BUF_ZV (b) + && (byte_pos == BYTE_BUF_BEGV (b) + || (BYTE_BUF_FETCH_CHAR (b, prev_bytebpos (b, byte_pos)) != '\n'))))) - data.bi_cursor_charbpos = bi_pos; + data.byte_cursor_charpos = byte_pos; else data.cursor_type = NO_CURSOR; - data.bi_charbpos = bi_pos; + data.byte_charpos = byte_pos; gb.glyph = Vtruncation_glyph; cachel = GLYPH_CACHEL (w, TRUN_GLYPH_INDEX); } @@ -2506,7 +2740,7 @@ /* The cursor can never be on the continuation glyph. */ data.cursor_type = NO_CURSOR; - /* data.bi_charbpos is already at the start of the next line. */ + /* data.byte_charpos is already at the start of the next line. */ dl->line_continuation = 1; gb.glyph = Vcontinuation_glyph; @@ -2515,14 +2749,14 @@ add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel); - if (truncate_win && data.bi_charbpos == BI_BUF_ZV (b) - && BI_BUF_FETCH_CHAR (b, prev_bytebpos (b, BI_BUF_ZV (b))) != '\n') + if (truncate_win && data.byte_charpos == BYTE_BUF_ZV (b) + && BYTE_BUF_FETCH_CHAR (b, prev_bytebpos (b, BYTE_BUF_ZV (b))) != '\n') /* #### Damn this losing shit. */ - data.bi_charbpos++; + data.byte_charpos++; } } else if ((active_minibuffer || !NILP (synch_minibuffers_value)) - && (!echo_area_active (f) || data.bi_charbpos == BI_BUF_ZV (b))) + && (!echo_area_active (f) || data.byte_charpos == BYTE_BUF_ZV (b))) { /* We need to add a marker to the end of the line since there is no newline character in order for the cursor to get drawn. We label @@ -2534,16 +2768,16 @@ data.findex = DEFAULT_INDEX; data.start_col = 0; data.start_col_xoffset = 0; - data.bi_start_col_enabled = 0; + data.byte_start_col_enabled = 0; data.max_pixpos += data.blank_width; - add_emchar_rune (&data); + add_ichar_rune (&data); data.max_pixpos -= data.blank_width; /* #### urk! Chuck, this shit is bad news. Going around manipulating invalid positions is guaranteed to result in trouble sooner or later. */ - data.bi_charbpos = BI_BUF_ZV (b) + 1; + data.byte_charpos = BYTE_BUF_ZV (b) + 1; } /* Calculate left whitespace boundary. */ @@ -2604,26 +2838,7 @@ else db->end_pos = dl->bounds.right_white; - /* update line height parameters */ - if (!data.new_ascent && !data.new_descent) - { - /* We've got a blank line so initialize these values from the default - face. */ - default_face_font_info (data.window, &data.new_ascent, - &data.new_descent, 0, 0, 0); - } - - if (data.max_pixmap_height) - { - int height = data.new_ascent + data.new_descent; - int pix_ascent, pix_descent; - - pix_descent = data.max_pixmap_height * data.new_descent / height; - pix_ascent = data.max_pixmap_height - pix_descent; - - data.new_ascent = max (data.new_ascent, pix_ascent); - data.new_descent = max (data.new_descent, pix_descent); - } + calculate_baseline (&data); dl->ascent = data.new_ascent; dl->descent = data.new_descent; @@ -2641,19 +2856,21 @@ dl->descent = descent; } + calculate_yoffset (dl, db); + dl->cursor_elt = data.cursor_x; /* #### lossage lossage lossage! Fix this shit! */ - if (data.bi_charbpos > BI_BUF_ZV (b)) - dl->end_charbpos = BUF_ZV (b); + if (data.byte_charpos > BYTE_BUF_ZV (b)) + dl->end_charpos = BUF_ZV (b); else - dl->end_charbpos = bytebpos_to_charbpos (b, data.bi_charbpos) - 1; + dl->end_charpos = bytebpos_to_charbpos (b, data.byte_charpos) - 1; if (truncate_win) - data.dl->num_chars = column_at_point (b, dl->end_charbpos, 0); + data.dl->num_chars = column_at_point (b, dl->end_charpos, 0); else /* This doesn't correctly take into account tabs and control characters but if the window isn't being truncated then this value isn't going to end up being used anyhow. */ - data.dl->num_chars = dl->end_charbpos - dl->charbpos; + data.dl->num_chars = dl->end_charpos - dl->charpos; /* #### handle horizontally scrolled line with text none of which was actually laid out. */ @@ -2676,10 +2893,10 @@ The main loop should get fixed so that it isn't necessary to call this function if we are already at EOB. */ - if (data.bi_charbpos == BI_BUF_ZV (b) && bi_start_pos == BI_BUF_ZV (b)) - return data.bi_charbpos + 1; /* Yuck! */ + if (data.byte_charpos == BYTE_BUF_ZV (b) && byte_start_pos == BYTE_BUF_ZV (b)) + return data.byte_charpos + 1; /* Yuck! */ else - return data.bi_charbpos; + return data.byte_charpos; } /* Display the overlay arrow at the beginning of the given line. */ @@ -2715,7 +2932,7 @@ if (STRINGP (Voverlay_arrow_string)) { - add_intbyte_string_runes + add_ibyte_string_runes (&data, XSTRING_DATA (Voverlay_arrow_string), XSTRING_LENGTH (Voverlay_arrow_string), @@ -2729,14 +2946,15 @@ gb.extent = Qnil; add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, 0); } - + if (data.max_pixmap_height) { int height = data.new_ascent + data.new_descent; int pix_ascent, pix_descent; - + pix_descent = data.max_pixmap_height * data.new_descent / height; pix_ascent = data.max_pixmap_height - pix_descent; + calculate_baseline (&data); data.new_ascent = max (data.new_ascent, pix_ascent); data.new_descent = max (data.new_descent, pix_descent); @@ -2748,6 +2966,8 @@ data.db->start_pos = dl->bounds.left_in; data.db->end_pos = data.pixpos; + calculate_yoffset (dl, data.db); + return data.pixpos - dl->bounds.left_in; } @@ -2819,20 +3039,13 @@ (reverse ? elt-- : elt++); } - if (data.max_pixmap_height) - { - int height = data.new_ascent + data.new_descent; - int pix_ascent, pix_descent; - - pix_descent = data.max_pixmap_height * data.new_descent / height; - pix_ascent = data.max_pixmap_height - pix_descent; - data.new_ascent = max (data.new_ascent, pix_ascent); - data.new_descent = max (data.new_descent, pix_descent); - } + calculate_baseline (&data); dl->ascent = data.new_ascent; dl->descent = data.new_descent; + calculate_yoffset (dl, data.db); + return data.pixpos; } @@ -2849,7 +3062,7 @@ : get_builtin_face_cache_index (w, Vright_margin_face)); rb.xpos = xpos; rb.width = width; - rb.charbpos = -1; + rb.charpos = -1; rb.endpos = 0; rb.type = RUNE_BLANK; rb.cursor_type = CURSOR_OFF; @@ -3558,7 +3771,7 @@ { int elt; Bytecount len; - Intbyte *strdata; + Ibyte *strdata; struct buffer *buf = XBUFFER (WINDOW_BUFFER (w)); in_modeline_generation = 1; @@ -3574,7 +3787,7 @@ { if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) { - len += (set_charptr_emchar + len += (set_itext_ichar (strdata + len, Dynarr_atp (db->runes, elt)->object.chr.ch)); } @@ -3652,7 +3865,7 @@ rb.findex = MODELINE_INDEX; rb.xpos = dl->bounds.left_out; rb.width = dl->bounds.right_out - dl->bounds.left_out; - rb.charbpos = 0; + rb.charpos = 0; rb.endpos = 0; rb.type = RUNE_HLINE; rb.object.hline.thickness = 1; @@ -3705,13 +3918,13 @@ } static Charcount -add_string_to_fstring_db_runes (pos_data *data, const Intbyte *str, +add_string_to_fstring_db_runes (pos_data *data, const Ibyte *str, Charcount pos, Charcount min_pos, Charcount max_pos) { /* This function has been Mule-ized. */ Charcount end; - const Intbyte *cur_pos = str; + const Ibyte *cur_pos = str; struct display_block *db = data->db; data->blank_width = space_width (XWINDOW (data->window)); @@ -3725,12 +3938,12 @@ while (pos < end && *cur_pos) { - const Intbyte *old_cur_pos = cur_pos; + const Ibyte *old_cur_pos = cur_pos; int succeeded; - data->ch = charptr_emchar (cur_pos); - succeeded = (add_emchar_rune (data) != ADD_FAILED); - INC_CHARPTR (cur_pos); + data->ch = itext_ichar (cur_pos); + succeeded = (add_ichar_rune (data) != ADD_FAILED); + INC_IBYTEPTR (cur_pos); if (succeeded) { pos++; @@ -3816,11 +4029,11 @@ /* A string. Add to the display line and check for %-constructs within it. */ - Intbyte *this = XSTRING_DATA (elt); + Ibyte *this = XSTRING_DATA (elt); while ((pos < max_pos || max_pos == -1) && *this) { - Intbyte *last = this; + Ibyte *last = this; while (*this && *this != '%') this++; @@ -3837,7 +4050,7 @@ { Charcount tmp_max = (max_pos == -1 ? pos + size - *offset : min (pos + size - *offset, max_pos)); - const Intbyte *tmp_last = charptr_n_addr (last, *offset); + const Ibyte *tmp_last = itext_n_addr (last, *offset); pos = add_string_to_fstring_db_runes (data, tmp_last, pos, pos, tmp_max); @@ -3881,7 +4094,7 @@ { int cur_pixsize; int dash_pixsize; - Intbyte ch = '-'; + Ibyte ch = '-'; SET_CURRENT_MODE_CHARS_PIXSIZE; dash_pixsize = @@ -3894,26 +4107,26 @@ while (num_to_add--) pos = add_string_to_fstring_db_runes - (data, (const Intbyte *) "-", pos, pos, max_pos); + (data, (const Ibyte *) "-", pos, pos, max_pos); } else if (*this != 0) { - Emchar ch = charptr_emchar (this); - Intbyte *str; + Ichar ch = itext_ichar (this); + Ibyte *str; Charcount size; decode_mode_spec (w, ch, type); - str = Dynarr_atp (mode_spec_intbyte_string, 0); + str = Dynarr_atp (mode_spec_ibyte_string, 0); size = bytecount_to_charcount /* Skip the null character added by `decode_mode_spec' */ - (str, Dynarr_length (mode_spec_intbyte_string)) - 1; + (str, Dynarr_length (mode_spec_ibyte_string)) - 1; if (size <= *offset) *offset -= size; else { - const Intbyte *tmp_str = charptr_n_addr (str, *offset); + const Ibyte *tmp_str = itext_n_addr (str, *offset); /* #### NOTE: I don't understand why a tmp_max is not computed and used here as in the plain string case @@ -3927,7 +4140,7 @@ /* NOT this++. There could be any sort of character at the current position. */ - INC_CHARPTR (this); + INC_IBYTEPTR (this); } if (max_pixsize > 0) @@ -3952,14 +4165,14 @@ don't check for % within it. */ if (STRINGP (tem)) { - Intbyte *str = XSTRING_DATA (tem); - Charcount size = XSTRING_CHAR_LENGTH (tem); + Ibyte *str = XSTRING_DATA (tem); + Charcount size = string_char_length (tem); if (size <= *offset) *offset -= size; else { - const Intbyte *tmp_str = charptr_n_addr (str, *offset); + const Ibyte *tmp_str = itext_n_addr (str, *offset); /* #### NOTE: I don't understand why a tmp_max is not computed and used here as in the plain string case @@ -4157,8 +4370,8 @@ *offset -= size; else { - const Intbyte *tmp_str = - charptr_n_addr ((const Intbyte *) str, *offset); + const Ibyte *tmp_str = + itext_n_addr ((const Ibyte *) str, *offset); /* #### NOTE: I don't understand why a tmp_max is not computed and used here as in the plain string case above. -- dv */ @@ -4171,7 +4384,7 @@ if (min_pos > pos) { - add_string_to_fstring_db_runes (data, (const Intbyte *) "", pos, + add_string_to_fstring_db_runes (data, (const Ibyte *) "", pos, min_pos, -1); } @@ -4269,9 +4482,9 @@ /***************************************************************************/ -/* */ -/* displayable string routines */ -/* */ +/* */ +/* displayable string routines */ +/* */ /***************************************************************************/ /* Given a position for a string in a window, ensure that the given @@ -4291,7 +4504,7 @@ static Charbpos create_string_text_block (struct window *w, Lisp_Object disp_string, struct display_line *dl, - Charbpos start_pos, + Charcount start_pos, prop_block_dynarr **prop, face_index default_face) { @@ -4306,13 +4519,12 @@ /* we're working with these a lot so precalculate them */ Bytecount slen = XSTRING_LENGTH (disp_string); - Bytecount bi_string_zv = slen; - Bytebpos bi_start_pos = string_index_char_to_byte (disp_string, start_pos); + Bytecount byte_string_zv = slen; + Bytecount byte_start_pos = string_index_char_to_byte (disp_string, start_pos); pos_data data; int truncate_win = b ? window_truncation_on (w) : 0; - int end_glyph_width = 0; /* We're going to ditch selective display for static text, it's an FSF thing and invisible extents are the way to go here. @@ -4361,7 +4573,7 @@ Since more than one display table is possible, you have great flexibility in mapping ranges of characters. */ - Emchar printable_min = b ? (CHAR_OR_CHAR_INTP (b->ctl_arrow) + Ichar printable_min = b ? (CHAR_OR_CHAR_INTP (b->ctl_arrow) ? XCHAR_OR_CHAR_INT (b->ctl_arrow) : ((EQ (b->ctl_arrow, Qt) || EQ (b->ctl_arrow, Qnil)) ? 255 : 160)) : 255; @@ -4410,7 +4622,7 @@ data.db = db; data.dl = dl; - data.bi_charbpos = bi_start_pos; + data.byte_charpos = byte_start_pos; data.pixpos = dl->bounds.left_in; data.last_charset = Qunbound; data.last_findex = default_face; @@ -4420,13 +4632,7 @@ /* Set the right boundary adjusting it to take into account any end glyph. Save the width of the end glyph for later use. */ data.max_pixpos = dl->bounds.right_in; -#if 0 - if (truncate_win) - end_glyph_width = GLYPH_CACHEL_WIDTH (w, TRUN_GLYPH_INDEX); - else - end_glyph_width = GLYPH_CACHEL_WIDTH (w, CONT_GLYPH_INDEX); -#endif - data.max_pixpos -= end_glyph_width; + data.max_pixpos -= data.end_glyph_width; data.cursor_type = NO_CURSOR; data.cursor_x = -1; @@ -4435,9 +4641,9 @@ /* I don't think we want this, string areas should not scroll with the window data.start_col = w->hscroll; - data.bi_start_col_enabled = (w->hscroll ? bi_start_pos : 0); + data.byte_start_col_enabled = (w->hscroll ? byte_start_pos : 0); */ - data.bi_start_col_enabled = 0; + data.byte_start_col_enabled = 0; data.hscroll_glyph_width_adjust = 0; /* We regenerate the line from the very beginning. */ @@ -4472,21 +4678,29 @@ while (data.pixpos <= data.max_pixpos) { /* #### This check probably should not be necessary. */ - if (data.bi_charbpos > bi_string_zv) + if (data.byte_charpos > byte_string_zv) { /* #### urk! More of this lossage! */ - data.bi_charbpos--; + data.byte_charpos--; goto done; } /* Check for face changes. */ - if (initial || (!no_more_frags && data.bi_charbpos == data.ef->end)) + if (initial || (!no_more_frags && data.byte_charpos == data.ef->end)) { + Lisp_Object last_glyph = Qnil; + /* Deal with clipped glyphs that we have already displayed. */ + if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) + { + last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph; + Dynarr_free (*prop); + *prop = 0; + } /* Now compute the face and begin/end-glyph information. */ data.findex = /* Remember that the extent-fragment routines deal in - Bytebpos's. */ - extent_fragment_update (w, data.ef, data.bi_charbpos); + Bytexpos's. */ + extent_fragment_update (w, data.ef, data.byte_charpos, last_glyph); /* This is somewhat cheesy but the alternative is to propagate default_face into extent_fragment_update. */ if (data.findex == DEFAULT_INDEX) @@ -4494,7 +4708,7 @@ get_display_tables (w, data.findex, &face_dt, &window_dt); - if (data.bi_charbpos == data.ef->end) + if (data.byte_charpos == data.ef->end) no_more_frags = 1; } initial = 0; @@ -4545,10 +4759,10 @@ if (data.start_col) data.start_col--; - if (data.bi_charbpos == bi_string_zv) + if (data.byte_charpos == byte_string_zv) goto done; else - INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); + INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos); } /* If there is propagation data, then it represents the current @@ -4562,13 +4776,13 @@ if (*prop) goto done; /* gee, a really narrow window */ - else if (data.bi_charbpos == bi_string_zv) + else if (data.byte_charpos == byte_string_zv) goto done; - else if (data.bi_charbpos < 0) + else if (data.byte_charpos < 0) /* #### urk urk urk! Aborts are not very fun! Fix this please! */ - data.bi_charbpos = 0; + data.byte_charpos = 0; else - INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); + INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos); } /* If there are end glyphs, add them to the line. These are @@ -4578,30 +4792,36 @@ a line are handled correctly. */ else if (Dynarr_length (data.ef->end_glyphs) > 0) { + data.ch = string_ichar (disp_string, data.byte_charpos); *prop = add_glyph_runes (&data, END_GLYPHS); - if (*prop) + + if (*prop) { goto done; + } } /* If there are begin glyphs, add them to the line. */ else if (Dynarr_length (data.ef->begin_glyphs) > 0) { + data.ch = string_ichar (disp_string, data.byte_charpos); *prop = add_glyph_runes (&data, BEGIN_GLYPHS); - if (*prop) + + if (*prop) { goto done; + } } /* If at end-of-buffer, we've already processed begin and end-glyphs at this point and there's no text to process, so we're done. */ - else if (data.bi_charbpos == bi_string_zv) + else if (data.byte_charpos == byte_string_zv) goto done; else { Lisp_Object entry = Qnil; /* Get the character at the current buffer position. */ - data.ch = XSTRING_CHAR (disp_string, data.bi_charbpos); + data.ch = string_ichar (disp_string, data.byte_charpos); if (!NILP (face_dt) || !NILP (window_dt)) entry = display_table_entry (data.ch, face_dt, window_dt); @@ -4622,7 +4842,7 @@ /* We aren't going to be adding an end glyph so give its space back in order to make sure that the cursor can fit. */ - data.max_pixpos += end_glyph_width; + data.max_pixpos += data.end_glyph_width; goto done; } @@ -4630,7 +4850,7 @@ just add it. */ else if (data.ch >= printable_min) { - *prop = add_emchar_rune (&data); + *prop = add_ichar_rune (&data); if (*prop) goto done; } @@ -4664,7 +4884,7 @@ *prop = add_blank_rune (&data, w, char_tab_width); /* add_blank_rune is only supposed to be called with - sizes guaranteed to fit in the available space. */ + sizes guaranteed to fit in the available space. */ assert (!(*prop)); if (prop_width) @@ -4689,7 +4909,7 @@ often bites people who carelessly use `char' instead of `unsigned char'.) */ - else if (data.ch < 0x100 && iscntrl ((Intbyte) data.ch)) + else if (data.ch < 0x100 && iscntrl ((Ibyte) data.ch)) { *prop = add_control_char_runes (&data, b); @@ -4711,27 +4931,27 @@ then just add it. */ else { - *prop = add_emchar_rune (&data); + *prop = add_ichar_rune (&data); if (*prop) goto done; } - INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); + INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos); } } -done: + done: /* Determine the starting point of the next line if we did not hit the end of the buffer. */ - if (data.bi_charbpos < bi_string_zv) + if (data.byte_charpos < byte_string_zv) { /* #### This check is not correct. If the line terminated due to a begin-glyph or end-glyph hitting window-end, then - data.ch will not point to the character at data.bi_charbpos. If + data.ch will not point to the character at data.byte_charpos. If you make the two changes mentioned at the top of this loop, you should be able to say '(if (*prop))'. That should also - make it possible to eliminate the data.bi_charbpos < BI_BUF_ZV (b) + make it possible to eliminate the data.byte_charpos < BYTE_BUF_ZV (b) check. */ /* The common case is that the line ended because we hit a newline. @@ -4739,7 +4959,7 @@ position. */ if (data.ch == '\n') { - INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); + INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos); } /* Otherwise we have a buffer line which cannot fit on one display @@ -4753,20 +4973,20 @@ for the next newline. We also add the end-of-line glyph which we know will fit because we adjusted the right border before we starting laying out the line. */ - data.max_pixpos += end_glyph_width; + data.max_pixpos += data.end_glyph_width; data.findex = default_face; gb.extent = Qnil; if (truncate_win) { - Bytebpos bi_pos; + Bytecount byte_pos; /* Now find the start of the next line. */ - bi_pos = bi_find_next_emchar_in_string (disp_string, '\n', - data.bi_charbpos, 1); + byte_pos = byte_find_next_ichar_in_string (disp_string, '\n', + data.byte_charpos, 1); data.cursor_type = NO_CURSOR; - data.bi_charbpos = bi_pos; + data.byte_charpos = byte_pos; gb.glyph = Vtruncation_glyph; cachel = GLYPH_CACHEL (w, TRUN_GLYPH_INDEX); } @@ -4775,30 +4995,30 @@ /* The cursor can never be on the continuation glyph. */ data.cursor_type = NO_CURSOR; - /* data.bi_charbpos is already at the start of the next line. */ + /* data.byte_charpos is already at the start of the next line. */ dl->line_continuation = 1; gb.glyph = Vcontinuation_glyph; cachel = GLYPH_CACHEL (w, CONT_GLYPH_INDEX); } - if (end_glyph_width) + if (data.end_glyph_width) add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel); - if (truncate_win && data.bi_charbpos == bi_string_zv) + if (truncate_win && data.byte_charpos == byte_string_zv) { - const Intbyte *endb = charptr_n_addr (XSTRING_DATA (disp_string), - bi_string_zv); - DEC_CHARPTR (endb); - if (charptr_emchar (endb) != '\n') + const Ibyte *endb = itext_n_addr (XSTRING_DATA (disp_string), + byte_string_zv); + DEC_IBYTEPTR (endb); + if (itext_ichar (endb) != '\n') { /* #### Damn this losing shit. */ - data.bi_charbpos++; + data.byte_charpos++; } } } } - else if (data.bi_charbpos == bi_string_zv) + else if (data.byte_charpos == byte_string_zv) { /* create_text_block () adds a bogus \n marker here which screws up subwindow display. Since we never have a cursor in the @@ -4862,26 +5082,7 @@ else db->end_pos = dl->bounds.right_white; - /* update line height parameters */ - if (!data.new_ascent && !data.new_descent) - { - /* We've got a blank line so initialize these values from the default - face. */ - default_face_font_info (data.window, &data.new_ascent, - &data.new_descent, 0, 0, 0); - } - - if (data.max_pixmap_height) - { - int height = data.new_ascent + data.new_descent; - int pix_ascent, pix_descent; - - pix_descent = data.max_pixmap_height * data.new_descent / height; - pix_ascent = data.max_pixmap_height - pix_descent; - - data.new_ascent = max (data.new_ascent, pix_ascent); - data.new_descent = max (data.new_descent, pix_descent); - } + calculate_baseline (&data); dl->ascent = data.new_ascent; dl->descent = data.new_descent; @@ -4899,24 +5100,26 @@ dl->descent = descent; } + calculate_yoffset (dl, db); + dl->cursor_elt = data.cursor_x; /* #### lossage lossage lossage! Fix this shit! */ - if (data.bi_charbpos > bi_string_zv) - dl->end_charbpos = buffer_or_string_bytebpos_to_charbpos (disp_string, - bi_string_zv); - else - dl->end_charbpos = - buffer_or_string_bytebpos_to_charbpos (disp_string, - data.bi_charbpos) - 1; + if (data.byte_charpos > byte_string_zv) + dl->end_charpos = buffer_or_string_bytexpos_to_charxpos (disp_string, + byte_string_zv); + else + dl->end_charpos = + buffer_or_string_bytexpos_to_charxpos (disp_string, + data.byte_charpos) - 1; if (truncate_win) data.dl->num_chars = - string_column_at_point (disp_string, dl->end_charbpos, + string_column_at_point (disp_string, dl->end_charpos, b ? XINT (b->tab_width) : 8); else /* This doesn't correctly take into account tabs and control characters but if the window isn't being truncated then this value isn't going to end up being used anyhow. */ - data.dl->num_chars = dl->end_charbpos - dl->charbpos; + data.dl->num_chars = dl->end_charpos - dl->charpos; /* #### handle horizontally scrolled line with text none of which was actually laid out. */ @@ -4939,11 +5142,11 @@ The main loop should get fixed so that it isn't necessary to call this function if we are already at EOB. */ - if (data.bi_charbpos == bi_string_zv && bi_start_pos == bi_string_zv) + if (data.byte_charpos == byte_string_zv && byte_start_pos == byte_string_zv) return string_index_byte_to_char (disp_string, - data.bi_charbpos) + 1; /* Yuck! */ + data.byte_charpos) + 1; /* Yuck! */ else - return string_index_byte_to_char (disp_string, data.bi_charbpos); + return string_index_byte_to_char (disp_string, data.byte_charpos); } /* Given a display line and a starting position, ensure that the @@ -4960,11 +5163,11 @@ static Charbpos generate_string_display_line (struct window *w, Lisp_Object disp_string, struct display_line *dl, - Charbpos start_pos, + Charcount start_pos, prop_block_dynarr **prop, face_index default_face) { - Charbpos ret_charbpos; + Charcount ret_charcount; /* you must set bounds before calling this. */ @@ -4986,11 +5189,11 @@ dl->modeline = 0; /* Create a display block for the text region of the line. */ - ret_charbpos = create_string_text_block (w, disp_string, dl, start_pos, - prop, default_face); - dl->charbpos = start_pos; - if (dl->end_charbpos < dl->charbpos) - dl->end_charbpos = dl->charbpos; + ret_charcount = create_string_text_block (w, disp_string, dl, start_pos, + prop, default_face); + dl->charpos = start_pos; + if (dl->end_charpos < dl->charpos) + dl->end_charpos = dl->charpos; /* If there are left glyphs associated with any character in the text block, then create a display block to handle them. */ @@ -5002,7 +5205,7 @@ if (dl->right_glyphs != NULL && Dynarr_length (dl->right_glyphs)) create_right_glyph_block (w, dl); - return ret_charbpos; + return ret_charcount; } /* This is ripped off from regenerate_window. All we want to do is @@ -5012,7 +5215,7 @@ generate_displayable_area (struct window *w, Lisp_Object disp_string, int xpos, int ypos, int width, int height, display_line_dynarr* dla, - Charbpos start_pos, + Charcount start_pos, face_index default_face) { int yend = ypos + height; @@ -5028,7 +5231,7 @@ if (NILP (disp_string)) return; - s_zv = XSTRING_CHAR_LENGTH (disp_string); + s_zv = string_char_length (disp_string); bounds.left_out = xpos; bounds.right_out = xpos + width; @@ -5044,12 +5247,14 @@ { struct display_line dl; struct display_line *dlp; - Charbpos next_pos; + Charcount next_pos; int local; + int pos_of_dlp = -1; if (Dynarr_length (dla) < Dynarr_largest (dla)) { - dlp = Dynarr_atp (dla, Dynarr_length (dla)); + pos_of_dlp = Dynarr_length (dla); + dlp = Dynarr_atp (dla, pos_of_dlp); local = 0; } else @@ -5092,6 +5297,7 @@ else dlp->clip = 0; + assert (pos_of_dlp < 0 || pos_of_dlp == Dynarr_length (dla)); Dynarr_add (dla, *dlp); /* #### This type of check needs to be done down in the @@ -5191,10 +5397,12 @@ struct display_line dl; struct display_line *dlp; int local; + int pos_of_dlp = -1; if (Dynarr_length (dla) < Dynarr_largest (dla)) { - dlp = Dynarr_atp (dla, Dynarr_length (dla)); + pos_of_dlp = Dynarr_length (dla); + dlp = Dynarr_atp (dla, pos_of_dlp); local = 0; } else @@ -5274,6 +5482,7 @@ if (dlp->num_chars > w->max_line_len) w->max_line_len = dlp->num_chars; + assert (pos_of_dlp < 0 || pos_of_dlp == Dynarr_length (dla)); Dynarr_add (dla, *dlp); /* #### This isn't right, but it is close enough for now. */ @@ -5309,39 +5518,39 @@ } } -#define REGEN_INC_FIND_START_END \ - do { \ - /* Determine start and end of lines. */ \ - if (!Dynarr_length (cdla)) \ - return 0; \ - else \ - { \ +#define REGEN_INC_FIND_START_END \ + do { \ + /* Determine start and end of lines. */ \ + if (!Dynarr_length (cdla)) \ + return 0; \ + else \ + { \ if (Dynarr_atp (cdla, 0)->modeline && Dynarr_atp (ddla, 0)->modeline) \ - { \ - dla_start = 1; \ - } \ - else if (!Dynarr_atp (cdla, 0)->modeline \ - && !Dynarr_atp (ddla, 0)->modeline) \ - { \ - dla_start = 0; \ - } \ - else \ - abort (); /* structs differ */ \ - \ - dla_end = Dynarr_length (cdla) - 1; \ - } \ - \ - start_pos = (Dynarr_atp (cdla, dla_start)->charbpos \ - + Dynarr_atp (cdla, dla_start)->offset); \ - /* If this isn't true, then startp has changed and we need to do a \ - full regen. */ \ - if (startp != start_pos) \ - return 0; \ - \ - /* Point is outside the visible region so give up. */ \ - if (pointm < start_pos) \ - return 0; \ - \ + { \ + dla_start = 1; \ + } \ + else if (!Dynarr_atp (cdla, 0)->modeline \ + && !Dynarr_atp (ddla, 0)->modeline) \ + { \ + dla_start = 0; \ + } \ + else \ + abort (); /* structs differ */ \ + \ + dla_end = Dynarr_length (cdla) - 1; \ + } \ + \ + start_pos = (Dynarr_atp (cdla, dla_start)->charpos \ + + Dynarr_atp (cdla, dla_start)->offset); \ + /* If this isn't true, then startp has changed and we need to do a \ + full regen. */ \ + if (startp != start_pos) \ + return 0; \ + \ + /* Point is outside the visible region so give up. */ \ + if (pointm < start_pos) \ + return 0; \ + \ } while (0) /* This attempts to incrementally update the display structures. It @@ -5429,8 +5638,8 @@ while (line <= dla_end) { struct display_line *dl = Dynarr_atp (cdla, line); - Charbpos lstart = dl->charbpos + dl->offset; - Charbpos lend = dl->end_charbpos + dl->offset; + Charbpos lstart = dl->charpos + dl->offset; + Charbpos lend = dl->end_charpos + dl->offset; if (beg_unchanged >= lstart && beg_unchanged <= lend) break; @@ -5470,14 +5679,14 @@ struct display_block *db; int initial_size; - assert (cdl->charbpos == ddl->charbpos); - assert (cdl->end_charbpos == ddl->end_charbpos); + assert (cdl->charpos == ddl->charpos); + assert (cdl->end_charpos == ddl->end_charpos); assert (cdl->offset == ddl->offset); db = get_display_block_from_line (ddl, TEXT); initial_size = Dynarr_length (db->runes); - old_start = ddl->charbpos + ddl->offset; - old_end = ddl->end_charbpos + ddl->offset; + old_start = ddl->charpos + ddl->offset; + old_end = ddl->end_charpos + ddl->offset; /* If this is the first line being updated and it used propagation data, fail. Otherwise we'll be okay because @@ -5485,7 +5694,7 @@ if (line == first_line && ddl->used_prop_data) return 0; - new_start = generate_display_line (w, ddl, 0, ddl->charbpos + ddl->offset, + new_start = generate_display_line (w, ddl, 0, ddl->charpos + ddl->offset, &prop, DESIRED_DISP); ddl->offset = 0; @@ -5508,8 +5717,8 @@ || cdl->top_clip != ddl->top_clip || (cdl->cursor_elt != -1 && ddl->cursor_elt == -1) || (cdl->cursor_elt == -1 && ddl->cursor_elt != -1) - || old_start != ddl->charbpos - || old_end != ddl->end_charbpos + || old_start != ddl->charpos + || old_end != ddl->end_charpos || initial_size != Dynarr_length (db->runes)) { return 0; @@ -5525,7 +5734,7 @@ /* If the extent changes end on the line we just updated then we're done. Otherwise go on to the next line. */ - if (end_unchanged <= ddl->end_charbpos) + if (end_unchanged <= ddl->end_charpos) break; else line++; @@ -5596,8 +5805,8 @@ while (line <= dla_end) { struct display_line *dl = Dynarr_atp (cdla, line); - Charbpos lstart = dl->charbpos + dl->offset; - Charbpos lend = dl->end_charbpos + dl->offset; + Charbpos lstart = dl->charpos + dl->offset; + Charbpos lend = dl->end_charpos + dl->offset; if (beg_unchanged >= lstart && beg_unchanged <= lend) break; @@ -5625,8 +5834,8 @@ struct display_line *cdl = Dynarr_atp (cdla, line); struct display_line *ddl = Dynarr_atp (ddla, line); - assert (cdl->charbpos == ddl->charbpos); - assert (cdl->end_charbpos == ddl->end_charbpos); + assert (cdl->charpos == ddl->charpos); + assert (cdl->end_charpos == ddl->end_charpos); assert (cdl->offset == ddl->offset); /* If the line continues to next display line, fail. */ @@ -5637,7 +5846,7 @@ if (ddl->used_prop_data) return 0; - new_start = generate_display_line (w, ddl, 0, ddl->charbpos + ddl->offset, + new_start = generate_display_line (w, ddl, 0, ddl->charpos + ddl->offset, &prop, DESIRED_DISP); ddl->offset = 0; @@ -5667,7 +5876,7 @@ /* If the changed area also ends on this line, then we may be in business. Update everything and return success. */ - if (end_unchanged >= ddl->charbpos && end_unchanged <= ddl->end_charbpos) + if (end_unchanged >= ddl->charpos && end_unchanged <= ddl->end_charpos) { w->last_modified[DESIRED_DISP] = make_int (BUF_MODIFF (b)); w->last_facechange[DESIRED_DISP] = make_int (BUF_FACECHANGE (b)); @@ -5712,8 +5921,8 @@ the line because we checked before entering the loop. */ if (extent_beg_unchanged != -1 && extent_end_unchanged != -1 - && ((extent_beg_unchanged < ddl->charbpos) - || (extent_end_unchanged > ddl->end_charbpos))) + && ((extent_beg_unchanged < ddl->charpos) + || (extent_end_unchanged > ddl->end_charpos))) return regenerate_window_extents_only_changed (w, startp, pointm, extent_beg_unchanged, extent_end_unchanged); @@ -5766,7 +5975,7 @@ Charbpos start, end; struct display_line *dl = Dynarr_atp (dla, first_line); - start = dl->charbpos; + start = dl->charpos; end = BUF_Z (b) - w->window_end_pos[type] - 1; if (point >= start && point <= end) @@ -5775,8 +5984,8 @@ { dl = Dynarr_atp (dla, Dynarr_length (dla) - 1); - if (point >= (dl->charbpos + dl->offset) - && point <= (dl->end_charbpos + dl->offset)) + if (point >= (dl->charpos + dl->offset) + && point <= (dl->end_charpos + dl->offset)) return !dl->clip; else return 1; @@ -5847,7 +6056,7 @@ display_line_dynarr *dla = window_display_lines (w, type); struct display_line *dl = Dynarr_atp (dla, line); - return dl->charbpos; + return dl->charpos; } } @@ -6291,10 +6500,13 @@ { Lisp_Object window = wrap_window (w); - va_run_hook_with_args_in_buffer (XBUFFER (w->buffer), - Qredisplay_end_trigger_functions, - 2, window, - w->redisplay_end_trigger); + va_run_hook_with_args_in_buffer_trapping_problems + ("Error in redisplay end trigger", + XBUFFER (w->buffer), + Qredisplay_end_trigger_functions, + 2, window, + w->redisplay_end_trigger, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); w->redisplay_end_trigger = Qnil; } } @@ -6308,6 +6520,7 @@ redisplay_frame (struct frame *f, int preemption_check) { struct device *d = XDEVICE (f->device); + int depth; if (preemption_check && !DEVICE_IMPL_FLAG (d, XDEVIMPF_DONT_PREEMPT_REDISPLAY)) @@ -6346,7 +6559,7 @@ } /* The menubar, toolbar, and icon updates must be done before - hold_frame_size_changes is called and we are officially + enter_redisplay_critical_section is called and we are officially 'in_display'. They may eval lisp code which may call Fsignal. If in_display is set Fsignal will abort. */ @@ -6385,7 +6598,7 @@ reset_gutter_display_lines (f); } - hold_frame_size_changes (); + depth = enter_redisplay_critical_section (); /* ----------------- BEGIN CRITICAL REDISPLAY SECTION ---------------- */ /* Within this section, we are defenseless and assume that the @@ -6395,7 +6608,7 @@ 2) Lisp code evaluation 3) frame size changes - We ensure (3) by calling hold_frame_size_changes(), which + We ensure (3) by calling enter_redisplay_critical_section(), which will cause any pending frame size changes to get put on hold till after the end of the critical section. (1) follows automatically if (2) is met. #### Unfortunately, there are @@ -6449,10 +6662,8 @@ /* ----------------- END CRITICAL REDISPLAY SECTION ---------------- */ - /* Allow frame size changes to occur again. - - #### what happens if changes to other frames happen? */ - unhold_one_frame_size_changes (f); + /* Allow frame size changes to occur again. */ + exit_redisplay_critical_section (depth); map_windows (f, call_redisplay_end_triggers, 0); return 0; @@ -6555,13 +6766,6 @@ return 0; } -static Lisp_Object -restore_profiling_redisplay_flag (Lisp_Object val) -{ - profiling_redisplay_flag = XINT (val); - return Qnil; -} - /* Ensure that all windows on all frames on all devices are displaying the current contents of their respective buffers. */ @@ -6573,11 +6777,7 @@ int count = specpdl_depth (); if (profiling_active) - { - record_unwind_protect (restore_profiling_redisplay_flag, - make_int (profiling_redisplay_flag)); - profiling_redisplay_flag = 1; - } + internal_bind_int (&profiling_redisplay_flag, 1); if (asynch_device_change_pending) handle_asynch_device_change (); @@ -6631,36 +6831,72 @@ #endif /* ERROR_CHECK_DISPLAY */ } +/* Note: All places in the C code that call redisplay() are prepared + to handle GCing. However, we can't currently handle GC inside the + guts of redisplay (#### someone should fix this), so we need to use + INHIBIT_GC when calling Lisp. + + #### We probably can't handle any deletion of existing buffers, frames, + windows, devices, consoles, text changes, etc. either. We should + + (a) Create the appropriate INHIBIT_ flags for this. + (b) In the longer run, fix redisplay to handle this. + + (#### What about other external entry points to the redisplay code? + Someone should go through and make sure that all callers can handle + GC there, too.) +*/ + void redisplay (void) { + run_pre_idle_hook (); + redisplay_no_pre_idle_hook (); +} + +void +redisplay_no_pre_idle_hook (void) +{ if (last_display_warning_tick != display_warning_tick && !inhibit_warning_display) { /* If an error occurs during this function, oh well. If we report another warning, we could get stuck in an infinite loop reporting warnings. */ - call0_trapping_errors (0, Qdisplay_warning_buffer); + call0_trapping_problems + (0, Qdisplay_warning_buffer, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); last_display_warning_tick = display_warning_tick; } - /* The run_hook_trapping_errors functions are smart enough not + /* The run_hook_trapping_problems functions are smart enough not to do any evalling if the hook function is empty, so there - should not be any significant time loss. All places in the - C code that call redisplay() are prepared to handle GCing, - so we should be OK. */ + should not be any significant time loss. */ #ifndef INHIBIT_REDISPLAY_HOOKS - run_hook_trapping_errors ("Error in pre-redisplay-hook", - Qpre_redisplay_hook); + run_hook_trapping_problems + ("Error in pre-redisplay-hook", + Qpre_redisplay_hook, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); #endif /* INHIBIT_REDISPLAY_HOOKS */ redisplay_without_hooks (); #ifndef INHIBIT_REDISPLAY_HOOKS - run_hook_trapping_errors ("Error in post-redisplay-hook", - Qpost_redisplay_hook); + run_hook_trapping_problems + ("Error in post-redisplay-hook", + Qpost_redisplay_hook, + INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); #endif /* INHIBIT_REDISPLAY_HOOKS */ } +Lisp_Object +eval_within_redisplay (Lisp_Object dont_trust_this_damn_sucker) +{ + return + eval_in_buffer_trapping_problems + ("Error calling function within redisplay", current_buffer, + dont_trust_this_damn_sucker, + INHIBIT_GC | INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY); +} /* Efficiently determine the window line number, and return a pointer to its printed representation. Do this regardless of whether @@ -6698,7 +6934,7 @@ /* Given a character representing an object in a modeline specification, return a string (stored into the global array - `mode_spec_intbyte_string') with the information that object + `mode_spec_ibyte_string') with the information that object represents. This function is largely unchanged from previous versions of the @@ -6709,13 +6945,13 @@ */ static void -decode_mode_spec (struct window *w, Emchar spec, int type) +decode_mode_spec (struct window *w, Ichar spec, int type) { Lisp_Object obj = Qnil; const char *str = NULL; struct buffer *b = XBUFFER (w->buffer); - Dynarr_reset (mode_spec_intbyte_string); + Dynarr_reset (mode_spec_ibyte_string); switch (spec) { @@ -6740,8 +6976,8 @@ long_to_string (buf, col); - Dynarr_add_many (mode_spec_intbyte_string, - (const Intbyte *) buf, strlen (buf)); + Dynarr_add_many (mode_spec_ibyte_string, + (const Ibyte *) buf, strlen (buf)); goto decode_mode_spec_done; } @@ -6874,7 +7110,7 @@ percent = 99; sprintf (buf, "%d%%", percent); - Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) buf, + Dynarr_add_many (mode_spec_ibyte_string, (Ibyte *) buf, strlen (buf)); goto decode_mode_spec_done; @@ -6925,7 +7161,7 @@ else sprintf (buf, "%d%%", percent); - Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) buf, + Dynarr_add_many (mode_spec_ibyte_string, (Ibyte *) buf, strlen (buf)); goto decode_mode_spec_done; @@ -6950,7 +7186,7 @@ } for (i = 0; i < command_loop_level; i++) - Dynarr_add (mode_spec_intbyte_string, '['); + Dynarr_add (mode_spec_ibyte_string, '['); goto decode_mode_spec_done; } @@ -6967,7 +7203,7 @@ } for (i = 0; i < command_loop_level; i++) - Dynarr_add (mode_spec_intbyte_string, ']'); + Dynarr_add (mode_spec_ibyte_string, ']'); goto decode_mode_spec_done; } @@ -6979,14 +7215,14 @@ } if (STRINGP (obj)) - Dynarr_add_many (mode_spec_intbyte_string, + Dynarr_add_many (mode_spec_ibyte_string, XSTRING_DATA (obj), XSTRING_LENGTH (obj)); else if (str) - Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) str, strlen (str)); + Dynarr_add_many (mode_spec_ibyte_string, (Ibyte *) str, strlen (str)); decode_mode_spec_done: - Dynarr_add (mode_spec_intbyte_string, '\0'); + Dynarr_add (mode_spec_ibyte_string, '\0'); } /* Given a display line, free all of its data structures. */ @@ -7196,8 +7432,8 @@ { struct line_start_cache lsc; - lsc.start = dl->charbpos; - lsc.end = dl->end_charbpos; + lsc.start = dl->charpos; + lsc.end = dl->end_charpos; lsc.height = dl->ascent + dl->descent; Dynarr_add (internal_cache, lsc); @@ -8252,7 +8488,7 @@ d->pixel_to_glyph_cache.obj_x = *obj_x; \ d->pixel_to_glyph_cache.obj_y = *obj_y; \ d->pixel_to_glyph_cache.w = *w; \ - d->pixel_to_glyph_cache.charbpos = *charbpos; \ + d->pixel_to_glyph_cache.charpos = *charpos; \ d->pixel_to_glyph_cache.closest = *closest; \ d->pixel_to_glyph_cache.modeline_closest = *modeline_closest; \ d->pixel_to_glyph_cache.obj1 = *obj1; \ @@ -8296,7 +8532,7 @@ int pixel_to_glyph_translation (struct frame *f, int x_coord, int y_coord, int *col, int *row, int *obj_x, int *obj_y, - struct window **w, Charbpos *charbpos, + struct window **w, Charbpos *charpos, Charbpos *closest, Charcount *modeline_closest, Lisp_Object *obj1, Lisp_Object *obj2) { @@ -8335,7 +8571,7 @@ *obj_x = cache->obj_x; *obj_y = cache->obj_y; *w = cache->w; - *charbpos = cache->charbpos; + *charpos = cache->charpos; *closest = cache->closest; *modeline_closest = cache->modeline_closest; *obj1 = cache->obj1; @@ -8350,7 +8586,7 @@ *obj_x = 0; *obj_y = 0; *w = 0; - *charbpos = 0; + *charpos = 0; *closest = 0; *modeline_closest = -1; *obj1 = Qnil; @@ -8577,20 +8813,20 @@ if (x_check <= left_bound) { if (dl->modeline) - *modeline_closest = Dynarr_atp (db->runes, 0)->charbpos; + *modeline_closest = Dynarr_atp (db->runes, 0)->charpos; else - *closest = Dynarr_atp (db->runes, 0)->charbpos; + *closest = Dynarr_atp (db->runes, 0)->charpos; } else { if (dl->modeline) *modeline_closest = Dynarr_atp (db->runes, - Dynarr_length (db->runes) - 1)->charbpos; + Dynarr_length (db->runes) - 1)->charpos; else *closest = Dynarr_atp (db->runes, - Dynarr_length (db->runes) - 1)->charbpos; + Dynarr_length (db->runes) - 1)->charpos; } if (dl->modeline) @@ -8645,7 +8881,7 @@ rb = Dynarr_atp (db->runes, *col); } - *charbpos = rb->charbpos + dl->offset; + *charpos = rb->charpos + dl->offset; low_x_coord = rb->xpos; high_x_coord = rb->xpos + rb->width; @@ -8660,11 +8896,11 @@ { if (dl->modeline) *modeline_closest = - (Dynarr_atp (db->runes, elt)->charbpos + + (Dynarr_atp (db->runes, elt)->charpos + dl->offset); else *closest = - (Dynarr_atp (db->runes, elt)->charbpos + + (Dynarr_atp (db->runes, elt)->charpos + dl->offset); break; } @@ -8678,18 +8914,18 @@ if (elt == Dynarr_length (db->runes)) { if (dl->modeline) - *modeline_closest = dl->end_charbpos + dl->offset; + *modeline_closest = dl->end_charpos + dl->offset; else - *closest = dl->end_charbpos + dl->offset; + *closest = dl->end_charpos + dl->offset; really_over_nothing = 1; } } else { if (dl->modeline) - *modeline_closest = rb->charbpos + dl->offset; + *modeline_closest = rb->charpos + dl->offset; else - *closest = rb->charbpos + dl->offset; + *closest = rb->charpos + dl->offset; } if (dl->modeline) @@ -8819,6 +9055,7 @@ DEVICE_FRAME_LOOP (frmcons, d) { struct frame *f = XFRAME (XCAR (frmcons)); + int depth; if (FRAME_REPAINT_P (f) && FRAME_HAS_MINIBUF_P (f)) { @@ -8837,7 +9074,9 @@ MAYBE_DEVMETH (d, clear_frame, (f)); f->echo_area_garbaged = 0; } + depth = enter_redisplay_critical_section (); redisplay_window (window, 0); + exit_redisplay_critical_section (depth); MAYBE_DEVMETH (d, frame_output_end, (f)); call_redisplay_end_triggers (XWINDOW (window), 0); @@ -8848,13 +9087,6 @@ return Qnil; } -static Lisp_Object -restore_disable_preemption_value (Lisp_Object value) -{ - disable_preemption = XINT (value); - return Qnil; -} - DEFUN ("redraw-frame", Fredraw_frame, 0, 2, 0, /* Clear frame FRAME and output again what is supposed to appear on it. FRAME defaults to the selected frame if omitted. @@ -8868,11 +9100,7 @@ int count = specpdl_depth (); if (!NILP (no_preempt)) - { - record_unwind_protect (restore_disable_preemption_value, - make_int (disable_preemption)); - disable_preemption++; - } + internal_bind_int (&disable_preemption, 1 + disable_preemption); f->clear = 1; redisplay_frame (f, 1); @@ -8899,11 +9127,7 @@ int count = specpdl_depth (); if (!NILP (no_preempt)) - { - record_unwind_protect (restore_disable_preemption_value, - make_int (disable_preemption)); - disable_preemption++; - } + internal_bind_int (&disable_preemption, 1 + disable_preemption); redisplay_frame (f, 1); @@ -8933,11 +9157,7 @@ int count = specpdl_depth (); if (!NILP (no_preempt)) - { - record_unwind_protect (restore_disable_preemption_value, - make_int (disable_preemption)); - disable_preemption++; - } + internal_bind_int (&disable_preemption, 1 + disable_preemption); DEVICE_FRAME_LOOP (frmcons, d) { @@ -8960,6 +9180,9 @@ Normally, redisplay is preempted as normal if input arrives. However, if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for input and is guaranteed to proceed to completion. + +Note: If you simply want everything redisplayed, the current idiom is +`(sit-for 0)'. */ (device, no_preempt)) { @@ -8967,11 +9190,7 @@ int count = specpdl_depth (); if (!NILP (no_preempt)) - { - record_unwind_protect (restore_disable_preemption_value, - make_int (disable_preemption)); - disable_preemption++; - } + internal_bind_int (&disable_preemption, 1 + disable_preemption); redisplay_device (d, 0); @@ -9007,7 +9226,7 @@ /***************************************************************************/ /* */ -/* Lisp-variable change triggers */ +/* Change flags */ /* */ /***************************************************************************/ @@ -9070,6 +9289,78 @@ Fforce_cursor_redisplay (w->frame); } +void +mark_buffers_changed (void) +{ + MARK_TYPE_CHANGED (buffers); +} + +void +mark_clip_changed (void) +{ + MARK_TYPE_CHANGED (clip); +} + +void +mark_extents_changed (void) +{ + MARK_TYPE_CHANGED (extents); +} + +void +mark_icon_changed (void) +{ + MARK_TYPE_CHANGED (icon); +} + +void +mark_menubar_changed (void) +{ + MARK_TYPE_CHANGED (menubar); +} + +void +mark_modeline_changed (void) +{ + MARK_TYPE_CHANGED (modeline); +} + +void +mark_point_changed (void) +{ + MARK_TYPE_CHANGED (point); +} + +void +mark_toolbar_changed (void) +{ + MARK_TYPE_CHANGED (toolbar); +} + +void +mark_gutter_changed (void) +{ + MARK_TYPE_CHANGED (gutter); +} + +void +mark_glyphs_changed (void) +{ + MARK_TYPE_CHANGED (glyphs); +} + +void +mark_subwindows_changed (void) +{ + MARK_TYPE_CHANGED (subwindows); +} + +void +mark_subwindows_state_changed (void) +{ + MARK_TYPE_CHANGED (subwindows_state); +} + #ifdef MEMORY_USAGE_STATS @@ -9187,8 +9478,8 @@ { if (!cmotion_display_lines) cmotion_display_lines = Dynarr_new (display_line); - if (!mode_spec_intbyte_string) - mode_spec_intbyte_string = Dynarr_new (Intbyte); + if (!mode_spec_ibyte_string) + mode_spec_ibyte_string = Dynarr_new (Ibyte); if (!formatted_string_extent_dynarr) formatted_string_extent_dynarr = Dynarr_new (EXTENT); if (!formatted_string_extent_start_dynarr) diff --text -u 'xemacs-21.5.6/src/redisplay.h' 'xemacs-21.5.7/src/redisplay.h' Index: ././src/redisplay.h --- ././src/redisplay.h Wed Mar 13 17:52:57 2002 +++ ././src/redisplay.h Fri Jun 21 06:18:43 2002 @@ -1,7 +1,7 @@ /* Redisplay data structures. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1996 Chuck Thompson. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. This file is part of XEmacs. @@ -112,15 +112,14 @@ each of the face properties in this particular window. */ - Charbpos charbpos; /* buffer position this rune is displaying; + Charxpos charpos; /* buffer position this rune is displaying; for the modeline, the value here is a Charcount, but who's looking? */ - Charbpos endpos; /* if set this rune covers a range of pos */ + Charxpos endpos; /* if set this rune covers a range of pos; + used in redisplay_move_cursor(). */ /* #### Chuck, what does it mean for a rune to cover a range of pos? I don't get this. */ - /* #### This isn't used as an rvalue anywhere! - remove! */ short xpos; /* horizontal starting position in pixels */ @@ -147,6 +146,9 @@ If this is a rune in the modeline then this might be nil. */ + int ascent; /* Ascent of this glyph, in pixels. */ + int descent; /* Descent of this glyph, in pixels. */ + int yoffset; /* Offset from line top to reach glyph top */ int xoffset; /* Number of pixels that need to be chopped off the left of the glyph. This has the effect of shifting the @@ -157,7 +159,7 @@ /* CHAR */ struct { - Emchar ch; /* Character of this rune. */ + Ichar ch; /* Character of this rune. */ } chr; /* HLINE */ @@ -255,9 +257,9 @@ /* display lines */ /*************************************************************************/ -/* Modeline commentary: IMO the modeline is handled very badly, we +/* Modeline commentary: IMO the modeline is handled very badly, we special case virtually *everything* in the redisplay routines for - the modeline. The fact that dl->charbpos can be either a buffer + the modeline. The fact that dl->charpos can be either a buffer position or a char count highlights this. There is no abstraction at all that I can find and it means that the code is made very ugly as a result. Either we should treat the modeline *entirely* separately, @@ -293,9 +295,9 @@ in pixels.*/ unsigned short top_clip; /* amount of top of line to clip in pixels.*/ - Charbpos charbpos; /* first buffer position on line */ - Charbpos end_charbpos; /* last buffer position on line */ - Charcount offset; /* adjustment to charbpos vals */ + Charxpos charpos; /* first buffer position on line */ + Charxpos end_charpos; /* last buffer position on line */ + Charcount offset; /* adjustment to charpos vals */ Charcount num_chars; /* # of chars on line including expansion of tabs and control chars */ @@ -383,13 +385,13 @@ }; /* NOTE NOTE NOTE: Currently the positions in an extent fragment - structure are Bytebpos's, not Charbpos's. This could change. */ + structure are Bytexpos's, not Charxpos's. This could change. */ struct extent_fragment { Lisp_Object object; /* buffer or string */ struct frame *frm; - Bytebpos pos, end; + Bytexpos pos, end; EXTENT_dynarr *extents; glyph_block_dynarr *begin_glyphs, *end_glyphs; unsigned int invisible:1; @@ -516,19 +518,30 @@ object##_changed_set = 1; } \ } while (0) -#define MARK_BUFFERS_CHANGED MARK_TYPE_CHANGED (buffers) -#define MARK_CLIP_CHANGED MARK_TYPE_CHANGED (clip) -#define MARK_EXTENTS_CHANGED MARK_TYPE_CHANGED (extents) -#define MARK_ICON_CHANGED MARK_TYPE_CHANGED (icon) -#define MARK_MENUBAR_CHANGED MARK_TYPE_CHANGED (menubar) -#define MARK_MODELINE_CHANGED MARK_TYPE_CHANGED (modeline) -#define MARK_POINT_CHANGED MARK_TYPE_CHANGED (point) -#define MARK_TOOLBAR_CHANGED MARK_TYPE_CHANGED (toolbar) -#define MARK_GUTTER_CHANGED MARK_TYPE_CHANGED (gutter) -#define MARK_GLYPHS_CHANGED MARK_TYPE_CHANGED (glyphs) -#define MARK_SUBWINDOWS_CHANGED MARK_TYPE_CHANGED (subwindows) -#define MARK_SUBWINDOWS_STATE_CHANGED MARK_TYPE_CHANGED (subwindows_state) - +void mark_buffers_changed (void); +#define MARK_BUFFERS_CHANGED mark_buffers_changed () +void mark_clip_changed (void); +#define MARK_CLIP_CHANGED mark_clip_changed () +void mark_extents_changed (void); +#define MARK_EXTENTS_CHANGED mark_extents_changed () +void mark_icon_changed (void); +#define MARK_ICON_CHANGED mark_icon_changed () +void mark_menubar_changed (void); +#define MARK_MENUBAR_CHANGED mark_menubar_changed () +void mark_modeline_changed (void); +#define MARK_MODELINE_CHANGED mark_modeline_changed () +void mark_point_changed (void); +#define MARK_POINT_CHANGED mark_point_changed () +void mark_toolbar_changed (void); +#define MARK_TOOLBAR_CHANGED mark_toolbar_changed () +void mark_gutter_changed (void); +#define MARK_GUTTER_CHANGED mark_gutter_changed () +void mark_glyphs_changed (void); +#define MARK_GLYPHS_CHANGED mark_glyphs_changed () +void mark_subwindows_changed (void); +#define MARK_SUBWINDOWS_CHANGED mark_subwindows_changed () +void mark_subwindows_state_changed (void); +#define MARK_SUBWINDOWS_STATE_CHANGED mark_subwindows_state_changed () #define CLASS_RESET_CHANGED_FLAGS(p) do { \ (p)->buffers_changed = 0; \ @@ -681,22 +694,25 @@ EXFUN (Fredraw_frame, 2); int redisplay_text_width_string (struct window *w, int findex, - Intbyte *nonreloc, Lisp_Object reloc, + Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount len); int redisplay_frame_text_width_string (struct frame *f, Lisp_Object face, - Intbyte *nonreloc, + Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount len); int redisplay_frame (struct frame *f, int preemption_check); +void redisplay_no_pre_idle_hook (void); void redisplay (void); +Lisp_Object eval_within_redisplay (Lisp_Object dont_trust_this_damn_sucker); struct display_block *get_display_block_from_line (struct display_line *dl, enum display_type type); layout_bounds calculate_display_line_boundaries (struct window *w, int modeline); Charbpos point_at_center (struct window *w, int type, Charbpos start, - Charbpos point); -int line_at_center (struct window *w, int type, Charbpos start, Charbpos point); + Charbpos point); +int line_at_center (struct window *w, int type, Charbpos start, + Charbpos point); int window_half_pixpos (struct window *w); void redisplay_echo_area (void); void free_display_structs (struct window_mirror *mir); @@ -726,13 +742,13 @@ int point_in_line_start_cache (struct window *w, Charbpos point, int min_past); int point_would_be_visible (struct window *w, Charbpos startp, - Charbpos point); + Charbpos point); Charbpos start_of_last_line (struct window *w, Charbpos startp); Charbpos end_of_last_line (struct window *w, Charbpos startp); Charbpos start_with_line_at_pixpos (struct window *w, Charbpos point, - int pixpos); + int pixpos); Charbpos start_with_point_on_display_line (struct window *w, Charbpos point, - int line); + int line); int redisplay_variable_changed (Lisp_Object sym, Lisp_Object *val, Lisp_Object in_object, int flags); void redisplay_glyph_changed (Lisp_Object glyph, Lisp_Object property, @@ -774,9 +790,8 @@ int cursor_width, int cursor_height, int offset_bitmap); int redisplay_calculate_display_boxes (struct display_line *dl, int xpos, - int xoffset, int start_pixpos, - int width, - struct display_box* dest, + int xoffset, int yoffset, int start_pixpos, + int width, struct display_box* dest, struct display_glyph_area* src); int redisplay_normalize_glyph_area (struct display_box* dest, struct display_glyph_area* glyphsrc); diff --text -u 'xemacs-21.5.6/src/regex.c' 'xemacs-21.5.7/src/regex.c' Index: ././src/regex.c --- ././src/regex.c Sun Mar 31 17:29:00 2002 +++ ././src/regex.c Wed Jun 5 18:57:05 2002 @@ -24,17 +24,6 @@ /* Synched up with: FSF 19.29. */ -/* Changes made for XEmacs: - - (1) the REGEX_BEGLINE_CHECK code from the XEmacs v18 regex routines - was added. This causes a huge speedup in font-locking. - (2) Rel-alloc is disabled when the MMAP version of rel-alloc is - being used, because it's too slow -- all those calls to mmap() - add humongous overhead. - (3) Lots and lots of changes for Mule. They are bracketed by - `#ifdef MULE' or with comments that have `XEmacs' in them. - */ - #ifdef HAVE_CONFIG_H #include #endif @@ -47,14 +36,6 @@ #define _GNU_SOURCE 1 #endif -#ifdef emacs -/* Converts the pointer to the char to BEG-based offset from the start. */ -#define PTR_TO_OFFSET(d) (MATCHING_IN_FIRST_STRING \ - ? (d) - string1 : (d) - (string2 - size1)) -#else -#define PTR_TO_OFFSET(d) 0 -#endif - /* We assume non-Mule if emacs isn't defined. */ #ifndef emacs #undef MULE @@ -105,7 +86,7 @@ Lisp_Object Vthe_lisp_rangetab; void -complex_vars_of_regex (void) +vars_of_regex (void) { Vthe_lisp_rangetab = Fmake_range_table (); staticpro (&Vthe_lisp_rangetab); @@ -114,15 +95,37 @@ #else /* not MULE */ void -complex_vars_of_regex (void) +vars_of_regex (void) { } #endif /* MULE */ -#define RE_TRANSLATE(ch) TRT_TABLE_OF (translate, (Emchar) ch) +#define RE_TRANSLATE_1(ch) TRT_TABLE_OF (translate, (Ichar) ch) #define TRANSLATE_P(tr) (!NILP (tr)) +/* Converts the pointer to the char to BEG-based offset from the start. */ +#define PTR_TO_OFFSET(d) (MATCHING_IN_FIRST_STRING \ + ? (d) - string1 : (d) - (string2 - size1)) + +/* Convert an offset from the start of the logical text string formed by + concatenating the two strings together into a character position in the + Lisp buffer or string that the text represents. Knows that + when handling buffer text, the "string" we're passed in is always + BEGV - ZV. */ + +static Charxpos +offset_to_charxpos (Lisp_Object lispobj, int off) +{ + if (STRINGP (lispobj)) + return string_index_byte_to_char (lispobj, off); + else if (BUFFERP (lispobj)) + return bytebpos_to_charbpos (XBUFFER (lispobj), + off + BYTE_BUF_BEGV (XBUFFER (lispobj))); + else + return 0; +} + #else /* not emacs */ /* If we are not linking with Emacs proper, @@ -139,7 +142,9 @@ #include -#define charptr_emchar(str) ((Emchar) (str)[0]) +#define itext_ichar(str) ((Ichar) (str)[0]) +#define itext_ichar_fmt(str, fmt, object) ((Ichar) (str)[0]) +#define itext_ichar_ascii_fmt(str, fmt, object) ((Ichar) (str)[0]) #if (LONGBITS > INTBITS) # define EMACS_INT long @@ -147,10 +152,14 @@ # define EMACS_INT int #endif -typedef int Emchar; +typedef int Ichar; -#define INC_CHARPTR(p) ((p)++) -#define DEC_CHARPTR(p) ((p)--) +#define INC_IBYTEPTR(p) ((p)++) +#define INC_IBYTEPTR_FMT(p, fmt) ((p)++) +#define DEC_IBYTEPTR(p) ((p)--) +#define DEC_IBYTEPTR_FMT(p, fmt) ((p)--) +#define itext_ichar_len(ptr) 1 +#define itext_ichar_len_fmt(ptr, fmt) 1 #include @@ -194,11 +203,11 @@ #endif /* SYNTAX_TABLE */ -#define SYNTAX_UNSAFE(ignored, c) re_syntax_table[c] +#define SYNTAX(ignored, c) re_syntax_table[c] #undef SYNTAX_FROM_CACHE -#define SYNTAX_FROM_CACHE SYNTAX_UNSAFE +#define SYNTAX_FROM_CACHE SYNTAX -#define RE_TRANSLATE(c) translate[(unsigned char) (c)] +#define RE_TRANSLATE_1(c) translate[(unsigned char) (c)] #define TRANSLATE_P(tr) tr #endif /* emacs */ @@ -1140,19 +1149,19 @@ matching calls, which it leaves unprotected, in the faith that they will not malloc.]] This previous paragraph is irrelevant. - XEmacs: We *do not* do anything so stupid as process input from - within a signal handler. However, the regexp routines may get - called reentrantly as a result of QUIT processing (e.g. under - Windows: re_match -> QUIT -> quit_p -> drain events -> process - WM_INITMENU -> call filter -> re_match), so we cannot have any - global variables (unless we do lots of trickiness including some + XEmacs: We *do not* do anything so stupid as process input from within a + signal handler. However, the regexp routines may get called reentrantly + as a result of QUIT processing (e.g. under Windows: re_match -> QUIT -> + quit_p -> drain events -> process WM_INITMENU -> call filter -> + re_match; see stack trace in signal.c), so we cannot have any global + variables (unless we do lots of trickiness including some unwind-protects, which isn't worth it at this point). The first paragraph appears utterly garbled to me -- shouldn't *ANY* use of - rel-alloc to different potentially cause buffer data to be - relocated? I must be missing something, though -- perhaps the - writer above is assuming that the failure stack(s) will always be - allocated after the buffer data, and thus reallocating them with - rel-alloc won't move buffer data. --ben */ + rel-alloc to different potentially cause buffer data to be relocated? I + must be missing something, though -- perhaps the writer above is + assuming that the failure stack(s) will always be allocated after the + buffer data, and thus reallocating them with rel-alloc won't move buffer + data. --ben */ /* Normally, this is fine. */ #define MATCH_MAY_ALLOCATE @@ -1574,13 +1583,11 @@ /* Subroutine declarations and macros for regex_compile. */ /* Fetch the next character in the uncompiled pattern---translating it - if necessary. Also cast from a signed character in the constant - string passed to us by the user to an unsigned char that we can use - as an array index (in, e.g., `translate'). */ + if necessary. */ #define PATFETCH(c) \ do { \ PATFETCH_RAW (c); \ - c = TRANSLATE (c); \ + c = RE_TRANSLATE (c); \ } while (0) /* Fetch the next character in the uncompiled pattern, with no @@ -1588,77 +1595,19 @@ #define PATFETCH_RAW(c) \ do {if (p == pend) return REG_EEND; \ assert (p < pend); \ - c = charptr_emchar (p); \ - INC_CHARPTR (p); \ + c = itext_ichar (p); \ + INC_IBYTEPTR (p); \ } while (0) /* Go backwards one character in the pattern. */ -#define PATUNFETCH DEC_CHARPTR (p) - -#ifdef MULE - -#define PATFETCH_EXTENDED(emch) \ - do {if (p == pend) return REG_EEND; \ - assert (p < pend); \ - emch = charptr_emchar ((const Intbyte *) p); \ - INC_CHARPTR (p); \ - if (TRANSLATE_P (translate) && emch < 0x80) \ - emch = (Emchar) (unsigned char) RE_TRANSLATE (emch); \ - } while (0) - -#define PATFETCH_RAW_EXTENDED(emch) \ - do {if (p == pend) return REG_EEND; \ - assert (p < pend); \ - emch = charptr_emchar ((const Intbyte *) p); \ - INC_CHARPTR (p); \ - } while (0) - -#define PATUNFETCH_EXTENDED DEC_CHARPTR (p) - -#define PATFETCH_EITHER(emch) \ - do { \ - if (has_extended_chars) \ - PATFETCH_EXTENDED (emch); \ - else \ - PATFETCH (emch); \ - } while (0) - -#define PATFETCH_RAW_EITHER(emch) \ - do { \ - if (has_extended_chars) \ - PATFETCH_RAW_EXTENDED (emch); \ - else \ - PATFETCH_RAW (emch); \ - } while (0) - -#define PATUNFETCH_EITHER \ - do { \ - if (has_extended_chars) \ - PATUNFETCH_EXTENDED (emch); \ - else \ - PATUNFETCH (emch); \ - } while (0) - -#else /* not MULE */ - -#define PATFETCH_EITHER(emch) PATFETCH (emch) -#define PATFETCH_RAW_EITHER(emch) PATFETCH_RAW (emch) -#define PATUNFETCH_EITHER PATUNFETCH - -#endif /* MULE */ +#define PATUNFETCH DEC_IBYTEPTR (p) /* If `translate' is non-null, return translate[D], else just D. We cast the subscript to translate because some data is declared as `char *', to avoid warnings when a string constant is passed. But when we use a character as a subscript we must make it unsigned. */ -#define TRANSLATE(d) (TRANSLATE_P (translate) ? RE_TRANSLATE (d) : (d)) - -#ifdef MULE - -#define TRANSLATE_EXTENDED_UNSAFE(emch) \ - (TRANSLATE_P (translate) && emch < 0x80 ? RE_TRANSLATE (emch) : (emch)) - -#endif +#define RE_TRANSLATE(d) \ + (TRANSLATE_P (translate) ? RE_TRANSLATE_1 (d) : (d)) /* Macros for outputting the compiled pattern into `buffer'. */ @@ -1729,7 +1678,7 @@ being larger than MAX_BUF_SIZE, then flag memory exhausted. */ #define EXTEND_BUFFER() \ do { \ - re_char *old_buffer = bufp->buffer; \ + re_char *old_buffer = bufp->buffer; \ if (bufp->allocated == MAX_BUF_SIZE) \ return REG_ESIZE; \ bufp->allocated <<= 1; \ @@ -1883,12 +1832,17 @@ static re_bool common_op_match_null_string_p (unsigned char **p, unsigned char *end, register_info_type *reg_info); -static int bcmp_translate (const unsigned char *s1, const unsigned char *s2, - REGISTER int len, RE_TRANSLATE_TYPE translate); +static int bcmp_translate (re_char *s1, re_char *s2, + REGISTER int len, RE_TRANSLATE_TYPE translate +#ifdef emacs + , Internal_Format fmt, Lisp_Object lispobj +#endif + ); static int re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string1, int size1, re_char *string2, int size2, int pos, - struct re_registers *regs, int stop); + struct re_registers *regs, int stop + RE_LISP_CONTEXT_ARGS_DECL); #ifndef MATCH_MAY_ALLOCATE @@ -3182,7 +3136,7 @@ /* You might think it would be useful for \ to mean not to translate; but if we don't translate it, it will never match anything. */ - c = TRANSLATE (c); + c = RE_TRANSLATE (c); goto normal_char; } break; @@ -3231,10 +3185,10 @@ #else { Bytecount bt_count; - Intbyte tmp_buf[MAX_EMCHAR_LEN]; + Ibyte tmp_buf[MAX_ICHAR_LEN]; int i; - bt_count = set_charptr_emchar (tmp_buf, c); + bt_count = set_itext_ichar (tmp_buf, c); for (i = 0; i < bt_count; i++) { @@ -3439,13 +3393,16 @@ Return an error code. We use these short variable names so we can use the same macros as - `regex_compile' itself. */ + `regex_compile' itself. + + Under Mule, this is only called when both chars of the range are + ASCII. */ static reg_errcode_t compile_range (re_char **p_ptr, re_char *pend, RE_TRANSLATE_TYPE translate, reg_syntax_t syntax, unsigned char *buf_end) { - Emchar this_char; + Ichar this_char; re_char *p = *p_ptr; int range_start, range_end; @@ -3478,7 +3435,7 @@ loop, since all characters <= 0xff. */ for (this_char = range_start; this_char <= range_end; this_char++) { - SET_LIST_BIT (TRANSLATE (this_char)); + SET_LIST_BIT (RE_TRANSLATE (this_char)); } return REG_NOERROR; @@ -3491,20 +3448,20 @@ RE_TRANSLATE_TYPE translate, reg_syntax_t syntax, Lisp_Object rtab) { - Emchar this_char, range_start, range_end; - const Intbyte *p; + Ichar this_char, range_start, range_end; + const Ibyte *p; if (*p_ptr == pend) return REG_ERANGE; - p = (const Intbyte *) *p_ptr; - range_end = charptr_emchar (p); + p = (const Ibyte *) *p_ptr; + range_end = itext_ichar (p); p--; /* back to '-' */ - DEC_CHARPTR (p); /* back to start of range */ + DEC_IBYTEPTR (p); /* back to start of range */ /* We also want to fetch the endpoints without translating them; the appropriate translation is done in the bit-setting loop below. */ - range_start = charptr_emchar (p); - INC_CHARPTR (*p_ptr); + range_start = itext_ichar (p); + INC_IBYTEPTR (*p_ptr); /* If the start is after the end, the range is empty. */ if (range_start > range_end) @@ -3514,15 +3471,13 @@ ranges entirely within the first 256 chars. */ if ((range_start >= 0x100 || range_end >= 0x100) - && CHAR_LEADING_BYTE (range_start) != - CHAR_LEADING_BYTE (range_end)) + && ichar_leading_byte (range_start) != + ichar_leading_byte (range_end)) return REG_ERANGESPAN; - /* As advertised, translations only work over the 0 - 0x7F range. - Making this kind of stuff work generally is much harder. - Iterating over the whole range like this would be way efficient - if the range encompasses 10,000 chars or something. You'd have - to do something like this: + /* #### This might be way inefficient if the range encompasses 10,000 + chars or something. To be efficient, you'd have to do something like + this: range_table a; range_table b; @@ -3533,10 +3488,9 @@ compute the union of a, b union the result into rtab */ - for (this_char = range_start; - this_char <= range_end && this_char < 0x80; this_char++) + for (this_char = range_start; this_char <= range_end; this_char++) { - SET_RANGETAB_BIT (TRANSLATE (this_char)); + SET_RANGETAB_BIT (RE_TRANSLATE (this_char)); } if (this_char <= range_end) @@ -3561,7 +3515,8 @@ Returns 0 if we succeed, -2 if an internal error. */ int -re_compile_fastmap (struct re_pattern_buffer *bufp) +re_compile_fastmap (struct re_pattern_buffer *bufp + RE_LISP_SHORT_CONTEXT_ARGS_DECL) { int j, k; #ifdef MATCH_MAY_ALLOCATE @@ -3570,6 +3525,9 @@ DECLARE_DESTINATION; /* We don't push any register information onto the failure stack. */ + /* &&#### this should be changed for 8-bit-fixed, for efficiency. see + comment marked with &&#### in re_search_2. */ + REGISTER char *fastmap = bufp->fastmap; unsigned char *pattern = bufp->buffer; long size = bufp->used; @@ -3681,7 +3639,7 @@ EMACS_INT first, last; Lisp_Object dummy_val; int jj; - Intbyte strr[MAX_EMCHAR_LEN]; + Ibyte strr[MAX_ICHAR_LEN]; unified_range_table_get_range (p, i, &first, &last, &dummy_val); @@ -3690,11 +3648,11 @@ /* Ranges below 0x100 can span charsets, but there are only two (Control-1 and Latin-1), and either first or last has to be in them. */ - set_charptr_emchar (strr, first); + set_itext_ichar (strr, first); fastmap[*strr] = 1; if (last < 0x100) { - set_charptr_emchar (strr, last); + set_itext_ichar (strr, last); fastmap[*strr] = 1; } } @@ -3732,34 +3690,6 @@ #endif /* MULE */ - case wordchar: -#ifdef emacs - k = (int) Sword; - goto matchsyntax; -#else - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX_UNSAFE - (XCHAR_TABLE - (regex_emacs_buffer->mirror_syntax_table), j) == Sword) - fastmap[j] = 1; - break; -#endif - - - case notwordchar: -#ifdef emacs - k = (int) Sword; - goto matchnotsyntax; -#else - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX_UNSAFE - (XCHAR_TABLE - (regex_emacs_buffer->mirror_syntax_table), j) != Sword) - fastmap[j] = 1; - break; -#endif - - case anychar: { int fastmap_newline = fastmap['\n']; @@ -3788,7 +3718,21 @@ break; } -#ifdef emacs +#ifndef emacs + case wordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (ignored, j) == Sword) + fastmap[j] = 1; + break; + + case notwordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (ignored, j) != Sword) + fastmap[j] = 1; + break; +#else /* emacs */ + case wordchar: + case notwordchar: case wordbound: case notwordbound: case wordbeg: @@ -3799,23 +3743,30 @@ aborting optimizations. */ bufp->can_be_null = 1; goto done; +#if 0 /* all of the following code is unused now that the `syntax-table' + property exists -- it's trickier to do this than just look in + the buffer. &&#### but we could just use the syntax-cache stuff + instead; why don't we? --ben */ + case wordchar: + k = (int) Sword; + goto matchsyntax; -#ifdef emacs -#if 0 /* Removed during syntax-table properties patch -- 2000/12/07 mct */ + case notwordchar: + k = (int) Sword; + goto matchnotsyntax; + case syntaxspec: k = *p++; -#endif - matchsyntax: + matchsyntax: #ifdef MULE for (j = 0; j < 0x80; j++) - if (SYNTAX_UNSAFE - (XCHAR_TABLE - (regex_emacs_buffer->mirror_syntax_table), j) == + if (SYNTAX + (XCHAR_TABLE (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf)), j) == (enum syntaxcode) k) fastmap[j] = 1; for (j = 0x80; j < 0xA0; j++) { - if (LEADING_BYTE_PREFIX_P((unsigned char) j)) + if (leading_byte_prefix_p ((unsigned char) j)) /* too complicated to calculate this right */ fastmap[j] = 1; else @@ -3823,11 +3774,10 @@ int multi_p; Lisp_Object cset; - cset = CHARSET_BY_LEADING_BYTE (j); + cset = charset_by_leading_byte (j); if (CHARSETP (cset)) { - if (charset_syntax (regex_emacs_buffer, cset, - &multi_p) + if (charset_syntax (lispbuf, cset, &multi_p) == Sword || multi_p) fastmap[j] = 1; } @@ -3835,30 +3785,27 @@ } #else /* not MULE */ for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX_UNSAFE - (XCHAR_TABLE - (regex_emacs_buffer->mirror_syntax_table), j) == + if (SYNTAX + (XCHAR_TABLE (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf)), j) == (enum syntaxcode) k) fastmap[j] = 1; #endif /* MULE */ break; -#if 0 /* Removed during syntax-table properties patch -- 2000/12/07 mct */ case notsyntaxspec: k = *p++; -#endif - matchnotsyntax: + matchnotsyntax: #ifdef MULE for (j = 0; j < 0x80; j++) - if (SYNTAX_UNSAFE + if (SYNTAX (XCHAR_TABLE - (regex_emacs_buffer->mirror_syntax_table), j) != + (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf)), j) != (enum syntaxcode) k) fastmap[j] = 1; for (j = 0x80; j < 0xA0; j++) { - if (LEADING_BYTE_PREFIX_P((unsigned char) j)) + if (leading_byte_prefix_p ((unsigned char) j)) /* too complicated to calculate this right */ fastmap[j] = 1; else @@ -3866,11 +3813,10 @@ int multi_p; Lisp_Object cset; - cset = CHARSET_BY_LEADING_BYTE (j); + cset = charset_by_leading_byte (j); if (CHARSETP (cset)) { - if (charset_syntax (regex_emacs_buffer, cset, - &multi_p) + if (charset_syntax (lispbuf, cset, &multi_p) != Sword || multi_p) fastmap[j] = 1; } @@ -3878,14 +3824,14 @@ } #else /* not MULE */ for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX_UNSAFE + if (SYNTAX (XCHAR_TABLE - (regex_emacs_buffer->mirror_syntax_table), j) != + (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf)), j) != (enum syntaxcode) k) fastmap[j] = 1; #endif /* MULE */ break; -#endif /* emacs */ +#endif /* 0 */ #ifdef MULE /* 97/2/17 jhod category patch */ @@ -3898,13 +3844,11 @@ /* All cases after this match the empty string. These end with `continue'. */ - - case before_dot: case at_dot: case after_dot: continue; -#endif /* not emacs */ +#endif /* emacs */ case no_op: @@ -4074,33 +4018,27 @@ int re_search (struct re_pattern_buffer *bufp, const char *string, int size, - int startpos, int range, struct re_registers *regs) + int startpos, int range, struct re_registers *regs + RE_LISP_CONTEXT_ARGS_DECL) { return re_search_2 (bufp, NULL, 0, string, size, startpos, range, - regs, size); + regs, size RE_LISP_CONTEXT_ARGS); } -#ifndef emacs -/* Snarfed from src/lisp.h, needed for compiling [ce]tags. */ -# define bytecount_to_charcount(ptr, len) (len) -# define charcount_to_bytecount(ptr, len) (len) -typedef int Charcount; -#endif - /* Using the compiled pattern in BUFP->buffer, first tries to match the virtual concatenation of STRING1 and STRING2, starting first at index STARTPOS, then at STARTPOS + 1, and so on. - With MULE, STARTPOS is a byte position, not a char position. And the - search will increment STARTPOS by the width of the current leading - character. - STRING1 and STRING2 have length SIZE1 and SIZE2, respectively. RANGE is how far to scan while trying to match. RANGE = 0 means try only at STARTPOS; in general, the last start tried is STARTPOS + RANGE. + All sizes and positions refer to bytes (not chars); under Mule, the code + knows about the format of the text and will only check at positions + where a character starts. + With MULE, RANGE is a byte position, not a char position. The last start tried is the character starting <= STARTPOS + RANGE. @@ -4118,7 +4056,8 @@ int re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const char *str2, int size2, int startpos, - int range, struct re_registers *regs, int stop) + int range, struct re_registers *regs, int stop + RE_LISP_CONTEXT_ARGS_DECL) { int val; re_char *string1 = (re_char *) str1; @@ -4131,7 +4070,12 @@ int anchored_at_begline = 0; #endif re_char *d; - Charcount d_size; +#ifdef emacs + Internal_Format fmt = buffer_or_other_internal_format (lispobj); +#endif /* emacs */ +#if 1 + int forward_search_p; +#endif /* Check for out-of-range STARTPOS. */ if (startpos < 0 || startpos > total_size) @@ -4144,6 +4088,10 @@ else if (endpos > total_size) range = total_size - startpos; +#if 1 + forward_search_p = range > 0; +#endif + /* If the search isn't to be a backwards one, don't waste time in a search for a pattern that must be anchored. */ if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0) @@ -4154,7 +4102,7 @@ { d = ((const unsigned char *) (startpos >= size1 ? string2 - size1 : string1) + startpos); - range = charcount_to_bytecount (d, 1); + range = itext_ichar_len_fmt (d, fmt); } } @@ -4163,8 +4111,10 @@ don't keep searching past point. */ if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0) { - range = BUF_PT (regex_emacs_buffer) - BUF_BEGV (regex_emacs_buffer) - - startpos; + if (!BUFFERP (lispobj)) + return -1; + range = (BUF_PT (XBUFFER (lispobj)) - BUF_BEGV (XBUFFER (lispobj)) + - startpos); if (range < 0) return -1; } @@ -4172,7 +4122,7 @@ /* Update the fastmap now if not correct already. */ if (fastmap && !bufp->fastmap_accurate) - if (re_compile_fastmap (bufp) == -2) + if (re_compile_fastmap (bufp RE_LISP_SHORT_CONTEXT_ARGS) == -2) return -2; #ifdef REGEX_BEGLINE_CHECK @@ -4192,53 +4142,83 @@ #endif #ifdef emacs - SETUP_SYNTAX_CACHE_FOR_OBJECT (regex_match_object, - regex_emacs_buffer, - SYNTAX_CACHE_OBJECT_BYTE_TO_CHAR (regex_match_object, - regex_emacs_buffer, - startpos), - 1); + scache = setup_syntax_cache (scache, lispobj, lispbuf, + offset_to_charxpos (lispobj, startpos), + 1); #endif /* Loop through the string, looking for a place to start matching. */ for (;;) { #ifdef REGEX_BEGLINE_CHECK - /* If the regex is anchored at the beginning of a line (i.e. with a ^), - then we can speed things up by skipping to the next beginning-of- - line. */ - if (anchored_at_begline && startpos > 0 && startpos != size1 && - range > 0) + /* If the regex is anchored at the beginning of a line (i.e. with a + ^), then we can speed things up by skipping to the next + beginning-of-line. However, to determine "beginning of line" we + need to look at the previous char, so can't do this check if at + beginning of either string. (Well, we could if at the beginning of + the second string, but it would require additional code, and this + is just an optimization.) */ + if (anchored_at_begline && startpos > 0 && startpos != size1) { - /* whose stupid idea was it anyway to make this - function take two strings to match?? */ - int lim = 0; - int irange = range; + if (range > 0) + { + /* whose stupid idea was it anyway to make this + function take two strings to match?? */ + int lim = 0; + re_char *orig_d; + re_char *stop_d; - if (startpos < size1 && startpos + range >= size1) - lim = range - (size1 - startpos); + /* Compute limit as below in fastmap code, so we are guaranteed + to remain within a single string. */ + if (startpos < size1 && startpos + range >= size1) + lim = range - (size1 - startpos); - d = ((const unsigned char *) - (startpos >= size1 ? string2 - size1 : string1) + startpos); - DEC_CHARPTR(d); /* Ok, since startpos != size1. */ - d_size = charcount_to_bytecount (d, 1); + d = ((const unsigned char *) + (startpos >= size1 ? string2 - size1 : string1) + startpos); + orig_d = d; + stop_d = d + range - lim; - if (TRANSLATE_P (translate)) - while (range > lim && *d != '\n') - { - d += d_size; /* Speedier INC_CHARPTR(d) */ - d_size = charcount_to_bytecount (d, 1); - range -= d_size; - } - else - while (range > lim && *d != '\n') - { - d += d_size; /* Speedier INC_CHARPTR(d) */ - d_size = charcount_to_bytecount (d, 1); - range -= d_size; - } + /* We want to find the next location (including the current + one) where the previous char is a newline, so back up one + and search forward for a newline. */ + DEC_IBYTEPTR_FMT (d, fmt); /* Ok, since startpos != size1. */ + + /* Written out as an if-else to avoid testing `translate' + inside the loop. */ + if (TRANSLATE_P (translate)) + while (d < stop_d && + RE_TRANSLATE_1 (itext_ichar_fmt (d, fmt, lispobj)) + != '\n') + INC_IBYTEPTR_FMT (d, fmt); + else + while (d < stop_d && + itext_ichar_ascii_fmt (d, fmt, lispobj) != '\n') + INC_IBYTEPTR_FMT (d, fmt); + + /* If we were stopped by a newline, skip forward over it. + Otherwise we will get in an infloop when our start position + was at begline. */ + if (d < stop_d) + INC_IBYTEPTR_FMT (d, fmt); + range -= d - orig_d; + startpos += d - orig_d; +#if 1 + assert (!forward_search_p || range >= 0); +#endif + } + else if (range < 0) + { + /* We're lazy, like in the fastmap code below */ + Ichar c; - startpos += irange - range; + d = ((const unsigned char *) + (startpos >= size1 ? string2 - size1 : string1) + startpos); + DEC_IBYTEPTR_FMT (d, fmt); + c = itext_ichar_fmt (d, fmt, lispobj); + c = RE_TRANSLATE (c); + if (c != '\n') + goto advance; + } } #endif /* REGEX_BEGLINE_CHECK */ @@ -4248,6 +4228,20 @@ the first null string. */ if (fastmap && startpos < total_size && !bufp->can_be_null) { + /* For the moment, fastmap always works as if buffer + is in default format, so convert chars in the search strings + into default format as we go along, if necessary. + + &&#### fastmap needs rethinking for 8-bit-fixed so + it's faster. We need it to reflect the raw + 8-bit-fixed values. That isn't so hard if we assume + that the top 96 bytes represent a single 1-byte + charset. For 16-bit/32-bit stuff it's probably not + worth it to make the fastmap represent the raw, due to + its nature -- we'd have to use the LSB for the + fastmap, and that causes lots of problems with Mule + chars, where it essentially wipes out the usefulness + of the fastmap entirely. */ if (range > 0) /* Searching forwards. */ { int lim = 0; @@ -4262,46 +4256,82 @@ /* Written out as an if-else to avoid testing `translate' inside the loop. */ if (TRANSLATE_P (translate)) - while (range > lim) - { + { + while (range > lim) + { + re_char *old_d = d; #ifdef MULE - Emchar buf_ch; - - buf_ch = charptr_emchar (d); - buf_ch = RE_TRANSLATE (buf_ch); - if (buf_ch >= 0200 || fastmap[(unsigned char) buf_ch]) - break; + Ibyte tempch[MAX_ICHAR_LEN]; + Ichar buf_ch = + RE_TRANSLATE_1 (itext_ichar_fmt (d, fmt, lispobj)); + set_itext_ichar (tempch, buf_ch); + if (fastmap[*tempch]) + break; #else - if (fastmap[(unsigned char)RE_TRANSLATE (*d)]) - break; + if (fastmap[(unsigned char) RE_TRANSLATE_1 (*d)]) + break; +#endif /* MULE */ + INC_IBYTEPTR_FMT (d, fmt); + range -= (d - old_d); +#if 1 + assert (!forward_search_p || range >= 0); +#endif + } + } +#ifdef MULE + else if (fmt != FORMAT_DEFAULT) + { + while (range > lim) + { + re_char *old_d = d; + Ibyte tempch[MAX_ICHAR_LEN]; + Ichar buf_ch = itext_ichar_fmt (d, fmt, lispobj); + set_itext_ichar (tempch, buf_ch); + if (fastmap[*tempch]) + break; + INC_IBYTEPTR_FMT (d, fmt); + range -= (d - old_d); +#if 1 + assert (!forward_search_p || range >= 0); +#endif + } + } #endif /* MULE */ - d_size = charcount_to_bytecount (d, 1); - range -= d_size; - d += d_size; /* Speedier INC_CHARPTR(d) */ - } else - while (range > lim && !fastmap[*d]) - { - d_size = charcount_to_bytecount (d, 1); - range -= d_size; - d += d_size; /* Speedier INC_CHARPTR(d) */ - } + { + while (range > lim && !fastmap[*d]) + { + re_char *old_d = d; + INC_IBYTEPTR (d); + range -= (d - old_d); +#if 1 + assert (!forward_search_p || range >= 0); +#endif + } + } startpos += irange - range; } else /* Searching backwards. */ { - Emchar c = (size1 == 0 || startpos >= size1 - ? charptr_emchar (string2 + startpos - size1) - : charptr_emchar (string1 + startpos)); - c = TRANSLATE (c); + /* #### It's not clear why we don't just write a loop, like + for the moving-forward case. Perhaps the writer got lazy, + since backward searches aren't so common. */ + d = ((const unsigned char *) + (startpos >= size1 ? string2 - size1 : string1) + startpos); #ifdef MULE - if (!(c >= 0200 || fastmap[(unsigned char) c])) - goto advance; + { + Ibyte tempch[MAX_ICHAR_LEN]; + Ichar buf_ch = + RE_TRANSLATE (itext_ichar_fmt (d, fmt, lispobj)); + set_itext_ichar (tempch, buf_ch); + if (!fastmap[*tempch]) + goto advance; + } #else - if (!fastmap[(unsigned char) c]) + if (!fastmap[(unsigned char) RE_TRANSLATE (*d)]) goto advance; -#endif +#endif /* MULE */ } } @@ -4315,7 +4345,8 @@ QUIT; #endif val = re_match_2_internal (bufp, string1, size1, string2, size2, - startpos, regs, stop); + startpos, regs, stop + RE_LISP_CONTEXT_ARGS); #ifndef REGEX_MALLOC #ifdef C_ALLOCA alloca (0); @@ -4333,26 +4364,35 @@ break; else if (range > 0) { + Bytecount d_size; d = ((const unsigned char *) (startpos >= size1 ? string2 - size1 : string1) + startpos); - d_size = charcount_to_bytecount (d, 1); + d_size = itext_ichar_len_fmt (d, fmt); range -= d_size; +#if 1 + assert (!forward_search_p || range >= 0); +#endif startpos += d_size; } else { + Bytecount d_size; /* Note startpos > size1 not >=. If we are on the string1/string2 boundary, we want to backup into string1. */ d = ((const unsigned char *) (startpos > size1 ? string2 - size1 : string1) + startpos); - DEC_CHARPTR(d); - d_size = charcount_to_bytecount (d, 1); + DEC_IBYTEPTR_FMT (d, fmt); + d_size = itext_ichar_len_fmt (d, fmt); range += d_size; +#if 1 + assert (!forward_search_p || range >= 0); +#endif startpos -= d_size; } } return -1; } /* re_search_2 */ + /* Declarations and macros for re_match_2. */ @@ -4369,7 +4409,7 @@ /* Call before fetching a character with *d. This switches over to string2 if necessary. */ -#define REGEX_PREFETCH() \ +#define REGEX_PREFETCH() \ while (d == dend) \ { \ /* End of string2 => fail. */ \ @@ -4394,9 +4434,8 @@ #define POS_AFTER_GAP_UNSAFE(d) ((d) == end1 ? string2 : (d)) /* Test if CH is a word-constituent character. (XEmacs change) */ -#define WORDCHAR_P_UNSAFE(ch) \ - (SYNTAX_UNSAFE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), \ - ch) == Sword) +#define WORDCHAR_P(ch) \ + (SYNTAX (BUFFER_MIRROR_SYNTAX_TABLE (lispbuf), ch) == Sword) /* Free everything we malloc. */ #ifdef MATCH_MAY_ALLOCATE @@ -4430,21 +4469,22 @@ /* Matching routines. */ -#ifndef emacs /* Emacs never uses this. */ +#ifndef emacs /* XEmacs never uses this. */ /* re_match is like re_match_2 except it takes only a single string. */ int re_match (struct re_pattern_buffer *bufp, const char *string, int size, - int pos, struct re_registers *regs) + int pos, struct re_registers *regs + RE_LISP_CONTEXT_ARGS_DECL) { int result = re_match_2_internal (bufp, NULL, 0, (re_char *) string, size, - pos, regs, size); + pos, regs, size + RE_LISP_CONTEXT_ARGS); alloca (0); return result; } #endif /* not emacs */ - /* re_match_2 matches the compiled pattern in BUFP against the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 and SIZE2, respectively). We start matching at POS, and stop matching @@ -4461,55 +4501,33 @@ int re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, - struct re_registers *regs, int stop) + struct re_registers *regs, int stop + RE_LISP_CONTEXT_ARGS_DECL) { int result; #ifdef emacs - SETUP_SYNTAX_CACHE_FOR_OBJECT (regex_match_object, - regex_emacs_buffer, - SYNTAX_CACHE_OBJECT_BYTE_TO_CHAR (regex_match_object, - regex_emacs_buffer, - pos), - 1); + scache = setup_syntax_cache (scache, lispobj, lispbuf, + offset_to_charxpos (lispobj, pos), + 1); #endif result = re_match_2_internal (bufp, (re_char *) string1, size1, (re_char *) string2, size2, - pos, regs, stop); + pos, regs, stop + RE_LISP_CONTEXT_ARGS); alloca (0); return result; } -#if defined (ERROR_CHECK_TEXT) && defined (emacs) -int in_re_match_2_internal; - -/* #### I am seeing an error (once) where regex_match_object gets set - to a string while matching on a buffer. The only way this seems - possible is recursive invocation of re_match_2_internal(). */ -static Lisp_Object -restore_in_re_match_2_internal (Lisp_Object val) -{ - in_re_match_2_internal = 0; - return Qnil; -} - -#define RESTORE_IN_MATCH_FLAG unbind_to (speccount) - -#else - -#define RESTORE_IN_MATCH_FLAG do {} while (0) - -#endif /* defined (ERROR_CHECK_TEXT) && defined (emacs) */ - - /* This is a separate function so that we can force an alloca cleanup afterwards. */ static int re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string1, int size1, re_char *string2, int size2, int pos, - struct re_registers *regs, int stop) + struct re_registers *regs, int stop + RE_LISP_CONTEXT_ARGS_DECL) { /* General temporaries. */ int mcnt; @@ -4639,16 +4657,9 @@ /* 1 if this match is the best seen so far. */ re_bool best_match_p; -#if defined (ERROR_CHECK_TEXT) && defined (emacs) - int speccount = specpdl_depth (); - -#if 0 - /* we've hopefully fixed the reentrancy problem. */ - assert (!in_re_match_2_internal); -#endif - in_re_match_2_internal = 1; - record_unwind_protect (restore_in_re_match_2_internal, Qnil); -#endif /* defined (ERROR_CHECK_TEXT) && defined (emacs) */ +#ifdef emacs + Internal_Format fmt = buffer_or_other_internal_format (lispobj); +#endif /* emacs */ DEBUG_PRINT1 ("\n\nEntering re_match_2.\n"); @@ -4676,7 +4687,6 @@ && best_regstart && best_regend && reg_dummy && reg_info_dummy)) { FREE_VARIABLES (); - RESTORE_IN_MATCH_FLAG; return -2; } } @@ -4694,7 +4704,6 @@ if (pos < 0 || pos > size1 + size2) { FREE_VARIABLES (); - RESTORE_IN_MATCH_FLAG; return -1; } @@ -4852,7 +4861,6 @@ if (regs->start == NULL || regs->end == NULL) { FREE_VARIABLES (); - RESTORE_IN_MATCH_FLAG; return -2; } bufp->regs_allocated = REGS_REALLOCATE; @@ -4869,7 +4877,6 @@ if (regs->start == NULL || regs->end == NULL) { FREE_VARIABLES (); - RESTORE_IN_MATCH_FLAG; return -2; } } @@ -4931,7 +4938,6 @@ DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); FREE_VARIABLES (); - RESTORE_IN_MATCH_FLAG; return mcnt; } @@ -4948,9 +4954,10 @@ DEBUG_PRINT1 ("EXECUTING succeed.\n"); goto succeed_label; - /* Match the next n pattern characters exactly. The following - byte in the pattern defines n, and the n bytes after that - are the characters to match. */ + /* Match exactly a string of length n in the pattern. The + following byte in the pattern defines n, and the n bytes after + that make up the string to match. (Under Mule, this will be in + the default internal format.) */ case exactn: mcnt = *p++; DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); @@ -4962,23 +4969,21 @@ do { #ifdef MULE - Emchar pat_ch, buf_ch; Bytecount pat_len; REGEX_PREFETCH (); - pat_ch = charptr_emchar (p); - buf_ch = charptr_emchar (d); - if (RE_TRANSLATE (buf_ch) != pat_ch) + if (RE_TRANSLATE_1 (itext_ichar_fmt (d, fmt, lispobj)) + != itext_ichar (p)) goto fail; - pat_len = charcount_to_bytecount (p, 1); + pat_len = itext_ichar_len (p); p += pat_len; - INC_CHARPTR (d); + INC_IBYTEPTR_FMT (d, fmt); mcnt -= pat_len; #else /* not MULE */ REGEX_PREFETCH (); - if ((unsigned char) RE_TRANSLATE (*d++) != *p++) + if ((unsigned char) RE_TRANSLATE_1 (*d++) != *p++) goto fail; mcnt--; #endif @@ -4987,12 +4992,40 @@ } else { - do +#ifdef MULE + /* If buffer format is default, then we can shortcut and just + compare the text directly, byte by byte. Otherwise, we + need to go character by character. */ + if (fmt != FORMAT_DEFAULT) { - REGEX_PREFETCH (); - if (*d++ != *p++) goto fail; + do + { + Bytecount pat_len; + + REGEX_PREFETCH (); + if (itext_ichar_fmt (d, fmt, lispobj) != + itext_ichar (p)) + goto fail; + + pat_len = itext_ichar_len (p); + p += pat_len; + INC_IBYTEPTR_FMT (d, fmt); + + mcnt -= pat_len; + } + while (mcnt > 0); + } + else +#endif + { + do + { + REGEX_PREFETCH (); + if (*d++ != *p++) goto fail; + mcnt--; + } + while (mcnt > 0); } - while (--mcnt); } SET_REGS_MATCHED (); break; @@ -5004,13 +5037,16 @@ REGEX_PREFETCH (); - if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n') - || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000')) + if ((!(bufp->syntax & RE_DOT_NEWLINE) && + RE_TRANSLATE (itext_ichar_fmt (d, fmt, lispobj)) == '\n') + || (bufp->syntax & RE_DOT_NOT_NULL && + RE_TRANSLATE (itext_ichar_fmt (d, fmt, lispobj)) == + '\000')) goto fail; SET_REGS_MATCHED (); DEBUG_PRINT2 (" Matched `%d'.\n", *d); - INC_CHARPTR (d); /* XEmacs change */ + INC_IBYTEPTR_FMT (d, fmt); /* XEmacs change */ break; @@ -5023,7 +5059,8 @@ DEBUG_PRINT2 ("EXECUTING charset%s.\n", not_p ? "_not" : ""); REGEX_PREFETCH (); - c = TRANSLATE (*d); /* The character to match. */ + c = itext_ichar_fmt (d, fmt, lispobj); + c = RE_TRANSLATE (c); /* The character to match. */ /* Cast to `unsigned int' instead of `unsigned char' in case the bit list is a full 32 bytes long. */ @@ -5036,7 +5073,7 @@ if (!not_p) goto fail; SET_REGS_MATCHED (); - INC_CHARPTR (d); /* XEmacs change */ + INC_IBYTEPTR_FMT (d, fmt); /* XEmacs change */ break; } @@ -5044,14 +5081,14 @@ case charset_mule: case charset_mule_not: { - REGISTER Emchar c; + REGISTER Ichar c; re_bool not_p = (re_opcode_t) *(p - 1) == charset_mule_not; DEBUG_PRINT2 ("EXECUTING charset_mule%s.\n", not_p ? "_not" : ""); REGEX_PREFETCH (); - c = charptr_emchar ((const Intbyte *) d); - c = TRANSLATE_EXTENDED_UNSAFE (c); /* The character to match. */ + c = itext_ichar_fmt (d, fmt, lispobj); + c = RE_TRANSLATE (c); /* The character to match. */ if (EQ (Qt, unified_range_table_lookup (p, c, Qnil))) not_p = !not_p; @@ -5061,7 +5098,7 @@ if (!not_p) goto fail; SET_REGS_MATCHED (); - INC_CHARPTR (d); + INC_IBYTEPTR_FMT (d, fmt); break; } #endif /* MULE */ @@ -5318,8 +5355,11 @@ /* Compare that many; failure if mismatch, else move past them. */ if (TRANSLATE_P (translate) - ? bcmp_translate ((unsigned char *) d, - (unsigned char *) d2, mcnt, translate) + ? bcmp_translate (d, d2, mcnt, translate +#ifdef emacs + , fmt, lispobj +#endif + ) : memcmp (d, d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; @@ -5341,10 +5381,14 @@ { if (!bufp->not_bol) break; } - else if (d[-1] == '\n' && bufp->newline_anchor) - { - break; - } + else + { + re_char *d2 = d; + DEC_IBYTEPTR (d2); + if (itext_ichar_ascii_fmt (d2, fmt, lispobj) == '\n' && + bufp->newline_anchor) + break; + } /* In all other cases, we fail. */ goto fail; @@ -5359,7 +5403,9 @@ } /* We have to ``prefetch'' the next character. */ - else if ((d == end1 ? *string2 : *d) == '\n' + else if ((d == end1 ? + itext_ichar_ascii_fmt (string2, fmt, lispobj) : + itext_ichar_ascii_fmt (d, fmt, lispobj)) == '\n' && bufp->newline_anchor) { break; @@ -5744,29 +5790,29 @@ re_char *d_before = POS_BEFORE_GAP_UNSAFE (d); re_char *d_after = POS_AFTER_GAP_UNSAFE (d); - /* emch1 is the character before d, syn1 is the syntax of emch1, - emch2 is the character at d, and syn2 is the syntax of emch2. */ - Emchar emch1, emch2; + /* emch1 is the character before d, syn1 is the syntax of + emch1, emch2 is the character at d, and syn2 is the + syntax of emch2. */ + Ichar emch1, emch2; int syn1, syn2; #ifdef emacs - int pos_before; + Charxpos pos_before; #endif - DEC_CHARPTR (d_before); - emch1 = charptr_emchar (d_before); - emch2 = charptr_emchar (d_after); + DEC_IBYTEPTR_FMT (d_before, fmt); + emch1 = itext_ichar_fmt (d_before, fmt, lispobj); + emch2 = itext_ichar_fmt (d_after, fmt, lispobj); #ifdef emacs - pos_before = SYNTAX_CACHE_BYTE_TO_CHAR (PTR_TO_OFFSET (d)) - 1; - UPDATE_SYNTAX_CACHE (pos_before); + pos_before = + offset_to_charxpos (lispobj, PTR_TO_OFFSET (d)) - 1; + UPDATE_SYNTAX_CACHE (scache, pos_before); #endif - syn1 = SYNTAX_FROM_CACHE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), - emch1); + syn1 = SYNTAX_FROM_CACHE (scache, emch1); #ifdef emacs - UPDATE_SYNTAX_CACHE_FORWARD (pos_before + 1); + UPDATE_SYNTAX_CACHE_FORWARD (scache, pos_before + 1); #endif - syn2 = SYNTAX_FROM_CACHE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), - emch2); + syn2 = SYNTAX_FROM_CACHE (scache, emch2); result = ((syn1 == Sword) != (syn2 == Sword)); } @@ -5792,24 +5838,22 @@ */ re_char *dtmp = POS_AFTER_GAP_UNSAFE (d); - Emchar emch = charptr_emchar (dtmp); + Ichar emch = itext_ichar_fmt (dtmp, fmt, lispobj); #ifdef emacs - int charpos = SYNTAX_CACHE_BYTE_TO_CHAR (PTR_TO_OFFSET (d)); - UPDATE_SYNTAX_CACHE (charpos); + Charxpos charpos = offset_to_charxpos (lispobj, PTR_TO_OFFSET (d)); + UPDATE_SYNTAX_CACHE (scache, charpos); #endif - if (SYNTAX_FROM_CACHE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), - emch) != Sword) + if (SYNTAX_FROM_CACHE (scache, emch) != Sword) goto fail; if (AT_STRINGS_BEG (d)) break; dtmp = POS_BEFORE_GAP_UNSAFE (d); - DEC_CHARPTR (dtmp); - emch = charptr_emchar (dtmp); + DEC_IBYTEPTR_FMT (dtmp, fmt); + emch = itext_ichar_fmt (dtmp, fmt, lispobj); #ifdef emacs - UPDATE_SYNTAX_CACHE_BACKWARD (charpos - 1); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, charpos - 1); #endif - if (SYNTAX_FROM_CACHE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), - emch) != Sword) + if (SYNTAX_FROM_CACHE (scache, emch) != Sword) break; goto fail; } @@ -5828,26 +5872,24 @@ The or condition is incorrect (reversed). */ re_char *dtmp; - Emchar emch; + Ichar emch; #ifdef emacs - int charpos = SYNTAX_CACHE_BYTE_TO_CHAR (PTR_TO_OFFSET (d)) - 1; - UPDATE_SYNTAX_CACHE (charpos); + Charxpos charpos = offset_to_charxpos (lispobj, PTR_TO_OFFSET (d)); + UPDATE_SYNTAX_CACHE (scache, charpos); #endif dtmp = POS_BEFORE_GAP_UNSAFE (d); - DEC_CHARPTR (dtmp); - emch = charptr_emchar (dtmp); - if (SYNTAX_FROM_CACHE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), - emch) != Sword) + DEC_IBYTEPTR_FMT (dtmp, fmt); + emch = itext_ichar_fmt (dtmp, fmt, lispobj); + if (SYNTAX_FROM_CACHE (scache, emch) != Sword) goto fail; if (AT_STRINGS_END (d)) break; dtmp = POS_AFTER_GAP_UNSAFE (d); - emch = charptr_emchar (dtmp); + emch = itext_ichar_fmt (dtmp, fmt, lispobj); #ifdef emacs - UPDATE_SYNTAX_CACHE_FORWARD (charpos + 1); + UPDATE_SYNTAX_CACHE_FORWARD (scache, charpos + 1); #endif - if (SYNTAX_FROM_CACHE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), - emch) != Sword) + if (SYNTAX_FROM_CACHE (scache, emch) != Sword) break; goto fail; } @@ -5855,35 +5897,27 @@ #ifdef emacs case before_dot: DEBUG_PRINT1 ("EXECUTING before_dot.\n"); - if (! (NILP (regex_match_object) || BUFFERP (regex_match_object)) - || (BUF_PTR_BYTE_POS (regex_emacs_buffer, (unsigned char *) d) - >= BUF_PT (regex_emacs_buffer))) + if (!BUFFERP (lispobj) + || (BUF_PTR_BYTE_POS (XBUFFER (lispobj), (unsigned char *) d) + >= BUF_PT (XBUFFER (lispobj)))) goto fail; break; case at_dot: DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (! (NILP (regex_match_object) || BUFFERP (regex_match_object)) - || (BUF_PTR_BYTE_POS (regex_emacs_buffer, (unsigned char *) d) - != BUF_PT (regex_emacs_buffer))) + if (!BUFFERP (lispobj) + || (BUF_PTR_BYTE_POS (XBUFFER (lispobj), (unsigned char *) d) + != BUF_PT (XBUFFER (lispobj)))) goto fail; break; case after_dot: DEBUG_PRINT1 ("EXECUTING after_dot.\n"); - if (! (NILP (regex_match_object) || BUFFERP (regex_match_object)) - || (BUF_PTR_BYTE_POS (regex_emacs_buffer, (unsigned char *) d) - <= BUF_PT (regex_emacs_buffer))) + if (!BUFFERP (lispobj) + || (BUF_PTR_BYTE_POS (XBUFFER (lispobj), (unsigned char *) d) + <= BUF_PT (XBUFFER (lispobj)))) goto fail; break; -#if 0 /* not emacs19 */ - case at_dot: - DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (BUF_PTR_BYTE_POS (regex_emacs_buffer, (unsigned char *) d) + 1 - != BUF_PT (regex_emacs_buffer)) - goto fail; - break; -#endif /* not emacs19 */ case syntaxspec: DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt); @@ -5898,20 +5932,16 @@ matchornotsyntax: { int matches; - Emchar emch; + Ichar emch; REGEX_PREFETCH (); -#ifdef emacs - { - int charpos = SYNTAX_CACHE_BYTE_TO_CHAR (PTR_TO_OFFSET (d)); - UPDATE_SYNTAX_CACHE (charpos); - } -#endif + UPDATE_SYNTAX_CACHE + (scache, offset_to_charxpos (lispobj, PTR_TO_OFFSET (d))); - emch = charptr_emchar ((const Intbyte *) d); - matches = (SYNTAX_FROM_CACHE (regex_emacs_buffer->mirror_syntax_table, - emch) == (enum syntaxcode) mcnt); - INC_CHARPTR (d); + emch = itext_ichar_fmt (d, fmt, lispobj); + matches = (SYNTAX_FROM_CACHE (scache, emch) == + (enum syntaxcode) mcnt); + INC_IBYTEPTR_FMT (d, fmt); if (matches != should_succeed) goto fail; SET_REGS_MATCHED (); @@ -5936,14 +5966,14 @@ should_succeed = 1; matchornotcategory: { - Emchar emch; + Ichar emch; mcnt = *p++; REGEX_PREFETCH (); - emch = charptr_emchar ((const Intbyte *) d); - INC_CHARPTR (d); - if (check_category_char(emch, regex_emacs_buffer->category_table, - mcnt, should_succeed)) + emch = itext_ichar_fmt (d, fmt, lispobj); + INC_IBYTEPTR_FMT (d, fmt); + if (check_category_char (emch, BUFFER_CATEGORY_TABLE (lispbuf), + mcnt, should_succeed)) goto fail; SET_REGS_MATCHED (); } @@ -5958,7 +5988,7 @@ case wordchar: DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n"); REGEX_PREFETCH (); - if (!WORDCHAR_P_UNSAFE ((int) (*d))) + if (!WORDCHAR_P ((int) (*d))) goto fail; SET_REGS_MATCHED (); d++; @@ -5967,7 +5997,7 @@ case notwordchar: DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); REGEX_PREFETCH (); - if (!WORDCHAR_P_UNSAFE ((int) (*d))) + if (!WORDCHAR_P ((int) (*d))) goto fail; SET_REGS_MATCHED (); d++; @@ -6034,7 +6064,6 @@ FREE_VARIABLES (); - RESTORE_IN_MATCH_FLAG; return -1; /* Failure to match. */ } /* re_match_2 */ @@ -6284,30 +6313,34 @@ static int bcmp_translate (re_char *s1, re_char *s2, - REGISTER int len, RE_TRANSLATE_TYPE translate) + REGISTER int len, RE_TRANSLATE_TYPE translate +#ifdef emacs + , Internal_Format fmt, Lisp_Object lispobj +#endif + ) { - REGISTER const unsigned char *p1 = s1, *p2 = s2; + REGISTER re_char *p1 = s1, *p2 = s2; #ifdef MULE - const unsigned char *p1_end = s1 + len; - const unsigned char *p2_end = s2 + len; + re_char *p1_end = s1 + len; + re_char *p2_end = s2 + len; while (p1 != p1_end && p2 != p2_end) { - Emchar p1_ch, p2_ch; + Ichar p1_ch, p2_ch; - p1_ch = charptr_emchar (p1); - p2_ch = charptr_emchar (p2); + p1_ch = itext_ichar_fmt (p1, fmt, lispobj); + p2_ch = itext_ichar_fmt (p2, fmt, lispobj); - if (RE_TRANSLATE (p1_ch) - != RE_TRANSLATE (p2_ch)) + if (RE_TRANSLATE_1 (p1_ch) + != RE_TRANSLATE_1 (p2_ch)) return 1; - INC_CHARPTR (p1); - INC_CHARPTR (p2); + INC_IBYTEPTR_FMT (p1, fmt); + INC_IBYTEPTR_FMT (p2, fmt); } #else /* not MULE */ while (len) { - if (RE_TRANSLATE (*p1++) != RE_TRANSLATE (*p2++)) return 1; + if (RE_TRANSLATE_1 (*p1++) != RE_TRANSLATE_1 (*p2++)) return 1; len--; } #endif /* MULE */ @@ -6343,7 +6376,8 @@ /* Match anchors at newline. */ bufp->newline_anchor = 1; - ret = regex_compile ((unsigned char *) pattern, length, re_syntax_options, bufp); + ret = regex_compile ((unsigned char *) pattern, length, re_syntax_options, + bufp); if (!ret) return NULL; @@ -6388,7 +6422,8 @@ /* Match anchors at newlines. */ re_comp_buf.newline_anchor = 1; - ret = regex_compile ((unsigned char *)s, strlen (s), re_syntax_options, &re_comp_buf); + ret = regex_compile ((unsigned char *)s, strlen (s), re_syntax_options, + &re_comp_buf); if (!ret) return NULL; @@ -6640,10 +6675,3 @@ #endif /* not emacs */ -/* -Local variables: -make-backup-files: t -version-control: t -trim-versions-without-asking: nil -End: -*/ diff --text -u 'xemacs-21.5.6/src/regex.h' 'xemacs-21.5.7/src/regex.h' Index: ././src/regex.h --- ././src/regex.h Thu Sep 20 15:29:12 2001 +++ ././src/regex.h Sun May 5 20:32:23 2002 @@ -2,6 +2,7 @@ expression library, version 0.12. Copyright (C) 1985, 89, 90, 91, 92, 93, 95 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,8 +26,16 @@ #ifdef emacs #define RE_TRANSLATE_TYPE Lisp_Object +#define RE_LISP_SHORT_CONTEXT_ARGS_DECL , Lisp_Object lispobj, struct buffer *lispbuf +#define RE_LISP_SHORT_CONTEXT_ARGS , lispobj, lispbuf +#define RE_LISP_CONTEXT_ARGS_DECL , Lisp_Object lispobj, struct buffer *lispbuf, struct syntax_cache *scache +#define RE_LISP_CONTEXT_ARGS , lispobj, lispbuf, scache #else #define RE_TRANSLATE_TYPE char * +#define RE_LISP_SHORT_CONTEXT_ARGS_DECL +#define RE_LISP_SHORT_CONTEXT_ARGS +#define RE_LISP_CONTEXT_ARGS_DECL +#define RE_LISP_CONTEXT_ARGS #define Elemcount ssize_t #define Bytecount ssize_t #endif /* emacs */ @@ -448,7 +457,8 @@ /* Compile a fastmap for the compiled pattern in BUFFER; used to accelerate searches. Return 0 if successful and -2 if was an internal error. */ -int re_compile_fastmap (struct re_pattern_buffer *buffer); +int re_compile_fastmap (struct re_pattern_buffer *buffer + RE_LISP_SHORT_CONTEXT_ARGS_DECL); /* Search in the string STRING (with length LENGTH) for the pattern @@ -458,27 +468,31 @@ information in REGS (if REGS and BUFFER->no_sub are nonzero). */ int re_search (struct re_pattern_buffer *buffer, const char *string, int length, int start, int range, - struct re_registers *regs); + struct re_registers *regs RE_LISP_CONTEXT_ARGS_DECL); /* Like `re_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ int re_search_2 (struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, int start, - int range, struct re_registers *regs, int stop); + int range, struct re_registers *regs, int stop + RE_LISP_CONTEXT_ARGS_DECL); +#ifndef emacs /* never used by XEmacs */ /* Like `re_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ int re_match (struct re_pattern_buffer *buffer, const char *string, - int length, int start, struct re_registers *regs); + int length, int start, struct re_registers *regs + RE_LISP_CONTEXT_ARGS_DECL); +#endif /* not emacs */ /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ int re_match_2 (struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, - int start, struct re_registers *regs, int stop); - + int start, struct re_registers *regs, int stop + RE_LISP_CONTEXT_ARGS_DECL); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using BUFFER and REGS will use this memory diff --text -u 'xemacs-21.5.6/src/s/cygwin32.h' 'xemacs-21.5.7/src/s/cygwin32.h' Index: ././src/s/cygwin32.h --- ././src/s/cygwin32.h Wed Mar 13 17:53:22 2002 +++ ././src/s/cygwin32.h Fri Jun 21 06:19:10 2002 @@ -83,3 +83,9 @@ It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "cygwin32" + +/* Cygwin bogusly forgets to copy mmap()ed regions into the child when + a fork is done; thus, any reference to anything in mmap()ed space + (under PDUMP, in particular, this bites, since all data loaded from + PDUMP is normally done using mmap()) will cause an immediate segfault. */ +#undef HAVE_MMAP diff --text -u 'xemacs-21.5.6/src/s/linux.h' 'xemacs-21.5.7/src/s/linux.h' Index: ././src/s/linux.h --- ././src/s/linux.h Wed Mar 13 17:53:22 2002 +++ ././src/s/linux.h Tue Jun 4 15:05:47 2002 @@ -86,8 +86,11 @@ #if defined(__linux__) && defined(powerpc) /*Added by Fukui*/ #define START_FILES /*Added by Fukui*/ #else /*Added by Fukui*/ - +#if defined __s390x__ || defined __x86_64__ +#define START_FILES "pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o" +#else #define START_FILES "pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o" +#endif #endif /*Added by Fukui*/ #endif @@ -108,7 +111,11 @@ #else /*#undef LIB_GCC #define LIB_GCC*/ +#if defined __s390x__ || defined __x86_64__ +#define LIB_STANDARD "-lgcc -lc -lgcc /usr/lib64/crtn.o" +#else #define LIB_STANDARD "-lgcc -lc -lgcc /usr/lib/crtn.o" +#endif #define LINKER "$(CC) -nostdlib" #endif diff --text -u 'xemacs-21.5.6/src/s/win32-common.h' 'xemacs-21.5.7/src/s/win32-common.h' Index: ././src/s/win32-common.h --- ././src/s/win32-common.h Wed Mar 13 17:53:23 2002 +++ ././src/s/win32-common.h Fri Jun 21 06:19:10 2002 @@ -1,6 +1,6 @@ /* Common system description file for cygwin32/windowsnt/mingw32. Copyright (C) 1993, 1994, 1995, 1999 Free Software Foundation, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -22,15 +22,9 @@ /* Do not define LOAD_AVE_TYPE or LOAD_AVE_CVT since there is no load average available. */ -/* If you are compiling with a non-C calling convention but need to - declare vararg routines differently, put it here */ -#define _VARARGS_ __cdecl - -/* If you are providing a function to something that will call the - function back (like a signal handler and signal, or main) its calling - convention must be whatever standard the libraries expect */ -#define _CALLBACK_ __cdecl - #define NO_MATHERR #define EXEC_SUFFIXES ".exe:.com:.bat:.cmd:" + +/* Define an identifier for all MS Windows systems -- Cygwin, native, MinGW */ +#define WIN32_ANY diff --text -u 'xemacs-21.5.6/src/s/windowsnt.h' 'xemacs-21.5.7/src/s/windowsnt.h' Index: ././src/s/windowsnt.h --- ././src/s/windowsnt.h Sun Mar 31 17:29:24 2002 +++ ././src/s/windowsnt.h Fri Jun 21 06:19:10 2002 @@ -211,7 +211,7 @@ #define MAIL_USE_LOCKING /* See unexnt.c */ -#if (_MSC_VER >= 1100) +#if (_MSC_VER >= 1100) && !defined(PDUMP) #define DUMP_SEPARATE_SECTION #endif #ifdef DUMP_SEPARATE_SECTION @@ -219,29 +219,39 @@ #pragma bss_seg("xdata") #endif -#ifdef HAVE_SCROLLBARS -/* Ensure the NT 4 mouse definitions in winuser.h are available */ +#ifdef emacs +/* intl-auto-encap-win32.[ch] assumes _WIN32_WINNT>=0x0400 + We don't want this set when building command-line helpers in lib-src */ # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0400 # endif #endif -/* Force the various NT 4 structures and constants to be included; we're - careful not to call (or even link with) functions not in NT 3.51 when - running on 3.51, but when running on NT 4 or Win9x, we use the later - functions, and need their headers. */ /* The VC++ (5.0, at least) headers treat WINVER non-existent as 0x0400 */ #if defined (WINVER) && WINVER < 0x0400 # undef WINVER # define WINVER 0x0400 #endif +/* Vararg routines, main(), and callback routines for library functions + (qsort(), signal(), etc.) need to be __cdecl if we use the fastcall + convention by default (a good idea, since it speeds things up). #### Why + do they have to complain about this? Why not just do the right thing + automatically? + + Prefix with X because plain CDECL is already defined by the VC++ header + files. */ +#define XCDECL __cdecl + /* MSVC 6.0 has a mechanism to declare functions which never return */ #if (_MSC_VER >= 1200) #define DOESNT_RETURN __declspec(noreturn) void #define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void decl #define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \ - __declspec(noreturn) extern void decl PRINTF_ARGS(str,idx) + __declspec(noreturn) extern void __cdecl decl PRINTF_ARGS(str,idx) +#else +#define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \ + extern void __cdecl decl PRINTF_ARGS(str,idx) #endif /* MSVC 6.0 */ /* MSVC warnings no-no crap. When adding one to this section, diff --text -u 'xemacs-21.5.6/src/scrollbar-gtk.c' 'xemacs-21.5.7/src/scrollbar-gtk.c' Index: ././src/scrollbar-gtk.c --- ././src/scrollbar-gtk.c Fri Mar 29 13:48:30 2002 +++ ././src/scrollbar-gtk.c Fri Jun 21 06:18:44 2002 @@ -27,13 +27,13 @@ #include #include "lisp.h" -#include "console-gtk.h" +#include "frame-impl.h" +#include "window.h" + +#include "console-gtk-impl.h" #include "glyphs-gtk.h" #include "gui-gtk.h" #include "scrollbar-gtk.h" - -#include "frame.h" -#include "window.h" static gboolean scrollbar_cb (GtkAdjustment *adj, gpointer user_data); diff --text -u 'xemacs-21.5.6/src/scrollbar-msw.c' 'xemacs-21.5.7/src/scrollbar-msw.c' Index: ././src/scrollbar-msw.c --- ././src/scrollbar-msw.c Sun Mar 31 17:29:01 2002 +++ ././src/scrollbar-msw.c Fri Jun 21 06:18:44 2002 @@ -33,13 +33,13 @@ #include "device.h" #include "elhash.h" #include "events.h" -#include "frame.h" +#include "frame-impl.h" #include "opaque.h" #include "scrollbar.h" #include "specifier.h" -#include "window.h" +#include "window-impl.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "scrollbar-msw.h" /* We use a similar sort of vertical scrollbar drag hack for mswindows @@ -94,7 +94,7 @@ (void *) qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA); Lisp_Object ptr; - VOID_TO_LISP (ptr, opaque); + ptr = VOID_TO_LISP (opaque); assert (OPAQUE_PTRP (ptr)); ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table); assert (!NILP (ptr)); @@ -221,7 +221,7 @@ else { Lisp_Object ptr; - VOID_TO_LISP (ptr, v); + ptr = VOID_TO_LISP (v); assert (OPAQUE_PTRP (ptr)); ptr = Fgethash (ptr, Vmswindows_scrollbar_instance_table, Qnil); sb = XSCROLLBAR_INSTANCE (ptr); @@ -335,7 +335,7 @@ { int hasVertBar, hasHorzBar; /* Indicates presence of scroll bars */ unsigned wheelScrollLines = 0; /* Number of lines per wheel notch */ - Lisp_Object win, corpore, sano; + Lisp_Object win = Qnil, corpore, sano; struct window_mirror *mirror; int mene, _mene, tekel, upharsin; Charbpos mens, sana; @@ -352,19 +352,22 @@ frame. */ if (ScreenToClient (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), &donde_esta) != 0) - /* stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y); */ - pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y, - &mene, &_mene, &tekel, &upharsin, - &needle_in_haystack, - &mens, &sana, &in, &corpore, &sano); - - if (needle_in_haystack) - { - win = wrap_window (needle_in_haystack); - /* stderr_out ("found needle\n"); - debug_print (win); */ + { + /* stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y); */ + pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y, + &mene, &_mene, &tekel, &upharsin, + &needle_in_haystack, + &mens, &sana, &in, &corpore, &sano); + + if (needle_in_haystack) + { + win = wrap_window (needle_in_haystack); + /* stderr_out ("found needle\n"); + debug_print (win); */ + } } - else + + if (!needle_in_haystack) { win = FRAME_SELECTED_WINDOW (XFRAME (frame)); needle_in_haystack = XWINDOW (win); @@ -489,11 +492,7 @@ vars_of_scrollbar_mswindows (void) { Fprovide (intern ("mswindows-scrollbars")); -} -void -complex_vars_of_scrollbar_mswindows (void) -{ staticpro (&Vmswindows_scrollbar_instance_table); Vmswindows_scrollbar_instance_table = make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); diff --text -u 'xemacs-21.5.6/src/scrollbar-x.c' 'xemacs-21.5.7/src/scrollbar-x.c' Index: ././src/scrollbar-x.c --- ././src/scrollbar-x.c Sun Mar 31 17:29:02 2002 +++ ././src/scrollbar-x.c Fri Jun 21 06:18:44 2002 @@ -28,11 +28,11 @@ #include #include "lisp.h" -#include "device.h" -#include "frame.h" +#include "device-impl.h" +#include "frame-impl.h" #include "window.h" -#include "console-x.h" +#include "console-x-impl.h" #include "glyphs-x.h" #include "gui-x.h" #include "scrollbar-x.h" diff --text -u 'xemacs-21.5.6/src/scrollbar.c' 'xemacs-21.5.7/src/scrollbar.c' Index: ././src/scrollbar.c --- ././src/scrollbar.c Fri Mar 29 13:48:32 2002 +++ ././src/scrollbar.c Fri Jun 21 06:18:44 2002 @@ -31,8 +31,8 @@ #include "buffer.h" #include "commands.h" #include "scrollbar.h" -#include "device.h" -#include "frame.h" +#include "device-impl.h" +#include "frame-impl.h" #include "glyphs.h" #include "gutter.h" #include "window.h" diff --text -u 'xemacs-21.5.6/src/search.c' 'xemacs-21.5.7/src/search.c' Index: ././src/search.c --- ././src/search.c Fri Mar 29 13:48:33 2002 +++ ././src/search.c Mon Jun 24 19:01:22 2002 @@ -24,7 +24,7 @@ /* Hacked on for Mule by Ben Wing, December 1994 and August 1995. */ -/* This file has been Mule-ized except for the TRT stuff. */ +/* This file has been Mule-ized. */ #include #include "lisp.h" @@ -43,7 +43,7 @@ #include "chartab.h" #define TRANSLATE(table, pos) \ - (!NILP (table) ? TRT_TABLE_OF (table, (Emchar) pos) : pos) + (!NILP (table) ? TRT_TABLE_OF (table, (Ichar) pos) : pos) #define REGEXP_CACHE_SIZE 20 @@ -85,7 +85,7 @@ able to free or re-allocate it properly. */ /* Note: things get trickier under Mule because the values returned from - the regexp routines are in Bytebposs but we need them to be in Charbpos's. + the regexp routines are in Bytebpos's but we need them to be in Charbpos's. We take the easy way out for the moment and just convert them immediately. We could be more clever by not converting them until necessary, but that gets real ugly real fast since the buffer might have changed and @@ -111,59 +111,17 @@ Lisp_Object Vskip_chars_range_table; static void set_search_regs (struct buffer *buf, Charbpos beg, Charcount len); -static void save_search_regs (void); -static Charbpos simple_search (struct buffer *buf, Intbyte *base_pat, +static Charbpos simple_search (struct buffer *buf, Ibyte *base_pat, + Bytecount len, Bytebpos pos, Bytebpos lim, + EMACS_INT n, Lisp_Object trt); +static Charbpos boyer_moore (struct buffer *buf, Ibyte *base_pat, Bytecount len, Bytebpos pos, Bytebpos lim, - EMACS_INT n, Lisp_Object trt); -static Charbpos boyer_moore (struct buffer *buf, Intbyte *base_pat, - Bytecount len, Bytebpos pos, Bytebpos lim, - EMACS_INT n, Lisp_Object trt, - Lisp_Object inverse_trt, int charset_base); + EMACS_INT n, Lisp_Object trt, + Lisp_Object inverse_trt, int charset_base); static Charbpos search_buffer (struct buffer *buf, Lisp_Object str, - Charbpos charbpos, Charbpos buflim, EMACS_INT n, int RE, - Lisp_Object trt, Lisp_Object inverse_trt, - int posix); - -struct regex_reentrancy -{ - struct syntax_cache cache; - struct buffer *regex_emacs_buffer; - Lisp_Object regex_match_object; -}; - -typedef struct -{ - Dynarr_declare (struct regex_reentrancy); -} regex_reentrancy_dynarr; - -static regex_reentrancy_dynarr *the_regex_reentrancy_dynarr; - -static Lisp_Object -restore_regex_reentrancy (Lisp_Object dummy) -{ - struct regex_reentrancy rr = Dynarr_pop (the_regex_reentrancy_dynarr); - syntax_cache = rr.cache; - regex_emacs_buffer = rr.regex_emacs_buffer; - regex_match_object = rr.regex_match_object; - return Qnil; -} - -static int -begin_regex_reentrancy (void) -{ - /* #### there is still a potential problem with the regex cache -- - the compiled regex could be overwritten. we'd need 20-fold - reentrancy, though. */ - struct regex_reentrancy rr; - rr.cache = syntax_cache; - rr.regex_emacs_buffer = regex_emacs_buffer; - rr.regex_match_object = regex_match_object; - if (!the_regex_reentrancy_dynarr) - the_regex_reentrancy_dynarr = Dynarr_new2 (regex_reentrancy_dynarr, - struct regex_reentrancy); - Dynarr_add (the_regex_reentrancy_dynarr, rr); - return record_unwind_protect (restore_regex_reentrancy, Qnil); -} + Charbpos charbpos, Charbpos buflim, EMACS_INT n, + int RE, Lisp_Object trt, + Lisp_Object inverse_trt, int posix); static void matcher_overflow (void) @@ -174,7 +132,7 @@ /* Compile a regexp and signal a Lisp error if anything goes wrong. PATTERN is the pattern to compile. CP is the place to put the result. - TRANSLATE is a translation table for ignoring case, or NULL for none. + TRANSLATE is a translation table for ignoring case, or Qnil for none. REGP is the structure that says where to store the "register" values that will result from matching this pattern. If it is 0, we should compile the pattern not to record any @@ -184,8 +142,8 @@ static int compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, - Lisp_Object translate, struct re_registers *regp, int posix, - Error_Behavior errb) + struct re_registers *regp, Lisp_Object translate, + int posix, Error_Behavior errb) { const char *val; reg_syntax_t old; @@ -213,7 +171,7 @@ /* Compile a regexp if necessary, but first check to see if there's one in the cache. PATTERN is the pattern to compile. - TRANSLATE is a translation table for ignoring case, or NULL for none. + TRANSLATE is a translation table for ignoring case, or Qnil for none. REGP is the structure that says where to store the "register" values that will result from matching this pattern. If it is 0, we should compile the pattern not to record any @@ -223,13 +181,21 @@ struct re_pattern_buffer * compile_pattern (Lisp_Object pattern, struct re_registers *regp, - Lisp_Object translate, int posix, Error_Behavior errb) + Lisp_Object translate, Lisp_Object searchobj, + struct buffer *searchbuf, int posix, Error_Behavior errb) { struct regexp_cache *cp, **cpp; for (cpp = &searchbuf_head; ; cpp = &cp->next) { cp = *cpp; + /* &&#### once we fix up the fastmap code in regex.c for 8-bit-fixed, + we need to record and compare the buffer and format, since the + fastmap will reflect the state of the buffer -- and things get + more complicated if the buffer has changed formats or (esp.) has + kept the format but changed its interpretation! may need to have + the code that changes the interpretation go through and invalidate + cache entries for that buffer. */ if (!NILP (Fstring_equal (cp->regexp, pattern)) && EQ (cp->buf.translate, translate) && cp->posix == posix) @@ -238,8 +204,8 @@ /* If we're at the end of the cache, compile into the last cell. */ if (cp->next == 0) { - if (!compile_pattern_1 (cp, pattern, translate, regp, posix, - errb)) + if (!compile_pattern_1 (cp, pattern, regp, translate, + posix, errb)) return 0; break; } @@ -271,13 +237,13 @@ return Qnil; /* Not reached. */ } -/* Convert the search registers from Bytebposs to Charbpos's. Needs to be +/* Convert the search registers from Bytebpos's to Charbpos's. Needs to be done after each regexp match that uses the search regs. We could get a potential speedup by not converting the search registers until it's really necessary, e.g. when match-data or replace-match is called. However, this complexifies the code a lot (e.g. the buffer - could have changed and the Bytebposs stored might be invalid) and is + could have changed and the Bytebpos's stored might be invalid) and is probably not a great time-saver. */ static void @@ -289,7 +255,8 @@ for (i = 0; i < num_regs; i++) { if (search_regs.start[i] >= 0) - search_regs.start[i] = bytebpos_to_charbpos (buf, search_regs.start[i]); + search_regs.start[i] = bytebpos_to_charbpos (buf, + search_regs.start[i]); if (search_regs.end[i] >= 0) search_regs.end[i] = bytebpos_to_charbpos (buf, search_regs.end[i]); } @@ -303,7 +270,7 @@ int num_regs = search_regs.num_regs; /* #### bytecount_to_charcount() is not that efficient. This function - could be faster if it did its own conversion (using INC_CHARPTR() + could be faster if it did its own conversion (using INC_IBYTEPTR() and such), because the register ends are likely to be somewhat ordered. (Even if not, you could sort them.) @@ -328,58 +295,63 @@ static Lisp_Object looking_at_1 (Lisp_Object string, struct buffer *buf, int posix) { - /* This function has been Mule-ized, except for the trt table handling. */ Lisp_Object val; Bytebpos p1, p2; Bytecount s1, s2; REGISTER int i; struct re_pattern_buffer *bufp; - int count = begin_regex_reentrancy (); - - if (running_asynch_code) - save_search_regs (); - + struct syntax_cache scache_struct; + struct syntax_cache *scache = &scache_struct; + CHECK_STRING (string); bufp = compile_pattern (string, &search_regs, (!NILP (buf->case_fold_search) ? XCASE_TABLE_DOWNCASE (buf->case_table) : Qnil), - posix, ERROR_ME); + wrap_buffer (buf), buf, posix, ERROR_ME); QUIT; /* Get pointers and sizes of the two strings that make up the visible portion of the buffer. */ - p1 = BI_BUF_BEGV (buf); - p2 = BI_BUF_CEILING_OF (buf, p1); + p1 = BYTE_BUF_BEGV (buf); + p2 = BYTE_BUF_CEILING_OF (buf, p1); s1 = p2 - p1; - s2 = BI_BUF_ZV (buf) - p2; + s2 = BYTE_BUF_ZV (buf) - p2; - regex_match_object = Qnil; - regex_emacs_buffer = buf; - i = re_match_2 (bufp, (char *) BI_BUF_BYTE_ADDRESS (buf, p1), - s1, (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, - BI_BUF_PT (buf) - BI_BUF_BEGV (buf), &search_regs, - BI_BUF_ZV (buf) - BI_BUF_BEGV (buf)); + /* By making the regex object, regex buffer, and syntax cache arguments + to re_{search,match}{,_2}, we've removed the need to do nasty things + to deal with regex reentrancy. (See stack trace in signal.c for proof + that this can happen.) + + #### there is still a potential problem with the regex cache -- + the compiled regex could be overwritten. we'd need 20-fold + reentrancy, though. Fix this. */ + + i = re_match_2 (bufp, (char *) BYTE_BUF_BYTE_ADDRESS (buf, p1), + s1, (char *) BYTE_BUF_BYTE_ADDRESS (buf, p2), s2, + BYTE_BUF_PT (buf) - BYTE_BUF_BEGV (buf), &search_regs, + BYTE_BUF_ZV (buf) - BYTE_BUF_BEGV (buf), wrap_buffer (buf), + buf, scache); if (i == -2) matcher_overflow (); val = (0 <= i ? Qt : Qnil); if (NILP (val)) - return unbind_to (count); + return Qnil; { int num_regs = search_regs.num_regs; for (i = 0; i < num_regs; i++) if (search_regs.start[i] >= 0) { - search_regs.start[i] += BI_BUF_BEGV (buf); - search_regs.end[i] += BI_BUF_BEGV (buf); + search_regs.start[i] += BYTE_BUF_BEGV (buf); + search_regs.end[i] += BYTE_BUF_BEGV (buf); } } last_thing_searched = wrap_buffer (buf); fixup_search_regs_for_buffer (buf); - return unbind_to_1 (count, val); + return val; } DEFUN ("looking-at", Flooking_at, 1, 2, 0, /* @@ -406,21 +378,20 @@ */ (regexp, buffer)) { - return looking_at_1 (regexp, decode_buffer (buffer, 0), 1); + return looking_at_1 (regexp, decode_buffer (buffer, 0), 1); } static Lisp_Object string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, struct buffer *buf, int posix) { - /* This function has been Mule-ized, except for the trt table handling. */ Bytecount val; Charcount s; struct re_pattern_buffer *bufp; - int count = begin_regex_reentrancy (); - if (running_asynch_code) - save_search_regs (); + /* Some FSF junk with running_asynch_code, to preserve the match + data. Not necessary because we don't call process filters + asynchronously (i.e. from within QUIT). */ CHECK_STRING (regexp); CHECK_STRING (string); @@ -429,7 +400,7 @@ s = 0; else { - Charcount len = XSTRING_CHAR_LENGTH (string); + Charcount len = string_char_length (string); CHECK_INT (start); s = XINT (start); @@ -443,25 +414,33 @@ bufp = compile_pattern (regexp, &search_regs, (!NILP (buf->case_fold_search) ? XCASE_TABLE_DOWNCASE (buf->case_table) : Qnil), - 0, ERROR_ME); + string, buf, 0, ERROR_ME); QUIT; { Bytecount bis = string_index_char_to_byte (string, s); - regex_match_object = string; - regex_emacs_buffer = buf; + struct syntax_cache scache_struct; + struct syntax_cache *scache = &scache_struct; + + /* By making the regex object, regex buffer, and syntax cache arguments + to re_{search,match}{,_2}, we've removed the need to do nasty things + to deal with regex reentrancy. (See stack trace in signal.c for proof + that this can happen.) + + #### there is still a potential problem with the regex cache -- + the compiled regex could be overwritten. we'd need 20-fold + reentrancy, though. Fix this. */ + val = re_search (bufp, (char *) XSTRING_DATA (string), XSTRING_LENGTH (string), bis, XSTRING_LENGTH (string) - bis, - &search_regs); + &search_regs, string, buf, scache); } if (val == -2) matcher_overflow (); - if (val < 0) return unbind_to (count); + if (val < 0) return Qnil; last_thing_searched = Qt; fixup_search_regs_for_string (string); - return - unbind_to_1 (count, - make_int (string_index_byte_to_char (string, val))); + return make_int (string_index_byte_to_char (string, val)); } DEFUN ("string-match", Fstring_match, 2, 4, 0, /* @@ -471,12 +450,26 @@ `match-end' and `match-beginning' also give indices of substrings matched by parenthesis constructs in the pattern. -Optional arg BUFFER controls how case folding is done (according to -the value of `case-fold-search' in that buffer and that buffer's case -tables) and defaults to the current buffer. +Optional arg BUFFER controls how case folding and syntax and category +lookup is done (according to the value of `case-fold-search' in that buffer +and that buffer's case tables, syntax tables, and category table). If nil +or unspecified, it defaults *NOT* to the current buffer but instead: + +-- the value of `case-fold-search' in the current buffer is still respected + because of idioms like + + (let ((case-fold-search nil)) + (string-match "^foo.*bar" string)) + + but the case, syntax, and category tables come from the standard tables, + which are accessed through functions `default-{case,syntax,category}-table' and serve as the parents of the + tables in particular buffer + */ (regexp, string, start, buffer)) { +/* &&#### implement new interp for buffer arg; check code to see if it + makes more sense than prev */ return string_match_1 (regexp, string, start, decode_buffer (buffer, 0), 0); } @@ -502,22 +495,22 @@ This does not clobber the match data. */ Bytecount -fast_string_match (Lisp_Object regexp, const Intbyte *nonreloc, +fast_string_match (Lisp_Object regexp, const Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length, int case_fold_search, Error_Behavior errb, int no_quit) { - /* This function has been Mule-ized, except for the trt table handling. */ Bytecount val; - Intbyte *newnonreloc = (Intbyte *) nonreloc; + Ibyte *newnonreloc = (Ibyte *) nonreloc; struct re_pattern_buffer *bufp; - int count; + struct syntax_cache scache_struct; + struct syntax_cache *scache = &scache_struct; bufp = compile_pattern (regexp, 0, (case_fold_search ? XCASE_TABLE_DOWNCASE (Vstandard_case_table) : Qnil), - 0, errb); + reloc, 0, 0, errb); if (!bufp) return -1; /* will only do this when errb != ERROR_ME */ if (!no_quit) @@ -532,15 +525,19 @@ if (!NILP (reloc)) newnonreloc = XSTRING_DATA (reloc); - count = begin_regex_reentrancy (); - /* #### evil current-buffer dependency */ - regex_match_object = reloc; - regex_emacs_buffer = current_buffer; + /* By making the regex object, regex buffer, and syntax cache arguments + to re_{search,match}{,_2}, we've removed the need to do nasty things + to deal with regex reentrancy. (See stack trace in signal.c for proof + that this can happen.) + + #### there is still a potential problem with the regex cache -- + the compiled regex could be overwritten. we'd need 20-fold + reentrancy, though. Fix this. */ + val = re_search (bufp, (char *) newnonreloc + offset, length, 0, - length, 0); + length, 0, reloc, 0, scache); no_quit_in_re_search = 0; - unbind_to (count); return val; } @@ -600,15 +597,13 @@ If ALLOW_QUIT is non-zero, call QUIT periodically. */ static Bytebpos -bi_scan_buffer (struct buffer *buf, Emchar target, Bytebpos st, Bytebpos en, - EMACS_INT count, EMACS_INT *shortage, int allow_quit) +byte_scan_buffer (struct buffer *buf, Ichar target, Bytebpos st, Bytebpos en, + EMACS_INT count, EMACS_INT *shortage, int allow_quit) { - /* This function has been Mule-ized. */ Bytebpos lim = en > 0 ? en : - ((count > 0) ? BI_BUF_ZV (buf) : BI_BUF_BEGV (buf)); + ((count > 0) ? BYTE_BUF_ZV (buf) : BYTE_BUF_BEGV (buf)); /* #### newline cache stuff in this function not yet ported */ - assert (count != 0); if (shortage) @@ -617,16 +612,26 @@ if (count > 0) { #ifdef MULE - /* Due to the Mule representation of characters in a buffer, - we can simply search for characters in the range 0 - 127 - directly. For other characters, we do it the "hard" way. - Note that this way works for all characters but the other - way is faster. */ - if (target >= 0200) + Internal_Format fmt = buf->text->format; + /* Check for char that's unrepresentable in the buffer -- it + certainly can't be there. */ + if (!ichar_fits_in_format (target, fmt, wrap_buffer (buf))) + { + *shortage = count; + return lim; + } + /* Due to the Mule representation of characters in a buffer, we can + simply search for characters in the range 0 - 127 directly; for + 8-bit-fixed, we can do this for all characters. In other cases, + we do it the "hard" way. Note that this way works for all + characters and all formats, but the other way is faster. */ + else if (! (fmt == FORMAT_8_BIT_FIXED || + (fmt == FORMAT_DEFAULT && ichar_ascii_p (target)))) { + Raw_Ichar raw = ichar_to_raw (target, fmt, wrap_buffer (buf)); while (st < lim && count > 0) { - if (BI_BUF_FETCH_CHAR (buf, st) == target) + if (BYTE_BUF_FETCH_CHAR_RAW (buf, st) == raw) count--; INC_BYTEBPOS (buf, st); } @@ -634,19 +639,20 @@ else #endif { + Raw_Ichar raw = ichar_to_raw (target, fmt, wrap_buffer (buf)); while (st < lim && count > 0) { Bytebpos ceil; - Intbyte *bufptr; + Ibyte *bufptr; - ceil = BI_BUF_CEILING_OF (buf, st); + ceil = BYTE_BUF_CEILING_OF (buf, st); ceil = min (lim, ceil); - bufptr = (Intbyte *) memchr (BI_BUF_BYTE_ADDRESS (buf, st), - (int) target, ceil - st); + bufptr = (Ibyte *) memchr (BYTE_BUF_BYTE_ADDRESS (buf, st), + raw, ceil - st); if (bufptr) { count--; - st = BI_BUF_PTR_BYTE_POS (buf, bufptr) + 1; + st = BYTE_BUF_PTR_BYTE_POS (buf, bufptr) + 1; } else st = ceil; @@ -662,36 +668,47 @@ else { #ifdef MULE - if (target >= 0200) + Internal_Format fmt = buf->text->format; + /* Check for char that's unrepresentable in the buffer -- it + certainly can't be there. */ + if (!ichar_fits_in_format (target, fmt, wrap_buffer (buf))) + { + *shortage = -count; + return lim; + } + else if (! (fmt == FORMAT_8_BIT_FIXED || + (fmt == FORMAT_DEFAULT && ichar_ascii_p (target)))) { + Raw_Ichar raw = ichar_to_raw (target, fmt, wrap_buffer (buf)); while (st > lim && count < 0) { DEC_BYTEBPOS (buf, st); - if (BI_BUF_FETCH_CHAR (buf, st) == target) + if (BYTE_BUF_FETCH_CHAR_RAW (buf, st) == raw) count++; } } else #endif { + Raw_Ichar raw = ichar_to_raw (target, fmt, wrap_buffer (buf)); while (st > lim && count < 0) { Bytebpos floor; - Intbyte *bufptr; - Intbyte *floorptr; + Ibyte *bufptr; + Ibyte *floorptr; - floor = BI_BUF_FLOOR_OF (buf, st); + floor = BYTE_BUF_FLOOR_OF (buf, st); floor = max (lim, floor); /* No memrchr() ... */ - bufptr = BI_BUF_BYTE_ADDRESS_BEFORE (buf, st); - floorptr = BI_BUF_BYTE_ADDRESS (buf, floor); + bufptr = BYTE_BUF_BYTE_ADDRESS_BEFORE (buf, st); + floorptr = BYTE_BUF_BYTE_ADDRESS (buf, floor); while (bufptr >= floorptr) { st--; /* At this point, both ST and BUFPTR refer to the same character. When the loop terminates, ST will always point to the last character we tried. */ - if (* (unsigned char *) bufptr == (unsigned char) target) + if (*bufptr == (Ibyte) raw) { count++; break; @@ -719,26 +736,26 @@ } Charbpos -scan_buffer (struct buffer *buf, Emchar target, Charbpos start, Charbpos end, +scan_buffer (struct buffer *buf, Ichar target, Charbpos start, Charbpos end, EMACS_INT count, EMACS_INT *shortage, int allow_quit) { - Bytebpos bi_retval; - Bytebpos bi_start, bi_end; + Bytebpos byte_retval; + Bytebpos byte_start, byte_end; - bi_start = charbpos_to_bytebpos (buf, start); + byte_start = charbpos_to_bytebpos (buf, start); if (end) - bi_end = charbpos_to_bytebpos (buf, end); + byte_end = charbpos_to_bytebpos (buf, end); else - bi_end = 0; - bi_retval = bi_scan_buffer (buf, target, bi_start, bi_end, count, + byte_end = 0; + byte_retval = byte_scan_buffer (buf, target, byte_start, byte_end, count, shortage, allow_quit); - return bytebpos_to_charbpos (buf, bi_retval); + return bytebpos_to_charbpos (buf, byte_retval); } Bytebpos -bi_find_next_newline_no_quit (struct buffer *buf, Bytebpos from, int count) +byte_find_next_newline_no_quit (struct buffer *buf, Bytebpos from, int count) { - return bi_scan_buffer (buf, '\n', from, 0, count, 0, 0); + return byte_scan_buffer (buf, '\n', from, 0, count, 0, 0); } Charbpos @@ -753,13 +770,12 @@ return scan_buffer (buf, '\n', from, 0, count, 0, 1); } -Bytebpos -bi_find_next_emchar_in_string (Lisp_Object str, Emchar target, Bytebpos st, +Bytecount +byte_find_next_ichar_in_string (Lisp_Object str, Ichar target, Bytecount st, EMACS_INT count) { - /* This function has been Mule-ized. */ Bytebpos lim = XSTRING_LENGTH (str) -1; - Intbyte *s = XSTRING_DATA (str); + Ibyte *s = XSTRING_DATA (str); assert (count >= 0); @@ -773,9 +789,9 @@ { while (st < lim && count > 0) { - if (XSTRING_CHAR (str, st) == target) + if (string_ichar (str, st) == target) count--; - INC_CHARBYTEBPOS (s, st); + INC_BYTECOUNT (s, st); } } else @@ -783,12 +799,12 @@ { while (st < lim && count > 0) { - Intbyte *bufptr = (Intbyte *) memchr (charptr_n_addr (s, st), + Ibyte *bufptr = (Ibyte *) memchr (itext_n_addr (s, st), (int) target, lim - st); if (bufptr) { count--; - st = (Bytebpos)(bufptr - s) + 1; + st = (Bytebpos) (bufptr - s) + 1; } else st = lim; @@ -801,7 +817,8 @@ not after, and only search up to TO. This isn't just find_next_newline (...)-1, because you might hit TO. */ Charbpos -find_before_next_newline (struct buffer *buf, Charbpos from, Charbpos to, int count) +find_before_next_newline (struct buffer *buf, Charbpos from, Charbpos to, + int count) { EMACS_INT shortage; Charbpos pos = scan_buffer (buf, '\n', from, to, count, &shortage, 1); @@ -812,23 +829,21 @@ return pos; } +/* This function synched with FSF 21.1 */ static Lisp_Object skip_chars (struct buffer *buf, int forwardp, int syntaxp, Lisp_Object string, Lisp_Object lim) { - /* This function has been Mule-ized. */ - REGISTER Intbyte *p, *pend; - REGISTER Emchar c; + REGISTER Ibyte *p, *pend; + REGISTER Ichar c; /* We store the first 256 chars in an array here and the rest in a range table. */ unsigned char fastmap[0400]; int negate = 0; REGISTER int i; -#ifndef emacs - Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); -#endif Charbpos limit; - + struct syntax_cache *scache; + if (NILP (lim)) limit = forwardp ? BUF_ZV (buf) : BUF_BEGV (buf); else @@ -860,31 +875,31 @@ while (p != pend) { - c = charptr_emchar (p); - INC_CHARPTR (p); + c = itext_ichar (p); + INC_IBYTEPTR (p); if (syntaxp) { if (c < 0400 && syntax_spec_code[c] < (unsigned char) Smax) fastmap[c] = 1; else - invalid_argument ("Invalid syntax designator", - make_char (c)); + invalid_argument ("Invalid syntax designator", make_char (c)); } else { if (c == '\\') { if (p == pend) break; - c = charptr_emchar (p); - INC_CHARPTR (p); + c = itext_ichar (p); + INC_IBYTEPTR (p); } if (p != pend && *p == '-') { - Emchar cend; + Ichar cend; + /* Skip over the dash. */ p++; if (p == pend) break; - cend = charptr_emchar (p); + cend = itext_ichar (p); while (c <= cend && c < 0400) { fastmap[c] = 1; @@ -893,7 +908,7 @@ if (c <= cend) Fput_range_table (make_int (c), make_int (cend), Qt, Vskip_chars_range_table); - INC_CHARPTR (p); + INC_IBYTEPTR (p); } else { @@ -906,6 +921,7 @@ } } + /* #### Not in FSF 21.1 */ if (syntaxp && fastmap['-'] != 0) fastmap[' '] = 1; @@ -919,36 +935,46 @@ { Charbpos start_point = BUF_PT (buf); + Charbpos pos = start_point; + Charbpos pos_byte = BYTE_BUF_PT (buf); if (syntaxp) { - SETUP_SYNTAX_CACHE_FOR_BUFFER (buf, BUF_PT (buf), forwardp ? 1 : -1); + scache = setup_buffer_syntax_cache (buf, pos, forwardp ? 1 : -1); /* All syntax designators are normal chars so nothing strange to worry about */ if (forwardp) { - while (BUF_PT (buf) < limit - && fastmap[(unsigned char) - syntax_code_spec - [(int) SYNTAX_FROM_CACHE (syntax_table, - BUF_FETCH_CHAR - (buf, BUF_PT (buf)))]]) - { - BUF_SET_PT (buf, BUF_PT (buf) + 1); - UPDATE_SYNTAX_CACHE_FORWARD (BUF_PT (buf)); - } + if (pos < limit) + while (fastmap[(unsigned char) + syntax_code_spec + [(int) SYNTAX_FROM_CACHE + (scache, BYTE_BUF_FETCH_CHAR (buf, pos_byte))]]) + { + pos++; + INC_BYTEBPOS (buf, pos_byte); + if (pos >= limit) + break; + UPDATE_SYNTAX_CACHE_FORWARD (scache, pos); + } } else { - while (BUF_PT (buf) > limit - && fastmap[(unsigned char) - syntax_code_spec - [(int) SYNTAX_FROM_CACHE (syntax_table, - BUF_FETCH_CHAR - (buf, BUF_PT (buf) - 1))]]) + while (pos > limit) { - BUF_SET_PT (buf, BUF_PT (buf) - 1); - UPDATE_SYNTAX_CACHE_BACKWARD (BUF_PT (buf) - 1); + Charbpos savepos = pos_byte; + pos--; + DEC_BYTEBPOS (buf, pos_byte); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, pos); + if (!fastmap[(unsigned char) + syntax_code_spec + [(int) SYNTAX_FROM_CACHE + (scache, BYTE_BUF_FETCH_CHAR (buf, pos_byte))]]) + { + pos++; + pos_byte = savepos; + break; + } } } } @@ -956,36 +982,47 @@ { if (forwardp) { - while (BUF_PT (buf) < limit) + while (pos < limit) { - Emchar ch = BUF_FETCH_CHAR (buf, BUF_PT (buf)); + Ichar ch = BYTE_BUF_FETCH_CHAR (buf, pos_byte); if ((ch < 0400) ? fastmap[ch] : (NILP (Fget_range_table (make_int (ch), Vskip_chars_range_table, Qnil)) == negate)) - BUF_SET_PT (buf, BUF_PT (buf) + 1); + { + pos++; + INC_BYTEBPOS (buf, pos_byte); + } else break; } } else { - while (BUF_PT (buf) > limit) + while (pos > limit) { - Emchar ch = BUF_FETCH_CHAR (buf, BUF_PT (buf) - 1); + Charbpos prev_pos_byte = pos_byte; + Ichar ch; + + DEC_BYTEBPOS (buf, prev_pos_byte); + ch = BYTE_BUF_FETCH_CHAR (buf, prev_pos_byte); if ((ch < 0400) ? fastmap[ch] : (NILP (Fget_range_table (make_int (ch), Vskip_chars_range_table, Qnil)) == negate)) - BUF_SET_PT (buf, BUF_PT (buf) - 1); + { + pos--; + pos_byte = prev_pos_byte; + } else break; } } } QUIT; + BOTH_BUF_SET_PT (buf, pos, pos_byte); return make_int (BUF_PT (buf) - start_point); } } @@ -1054,7 +1091,6 @@ Lisp_Object count, Lisp_Object buffer, int direction, int RE, int posix) { - /* This function has been Mule-ized, except for the trt table handling. */ REGISTER Charbpos np; Charbpos lim; EMACS_INT n = direction; @@ -1121,9 +1157,8 @@ static int trivial_regexp_p (Lisp_Object regexp) { - /* This function has been Mule-ized. */ Bytecount len = XSTRING_LENGTH (regexp); - Intbyte *s = XSTRING_DATA (regexp); + Ibyte *s = XSTRING_DATA (regexp); while (--len >= 0) { switch (*s++) @@ -1172,17 +1207,16 @@ Charbpos buflim, EMACS_INT n, int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix) { - /* This function has been Mule-ized, except for the trt table handling. */ Bytecount len = XSTRING_LENGTH (string); - Intbyte *base_pat = XSTRING_DATA (string); + Ibyte *base_pat = XSTRING_DATA (string); REGISTER EMACS_INT i, j; Bytebpos p1, p2; Bytecount s1, s2; Bytebpos pos, lim; - int count; - if (running_asynch_code) - save_search_regs (); + /* Some FSF junk with running_asynch_code, to preserve the match + data. Not necessary because we don't call process filters + asynchronously (i.e. from within QUIT). */ /* Null string is found at starting position. */ if (len == 0) @@ -1200,30 +1234,41 @@ if (RE && !trivial_regexp_p (string)) { struct re_pattern_buffer *bufp; - count = begin_regex_reentrancy (); - bufp = compile_pattern (string, &search_regs, trt, posix, - ERROR_ME); + bufp = compile_pattern (string, &search_regs, trt, + wrap_buffer (buf), buf, posix, ERROR_ME); /* Get pointers and sizes of the two strings that make up the visible portion of the buffer. */ - p1 = BI_BUF_BEGV (buf); - p2 = BI_BUF_CEILING_OF (buf, p1); + p1 = BYTE_BUF_BEGV (buf); + p2 = BYTE_BUF_CEILING_OF (buf, p1); s1 = p2 - p1; - s2 = BI_BUF_ZV (buf) - p2; - regex_match_object = Qnil; + s2 = BYTE_BUF_ZV (buf) - p2; - while (n < 0) + while (n != 0) { Bytecount val; + struct syntax_cache scache_struct; + struct syntax_cache *scache = &scache_struct; + QUIT; - regex_emacs_buffer = buf; + /* By making the regex object, regex buffer, and syntax cache + arguments to re_{search,match}{,_2}, we've removed the need to + do nasty things to deal with regex reentrancy. (See stack + trace in signal.c for proof that this can happen.) + + #### there is still a potential problem with the regex cache -- + the compiled regex could be overwritten. we'd need 20-fold + reentrancy, though. Fix this. */ + val = re_search_2 (bufp, - (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, - (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, - pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, - pos - BI_BUF_BEGV (buf)); + (char *) BYTE_BUF_BYTE_ADDRESS (buf, p1), s1, + (char *) BYTE_BUF_BYTE_ADDRESS (buf, p2), s2, + pos - BYTE_BUF_BEGV (buf), lim - pos, &search_regs, + n > 0 ? lim - BYTE_BUF_BEGV (buf) : + pos - BYTE_BUF_BEGV (buf), wrap_buffer (buf), + buf, scache); if (val == -2) { @@ -1232,45 +1277,7 @@ if (val >= 0) { int num_regs = search_regs.num_regs; - j = BI_BUF_BEGV (buf); - for (i = 0; i < num_regs; i++) - if (search_regs.start[i] >= 0) - { - search_regs.start[i] += j; - search_regs.end[i] += j; - } - last_thing_searched = wrap_buffer (buf); - /* Set pos to the new position. */ - pos = search_regs.start[0]; - fixup_search_regs_for_buffer (buf); - /* And charbpos too. */ - charbpos = search_regs.start[0]; - } - else - { - unbind_to (count); - return n; - } - n++; - } - while (n > 0) - { - Bytecount val; - QUIT; - regex_emacs_buffer = buf; - val = re_search_2 (bufp, - (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, - (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, - pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, - lim - BI_BUF_BEGV (buf)); - if (val == -2) - { - matcher_overflow (); - } - if (val >= 0) - { - int num_regs = search_regs.num_regs; - j = BI_BUF_BEGV (buf); + j = BYTE_BUF_BEGV (buf); for (i = 0; i < num_regs; i++) if (search_regs.start[i] >= 0) { @@ -1279,33 +1286,30 @@ } last_thing_searched = wrap_buffer (buf); /* Set pos to the new position. */ - pos = search_regs.end[0]; + pos = n > 0 ? search_regs.end[0] : search_regs.start[0]; fixup_search_regs_for_buffer (buf); /* And charbpos too. */ - charbpos = search_regs.end[0]; + charbpos = n > 0 ? search_regs.end[0] : search_regs.start[0]; } else - { - unbind_to (count); - return 0 - n; - } - n--; + return (n > 0 ? 0 - n : n); + if (n > 0) n--; else n++; } - unbind_to (count); return charbpos; } else /* non-RE case */ { int charset_base = -1; int boyer_moore_ok = 1; - Intbyte *pat = 0; - Intbyte *patbuf = alloca_array (Intbyte, len * MAX_EMCHAR_LEN); + Ibyte *pat = 0; + Ibyte *patbuf = alloca_array (Ibyte, len * MAX_ICHAR_LEN); pat = patbuf; #ifdef MULE + /* &&#### needs some 8-bit work here */ while (len > 0) { - Intbyte tmp_str[MAX_EMCHAR_LEN]; - Emchar c, translated, inverse; + Ibyte tmp_str[MAX_ICHAR_LEN]; + Ichar c, translated, inverse; Bytecount orig_bytelen, new_bytelen, inv_bytelen; /* If we got here and the RE flag is set, it's because @@ -1316,14 +1320,13 @@ len--; base_pat++; } - c = charptr_emchar (base_pat); + c = itext_ichar (base_pat); translated = TRANSLATE (trt, c); inverse = TRANSLATE (inverse_trt, c); - orig_bytelen = charcount_to_bytecount (base_pat, 1); - inv_bytelen = set_charptr_emchar (tmp_str, inverse); - new_bytelen = set_charptr_emchar (tmp_str, translated); - + orig_bytelen = itext_ichar_len (base_pat); + inv_bytelen = set_itext_ichar (tmp_str, inverse); + new_bytelen = set_itext_ichar (tmp_str, translated); if (new_bytelen != orig_bytelen || inv_bytelen != orig_bytelen) boyer_moore_ok = 0; @@ -1331,7 +1334,7 @@ { /* Keep track of which character set row contains the characters that need translation. */ - int charset_base_code = c & ~CHAR_FIELD3_MASK; + int charset_base_code = c & ~ICHAR_FIELD3_MASK; if (charset_base == -1) charset_base = charset_base_code; else if (charset_base != charset_base_code) @@ -1368,10 +1371,9 @@ } } -/* Do a simple string search N times for the string PAT, - whose length is LEN/LEN_BYTE, - from buffer position POS/POS_BYTE until LIM/LIM_BYTE. - TRT is the translation table. +/* Do a simple string search N times for the string PAT, whose length is + LEN/LEN_BYTE, from buffer position POS until LIM. TRT is the + translation table. Return the character position where the match is found. Otherwise, if M matches remained to be found, return -M. @@ -1381,48 +1383,48 @@ boyer_moore cannot work. */ static Charbpos -simple_search (struct buffer *buf, Intbyte *base_pat, Bytecount len_byte, - Bytebpos idx, Bytebpos lim, EMACS_INT n, Lisp_Object trt) +simple_search (struct buffer *buf, Ibyte *base_pat, Bytecount len, + Bytebpos pos, Bytebpos lim, EMACS_INT n, Lisp_Object trt) { int forward = n > 0; Bytecount buf_len = 0; /* Shut up compiler. */ - if (lim > idx) + if (lim > pos) while (n > 0) { while (1) { - Bytecount this_len = len_byte; - Bytebpos this_idx = idx; - Intbyte *p = base_pat; - if (idx >= lim) + Bytecount this_len = len; + Bytebpos this_pos = pos; + Ibyte *p = base_pat; + if (pos >= lim) goto stop; while (this_len > 0) { - Emchar pat_ch, buf_ch; + Ichar pat_ch, buf_ch; Bytecount pat_len; - pat_ch = charptr_emchar (p); - buf_ch = BI_BUF_FETCH_CHAR (buf, this_idx); + pat_ch = itext_ichar (p); + buf_ch = BYTE_BUF_FETCH_CHAR (buf, this_pos); buf_ch = TRANSLATE (trt, buf_ch); if (buf_ch != pat_ch) break; - pat_len = charcount_to_bytecount (p, 1); + pat_len = itext_ichar_len (p); p += pat_len; this_len -= pat_len; - INC_BYTEBPOS (buf, this_idx); + INC_BYTEBPOS (buf, this_pos); } if (this_len == 0) { - buf_len = this_idx - idx; - idx = this_idx; + buf_len = this_pos - pos; + pos = this_pos; break; } - INC_BYTEBPOS (buf, idx); + INC_BYTEBPOS (buf, pos); } n--; } @@ -1431,36 +1433,36 @@ { while (1) { - Bytecount this_len = len_byte; - Bytebpos this_idx = idx; - Intbyte *p; - if (idx <= lim) + Bytecount this_len = len; + Bytebpos this_pos = pos; + Ibyte *p; + if (pos <= lim) goto stop; - p = base_pat + len_byte; + p = base_pat + len; while (this_len > 0) { - Emchar pat_ch, buf_ch; + Ichar pat_ch, buf_ch; - DEC_CHARPTR (p); - DEC_BYTEBPOS (buf, this_idx); - pat_ch = charptr_emchar (p); - buf_ch = BI_BUF_FETCH_CHAR (buf, this_idx); + DEC_IBYTEPTR (p); + DEC_BYTEBPOS (buf, this_pos); + pat_ch = itext_ichar (p); + buf_ch = BYTE_BUF_FETCH_CHAR (buf, this_pos); buf_ch = TRANSLATE (trt, buf_ch); if (buf_ch != pat_ch) break; - this_len -= charcount_to_bytecount (p, 1); + this_len -= itext_ichar_len (p); } if (this_len == 0) { - buf_len = idx - this_idx; - idx = this_idx; + buf_len = pos - this_pos; + pos = this_pos; break; } - DEC_BYTEBPOS (buf, idx); + DEC_BYTEBPOS (buf, pos); } n++; } @@ -1470,13 +1472,13 @@ Charbpos beg, end, retval; if (forward) { - beg = bytebpos_to_charbpos (buf, idx - buf_len); - retval = end = bytebpos_to_charbpos (buf, idx); + beg = bytebpos_to_charbpos (buf, pos - buf_len); + retval = end = bytebpos_to_charbpos (buf, pos); } else { - retval = beg = bytebpos_to_charbpos (buf, idx); - end = bytebpos_to_charbpos (buf, idx + buf_len); + retval = beg = bytebpos_to_charbpos (buf, pos); + end = bytebpos_to_charbpos (buf, pos + buf_len); } set_search_regs (buf, beg, end - beg); @@ -1502,10 +1504,11 @@ If that criterion is not satisfied, do not call this function. */ static Charbpos -boyer_moore (struct buffer *buf, Intbyte *base_pat, Bytecount len, +boyer_moore (struct buffer *buf, Ibyte *base_pat, Bytecount len, Bytebpos pos, Bytebpos lim, EMACS_INT n, Lisp_Object trt, Lisp_Object inverse_trt, int charset_base) { + /* &&#### needs some 8-bit work here */ /* #### Someone really really really needs to comment the workings of this junk somewhat better. @@ -1542,13 +1545,13 @@ Bytebpos limit; Bytecount stride_for_teases = 0; REGISTER EMACS_INT i, j; - Intbyte *pat, *pat_end; - REGISTER Intbyte *cursor, *p_limit, *ptr2; - Intbyte simple_translate[0400]; + Ibyte *pat, *pat_end; + REGISTER Ibyte *cursor, *p_limit, *ptr2; + Ibyte simple_translate[0400]; REGISTER int direction = ((n > 0) ? 1 : -1); #ifdef MULE - Intbyte translate_prev_byte = 0; - Intbyte translate_anteprev_byte = 0; + Ibyte translate_prev_byte = 0; + Ibyte translate_anteprev_byte = 0; #endif #ifdef C_ALLOCA EMACS_INT BM_tab_space[0400]; @@ -1609,34 +1612,34 @@ in the pattern. Others don't matter anyway! */ xzero (simple_translate); for (i = 0; i < 0400; i++) - simple_translate[i] = (Intbyte) i; + simple_translate[i] = (Ibyte) i; i = 0; while (i != infinity) { - Intbyte *ptr = base_pat + i; + Ibyte *ptr = base_pat + i; i += direction; if (i == dirlen) i = infinity; if (!NILP (trt)) { #ifdef MULE - Emchar ch, untranslated; + Ichar ch, untranslated; int this_translated = 1; /* Is *PTR the last byte of a character? */ - if (pat_end - ptr == 1 || INTBYTE_FIRST_BYTE_P (ptr[1])) + if (pat_end - ptr == 1 || ibyte_first_byte_p (ptr[1])) { - Intbyte *charstart = ptr; - while (!INTBYTE_FIRST_BYTE_P (*charstart)) + Ibyte *charstart = ptr; + while (!ibyte_first_byte_p (*charstart)) charstart--; - untranslated = charptr_emchar (charstart); - if (charset_base == (untranslated & ~CHAR_FIELD3_MASK)) + untranslated = itext_ichar (charstart); + if (charset_base == (untranslated & ~ICHAR_FIELD3_MASK)) { ch = TRANSLATE (trt, untranslated); - if (!INTBYTE_FIRST_BYTE_P (*ptr)) + if (!ibyte_first_byte_p (*ptr)) { translate_prev_byte = ptr[-1]; - if (!INTBYTE_FIRST_BYTE_P (translate_prev_byte)) + if (!ibyte_first_byte_p (translate_prev_byte)) translate_anteprev_byte = ptr[-2]; } } @@ -1660,10 +1663,10 @@ stride_for_teases = BM_tab[j]; BM_tab[j] = dirlen - i; /* A translation table is accompanied by its inverse -- - see comment following downcase_table for details */ + see comment in casetab.c. */ if (this_translated) { - Emchar starting_ch = ch; + Ichar starting_ch = ch; EMACS_INT starting_j = j; while (1) { @@ -1676,7 +1679,7 @@ /* For all the characters that map into CH, set up simple_translate to map the last byte into STARTING_J. */ - simple_translate[j] = (Intbyte) starting_j; + simple_translate[j] = (Ibyte) starting_j; if (ch == starting_ch) break; BM_tab[j] = dirlen - i; @@ -1690,11 +1693,10 @@ stride_for_teases = BM_tab[j]; BM_tab[j] = dirlen - i; /* A translation table is accompanied by its inverse -- - see comment following downcase_table for details */ - + see comment in casetab.c. */ while ((j = TRANSLATE (inverse_trt, j)) != k) { - simple_translate[j] = (Intbyte) k; + simple_translate[j] = (Ibyte) k; BM_tab[j] = dirlen - i; } #endif @@ -1720,7 +1722,7 @@ while (n != 0) { Bytebpos tail_end; - Intbyte *tail_end_ptr; + Ibyte *tail_end_ptr; /* It's been reported that some (broken) compiler thinks that Boolean expressions in an arithmetic context are unsigned. Using an explicit ?1:0 prevents this. */ @@ -1734,20 +1736,22 @@ /* XEmacs change: definitions of CEILING_OF and FLOOR_OF have changed. See buffer.h. */ limit = ((direction > 0) - ? BI_BUF_CEILING_OF (buf, limit) - 1 - : BI_BUF_FLOOR_OF (buf, limit + 1)); + ? BYTE_BUF_CEILING_OF (buf, limit) - 1 + : BYTE_BUF_FLOOR_OF (buf, limit + 1)); /* LIMIT is now the last (not beyond-last!) value POS can take on without hitting edge of buffer or the gap. */ limit = ((direction > 0) ? min (lim - 1, min (limit, pos + 20000)) : max (lim, max (limit, pos - 20000))); - tail_end = BI_BUF_CEILING_OF (buf, pos); - tail_end_ptr = BI_BUF_BYTE_ADDRESS (buf, tail_end); + tail_end = BYTE_BUF_CEILING_OF (buf, pos); + tail_end_ptr = BYTE_BUF_BYTE_ADDRESS (buf, tail_end); if ((limit - pos) * direction > 20) { - p_limit = BI_BUF_BYTE_ADDRESS (buf, limit); - ptr2 = (cursor = BI_BUF_BYTE_ADDRESS (buf, pos)); + /* We have to be careful because the code can generate addresses + that don't point to the beginning of characters. */ + p_limit = BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, limit); + ptr2 = (cursor = BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, pos)); /* In this loop, pos + cursor - ptr2 is the surrogate for pos */ while (1) /* use one cursor setting as long as i can */ @@ -1801,14 +1805,14 @@ while ((i -= direction) + direction != 0) { #ifdef MULE - Emchar ch; + Ichar ch; cursor -= direction; /* Translate only the last byte of a character. */ if ((cursor == tail_end_ptr - || INTBYTE_FIRST_BYTE_P (cursor[1])) - && (INTBYTE_FIRST_BYTE_P (cursor[0]) + || ibyte_first_byte_p (cursor[1])) + && (ibyte_first_byte_p (cursor[0]) || (translate_prev_byte == cursor[-1] - && (INTBYTE_FIRST_BYTE_P (translate_prev_byte) + && (ibyte_first_byte_p (translate_prev_byte) || translate_anteprev_byte == cursor[-2])))) ch = simple_translate[*cursor]; else @@ -1860,8 +1864,8 @@ /* XEmacs change: definitions of CEILING_OF and FLOOR_OF have changed. See buffer.h. */ limit = ((direction > 0) - ? BI_BUF_CEILING_OF (buf, pos - dirlen + 1) - 1 - : BI_BUF_FLOOR_OF (buf, pos - dirlen)); + ? BYTE_BUF_CEILING_OF (buf, pos - dirlen + 1) - 1 + : BYTE_BUF_FLOOR_OF (buf, pos - dirlen)); limit = ((direction > 0) ? min (limit + len, lim - 1) : max (limit - len, lim)); @@ -1874,9 +1878,9 @@ (the reach is at most len + 21, and typically does not exceed len) */ while ((limit - pos) * direction >= 0) - /* *not* BI_BUF_FETCH_CHAR. We are working here + /* *not* BYTE_BUF_FETCH_CHAR. We are working here with bytes, not characters. */ - pos += BM_tab[*BI_BUF_BYTE_ADDRESS (buf, pos)]; + pos += BM_tab[*BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, pos)]; /* now run the same tests to distinguish going off the end, a match or a phony match. */ if ((pos - limit) * direction <= len) @@ -1888,17 +1892,17 @@ while ((i -= direction) + direction != 0) { #ifdef MULE - Emchar ch; - Intbyte *ptr; + Ichar ch; + Ibyte *ptr; #endif pos -= direction; #ifdef MULE - ptr = BI_BUF_BYTE_ADDRESS (buf, pos); + ptr = BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, pos); if ((ptr == tail_end_ptr - || INTBYTE_FIRST_BYTE_P (ptr[1])) - && (INTBYTE_FIRST_BYTE_P (ptr[0]) + || ibyte_first_byte_p (ptr[1])) + && (ibyte_first_byte_p (ptr[0]) || (translate_prev_byte == ptr[-1] - && (INTBYTE_FIRST_BYTE_P (translate_prev_byte) + && (ibyte_first_byte_p (translate_prev_byte) || translate_anteprev_byte == ptr[-2])))) ch = simple_translate[*ptr]; else @@ -1907,8 +1911,9 @@ break; #else - if (pat[i] != TRANSLATE (trt, - *BI_BUF_BYTE_ADDRESS (buf, pos))) + if (pat[i] != + TRANSLATE (trt, + *BYTE_BUF_BYTE_ADDRESS_NO_VERIFY (buf, pos))) break; #endif } @@ -1954,7 +1959,6 @@ static void set_search_regs (struct buffer *buf, Charbpos beg, Charcount len) { - /* This function has been Mule-ized. */ /* Make sure we have registers in which to store the match position. */ if (search_regs.num_regs == 0) @@ -1980,43 +1984,43 @@ Charcount i, len; EMACS_INT punct_count = 0, word_count = 0; struct buffer *buf = decode_buffer (buffer, 0); - Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); + Lisp_Object syntax_table = buf->mirror_syntax_table; CHECK_STRING (string); - len = XSTRING_CHAR_LENGTH (string); + len = string_char_length (string); for (i = 0; i < len; i++) - if (!WORD_SYNTAX_P (syntax_table, XSTRING_CHAR (string, i))) + if (!WORD_SYNTAX_P (syntax_table, string_ichar (string, i))) { punct_count++; if (i > 0 && WORD_SYNTAX_P (syntax_table, - XSTRING_CHAR (string, i - 1))) + string_ichar (string, i - 1))) word_count++; } - if (WORD_SYNTAX_P (syntax_table, XSTRING_CHAR (string, len - 1))) + if (WORD_SYNTAX_P (syntax_table, string_ichar (string, len - 1))) word_count++; if (!word_count) return build_string (""); { /* The following value is an upper bound on the amount of storage we need. In non-Mule, it is exact. */ - Intbyte *storage = - (Intbyte *) alloca (XSTRING_LENGTH (string) - punct_count + + Ibyte *storage = + (Ibyte *) ALLOCA (XSTRING_LENGTH (string) - punct_count + 5 * (word_count - 1) + 4); - Intbyte *o = storage; + Ibyte *o = storage; *o++ = '\\'; *o++ = 'b'; for (i = 0; i < len; i++) { - Emchar ch = XSTRING_CHAR (string, i); + Ichar ch = string_ichar (string, i); if (WORD_SYNTAX_P (syntax_table, ch)) - o += set_charptr_emchar (o, ch); + o += set_itext_ichar (o, ch); else if (i > 0 && WORD_SYNTAX_P (syntax_table, - XSTRING_CHAR (string, i - 1)) + string_ichar (string, i - 1)) && --word_count) { *o++ = '\\'; @@ -2253,7 +2257,7 @@ Dynarr_free (get_opaque_ptr (XCDR (cons))); free_opaque_ptr (XCAR (cons)); free_opaque_ptr (XCDR (cons)); - free_cons (XCONS (cons)); + free_cons (cons); return Qnil; } @@ -2299,7 +2303,6 @@ */ (replacement, fixedcase, literal, string, strbuffer)) { - /* This function has been Mule-ized. */ /* This function can GC */ enum { nochange, all_caps, cap_initial } case_action; Charbpos pos, last; @@ -2307,10 +2310,10 @@ int some_lowercase; int some_uppercase; int some_nonuppercase_initial; - Emchar c, prevc; + Ichar c, prevc; Charcount inslen; struct buffer *buf; - Lisp_Char_Table *syntax_table; + Lisp_Object syntax_table; int mc_count; Lisp_Object buffer; int_dynarr *ul_action_dynarr = 0; @@ -2349,13 +2352,14 @@ buf = XBUFFER (buffer); } - syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); + syntax_table = buf->mirror_syntax_table; case_action = nochange; /* We tried an initialization */ /* but some C compilers blew it */ if (search_regs.num_regs == 0) - signal_error (Qinvalid_operation, "replace-match called before any match found", Qunbound); + signal_error (Qinvalid_operation, + "replace-match called before any match found", Qunbound); if (NILP (string)) { @@ -2369,7 +2373,7 @@ { if (search_regs.start[0] < 0 || search_regs.start[0] > search_regs.end[0] - || search_regs.end[0] > XSTRING_CHAR_LENGTH (string)) + || search_regs.end[0] > string_char_length (string)) args_out_of_range (make_int (search_regs.start[0]), make_int (search_regs.end[0])); } @@ -2394,7 +2398,7 @@ if (NILP (string)) c = BUF_FETCH_CHAR (buf, pos); else - c = XSTRING_CHAR (string, pos); + c = string_ichar (string, pos); if (LOWERCASEP (buf, c)) { @@ -2452,7 +2456,7 @@ /* Do case substitution into REPLACEMENT if desired. */ if (NILP (literal)) { - Charcount stlen = XSTRING_CHAR_LENGTH (replacement); + Charcount stlen = string_char_length (replacement); Charcount strpos; /* XEmacs change: rewrote this loop somewhat to make it cleaner. Also added \U, \E, etc. */ @@ -2479,10 +2483,10 @@ Charcount substart = -1; Charcount subend = -1; - c = XSTRING_CHAR (replacement, strpos); + c = string_ichar (replacement, strpos); if (c == '\\' && strpos < stlen - 1) { - c = XSTRING_CHAR (replacement, ++strpos); + c = string_ichar (replacement, ++strpos); if (c == '&') { literal_end = strpos - 1; @@ -2518,7 +2522,7 @@ literal_end = strpos - 1; Dynarr_add (ul_pos_dynarr, (!NILP (accum) - ? XSTRING_CHAR_LENGTH (accum) + ? string_char_length (accum) : 0) + (literal_end - literal_start)); Dynarr_add (ul_action_dynarr, c); } @@ -2567,13 +2571,13 @@ { int i = 0; int cur_action = 'E'; - Charcount stlen = XSTRING_CHAR_LENGTH (replacement); + Charcount stlen = string_char_length (replacement); Charcount strpos; for (strpos = 0; strpos < stlen; strpos++) { - Emchar curchar = XSTRING_CHAR (replacement, strpos); - Emchar newchar = -1; + Ichar curchar = string_ichar (replacement, strpos); + Ichar newchar = -1; if (i < Dynarr_length (ul_pos_dynarr) && strpos == Dynarr_at (ul_pos_dynarr, i)) { @@ -2621,7 +2625,7 @@ Finsert (1, &replacement); else { - Charcount stlen = XSTRING_CHAR_LENGTH (replacement); + Charcount stlen = string_char_length (replacement); Charcount strpos; struct gcpro gcpro1; GCPRO1 (replacement); @@ -2633,7 +2637,7 @@ */ Charcount offset = BUF_PT (buf) - search_regs.start[sub]; - c = XSTRING_CHAR (replacement, strpos); + c = string_ichar (replacement, strpos); if (c == '\\' && strpos < stlen - 1) { /* XXX FIXME: replacing just a substring non-literally @@ -2642,7 +2646,7 @@ claims Finsert_buffer_substring already handles this correctly. */ - c = XSTRING_CHAR (replacement, ++strpos); + c = string_ichar (replacement, ++strpos); if (c == '&') Finsert_buffer_substring (buffer, @@ -2705,8 +2709,8 @@ for (pos = BUF_PT (buf) - inslen; pos < eend; pos++) { - Emchar curchar = BUF_FETCH_CHAR (buf, pos); - Emchar newchar = -1; + Ichar curchar = BUF_FETCH_CHAR (buf, pos); + Ichar newchar = -1; if (i < Dynarr_length (ul_pos_dynarr) && pos == Dynarr_at (ul_pos_dynarr, i)) { @@ -2743,7 +2747,6 @@ static Lisp_Object match_limit (Lisp_Object num, int beginningp) { - /* This function has been Mule-ized. */ int n; CHECK_INT (num); @@ -2792,7 +2795,6 @@ */ (integers, reuse)) { - /* This function has been Mule-ized. */ Lisp_Object tail, prev; Lisp_Object *data; int i; @@ -2865,14 +2867,14 @@ */ (list)) { - /* This function has been Mule-ized. */ REGISTER int i; REGISTER Lisp_Object marker; int num_regs; int length; - if (running_asynch_code) - save_search_regs (); + /* Some FSF junk with running_asynch_code, to preserve the match + data. Not necessary because we don't call process filters + asynchronously (i.e. from within QUIT). */ CONCHECK_LIST (list); @@ -2935,48 +2937,6 @@ return Qnil; } -/* If non-zero the match data have been saved in saved_search_regs - during the execution of a sentinel or filter. */ -static int search_regs_saved; -static struct re_registers saved_search_regs; - -/* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data - if asynchronous code (filter or sentinel) is running. */ -static void -save_search_regs (void) -{ - if (!search_regs_saved) - { - saved_search_regs.num_regs = search_regs.num_regs; - saved_search_regs.start = search_regs.start; - saved_search_regs.end = search_regs.end; - search_regs.num_regs = 0; - search_regs.start = 0; - search_regs.end = 0; - - search_regs_saved = 1; - } -} - -/* Called upon exit from filters and sentinels. */ -void -restore_match_data (void) -{ - if (search_regs_saved) - { - if (search_regs.num_regs > 0) - { - xfree (search_regs.start); - xfree (search_regs.end); - } - search_regs.num_regs = saved_search_regs.num_regs; - search_regs.start = saved_search_regs.start; - search_regs.end = saved_search_regs.end; - - search_regs_saved = 0; - } -} - /* Quote a string to inactivate reg-expr chars */ DEFUN ("regexp-quote", Fregexp_quote, 1, 1, 0, /* @@ -2984,12 +2944,12 @@ */ (string)) { - REGISTER Intbyte *in, *out, *end; - REGISTER Intbyte *temp; + REGISTER Ibyte *in, *out, *end; + REGISTER Ibyte *temp; CHECK_STRING (string); - temp = (Intbyte *) alloca (XSTRING_LENGTH (string) * 2); + temp = (Ibyte *) ALLOCA (XSTRING_LENGTH (string) * 2); /* Now copy the data into the new string, inserting escapes. */ @@ -2999,15 +2959,15 @@ while (in < end) { - Emchar c = charptr_emchar (in); + Ichar c = itext_ichar (in); if (c == '[' || c == ']' || c == '*' || c == '.' || c == '\\' || c == '?' || c == '+' || c == '^' || c == '$') *out++ = '\\'; - out += set_charptr_emchar (out, c); - INC_CHARPTR (in); + out += set_itext_ichar (out, c); + INC_IBYTEPTR (in); } return make_string (temp, out - temp); @@ -3106,11 +3066,7 @@ occur and a back reference to one of them is directly followed by a digit. */ ); warn_about_possibly_incompatible_back_references = 1; -} -void -complex_vars_of_search (void) -{ Vskip_chars_range_table = Fmake_range_table (); staticpro (&Vskip_chars_range_table); } diff --text -u 'xemacs-21.5.6/src/select-common.h' 'xemacs-21.5.7/src/select-common.h' Index: ././src/select-common.h --- ././src/select-common.h Thu Sep 20 15:29:13 2001 +++ ././src/select-common.h Wed Jun 5 18:57:09 2002 @@ -210,13 +210,13 @@ } else if (CHARP (obj)) { - Intbyte buf[MAX_EMCHAR_LEN]; + Ibyte buf[MAX_ICHAR_LEN]; Bytecount len; const Extbyte *extval; Bytecount extvallen; *format_ret = 8; - len = set_charptr_emchar (buf, XCHAR (obj)); + len = set_itext_ichar (buf, XCHAR (obj)); TO_EXTERNAL_FORMAT (DATA, (buf, len), ALLOCA, (extval, extvallen), Qctext); diff --text -u 'xemacs-21.5.6/src/select-gtk.c' 'xemacs-21.5.7/src/select-gtk.c' Index: ././src/select-gtk.c --- ././src/select-gtk.c Fri Mar 29 13:48:34 2002 +++ ././src/select-gtk.c Fri Jun 21 06:18:45 2002 @@ -31,13 +31,15 @@ #include #include "lisp.h" -#include "events.h" + #include "buffer.h" -#include "device.h" -#include "console-gtk.h" -#include "select.h" -#include "opaque.h" +#include "device-impl.h" +#include "events.h" #include "frame.h" +#include "opaque.h" +#include "select.h" + +#include "console-gtk-impl.h" static Lisp_Object Vretrieved_selection; static gboolean waiting_for_selection; @@ -68,7 +70,7 @@ if (atom == GDK_SELECTION_SECONDARY) return (QSECONDARY); { - Intbyte *intstr; + Ibyte *intstr; Extbyte *str = gdk_atom_name (atom); if (! str) return Qnil; diff --text -u 'xemacs-21.5.6/src/select-msw.c' 'xemacs-21.5.7/src/select-msw.c' Index: ././src/select-msw.c --- ././src/select-msw.c Sun Mar 31 17:29:02 2002 +++ ././src/select-msw.c Fri Jun 21 06:18:45 2002 @@ -34,12 +34,12 @@ #include #include "lisp.h" #include "buffer.h" -#include "frame.h" +#include "frame-impl.h" #include "select.h" #include "opaque.h" #include "file-coding.h" -#include "console-msw.h" +#include "console-msw-impl.h" static int in_own_selection; @@ -314,7 +314,7 @@ else /* we do NOT append a zero byte. we don't know whether we're dealing with regular text, unicode text, binary data, etc. */ - TO_EXTERNAL_FORMAT (LISP_STRING, data, ALLOCA, (src, size), + TO_EXTERNAL_FORMAT (LISP_STRING, data, MALLOC, (src, size), Qbinary); /* Allocate memory */ @@ -324,6 +324,7 @@ { CloseClipboard (); + xfree (src); return Qnil; } @@ -334,10 +335,12 @@ GlobalFree (hValue); CloseClipboard (); + xfree (src); return Qnil; } memcpy (dst, src, size); + xfree (src); GlobalUnlock (hValue); diff --text -u 'xemacs-21.5.6/src/select-x.c' 'xemacs-21.5.7/src/select-x.c' Index: ././src/select-x.c --- ././src/select-x.c Sun Mar 31 17:29:03 2002 +++ ././src/select-x.c Fri Jun 21 06:18:45 2002 @@ -27,12 +27,12 @@ #include "lisp.h" #include "charset.h" -#include "device.h" -#include "frame.h" +#include "device-impl.h" +#include "frame-impl.h" #include "opaque.h" #include "select.h" -#include "console-x.h" +#include "console-x-impl.h" #include "objects-x.h" #include "systime.h" @@ -179,7 +179,7 @@ #endif { - Intbyte *intstr; + Ibyte *intstr; Extbyte *str = XGetAtomName (display, atom); if (! str) return Qnil; @@ -287,17 +287,17 @@ #endif XmString fmh; String encoding = "STRING"; - const Intbyte *data = XSTRING_DATA (selection_value); + const Ibyte *data = XSTRING_DATA (selection_value); Bytecount bytes = XSTRING_LENGTH (selection_value); #ifdef MULE { enum { ASCII, LATIN_1, WORLD } chartypes = ASCII; - const Intbyte *ptr = data, *end = ptr + bytes; + const Ibyte *ptr = data, *end = ptr + bytes; /* Optimize for the common ASCII case */ while (ptr <= end) { - if (BYTE_ASCII_P (*ptr)) + if (byte_ascii_p (*ptr)) { ptr++; continue; @@ -1294,12 +1294,12 @@ Display *display = DEVICE_X_DISPLAY (d); Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ Atom cut_buffer_atom; - const Intbyte *data = XSTRING_DATA (string); + const Ibyte *data = XSTRING_DATA (string); Bytecount bytes = XSTRING_LENGTH (string); Bytecount bytes_remaining; Bytecount max_bytes = SELECTION_QUANTUM (display); #ifdef MULE - const Intbyte *ptr, *end; + const Ibyte *ptr, *end; enum { ASCII, LATIN_1, WORLD } chartypes = ASCII; #endif @@ -1322,7 +1322,7 @@ /* Optimize for the common ASCII case */ for (ptr = data, end = ptr + bytes; ptr <= end; ) { - if (BYTE_ASCII_P (*ptr)) + if (byte_ascii_p (*ptr)) { ptr++; continue; @@ -1482,7 +1482,7 @@ x_selection_timeout = 0; DEFVAR_BOOL ("x-selection-strict-motif-ownership", &x_selection_strict_motif_ownership /* -*If true and XEmacs already owns the clipboard, don't own it again in the +*If nil and XEmacs already owns the clipboard, don't own it again in the Motif way. Owning the selection on the Motif way does a huge amount of X protocol, and it makes killing text incredibly slow when using an X terminal. However, when enabled Motif text fields don't bother to look up diff --text -u 'xemacs-21.5.6/src/select.c' 'xemacs-21.5.7/src/select.c' Index: ././src/select.c --- ././src/select.c Thu May 24 16:51:29 2001 +++ ././src/select.c Fri Jun 21 06:18:45 2002 @@ -25,7 +25,7 @@ #include "lisp.h" #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "extents.h" #include "console.h" #include "objects.h" diff --text -u 'xemacs-21.5.6/src/sheap.c' 'xemacs-21.5.7/src/sheap.c' Index: ././src/sheap.c --- ././src/sheap.c Wed Mar 13 17:52:58 2002 +++ ././src/sheap.c Tue May 28 17:45:01 2002 @@ -42,8 +42,8 @@ int static_heap_initialized=0; int static_heap_dumped=0; -void* more_static_core ( ptrdiff_t increment ); -void* more_static_core ( ptrdiff_t increment ) +void *more_static_core ( ptrdiff_t increment ); +void *more_static_core ( ptrdiff_t increment ) { int size = (int) increment; void *result; diff --text -u 'xemacs-21.5.6/src/signal.c' 'xemacs-21.5.7/src/signal.c' Index: ././src/signal.c --- ././src/signal.c Sun Mar 31 17:29:03 2002 +++ ././src/signal.c Fri Jun 21 06:18:46 2002 @@ -1,6 +1,6 @@ /* Handling asynchronous signals. Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 2001 Ben Wing. + Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -25,9 +25,9 @@ #include "lisp.h" #include "console.h" -#include "device.h" +#include "device-impl.h" #include "events.h" /* for signal_fake_event() */ -#include "frame.h" +#include "frame-impl.h" #include "process.h" #include "sysdep.h" @@ -214,8 +214,8 @@ } else /* call1 GC-protects its arguments */ - call1_trapping_errors ("Error in asynchronous timeout callback", - fun, arg); + call1_trapping_problems ("Error in asynchronous timeout callback", + fun, arg, INHIBIT_GC); waiting_for_user_input_p = 0; @@ -425,9 +425,17 @@ /* called from QUIT when something_happened gets set (as a result of a signal) */ -int +void check_what_happened (void) { +#ifdef ERROR_CHECK_TRAPPING_PROBLEMS + if (in_display + && !((get_inhibit_flags () & INTERNAL_INHIBIT_ERRORS) + && (get_inhibit_flags () & INTERNAL_INHIBIT_THROWS))) + assert_with_message + (0, "QUIT called from within redisplay without being properly wrapped"); +#endif + /* No GC can happen anywhere here. handle_async_timeout_signal() prevents GC (from asynch timeout handler), so does check_quit() (from processing a message such as WM_INITMENU as a result of @@ -446,7 +454,7 @@ establish_slow_interrupt_timer (); } - return check_quit (); + check_quit (); } #ifdef SIGIO @@ -633,12 +641,133 @@ /* Control-G checking */ /**********************************************************************/ -static Lisp_Object -restore_dont_check_for_quit (Lisp_Object val) -{ - dont_check_for_quit = XINT (val); - return Qnil; -} +/* Note: The code to handle QUIT is divided between lisp.h and signal.c. + There is also some special-case code in the async timer code in + event-stream.c to notice when the poll-for-quit (and poll-for-sigchld) + timers have gone off. */ + +/* OK, here's an overview of how this convoluted stuff works: + +[1] Scattered throughout the XEmacs core code are calls to the macro QUIT; + This macro checks to see whether a C-g has recently been pressed and + not yet handled, and if so, it handles the C-g by calling signal_quit(), + which invokes the standard Fsignal() code, with the error being Qquit. + Lisp code can establish handlers for this (using condition-case), but + normally there is no handler, and so execution is thrown back to the + innermost enclosing event loop. (One of the things that happens when + entering an event loop is that a condition-case is established that + catches *all* calls to `signal', including this one.) + +[2] How does the QUIT macro check to see whether C-g has been pressed; + obviously this needs to be extremely fast. Now for some history. + In early Lemacs as inherited from the FSF going back 15 years or + more, there was a great fondness for using SIGIO (which is sent + whenever there is I/O available on a given socket, tty, etc.). + In fact, in GNU Emacs, perhaps even today, all reading of events + from the X server occurs inside the SIGIO handler! This is crazy, + but not completely relevant. What is relevant is that similar + stuff happened inside the SIGIO handler for C-g: it searched + through all the pending (i.e. not yet delivered to XEmacs yet) + X events for one that matched C-g. When it saw a match, it set + Vquit_flag to Qt. On TTY's, C-g is actually mapped to be the + interrupt character (i.e. it generates SIGINT), and XEmacs's + handler for this signal sets Vquit_flag to Qt. Then, sometime + later after the signal handlers finished and a QUIT macro was + called, the macro noticed the setting of Vquit_flag and used + this as an indication to call signal_quit(). What signal_quit() + actually does is set Vquit_flag to Qnil (so that we won't get + repeated interruptions from a single C-g press) and then calls + the equivalent of (signal 'quit nil). + +[3] Another complication is introduced in that Vquit_flag is actually + exported to Lisp as `quit-flag'. This allows users some level of + control over whether and when C-g is processed as quit, esp. in + combination with `inhibit-quit'. This is another Lisp variable, + and if set to non-nil, it inhibits signal_quit() from getting + called, meaning that the C-g gets essentially ignored. But not + completely: Because the resetting of `quit-flag' happens only + in signal_quit(), which isn't getting called, the C-g press is + still noticed, and as soon as `inhibit-quit' is set back to nil, + a quit will be signalled at the next QUIT macro. Thus, what + `inhibit-quit' really does is defer quits until after the quit- + inhibitted period. + +[4] Another consideration, introduced by XEmacs, is critical quitting. + If you press Control-Shift-G instead of just C-g, `quit-flag' is + set to `critical' instead of to t. When QUIT processes this value, + it *ignores* the value of `inhibit-quit'. This allows you to quit + even out of a quit-inhibitted section of code! Furthermore, when + signal_quit() notices that it was invoked as a result of a critical + quit, it automatically invokes the debugger (which otherwise would + only happen when `debug-on-quit' is set to t). + +[5] Well, I explained above about how `quit-flag' gets set correctly, + but I began with a disclaimer stating that this was the old way + of doing things. What's done now? Well, first of all, the SIGIO + handler (which formerly checked all pending events to see if there's + a C-g) now does nothing but set a flag -- or actually two flags, + something_happened and quit_check_signal_happened. There are two + flags because the QUIT macro is now used for more than just handling + QUIT; it's also used for running asynchronous timeout handlers that + have recently expired, and perhaps other things. The idea here is + that the QUIT macros occur extremely often in the code, but only occur + at places that are relatively safe -- in particular, if an error occurs, + nothing will get completely trashed. + +[6] Now, let's look at QUIT again. + + UNFINISHED. Note, however, that as of the point when this comment + got committed to CVS (mid-2001), the interaction between reading + C-g as an event and processing it as QUIT was overhauled to (for + the first time) be understandable and actually work correctly. + Now, the way things work is that if C-g is pressed while XEmacs is + blocking at the top level, waiting for a user event, it will be + read as an event; otherwise, it will cause QUIT. (This includes + times when XEmacs is blocking, but not waiting for a user event, + e.g. accept-process-output and wait_delaying_user_events().) + Formerly, this was supposed to happen, but didn't always due to a + bizarre and broken scheme, documented in next_event_internal + like this: + + If we read a ^G, then set quit-flag but do not discard the ^G. + The callers of next_event_internal() will do one of two things: + + -- set Vquit_flag to Qnil. (next-event does this.) This will + cause the ^G to be treated as a normal keystroke. + -- not change Vquit_flag but attempt to enqueue the ^G, at + which point it will be discarded. The next time QUIT is + called, it will notice that Vquit_flag was set. + + This required weirdness in enqueue_command_event_1 like this: + + put the event on the typeahead queue, unless + the event is the quit char, in which case the `QUIT' + which will occur on the next trip through this loop is + all the processing we should do - leaving it on the queue + would cause the quit to be processed twice. + + And further weirdness elsewhere, none of which made any sense, + and didn't work, because (e.g.) it required that QUIT never + happen anywhere inside next_event_internal() or any callers when + C-g should be read as a user event, which was impossible to + implement in practice. + + Now what we do is fairly simple. Callers of next_event_internal() + that want C-g read as a user event call begin_dont_check_for_quit(). + next_event_internal(), when it gets a C-g, simply sets Vquit_flag + (just as when a C-g is detected during the operation of QUIT or + QUITP), and then tries to QUIT. This will fail if blocked by the + previous call, at which point next_event_internal() will return + the C-g as an event. To unblock things, first set Vquit_flag to + nil (it was set to t when the C-g was read, and if we don't reset + it, the next call to QUIT will quit), and then unbind_to() the + depth returned by begin_dont_check_for_quit(). It makes no + difference is QUIT is called a zillion times in next_event_internal() + or anywhere else, because it's blocked and will never signal. + + --ben + */ + /* Defer all checking or processing of C-g. You can do this, for example, if you want to read C-g's as events. (In that case, you should set @@ -654,19 +783,40 @@ to check dont_check_for_quit when quit-flag == `critical', which is rare. */ specbind (Qinhibit_quit, Qt); - record_unwind_protect (restore_dont_check_for_quit, - make_int (dont_check_for_quit)); - dont_check_for_quit = 1; + internal_bind_int (&dont_check_for_quit, 1); return depth; } -/* The effect of this function is to set Vquit_flag if the user pressed - ^G and discard the ^G, so as to not notice the same ^G again. */ +/* If we're inside of a begin_dont_check_for_quit() section, but want + to temporarily enable quit-checking, call this. This is used in + particular when processing menu filters -- some menu filters do + antisocial things like load large amounts of Lisp code (custom in + particular), and we obviously want a way of breaking out of any + problems. If you do use this, you should really be trapping the + throw() that comes from the quitting (as does the code that handles + menus popping up). */ + int +begin_do_check_for_quit (void) +{ + int depth = specpdl_depth (); + specbind (Qinhibit_quit, Qnil); + internal_bind_int (&dont_check_for_quit, 0); + /* #### should we set Vquit_flag to Qnil? */ + return depth; + } + +/* The effect of this function is to set Vquit_flag appropriately if the + user pressed C-g or Sh-C-g. After this function finishes, Vquit_flag + will be Qt for C-g, Qcritical for Sh-C-g, and unchanged otherwise. + The C-g or Sh-C-g is discarded, so it won't be noticed again. +*/ + +void check_quit (void) { - /* dont_check_for_quit is set in two circumstances: + /* dont_check_for_quit is set in three circumstances: (1) when we are in the process of changing the window configuration. The frame might be in an inconsistent state, @@ -676,15 +826,11 @@ as an event. The normal check for quit will discard the C-g, which would be bad. - [[#### C-g is still often read as quit, e.g. if you type C-x C-g (the - C-g happens during the sit-for in maybe_echo_keys(); even if we - attempt to inhibit quit here, there is still a check later on for - QUIT. To fix this properly requires a fairly substantial overhaul of - the quit-checking code, which is probably not worth it.)]] not true, - we just have to always do dont_check_for_quit around all code that - reads events. my stderr-proc ws already does this. + (3) when we're going down with a fatal error. we're most likely + in an inconsistent state, and we definitely don't want to be + interrupted. */ - We should *not* conditionalize on Vinhibit_quit, or + /* We should *not* conditionalize on Vinhibit_quit, or critical-quit (Control-Shift-G) won't work right. */ /* WARNING: Even calling check_quit(), without actually dispatching @@ -824,9 +970,10 @@ KERNEL32! BaseProcessStart@4 + 115547 bytes */ - + int specdepth; + if (dont_check_for_quit) - return 0; + return; if (quit_check_signal_happened) { @@ -834,14 +981,11 @@ which would majorly fuck a lot of things, e.g. re_match() [string gets relocated] and lots of other code that's not prepared to handle GC in QUIT. */ - int specdepth = begin_gc_forbidden (); + specdepth = begin_gc_forbidden (); quit_check_signal_happened = 0; event_stream_quit_p (); unbind_to (specdepth); - return 1; } - else - return 0; } @@ -880,7 +1024,7 @@ #endif /* 0 */ -#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD) +#if defined (HAVE_UNIX_PROCESSES) && !defined (SIGCHLD) static void init_poll_for_sigchld (void) @@ -1065,7 +1209,7 @@ #endif } -#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD) +#if defined (HAVE_UNIX_PROCESSES) && !defined (SIGCHLD) init_poll_for_sigchld (); #endif diff --text -u 'xemacs-21.5.6/src/sound.c' 'xemacs-21.5.7/src/sound.c' Index: ././src/sound.c --- ././src/sound.c Fri Mar 29 13:48:35 2002 +++ ././src/sound.c Fri Jun 21 06:18:46 2002 @@ -33,9 +33,9 @@ #include "buffer.h" #ifdef HAVE_X_WINDOWS -#include "console-x.h" +#include "console-x-impl.h" #endif -#include "device.h" +#include "device-impl.h" #include "redisplay.h" #include "sound.h" @@ -45,6 +45,10 @@ #ifdef HAVE_NATIVE_SOUND # include "sysproc.h" +#endif + +#ifdef WIN32_NATIVE +#include "syswindows.h" #endif #ifdef HAVE_ESD_SOUND diff --text -u 'xemacs-21.5.6/src/sound.h' 'xemacs-21.5.7/src/sound.h' Index: ././src/sound.h --- ././src/sound.h Wed Mar 13 17:52:59 2002 +++ ././src/sound.h Wed Jun 5 18:57:12 2002 @@ -31,15 +31,15 @@ # define sound_perror(string) \ do { \ - Intbyte *errmess; \ - Intbyte *string_int; \ + Ibyte *errmess; \ + Ibyte *string_int; \ GET_STRERROR (errmess, errno); \ EXTERNAL_TO_C_STRING (string, string_int, Qnative); \ warn_when_safe (Qsound, Qerror, "audio: %s, %s", string_int, errmess); \ } while (0) # define sound_warn(string) \ do { \ - Intbyte *string_int; \ + Ibyte *string_int; \ EXTERNAL_TO_C_STRING (GETTEXT (string), string_int, Qnative); \ warn_when_safe (Qsound, Qwarning, "audio: %s", string_int); \ } while (0) diff --text -u 'xemacs-21.5.6/src/specifier.c' 'xemacs-21.5.7/src/specifier.c' Index: ././src/specifier.c --- ././src/specifier.c Mon Apr 1 12:58:48 2002 +++ ././src/specifier.c Fri Jun 21 06:18:46 2002 @@ -33,7 +33,7 @@ #include "buffer.h" #include "chartab.h" -#include "device.h" +#include "device-impl.h" #include "frame.h" #include "glyphs.h" #include "opaque.h" @@ -274,12 +274,17 @@ sp->methods->name, sp->header.uid); write_fmt_string (printcharfun, "#<%s-specifier global=", sp->methods->name); +#if 0 + /* #### Not obvious this is useful, and overrides user settings; if we + resurrect this, create variables like `print-specifier-length' so it + can be controlled. */ specbind (Qprint_string_length, make_int (100)); specbind (Qprint_length, make_int (5)); +#endif the_specs = Fspecifier_specs (obj, Qglobal, Qnil, Qnil); if (NILP (the_specs)) /* there are no global specs */ - write_c_string ("", printcharfun); + write_c_string (printcharfun, ""); else print_internal (the_specs, printcharfun, 1); if (!NILP (sp->fallback)) @@ -350,9 +355,8 @@ inline static Bytecount aligned_sizeof_specifier (Bytecount specifier_type_specific_size) { - return ALIGN_SIZE (offsetof (Lisp_Specifier, data) - + specifier_type_specific_size, - ALIGNOF (max_align_t)); + return MAX_ALIGN_SIZE (offsetof (Lisp_Specifier, data) + + specifier_type_specific_size); } static Bytecount @@ -1018,7 +1022,6 @@ Lisp_Object rest, rest2; Lisp_Object device = wrap_device (d); - DEVICE_USER_DEFINED_TAGS (d) = Fcopy_alist (Vuser_defined_tags); /* Now set up the initial values */ @@ -1032,7 +1035,8 @@ if (NILP (predicate)) XCDR (XCAR (rest2)) = Qt; else - XCDR (XCAR (rest2)) = !NILP (call1 (predicate, device)) ? Qt : Qnil; + XCDR (XCAR (rest2)) = + !NILP (call_critical_lisp_code (d, predicate, device)) ? Qt : Qnil; } } @@ -1366,23 +1370,10 @@ spec); } -/* Helper function which unwind protects the value of - Vunlock_ghost_specifiers, then sets it to non-nil value */ -static Lisp_Object -restore_unlock_value (Lisp_Object val) -{ - Vunlock_ghost_specifiers = val; - return val; -} - int unlock_ghost_specifiers_protected (void) { - int depth = specpdl_depth (); - record_unwind_protect (restore_unlock_value, - Vunlock_ghost_specifiers); - Vunlock_ghost_specifiers = Qt; - return depth; + return internal_bind_lisp_object (&Vunlock_ghost_specifiers, Qt); } /* This gets hit so much that the function call overhead had a @@ -2730,11 +2721,14 @@ display table is not there. (Chartable specifiers are not yet implemented.) --- For font specifiers, MATCHSPEC should be a charset, and the specification - (a font string) must have a registry that matches the charset's registry. - (This only makes sense with Mule support.) This makes it easy to choose a - font that can display a particular character. (This is what redisplay - does, in fact.) +-- For font specifiers, MATCHSPEC should be a list (CHARSET . SECOND-STAGE-P), + and the specification (a font string) must have a registry that matches + the charset's registry. (This only makes sense with Mule support.) This + makes it easy to choose a font that can display a particular + character. (This is what redisplay does, in fact.) SECOND-STAGE-P means + to ignore the font's registry and instead look at the characters in the + font to see if the font can support the charset. This currently only makes + sense under MS Windows. */ (specifier, matchspec, domain, default_, no_fallback)) { @@ -2818,8 +2812,35 @@ /* Caching in the struct window or frame */ /************************************************************************/ -/* Either STRUCT_WINDOW_OFFSET or STRUCT_FRAME_OFFSET can be 0 to indicate - no caching in that sort of object. */ +/* Cause the current value of SPECIFIER in the domain of each frame and/or + window to be cached in the struct frame at STRUCT_FRAME_OFFSET and the + struct window at STRUCT_WINDOW_OFFSET. When the value changes in a + particular window, VALUE_CHANGED_IN_WINDOW is called. When the value + changes in a particular frame, VALUE_CHANGED_IN_FRAME is called. + + Either STRUCT_WINDOW_OFFSET or STRUCT_FRAME_OFFSET can be 0 to indicate + no caching in that sort of object. However, if they're not 0, you + must supply a corresponding value-changed function. (This is the case + so that you are forced to consider the ramifications of a value change. + You nearly always need to do something, e.g. set a dirty flag.) + + If you create a built-in specifier, you should do the following: + + - Make sure the file you create the specifier in has a + specifier_vars_of_foo() function. If not, create it, declare it in + symsinit.h, and make sure it's called in the appropriate place in + emacs.c. + - In specifier_vars_of_foo(), do a DEFVAR_SPECIFIER(), followed by + initializing the specifier using Fmake_specifier(), followed by + set_specifier_fallback(), followed (optionally) by + set_specifier_caching(). + - If you used set_specifier_caching(), make sure to create the + appropriate value-changed functions. Also make sure to add the + appropriate slots where the values are cached to frameslots.h and + winslots.h. + + Do a grep for menubar_visible_p for an example. +*/ /* #### It would be nice if the specifier caching automatically knew about specifier fallbacks, so we didn't have to do it ourselves. */ @@ -2844,6 +2865,10 @@ sp->caching->value_changed_in_window = value_changed_in_window; sp->caching->offset_into_struct_frame = struct_frame_offset; sp->caching->value_changed_in_frame = value_changed_in_frame; + if (struct_window_offset) + assert (value_changed_in_window); + if (struct_frame_offset) + assert (value_changed_in_frame); sp->caching->always_recompute = always_recompute; Vcached_specifiers = Fcons (specifier, Vcached_specifiers); if (BODILY_SPECIFIER_P (sp)) @@ -2946,7 +2971,7 @@ { Lisp_Object specifier = Qnil; - VOID_TO_LISP (specifier, closure); + specifier = VOID_TO_LISP (closure); recompute_one_cached_specifier_in_window (specifier, w); return 0; } diff --text -u 'xemacs-21.5.6/src/specifier.h' 'xemacs-21.5.7/src/specifier.h' Index: ././src/specifier.h --- ././src/specifier.h Sun Mar 31 17:29:05 2002 +++ ././src/specifier.h Sun May 5 20:32:28 2002 @@ -1,6 +1,6 @@ /* Generic specifier list implementation Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 2002 Ben Wing + Copyright (C) 1995, 1996, 2002 Ben Wing This file is part of XEmacs. @@ -282,10 +282,10 @@ #ifdef ERROR_CHECK_TYPES #define DECLARE_SPECIFIER_TYPE(type) \ extern struct specifier_methods * type##_specifier_methods; \ -INLINE_HEADER struct type##_specifier * \ -error_check_##type##_specifier_data (Lisp_Specifier *sp); \ -INLINE_HEADER struct type##_specifier * \ +DECLARE_INLINE_HEADER ( \ +struct type##_specifier * \ error_check_##type##_specifier_data (Lisp_Specifier *sp) \ +) \ { \ if (SPECIFIERP (sp->magic_parent)) \ { \ @@ -297,10 +297,10 @@ assert (SPECIFIER_TYPE_P (sp, type)); \ return (struct type##_specifier *) sp->data; \ } \ -INLINE_HEADER Lisp_Specifier * \ -error_check_##type##_specifier_type (Lisp_Object obj); \ -INLINE_HEADER Lisp_Specifier * \ +DECLARE_INLINE_HEADER ( \ +Lisp_Specifier * \ error_check_##type##_specifier_type (Lisp_Object obj) \ +) \ { \ Lisp_Specifier *sp = XSPECIFIER (obj); \ assert (SPECIFIER_TYPE_P (sp, type)); \ diff --text -u 'xemacs-21.5.6/src/symbols.c' 'xemacs-21.5.7/src/symbols.c' Index: ././src/symbols.c --- ././src/symbols.c Mon Apr 1 12:58:48 2002 +++ ././src/symbols.c Fri Jun 21 06:18:46 2002 @@ -55,7 +55,7 @@ #include "lisp.h" #include "buffer.h" /* for Vbuffer_defaults */ -#include "console.h" +#include "console-impl.h" #include "elhash.h" Lisp_Object Qad_advice_info, Qad_activate; @@ -174,7 +174,7 @@ } Lisp_Object -intern_int (const Intbyte *str) +intern_int (const Ibyte *str) { Bytecount len = qxestrlen (str); Lisp_Object obarray = Vobarray; @@ -192,9 +192,22 @@ } Lisp_Object -intern (const CIntbyte *str) +intern (const CIbyte *str) { - return intern_int ((Intbyte *) str); + return intern_int ((Ibyte *) str); +} + +Lisp_Object +intern_converting_underscores_to_dashes (const CIbyte *str) +{ + Bytecount len = strlen (str); + CIbyte *tmp = alloca_extbytes (len + 1); + Bytecount i; + strcpy (tmp, str); + for (i = 0; i < len; i++) + if (tmp[i] == '_') + tmp[i] = '-'; + return intern_int ((Ibyte *) tmp); } DEFUN ("intern", Fintern, 1, 2, 0, /* @@ -231,7 +244,7 @@ XSYMBOL_NEXT (symbol) = 0; *ptr = object; - if (XSTRING_BYTE (XSYMBOL_NAME (symbol), 0) == ':' && EQ (obarray, Vobarray)) + if (string_byte (XSYMBOL_NAME (symbol), 0) == ':' && EQ (obarray, Vobarray)) { /* The LISP way is to put keywords in their own package, but we don't have packages, so we do something simpler. Someday, @@ -341,7 +354,7 @@ Also store the bucket number in oblookup_last_bucket_number. */ Lisp_Object -oblookup (Lisp_Object obarray, const Intbyte *ptr, Bytecount size) +oblookup (Lisp_Object obarray, const Ibyte *ptr, Bytecount size) { unsigned int hash, obsize; Lisp_Symbol *tail; @@ -380,7 +393,7 @@ Investigation by Karl Nelson . Do a web search for "g_str_hash X31_HASH" if you want to know more. */ unsigned int -hash_string (const Intbyte *ptr, Bytecount len) +hash_string (const Ibyte *ptr, Bytecount len) { unsigned int hash; @@ -3214,7 +3227,7 @@ /* Bootstrapping problem: Qnil isn't set when make_string_nocopy is called the first time. */ - Qnil = Fmake_symbol (make_string_nocopy ((const Intbyte *) "nil", 3)); + Qnil = Fmake_symbol (make_string_nocopy ((const Ibyte *) "nil", 3)); XSTRING_PLIST (XSYMBOL (Qnil)->name) = Qnil; XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */ XSYMBOL (Qnil)->plist = Qnil; @@ -3273,7 +3286,7 @@ for (i = 0; i < len; i++) if (temp[i] == '_') temp[i] = '-'; - *location = Fintern (make_string ((const Intbyte *) temp, len), Qnil); + *location = Fintern (make_string ((const Ibyte *) temp, len), Qnil); if (dump_p) staticpro (location); else @@ -3308,7 +3321,7 @@ void defsymbol_nodump (Lisp_Object *location, const char *name) { - *location = Fintern (make_string_nocopy ((const Intbyte *) name, + *location = Fintern (make_string_nocopy ((const Ibyte *) name, strlen (name)), Qnil); staticpro_nodump (location); @@ -3317,7 +3330,7 @@ void defsymbol (Lisp_Object *location, const char *name) { - *location = Fintern (make_string_nocopy ((const Intbyte *) name, + *location = Fintern (make_string_nocopy ((const Ibyte *) name, strlen (name)), Qnil); staticpro (location); @@ -3579,7 +3592,7 @@ sym = Fintern (build_string (symbol_name), Qnil); else #endif - sym = Fintern (make_string_nocopy ((const Intbyte *) symbol_name, + sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name, strlen (symbol_name)), Qnil); XSYMBOL (sym)->value = wrap_pointer_1 (magic); diff --text -u 'xemacs-21.5.6/src/symsinit.h' 'xemacs-21.5.7/src/symsinit.h' Index: ././src/symsinit.h --- ././src/symsinit.h Thu Mar 21 16:30:56 2002 +++ ././src/symsinit.h Tue Jun 4 15:05:38 2002 @@ -35,8 +35,12 @@ void init_win32_very_early (void); void init_mswindows_dde_very_early (void); -/* Early Lisp-engine initialization (dump-time only for init, - dump-time and post-pdump-load-time for reinit). */ +/* Early Lisp-engine initialization -- dump-time only for init, dump-time + and post-pdump-load-time for reinit. We call the reinit() routine + ourselves at post-pdump-load-time, but the init_() routine calls the + reinit() routine itself. (This is because sometimes the timing of when + to call the routine is tricky -- the init routine might need to do some + stuff, call the reinit() routine, and do some more stuff.) */ void init_alloc_once_early (void); void reinit_alloc_once_early (void); @@ -47,6 +51,18 @@ void init_opaque_once_early (void); void init_elhash_once_early (void); void init_eistring_once_early (void); +void reinit_eistring_once_early (void); + +/* Reset the Lisp engine. Called both at dump-time, run-time and + run-temacs-time; at dump-time, it's called early, before any of the + vars() or complex_vars() routines. Currently does almost nothing. */ + +void init_alloc_early (void); + +/* Called somewhat randomly -- at dump-time, in the middle of the vars() + calls, and at run-time, just before the late initializations. */ + +void init_eval_semi_early (void); /* Declare the built-in symbols and primitives (dump-time only). */ @@ -56,7 +72,6 @@ void syms_of_buffer (void); void syms_of_bytecode (void); void syms_of_callint (void); -void syms_of_callproc (void); void syms_of_casefiddle (void); void syms_of_casetab (void); void syms_of_chartab (void); @@ -95,7 +110,9 @@ void syms_of_filelock (void); void syms_of_floatfns (void); void syms_of_fns (void); +#ifdef USE_C_FONT_LOCK void syms_of_font_lock (void); +#endif /* USE_C_FONT_LOCK */ void syms_of_frame (void); void syms_of_frame_mswindows (void); void syms_of_frame_tty (void); @@ -276,7 +293,6 @@ void reinit_vars_of_buffer (void); void vars_of_bytecode (void); void vars_of_callint (void); -void vars_of_callproc (void); void vars_of_chartab (void); void vars_of_cmdloop (void); void vars_of_cmds (void); @@ -325,8 +341,10 @@ void vars_of_filelock (void); void vars_of_floatfns (void); void vars_of_fns (void); +#ifdef USE_C_FONT_LOCK void vars_of_font_lock (void); void reinit_vars_of_font_lock (void); +#endif /* USE_C_FONT_LOCK */ void vars_of_frame_tty (void); void vars_of_frame_mswindows (void); void reinit_vars_of_frame_mswindows (void); @@ -373,7 +391,6 @@ void vars_of_mule_wnn (void); void reinit_vars_of_mule_wnn (void); void vars_of_nt (void); -void vars_of_ntproc (void); void vars_of_objects (void); void reinit_vars_of_objects (void); void vars_of_objects_tty (void); @@ -388,6 +405,7 @@ void vars_of_profile (void); void vars_of_ralloc (void); void vars_of_redisplay (void); +void vars_of_regex (void); void vars_of_scrollbar_x (void); void reinit_vars_of_scrollbar_x (void); void vars_of_scrollbar (void); @@ -422,6 +440,7 @@ /* Initialize specifier variables (dump-time only). */ void specifier_vars_of_glyphs (void); +void specifier_vars_of_glyphs_widget (void); void specifier_vars_of_gutter (void); void specifier_vars_of_menubar (void); void specifier_vars_of_redisplay (void); @@ -435,8 +454,6 @@ #### The reinit_() functions should be called from emacs.c, not the corresponding complex_vars_of_(). */ -void complex_vars_of_regex (void); -void complex_vars_of_search (void); void complex_vars_of_faces (void); void complex_vars_of_mule_charset (void); void complex_vars_of_file_coding (void); @@ -447,10 +464,9 @@ void complex_vars_of_alloc (void); void complex_vars_of_menubar (void); void complex_vars_of_scrollbar (void); -void complex_vars_of_scrollbar_mswindows (void); void complex_vars_of_frame (void); -void complex_vars_of_casetab (void); void complex_vars_of_syntax (void); +void complex_vars_of_casetab (void); void complex_vars_of_chartab (void); void complex_vars_of_buffer (void); void reinit_complex_vars_of_buffer_runtime_only (void); @@ -461,28 +477,19 @@ void reinit_complex_vars_of_minibuf (void); void complex_vars_of_keymap (void); -/* Reset the Lisp engine. Called both at dump-time and run-time; - at dump-time, it's called early, before any of the vars() or - complex_vars() routines. */ - -void init_alloc_early (void); -void init_eval_early (void); - /* Late initialization -- stuff pertaining only to interactive usage, I/O, or Lisp reading. (Dump-time and run-time, but the code itself may conditionalize on this by checking the `initialized' variable.) */ void init_buffer_1 (void); void init_buffer_2 (void); -void init_callproc (void); void init_console_stream (int reinit); void init_device_tty (void); void init_editfns (void); -void init_environment (void); void init_event_Xt_late (void); +void init_event_mswindows_late (void); void init_event_stream (void); void init_event_tty_late (void); -void init_event_mswindows_late (void); void init_event_unixoid (void); void init_file_coding (void); void init_hpplay (void); @@ -490,15 +497,15 @@ void init_intl_win32 (void); void init_lread (void); void init_macros (void); +void init_mswindows_environment (void); void init_mule_charset (void); -void init_ntproc (void); /* #### delete me, please! */ -/* Not named init_process in order to avoid conflict with NS 3.3 */ -void init_xemacs_process (void); +void init_nt (void); void init_postgresql_from_environment (void); void init_redisplay (void); void init_select_mswindows (void); void init_sunpro (void); void init_win32 (void); +void init_xemacs_process (void); void syms_of_device_gtk (void); void syms_of_dialog_gtk (void); diff --text -u 'xemacs-21.5.6/src/syntax.c' 'xemacs-21.5.7/src/syntax.c' Index: ././src/syntax.c --- ././src/syntax.c Wed Mar 13 17:53:00 2002 +++ ././src/syntax.c Fri Jun 21 06:18:47 2002 @@ -1,7 +1,7 @@ /* XEmacs routines to deal with syntax tables; also word and list parsing. Copyright (C) 1985-1994 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -78,24 +78,22 @@ each iteration in re_search_2(). */ int no_quit_in_re_search; -/* Tell the regex routines which buffer to access for SYNTAX() lookups - and the like. */ -struct buffer *regex_emacs_buffer; - -/* In Emacs, this is the string or buffer in which we - are matching. It is used for looking up syntax properties. */ -Lisp_Object regex_match_object; - +/* The standard syntax table is stored where it will automatically + be used in all new buffers. */ Lisp_Object Vstandard_syntax_table; Lisp_Object Vsyntax_designator_chars_string; +Lisp_Object Vtemp_table_for_use_updating_syntax_tables; + +static void syntax_cache_table_was_changed (struct buffer *buf); + /* This is the internal form of the parse state used in parse-partial-sexp. */ struct lisp_parse_state { int depth; /* Depth at end of parsing */ - Emchar instring; /* -1 if not within string, else desired terminator */ + Ichar instring; /* -1 if not within string, else desired terminator */ int incomment; /* Nonzero if within a comment at end of parsing */ int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE */ int quoted; /* Nonzero if just after an escape char at end of @@ -105,9 +103,9 @@ Charbpos prevlevelstart;/* Char number of start of containing expression */ Charbpos location; /* Char number at which parsing stopped */ int mindepth; /* Minimum depth seen while scanning */ - Charbpos comstr_start; /* Position just after last comment/string starter */ - Lisp_Object levelstarts; /* Char numbers of starts-of-expression - of levels (starting from outermost). */ + Charbpos comstr_start;/* Position just after last comment/string starter */ + Lisp_Object levelstarts;/* Char numbers of starts-of-expression + of levels (starting from outermost). */ }; /* These variables are a cache for finding the start of a defun. @@ -131,7 +129,8 @@ find_defun_start (struct buffer *buf, Charbpos pos) { Charbpos tem; - + struct syntax_cache *scache; + /* Use previous finding, if it's valid and applies to this inquiry. */ if (buf == find_start_buffer /* Reuse the defun-start even if POS is a little farther on. @@ -146,13 +145,13 @@ /* Back up to start of line. */ tem = find_next_newline (buf, pos, -1); - SETUP_SYNTAX_CACHE (tem, 1); + scache = setup_buffer_syntax_cache (buf, tem, 1); while (tem > BUF_BEGV (buf)) { - UPDATE_SYNTAX_CACHE_BACKWARD(tem); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, tem); /* Open-paren at start of line means we found our defun-start. */ - if (SYNTAX_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, tem)) == Sopen) + if (SYNTAX_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, tem)) == Sopen) break; /* Move to beg of previous line. */ tem = find_next_newline (buf, tem, -2); @@ -199,6 +198,32 @@ return decode_buffer (buffer, 0)->syntax_table; } +#ifdef DEBUG_XEMACS + +DEFUN ("mirror-syntax-table", Fmirror_syntax_table, 0, 1, 0, /* +Return the current mirror syntax table, for debugging purposes. +This is the one specified by the current buffer, or by BUFFER if it +is non-nil. +*/ + (buffer)) +{ + return decode_buffer (buffer, 0)->mirror_syntax_table; +} + +DEFUN ("syntax-cache-info", Fsyntax_cache_info, 0, 1, 0, /* +Return info about the syntax cache in BUFFER. +BUFFER defaults to the current buffer if nil. +*/ + (buffer)) +{ + struct buffer *buf = decode_buffer (buffer, 0); + struct syntax_cache *cache = buf->syntax_cache; + return list4 (cache->start, cache->end, make_int (cache->prev_change), + make_int (cache->next_change)); +} + +#endif /* DEBUG_XEMACS */ + DEFUN ("standard-syntax-table", Fstandard_syntax_table, 0, 0, 0, /* Return the standard syntax table. This is the one used for new buffers. @@ -231,14 +256,160 @@ syntax_table = check_syntax_table (syntax_table, Qnil); buf->syntax_table = syntax_table; buf->mirror_syntax_table = XCHAR_TABLE (syntax_table)->mirror_table; + syntax_cache_table_was_changed (buf); /* Indicate that this buffer now has a specified syntax table. */ buf->local_var_flags |= XINT (buffer_local_flags.syntax_table); return syntax_table; } -/* The current syntax state */ -struct syntax_cache syntax_cache; +static void +init_syntax_cache (struct syntax_cache *cache, Lisp_Object object, + struct buffer *buffer, int infinite) +{ + xzero (*cache); + cache->object = object; + cache->buffer = buffer; + cache->no_syntax_table_prop = 1; + cache->current_syntax_table = + BUFFER_MIRROR_SYNTAX_TABLE (cache->buffer); + cache->start = Qnil; + cache->end = Qnil; + if (infinite) + { + cache->prev_change = EMACS_INT_MIN; + cache->next_change = EMACS_INT_MAX; + } + else + { + cache->prev_change = -1; + cache->next_change = -1; + } +} + +struct syntax_cache * +setup_syntax_cache (struct syntax_cache *cache, Lisp_Object object, + struct buffer *buffer, Charxpos from, int count) +{ + if (BUFFERP (object)) + cache = XBUFFER (object)->syntax_cache; + if (!lookup_syntax_properties) + init_syntax_cache (cache, object, buffer, 1); + else if (!BUFFERP (object)) + init_syntax_cache (cache, object, buffer, 0); + if (lookup_syntax_properties) + { + if (count <= 0) + { + from--; + from = buffer_or_string_clip_to_accessible_byte (cache->object, + from); + } + if (!(from >= cache->prev_change && from < cache->next_change)) + update_syntax_cache (cache, from, count); + } + return cache; +} + +struct syntax_cache * +setup_buffer_syntax_cache (struct buffer *buffer, Charxpos from, int count) +{ + return setup_syntax_cache (NULL, wrap_buffer (buffer), buffer, from, count); +} + +void +mark_buffer_syntax_cache (struct buffer *buf) +{ + struct syntax_cache *cache = buf->syntax_cache; + if (!cache) /* Vbuffer_defaults and such don't have caches */ + return; + mark_object (cache->object); + if (cache->buffer) + mark_object (wrap_buffer (cache->buffer)); + mark_object (cache->current_syntax_table); + mark_object (cache->start); + mark_object (cache->end); +} + +static void +reset_buffer_cache_range (struct syntax_cache *cache, Lisp_Object buffer) +{ + Fset_marker (cache->start, make_int (1), buffer); + Fset_marker (cache->end, make_int (1), buffer); + Fset_marker_insertion_type (cache->start, Qt); + Fset_marker_insertion_type (cache->end, Qnil); + cache->prev_change = -1; + cache->next_change = -1; +} + +void +init_buffer_syntax_cache (struct buffer *buf) +{ + struct syntax_cache *cache; + buf->syntax_cache = xnew_and_zero (struct syntax_cache); + cache = buf->syntax_cache; + cache->object = wrap_buffer (buf); + cache->buffer = buf; + cache->no_syntax_table_prop = 1; + cache->current_syntax_table = BUFFER_MIRROR_SYNTAX_TABLE (cache->buffer); + cache->start = Fmake_marker (); + cache->end = Fmake_marker (); + reset_buffer_cache_range (cache, cache->object); +} + +void +uninit_buffer_syntax_cache (struct buffer *buf) +{ + xfree (buf->syntax_cache); + buf->syntax_cache = 0; +} + + +static void +syntax_cache_table_was_changed (struct buffer *buf) +{ + struct syntax_cache *cache = buf->syntax_cache; + if (cache->no_syntax_table_prop) + cache->current_syntax_table = + BUFFER_MIRROR_SYNTAX_TABLE (buf); +} + +/* The syntax-table property on the range covered by EXTENT may be changing, + either because EXTENT has a syntax-table property and is being attached + or detached (this includes having its endpoints changed), or because + the value of EXTENT's syntax-table property is changing. */ + +void +signal_syntax_table_extent_changed (EXTENT extent) +{ + Lisp_Object buffer = Fextent_object (wrap_extent (extent)); + if (BUFFERP (buffer)) + { + struct syntax_cache *cache = XBUFFER (buffer)->syntax_cache; + Bytexpos start = extent_endpoint_byte (extent, 0); + Bytexpos end = extent_endpoint_byte (extent, 1); + Bytexpos start2 = byte_marker_position (cache->start); + Bytexpos end2 = byte_marker_position (cache->end); + /* If the extent is entirely before or entirely after the cache range, + it doesn't overlap. Otherwise, invalidate the range. */ + if (!(end < start2 || start > end2)) + reset_buffer_cache_range (cache, buffer); + } +} + +/* Extents have been adjusted for insertion or deletion, so we need to + refetch the start and end position of the extent */ +void +signal_syntax_table_extent_adjust (struct buffer *buf) +{ + struct syntax_cache *cache = buf->syntax_cache; + /* If the cache was invalid before, leave it that way. We only want + to update the limits of validity when they were actually valid. */ + if (cache->prev_change < 0) + return; + cache->prev_change = marker_position (cache->start); + cache->next_change = marker_position (cache->end); +} /* Update syntax_cache to an appropriate setting for position POS @@ -255,82 +426,91 @@ whatever is returned by get-char-property. It might be worth it at some point to merge provided syntax tables - outward to the current buffer. */ + outward to the current buffer (#### rewrite in English please?!). */ void -update_syntax_cache (int pos, int count, int init) +update_syntax_cache (struct syntax_cache *cache, Charxpos cpos, int count) { Lisp_Object tmp_table; - - if (init) + Bytexpos pos; + Bytexpos lim; + Bytexpos next, prev; + int at_begin = 0, at_end = 0; + + if (NILP (cache->object)) + return; + + pos = buffer_or_string_charxpos_to_bytexpos (cache->object, cpos); + + tmp_table = get_char_property (pos, Qsyntax_table, cache->object, + EXTENT_AT_AFTER, 0); + lim = next_single_property_change (pos, Qsyntax_table, cache->object, + -1); + if (lim < 0) { - syntax_cache.prev_change = -1; - syntax_cache.next_change = -1; + next = buffer_or_string_absolute_end_byte (cache->object); + at_begin = 1; } + else + next = lim; - if (pos > syntax_cache.prev_change && - pos < syntax_cache.next_change) + if (pos < buffer_or_string_absolute_end_byte (cache->object)) + pos = next_bytexpos (cache->object, pos); + lim = previous_single_property_change (pos, Qsyntax_table, cache->object, + -1); + if (lim < 0) { - /* do nothing */ + prev = buffer_or_string_absolute_begin_byte (cache->object); + at_end = 1; } else - { - if (NILP (syntax_cache.object) || EQ (syntax_cache.object, Qt)) - { - int get_change_before = pos + 1; - - tmp_table = Fget_char_property (make_int(pos), Qsyntax_table, - wrap_buffer (syntax_cache.buffer), Qnil); - syntax_cache.next_change = - XINT (Fnext_extent_change (make_int (pos > 0 ? pos : 1), - wrap_buffer (syntax_cache.buffer))); - - if (get_change_before < 1) - get_change_before = 1; - else if (get_change_before > BUF_ZV (syntax_cache.buffer)) - get_change_before = BUF_ZV (syntax_cache.buffer); - - syntax_cache.prev_change = - XINT (Fprevious_extent_change (make_int (get_change_before), - wrap_buffer (syntax_cache.buffer))); - } - else - { - int get_change_before = pos + 1; + prev = lim; - tmp_table = Fget_char_property (make_int(pos), Qsyntax_table, - syntax_cache.object, Qnil); - syntax_cache.next_change = - XINT (Fnext_extent_change (make_int (pos >= 0 ? pos : 0), - syntax_cache.object)); - - if (get_change_before < 0) - get_change_before = 0; - else if (get_change_before > XSTRING_LENGTH(syntax_cache.object)) - get_change_before = XSTRING_LENGTH(syntax_cache.object); - - syntax_cache.prev_change = - XINT (Fprevious_extent_change (make_int (pos >= 0 ? pos : 0), - syntax_cache.object)); - } - - if (EQ (Fsyntax_table_p (tmp_table), Qt)) - { - syntax_cache.use_code = 0; - syntax_cache.current_syntax_table = - XCHAR_TABLE (tmp_table)->mirror_table; - } - else if (CONSP (tmp_table) && INTP (XCAR (tmp_table))) - { - syntax_cache.use_code = 1; - syntax_cache.syntax_code = XINT (XCAR(tmp_table)); - } - else - { - syntax_cache.use_code = 0; - syntax_cache.current_syntax_table = - syntax_cache.buffer->mirror_syntax_table; - } + cache->prev_change = + buffer_or_string_bytexpos_to_charxpos (cache->object, prev); + cache->next_change = + buffer_or_string_bytexpos_to_charxpos (cache->object, next); + + if (BUFFERP (cache->object)) + { + /* If we are at the beginning or end of buffer, check to see if there's + a zero-length `syntax-table' extent there (highly unlikely); if not, + then we can safely make the end closed, so it will take in newly + inserted text. (If such an extent is inserted, we will be informed + through signal_syntax_table_extent_changed().) */ + Fset_marker (cache->start, make_int (cache->prev_change), cache->object); + Fset_marker_insertion_type + (cache->start, + at_begin && NILP (extent_at (prev, cache->object, Qsyntax_table, + NULL, EXTENT_AT_AT, 0)) + ? Qnil : Qt); + Fset_marker (cache->end, make_int (cache->next_change), cache->object); + Fset_marker_insertion_type + (cache->end, + at_end && NILP (extent_at (next, cache->object, Qsyntax_table, + NULL, EXTENT_AT_AT, 0)) + ? Qt : Qnil); + } + + if (!NILP (Fsyntax_table_p (tmp_table))) + { + cache->use_code = 0; + cache->current_syntax_table = + XCHAR_TABLE (tmp_table)->mirror_table; + cache->no_syntax_table_prop = 0; + } + else if (CONSP (tmp_table) && INTP (XCAR (tmp_table))) + { + cache->use_code = 1; + cache->syntax_code = XINT (XCAR (tmp_table)); + cache->no_syntax_table_prop = 0; + } + else + { + cache->use_code = 0; + cache->no_syntax_table_prop = 1; + cache->current_syntax_table = + BUFFER_MIRROR_SYNTAX_TABLE (cache->buffer); } } @@ -383,16 +563,18 @@ */ (character, syntax_table)) { - Lisp_Char_Table *mirrortab; + Lisp_Object mirrortab; if (NILP (character)) { character = make_char ('\000'); } CHECK_CHAR_COERCE_INT (character); - syntax_table = check_syntax_table (syntax_table, current_buffer->syntax_table); - mirrortab = XCHAR_TABLE (XCHAR_TABLE (syntax_table)->mirror_table); - return make_char (syntax_code_spec[(int) SYNTAX (mirrortab, XCHAR (character))]); + syntax_table = check_syntax_table (syntax_table, + current_buffer->syntax_table); + mirrortab = XCHAR_TABLE (syntax_table)->mirror_table; + return make_char (syntax_code_spec[(int) SYNTAX (mirrortab, + XCHAR (character))]); } #ifdef MULE @@ -401,22 +583,22 @@ charset_syntax (struct buffer *buf, Lisp_Object charset, int *multi_p_out) { *multi_p_out = 1; - /* #### get this right */ + /* !!#### get this right */ return Spunct; } #endif Lisp_Object -syntax_match (Lisp_Object syntax_table, Emchar ch) +syntax_match (Lisp_Object syntax_table, Ichar ch) { - Lisp_Object code = XCHAR_TABLE_VALUE_UNSAFE (syntax_table, ch); + Lisp_Object code = get_char_table (ch, syntax_table); Lisp_Object code2 = code; if (CONSP (code)) code2 = XCAR (code); if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit) - code = XCHAR_TABLE_VALUE_UNSAFE (Vstandard_syntax_table, ch); + code = get_char_table (ch, Vstandard_syntax_table); return CONSP (code) ? XCDR (code) : Qnil; } @@ -428,12 +610,13 @@ */ (character, syntax_table)) { - Lisp_Char_Table *mirrortab; + Lisp_Object mirrortab; int code; CHECK_CHAR_COERCE_INT (character); - syntax_table = check_syntax_table (syntax_table, current_buffer->syntax_table); - mirrortab = XCHAR_TABLE (XCHAR_TABLE (syntax_table)->mirror_table); + syntax_table = check_syntax_table (syntax_table, + current_buffer->syntax_table); + mirrortab = XCHAR_TABLE (syntax_table)->mirror_table; code = SYNTAX (mirrortab, XCHAR (character)); if (code == Sopen || code == Sclose || code == Sstring) return syntax_match (syntax_table, XCHAR (character)); @@ -448,10 +631,8 @@ There is no word boundary between two word-constituent ASCII characters. */ #define WORD_BOUNDARY_P(c1, c2) \ - (!(CHAR_ASCII_P (c1) && CHAR_ASCII_P (c2)) \ + (!(ichar_ascii_p (c1) && ichar_ascii_p (c2)) \ && word_boundary_p (c1, c2)) - -extern int word_boundary_p (Emchar c1, Emchar c2); #endif /* Return the position across COUNT words from FROM. @@ -462,10 +643,9 @@ scan_words (struct buffer *buf, Charbpos from, int count) { Charbpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf); - Emchar ch0, ch1; + Ichar ch0, ch1; enum syntaxcode code; - - SETUP_SYNTAX_CACHE_FOR_BUFFER (buf, from, count); + struct syntax_cache *scache = setup_buffer_syntax_cache (buf, from, count); /* #### is it really worth it to hand expand both cases? JV */ while (count > 0) @@ -477,9 +657,9 @@ if (from == limit) return 0; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); ch0 = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, ch0); + code = SYNTAX_FROM_CACHE (scache, ch0); from++; if (words_include_escapes @@ -493,9 +673,9 @@ while (from != limit) { - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); ch1 = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, ch1); + code = SYNTAX_FROM_CACHE (scache, ch1); if (!(words_include_escapes && (code == Sescape || code == Scharquote))) if (code != Sword @@ -521,9 +701,9 @@ if (from == limit) return 0; - UPDATE_SYNTAX_CACHE_BACKWARD (from - 1); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from - 1); ch1 = BUF_FETCH_CHAR (buf, from - 1); - code = SYNTAX_FROM_CACHE (mirrortab, ch1); + code = SYNTAX_FROM_CACHE (scache, ch1); from--; if (words_include_escapes @@ -537,9 +717,9 @@ while (from != limit) { - UPDATE_SYNTAX_CACHE_BACKWARD (from - 1); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from - 1); ch0 = BUF_FETCH_CHAR (buf, from - 1); - code = SYNTAX_FROM_CACHE (mirrortab, ch0); + code = SYNTAX_FROM_CACHE (scache, ch0); if (!(words_include_escapes && (code == Sescape || code == Scharquote))) @@ -610,7 +790,7 @@ find_start_of_comment (struct buffer *buf, Charbpos from, Charbpos stop, int comstyle) { - Emchar c; + Ichar c; enum syntaxcode code; /* Look back, counting the parity of string-quotes, @@ -623,7 +803,7 @@ which is I+2X quotes from the comment-end. PARITY is current parity of quotes from the comment end. */ int parity = 0; - Emchar my_stringend = 0; + Ichar my_stringend = 0; int string_lossage = 0; Charbpos comment_end = from; Charbpos comstart_pos = 0; @@ -632,6 +812,7 @@ /* mask to match comment styles against; for ST_COMMENT_STYLE, this will get set to SYNTAX_COMMENT_STYLE_B, but never get checked */ int mask = comstyle ? SYNTAX_COMMENT_STYLE_B : SYNTAX_COMMENT_STYLE_A; + struct syntax_cache *scache = buf->syntax_cache; /* At beginning of range to scan, we're outside of strings; that determines quote parity to the comment-end. */ @@ -641,11 +822,11 @@ /* Move back and examine a character. */ from--; - UPDATE_SYNTAX_CACHE_BACKWARD (from); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, c); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); + code = SYNTAX_FROM_CODE (syncode); /* is this a 1-char comment end sequence? if so, try to see if style matches previously extracted mask */ @@ -671,17 +852,18 @@ if (SYNTAX_CODE_END_SECOND_P (syncode)) { int prev_syncode; - UPDATE_SYNTAX_CACHE_BACKWARD (from - 1); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from - 1); prev_syncode = - SYNTAX_CODE_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, from - 1)); + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from - 1)); if (SYNTAX_CODES_END_P (prev_syncode, syncode)) { code = Sendcomment; styles_match_p = - SYNTAX_CODES_COMMENT_MASK_END (prev_syncode, syncode) & mask; + SYNTAX_CODES_COMMENT_MASK_END (prev_syncode, + syncode) & mask; from--; - UPDATE_SYNTAX_CACHE_BACKWARD (from); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); /* Found a comment-end sequence, so skip past the @@ -694,17 +876,18 @@ if (SYNTAX_CODE_START_SECOND_P (syncode)) { int prev_syncode; - UPDATE_SYNTAX_CACHE_BACKWARD (from - 1); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from - 1); prev_syncode = - SYNTAX_CODE_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, from - 1)); + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from - 1)); if (SYNTAX_CODES_START_P (prev_syncode, syncode)) { code = Scomment; styles_match_p = - SYNTAX_CODES_COMMENT_MASK_START (prev_syncode, syncode) & mask; + SYNTAX_CODES_COMMENT_MASK_START (prev_syncode, + syncode) & mask; from--; - UPDATE_SYNTAX_CACHE_BACKWARD (from); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); } } @@ -784,19 +967,21 @@ else /* We can't grok this as a comment; scan it normally. */ from = comment_end; - UPDATE_SYNTAX_CACHE_FORWARD (from - 1); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from - 1); } return from; } static Charbpos -find_end_of_comment (struct buffer *buf, Charbpos from, Charbpos stop, int comstyle) +find_end_of_comment (struct buffer *buf, Charbpos from, Charbpos stop, + int comstyle) { int c; int prev_code; /* mask to match comment styles against; for ST_COMMENT_STYLE, this will get set to SYNTAX_COMMENT_STYLE_B, but never get checked */ int mask = comstyle ? SYNTAX_COMMENT_STYLE_B : SYNTAX_COMMENT_STYLE_A; + struct syntax_cache *scache = buf->syntax_cache; /* This is only called by functions which have already set up the syntax_cache and are keeping it up-to-date */ @@ -807,16 +992,16 @@ return -1; } - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); /* Test for generic comments */ if (comstyle == ST_COMMENT_STYLE) { - if (SYNTAX_FROM_CACHE (mirrortab, c) == Scomment_fence) + if (SYNTAX_FROM_CACHE (scache, c) == Scomment_fence) { from++; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); break; } from++; @@ -825,25 +1010,25 @@ } else - if (SYNTAX_FROM_CACHE (mirrortab, c) == Sendcomment + if (SYNTAX_FROM_CACHE (scache, c) == Sendcomment && SYNTAX_CODE_MATCHES_1CHAR_P - (SYNTAX_CODE_FROM_CACHE (mirrortab, c), mask)) + (SYNTAX_CODE_FROM_CACHE (scache, c), mask)) /* we have encountered a comment end of the same style as the comment sequence which began this comment section */ { from++; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); break; } - prev_code = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + prev_code = SYNTAX_CODE_FROM_CACHE (scache, c); from++; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); if (from < stop && SYNTAX_CODES_MATCH_END_P (prev_code, - SYNTAX_CODE_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, from)), + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from)), mask) ) @@ -852,7 +1037,7 @@ section */ { from++; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); break; } } @@ -880,12 +1065,13 @@ { Charbpos from; Charbpos stop; - Emchar c; + Ichar c; enum syntaxcode code; int syncode; EMACS_INT n; struct buffer *buf = decode_buffer (buffer, 0); - + struct syntax_cache *scache; + if (NILP (count)) n = 1; else @@ -896,7 +1082,7 @@ from = BUF_PT (buf); - SETUP_SYNTAX_CACHE (from, n); + scache = setup_buffer_syntax_cache (buf, from, n); while (n > 0) { QUIT; @@ -912,10 +1098,10 @@ continue; } - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, c); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); + code = SYNTAX_FROM_CODE (syncode); if (code == Scomment) { @@ -939,10 +1125,9 @@ && SYNTAX_CODE_START_FIRST_P (syncode)) { int next_syncode; - UPDATE_SYNTAX_CACHE_FORWARD (from + 1); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from + 1); next_syncode = - SYNTAX_CODE_FROM_CACHE (mirrortab, - BUF_FETCH_CHAR (buf, from + 1)); + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from + 1)); if (SYNTAX_CODES_START_P (syncode, next_syncode)) { @@ -961,7 +1146,8 @@ if (code == Scomment) { - Charbpos newfrom = find_end_of_comment (buf, from, stop, comstyle); + Charbpos newfrom = find_end_of_comment (buf, from, stop, + comstyle); if (newfrom < 0) { /* we stopped because from==stop */ @@ -1004,8 +1190,8 @@ } c = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, c); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); + code = SYNTAX_FROM_CODE (syncode); if (code == Sendcomment) { @@ -1026,10 +1212,9 @@ && SYNTAX_CODE_END_SECOND_P (syncode)) { int prev_syncode; - UPDATE_SYNTAX_CACHE_BACKWARD (from - 1); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from - 1); prev_syncode = - SYNTAX_CODE_FROM_CACHE (mirrortab, - BUF_FETCH_CHAR (buf, from - 1)); + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from - 1)); if (SYNTAX_CODES_END_P (prev_syncode, syncode)) { /* We must record the comment style encountered so that @@ -1070,16 +1255,17 @@ int sexpflag, int noerror) { Charbpos stop; - Emchar c; + Ichar c; int quoted; int mathexit = 0; enum syntaxcode code; int syncode; int min_depth = depth; /* Err out if depth gets less than this. */ - + struct syntax_cache *scache; + if (depth > 0) min_depth = 0; - SETUP_SYNTAX_CACHE_FOR_BUFFER (buf, from, count); + scache = setup_buffer_syntax_cache (buf, from, count); while (count > 0) { QUIT; @@ -1089,10 +1275,10 @@ { int comstyle = 0; /* mask for finding matching comment style */ - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, c); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); + code = SYNTAX_FROM_CODE (syncode); from++; /* a 1-char comment start sequence */ @@ -1108,24 +1294,24 @@ && parse_sexp_ignore_comments) { int next_syncode; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); next_syncode = - SYNTAX_CODE_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, from)); + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from)); if (SYNTAX_CODES_START_P (syncode, next_syncode)) { - /* we have encountered a comment start sequence and we - are ignoring all text inside comments. we must record - the comment style this sequence begins so that later, - only a comment end of the same style actually ends - the comment section */ - code = Scomment; + /* we have encountered a comment start sequence and we + are ignoring all text inside comments. we must record + the comment style this sequence begins so that later, + only a comment end of the same style actually ends + the comment section */ + code = Scomment; comstyle = SYNTAX_CODES_COMMENT_MASK_START (syncode, next_syncode) == SYNTAX_COMMENT_STYLE_A ? 0 : 1; - from++; - } + from++; + } } - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); if (SYNTAX_CODE_PREFIX (syncode)) continue; @@ -1143,9 +1329,8 @@ /* This word counts as a sexp; return at end of it. */ while (from < stop) { - UPDATE_SYNTAX_CACHE_FORWARD (from); - switch (SYNTAX_FROM_CACHE (mirrortab, - BUF_FETCH_CHAR (buf, from))) + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); + switch (SYNTAX_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from))) { case Scharquote: case Sescape: @@ -1168,7 +1353,7 @@ case Scomment: if (!parse_sexp_ignore_comments) break; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); { Charbpos newfrom = find_end_of_comment (buf, from, stop, comstyle); @@ -1207,21 +1392,22 @@ { if (noerror) return Qnil; - signal_error (Qsyntax_error, "Containing expression ends prematurely", Qunbound); + syntax_error ("Containing expression ends prematurely", + Qunbound); } break; case Sstring_fence: case Sstring: { - Emchar stringterm; + Ichar stringterm; if (code != Sstring_fence) { - /* XEmacs change: call syntax_match on character */ - Emchar ch = BUF_FETCH_CHAR (buf, from - 1); + /* XEmacs change: call syntax_match on character */ + Ichar ch = BUF_FETCH_CHAR (buf, from - 1); Lisp_Object stermobj = - syntax_match (syntax_cache.current_syntax_table, ch); + syntax_match (scache->current_syntax_table, ch); if (CHARP (stermobj)) stringterm = XCHAR (stermobj); @@ -1235,14 +1421,14 @@ { if (from >= stop) goto lose; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); if (code == Sstring ? c == stringterm - : SYNTAX_FROM_CACHE (mirrortab, c) == Sstring_fence) + : SYNTAX_FROM_CACHE (scache, c) == Sstring_fence) break; - switch (SYNTAX_FROM_CACHE (mirrortab, c)) + switch (SYNTAX_FROM_CACHE (scache, c)) { case Scharquote: case Sescape: @@ -1284,17 +1470,17 @@ int comstyle = 0; /* mask for finding matching comment style */ from--; - UPDATE_SYNTAX_CACHE_BACKWARD (from); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from); quoted = char_quoted (buf, from); if (quoted) { from--; - UPDATE_SYNTAX_CACHE_BACKWARD (from); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from); } c = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, c); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); + code = SYNTAX_FROM_CODE (syncode); if (code == Sendcomment && parse_sexp_ignore_comments) { @@ -1311,9 +1497,9 @@ && parse_sexp_ignore_comments) { int prev_syncode; - UPDATE_SYNTAX_CACHE_BACKWARD (from - 1); - prev_syncode = SYNTAX_CODE_FROM_CACHE - (mirrortab, BUF_FETCH_CHAR (buf, from - 1)); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from - 1); + prev_syncode = + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from - 1)); if (SYNTAX_CODES_END_P (prev_syncode, syncode)) { @@ -1339,15 +1525,15 @@ passing it. */ while (from > stop) { - UPDATE_SYNTAX_CACHE_BACKWARD (from); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from); quoted = char_quoted (buf, from - 1); if (quoted) from--; if (! (quoted || (syncode = - SYNTAX_FROM_CACHE (mirrortab, - BUF_FETCH_CHAR (buf, from - 1))) + SYNTAX_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, + from - 1))) == Sword || syncode == Ssymbol || syncode == Squote)) @@ -1379,7 +1565,8 @@ { if (noerror) return Qnil; - signal_error (Qsyntax_error, "Containing expression ends prematurely", Qunbound); + syntax_error ("Containing expression ends prematurely", + Qunbound); } break; @@ -1393,14 +1580,14 @@ case Sstring_fence: case Sstring: { - Emchar stringterm; + Ichar stringterm; if (code != Sstring_fence) { /* XEmacs change: call syntax_match() on character */ - Emchar ch = BUF_FETCH_CHAR (buf, from); + Ichar ch = BUF_FETCH_CHAR (buf, from); Lisp_Object stermobj = - syntax_match (syntax_cache.current_syntax_table, ch); + syntax_match (scache->current_syntax_table, ch); if (CHARP (stermobj)) stringterm = XCHAR (stermobj); @@ -1414,12 +1601,12 @@ { if (from == stop) goto lose; - UPDATE_SYNTAX_CACHE_BACKWARD (from - 1); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, from - 1); c = BUF_FETCH_CHAR (buf, from - 1); if ((code == Sstring ? c == stringterm - : SYNTAX_FROM_CACHE (mirrortab, c) == Sstring_fence) + : SYNTAX_FROM_CACHE (scache, c) == Sstring_fence) && !char_quoted (buf, from - 1)) { break; @@ -1449,7 +1636,7 @@ lose: if (!noerror) - signal_error (Qsyntax_error, "Unbalanced parentheses", Qunbound); + syntax_error ("Unbalanced parentheses", Qunbound); return Qnil; } @@ -1460,11 +1647,12 @@ Charbpos beg = BUF_BEGV (buf); int quoted = 0; Charbpos startpos = pos; + struct syntax_cache *scache = buf->syntax_cache; while (pos > beg) { - UPDATE_SYNTAX_CACHE_BACKWARD (pos - 1); - code = SYNTAX_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, pos - 1)); + UPDATE_SYNTAX_CACHE_BACKWARD (scache, pos - 1); + code = SYNTAX_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, pos - 1)); if (code != Scharquote && code != Sescape) break; @@ -1472,7 +1660,7 @@ quoted = !quoted; } - UPDATE_SYNTAX_CACHE (startpos); + UPDATE_SYNTAX_CACHE (scache, startpos); return quoted; } @@ -1548,18 +1736,15 @@ struct buffer *buf = decode_buffer (buffer, 0); Charbpos beg = BUF_BEGV (buf); Charbpos pos = BUF_PT (buf); -#ifndef emacs - Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); -#endif - Emchar c = '\0'; /* initialize to avoid compiler warnings */ - - - SETUP_SYNTAX_CACHE_FOR_BUFFER (buf, pos, -1); + Ichar c = '\0'; /* initialize to avoid compiler warnings */ + struct syntax_cache *scache; + + scache = setup_buffer_syntax_cache (buf, pos, -1); while (pos > beg && !char_quoted (buf, pos - 1) /* Previous statement updates syntax table. */ - && (SYNTAX_FROM_CACHE (mirrortab, c = BUF_FETCH_CHAR (buf, pos - 1)) == Squote - || SYNTAX_CODE_PREFIX (SYNTAX_CODE_FROM_CACHE (mirrortab, c)))) + && (SYNTAX_FROM_CACHE (scache, c = BUF_FETCH_CHAR (buf, pos - 1)) == Squote + || SYNTAX_CODE_PREFIX (SYNTAX_CODE_FROM_CACHE (scache, c)))) pos--; BUF_SET_PT (buf, pos); @@ -1594,8 +1779,9 @@ int start_quoted = 0; /* Nonzero means starting after a char quote */ int boundary_stop = commentstop == -1; Lisp_Object tem; - - SETUP_SYNTAX_CACHE (from, 1); + struct syntax_cache *scache; + + scache = setup_buffer_syntax_cache (buf, from, 1); if (NILP (oldstate)) { depth = 0; @@ -1651,7 +1837,8 @@ { curlevel->last = XINT (Fcar (tem)); if (++curlevel == endlevel) - signal_error (Qstack_overflow, "Nesting too deep for parser", Qunbound); + stack_overflow ("Nesting too deep for parser", + make_int (curlevel - levelstart)); curlevel->prev = -1; curlevel->last = -1; tem = Fcdr (tem); @@ -1675,15 +1862,15 @@ while (from < end) { - Emchar c; + Ichar c; int syncode; QUIT; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); - code = SYNTAX_FROM_CACHE (mirrortab, c); - syncode = SYNTAX_CODE_FROM_CACHE (mirrortab, c); + syncode = SYNTAX_CODE_FROM_CACHE (scache, c); + code = SYNTAX_FROM_CODE (syncode); from++; /* record the comment style we have entered so that only the @@ -1709,9 +1896,9 @@ SYNTAX_CODE_START_FIRST_P (syncode)) { int next_syncode; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); next_syncode = - SYNTAX_CODE_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, from)); + SYNTAX_CODE_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from)); if (SYNTAX_CODES_START_P (syncode, next_syncode)) { @@ -1720,7 +1907,7 @@ (syncode, next_syncode) == SYNTAX_COMMENT_STYLE_A ? 0 : 1; state.comstr_start = from - 1; from++; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); } } @@ -1744,8 +1931,8 @@ symstarted: while (from < end) { - UPDATE_SYNTAX_CACHE_FORWARD (from); - switch (SYNTAX_FROM_CACHE (mirrortab, BUF_FETCH_CHAR (buf, from))) + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); + switch (SYNTAX_FROM_CACHE (scache, BUF_FETCH_CHAR (buf, from))) { case Scharquote: case Sescape: @@ -1771,9 +1958,10 @@ startincomment: if (commentstop == 1) goto done; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); { - Charbpos newfrom = find_end_of_comment (buf, from, end, state.comstyle); + Charbpos newfrom = find_end_of_comment (buf, from, end, + state.comstyle); if (newfrom < 0) { /* we terminated search because from == end */ @@ -1793,7 +1981,8 @@ /* curlevel++->last ran into compiler bug on Apollo */ curlevel->last = from - 1; if (++curlevel == endlevel) - signal_error (Qstack_overflow, "Nesting too deep for parser", Qunbound); + stack_overflow ("Nesting too deep for parser", + make_int (curlevel - levelstart)); curlevel->prev = -1; curlevel->last = -1; if (targetdepth == depth) goto done; @@ -1821,9 +2010,9 @@ else { /* XEmacs change: call syntax_match() on character */ - Emchar ch = BUF_FETCH_CHAR (buf, from - 1); + Ichar ch = BUF_FETCH_CHAR (buf, from - 1); Lisp_Object stermobj = - syntax_match (syntax_cache.current_syntax_table, ch); + syntax_match (scache->current_syntax_table, ch); if (CHARP (stermobj)) state.instring = XCHAR (stermobj); @@ -1838,9 +2027,9 @@ if (from >= end) goto done; - UPDATE_SYNTAX_CACHE_FORWARD (from); + UPDATE_SYNTAX_CACHE_FORWARD (scache, from); c = BUF_FETCH_CHAR (buf, from); - temp_code = SYNTAX_FROM_CACHE (mirrortab, c); + temp_code = SYNTAX_FROM_CACHE (scache, c); if ( state.instring != ST_STRING_STYLE && @@ -1940,6 +2129,8 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. If it is `syntax-table', stop after the start of a comment or a string, or after the end of a comment or string. +Seventh arg BUFFER specifies the buffer to do the parsing in, and defaults +to the current buffer. */ (from, to, targetdepth, stopbefore, oldstate, commentstop, buffer)) { @@ -1978,8 +2169,10 @@ ? Qnil : (state.instring == ST_STRING_STYLE ? Qt : make_int (state.instring)), val); - val = Fcons (state.thislevelstart < 0 ? Qnil : make_int (state.thislevelstart), val); - val = Fcons (state.prevlevelstart < 0 ? Qnil : make_int (state.prevlevelstart), val); + val = Fcons (state.thislevelstart < 0 ? Qnil : + make_int (state.thislevelstart), val); + val = Fcons (state.prevlevelstart < 0 ? Qnil : + make_int (state.prevlevelstart), val); val = Fcons (make_int (state.depth), val); return val; @@ -2002,45 +2195,92 @@ syntax table as well. */ -struct cmst_arg +static int +copy_to_mirrortab (struct chartab_range *range, Lisp_Object table, + Lisp_Object val, void *arg) +{ + Lisp_Object mirrortab = VOID_TO_LISP (arg); + + if (CONSP (val)) + val = XCAR (val); + if (SYNTAX_FROM_CODE (XINT (val)) != Sinherit) + put_char_table (mirrortab, range, val); + return 0; +} + +struct cinap { Lisp_Object mirrortab; - int check_inherit; + Lisp_Object bogus; }; static int -cmst_mapfun (struct chartab_range *range, Lisp_Object val, void *arg) +copy_if_not_already_present (struct chartab_range *range, Lisp_Object table, + Lisp_Object val, void *arg) { - struct cmst_arg *closure = (struct cmst_arg *) arg; + struct cinap *a = (struct cinap *) arg; if (CONSP (val)) val = XCAR (val); - if (SYNTAX_FROM_CODE (XINT (val)) == Sinherit - && closure->check_inherit) + if (SYNTAX_FROM_CODE (XINT (val)) != Sinherit) { - struct cmst_arg recursive; - - recursive.mirrortab = closure->mirrortab; - recursive.check_inherit = 0; - map_char_table (XCHAR_TABLE (Vstandard_syntax_table), range, - cmst_mapfun, &recursive); + Lisp_Object existing = + get_range_char_table (range, a->mirrortab, a->bogus); + if (NILP (existing)) + /* nothing at all */ + put_char_table (a->mirrortab, range, val); + else if (!EQ (existing, a->bogus)) + /* full */ + ; + else + { + Freset_char_table (Vtemp_table_for_use_updating_syntax_tables); + copy_char_table_range + (a->mirrortab, + Vtemp_table_for_use_updating_syntax_tables, + range); + put_char_table (a->mirrortab, range, val); + copy_char_table_range + (Vtemp_table_for_use_updating_syntax_tables, + a->mirrortab, range); + } } - else - put_char_table (XCHAR_TABLE (closure->mirrortab), range, val); + return 0; } static void -update_just_this_syntax_table (Lisp_Char_Table *ct) +update_just_this_syntax_table (Lisp_Object table) { struct chartab_range range; - struct cmst_arg arg; + Lisp_Object mirrortab = XCHAR_TABLE (table)->mirror_table; - arg.mirrortab = ct->mirror_table; - arg.check_inherit = (CHAR_TABLEP (Vstandard_syntax_table) - && ct != XCHAR_TABLE (Vstandard_syntax_table)); range.type = CHARTAB_RANGE_ALL; - map_char_table (ct, &range, cmst_mapfun, &arg); + Freset_char_table (mirrortab); + /* First, copy the tables values other than inherit into the mirror + table. Then, for tables other than the standard syntax table, map + over the standard table, copying values into the mirror table only if + entries don't already exist in that table. (The copying step requires + another mapping.) + */ + + map_char_table (table, &range, copy_to_mirrortab, LISP_TO_VOID (mirrortab)); + /* second clause catches bootstrapping problems when initializing the + standard syntax table */ + if (!EQ (table, Vstandard_syntax_table) && !NILP (Vstandard_syntax_table)) + { + struct cinap cinap; + struct gcpro gcpro1; + cinap.mirrortab = mirrortab; + /* Something that won't be in the table. */ + cinap.bogus = make_float (0.0); + GCPRO1 (cinap.bogus); + map_char_table (Vstandard_syntax_table, &range, + copy_if_not_already_present, &cinap); + UNGCPRO; + } + /* The resetting made the default be Qnil. Put it back to Spunct. */ + set_char_table_default (mirrortab, make_int (Spunct)); } /* Called from chartab.c when a change is made to a syntax table. @@ -2049,20 +2289,18 @@ one. */ void -update_syntax_table (Lisp_Char_Table *ct) +update_syntax_table (Lisp_Object table) { - /* Don't be stymied at startup. */ - if (CHAR_TABLEP (Vstandard_syntax_table) - && ct == XCHAR_TABLE (Vstandard_syntax_table)) + if (EQ (table, Vstandard_syntax_table)) { Lisp_Object syntab; for (syntab = Vall_syntax_tables; !NILP (syntab); syntab = XCHAR_TABLE (syntab)->next_table) - update_just_this_syntax_table (XCHAR_TABLE (syntab)); + update_just_this_syntax_table (syntab); } else - update_just_this_syntax_table (ct); + update_just_this_syntax_table (table); } @@ -2078,6 +2316,10 @@ DEFSUBR (Fsyntax_table_p); DEFSUBR (Fsyntax_table); +#ifdef DEBUG_XEMACS + DEFSUBR (Fmirror_syntax_table); + DEFSUBR (Fsyntax_cache_info); +#endif /* DEBUG_XEMACS */ DEFSUBR (Fstandard_syntax_table); DEFSUBR (Fcopy_syntax_table); DEFSUBR (Fset_syntax_table); @@ -2105,11 +2347,15 @@ parse_sexp_ignore_comments = 0; DEFVAR_BOOL ("lookup-syntax-properties", &lookup_syntax_properties /* -Non-nil means `forward-sexp', etc., grant `syntax-table' property. +Non-nil means `forward-sexp', etc., respect the `syntax-table' property. +This property can be placed on buffers or strings and can be used to explicitly +specify the syntax table to be used for looking up the syntax of the chars +having this property, or to directly specify the syntax of the chars. + The value of this property should be either a syntax table, or a cons of the form (SYNTAXCODE . MATCHCHAR), SYNTAXCODE being the numeric syntax code, MATCHCHAR being nil or the character to match (which is -relevant only for open/close type. +relevant only when the syntax code is open/close-type). */ ); lookup_syntax_properties = 1; @@ -2131,7 +2377,7 @@ void complex_vars_of_syntax (void) { - Emchar i; + Ichar i; const char *p; /* Set this now, so first buffer creation can refer to it. */ /* Make it nil before calling copy-syntax-table @@ -2140,11 +2386,14 @@ Vstandard_syntax_table = Fcopy_syntax_table (Qnil); staticpro (&Vstandard_syntax_table); + Vtemp_table_for_use_updating_syntax_tables = Fmake_char_table (Qgeneric); + staticpro (&Vtemp_table_for_use_updating_syntax_tables); + Vsyntax_designator_chars_string = make_string_nocopy (syntax_code_spec, Smax); staticpro (&Vsyntax_designator_chars_string); - fill_char_table (XCHAR_TABLE (Vstandard_syntax_table), make_int (Spunct)); + set_char_table_default (Vstandard_syntax_table, make_int (Spunct)); for (i = 0; i <= 32; i++) /* Control 0 plus SPACE */ Fput_char_table (make_char (i), make_int (Swhitespace), diff --text -u 'xemacs-21.5.6/src/syntax.h' 'xemacs-21.5.7/src/syntax.h' Index: ././src/syntax.h --- ././src/syntax.h Fri Mar 29 13:48:38 2002 +++ ././src/syntax.h Wed Jun 5 18:57:15 2002 @@ -74,25 +74,16 @@ /* Return the syntax code for a particular character and mirror table. */ -#define SYNTAX_CODE_UNSAFE(table, c) \ - XINT (CHAR_TABLE_VALUE_UNSAFE (table, c)) - -INLINE_HEADER int SYNTAX_CODE (Lisp_Char_Table *table, Emchar c); -INLINE_HEADER int -SYNTAX_CODE (Lisp_Char_Table *table, Emchar c) -{ - return SYNTAX_CODE_UNSAFE (table, c); -} - -#define SYNTAX_UNSAFE(table, c) \ - ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177)) +#define SYNTAX_CODE(table, c) XINT (get_char_table (c, table)) #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177)) + #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c)) -INLINE_HEADER int WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c); -INLINE_HEADER int -WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c) +DECLARE_INLINE_HEADER ( +int +WORD_SYNTAX_P (Lisp_Object table, Ichar c) +) { return SYNTAX (table, c) == Sword; } @@ -136,8 +127,6 @@ /* The prefix flag bit for backward-prefix-chars is now put into bit 7. */ -#define SYNTAX_PREFIX_UNSAFE(table, c) \ - ((SYNTAX_CODE_UNSAFE (table, c) >> 7) & 1) #define SYNTAX_PREFIX(table, c) \ ((SYNTAX_CODE (table, c) >> 7) & 1) @@ -175,6 +164,9 @@ #define SYNTAX_SECOND_CHAR_END 0x03 #define SYNTAX_SECOND_CHAR 0x33 +#if 0 + +/* #### Entirely unused. Should they be deleted? */ /* #### These are now more or less equivalent to SYNTAX_COMMENT_MATCH_START ...*/ @@ -232,12 +224,7 @@ ? SYNTAX_COMMENT_STYLE_B \ : 0))) -EXFUN (Fchar_syntax, 2); -EXFUN (Fforward_word, 2); - -/* The standard syntax table is stored where it will automatically - be used in all new buffers. */ -extern Lisp_Object Vstandard_syntax_table; +#endif /* 0 */ /* This array, indexed by a character, contains the syntax code which that character signifies (as a char). @@ -255,164 +242,116 @@ /* NOTE: This does not refer to the mirror table, but to the syntax table itself. */ -Lisp_Object syntax_match (Lisp_Object table, Emchar ch); +Lisp_Object syntax_match (Lisp_Object table, Ichar ch); extern int no_quit_in_re_search; -extern struct buffer *regex_emacs_buffer; - -/* This is the string or buffer in which we are matching. It is used - for looking up syntax properties. */ -extern Lisp_Object regex_match_object; -void update_syntax_table (Lisp_Char_Table *ct); +void update_syntax_table (Lisp_Object table); -#ifdef emacs + +/****************************** syntax caches ********************************/ extern int lookup_syntax_properties; +/* Now that the `syntax-table' property exists, and can override the syntax + table or directly specify the syntax, we cache the last place we + retrieved the syntax-table property. This is because, when moving + linearly through text (e.g. in the regex routines or the scanning + routines in syntax.c), we only need to recalculate at the next place the + syntax-table property changes (i.e. not every position), and when we do + need to recalculate, we can update the info from the previous info + faster than if we did the whole calculation from scratch. */ struct syntax_cache { - int use_code; /* Whether to use syntax_code - or current_syntax_table. */ - struct buffer* buffer; /* The buffer the current syntax cache - applies to. */ + int use_code; /* Whether to use syntax_code or + current_syntax_table. This is + set depending on whether the + syntax-table property is a + syntax table or a syntax + code. */ + int no_syntax_table_prop; /* If non-zero, there was no + `syntax-table' property on the + current range, and so we're + using the buffer's syntax table. + This is important to note because + sometimes the buffer's syntax + table can be changed. */ Lisp_Object object; /* The buffer or string the current - syntax cache applies to. */ + syntax cache applies to, or + Qnil for a string of text not + coming from a buffer or string. */ + struct buffer *buffer; /* The buffer that supplies the + syntax tables, or 0 for the + standard syntax table. If + OBJECT is a buffer, this will + always be the same buffer. */ int syntax_code; /* Syntax code of current char. */ Lisp_Object current_syntax_table; /* Syntax table for current pos. */ - Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ - - Charbpos next_change; /* Position of the next extent + Lisp_Object start, end; /* Markers to keep track of the + known region in a buffer. + Formerly we used an internal + extent, but it seems that having + an extent over the entire buffer + causes serious slowdowns in + extent operations! Yuck! */ + Charxpos next_change; /* Position of the next extent change. */ - Charbpos prev_change; /* Position of the previous - extent change. */ + Charxpos prev_change; /* Position of the previous extent + change. */ }; -extern struct syntax_cache syntax_cache; -void update_syntax_cache (int pos, int count, int init); +/* Note that the external interface to the syntax-cache uses charpos's, but + intnernally we use bytepos's, for speed. */ + +void update_syntax_cache (struct syntax_cache *cache, Charxpos pos, int count); +struct syntax_cache *setup_syntax_cache (struct syntax_cache *cache, + Lisp_Object object, + struct buffer *buffer, + Charxpos from, int count); +struct syntax_cache *setup_buffer_syntax_cache (struct buffer *buffer, + Charxpos from, int count); /* Make syntax cache state good for CHARPOS, assuming it is currently good for a position before CHARPOS. */ -#define UPDATE_SYNTAX_CACHE_FORWARD(pos) \ - (lookup_syntax_properties \ - ? (update_syntax_cache ((pos), 1, 0), 1) \ - : 0) +DECLARE_INLINE_HEADER ( +void +UPDATE_SYNTAX_CACHE_FORWARD (struct syntax_cache *cache, Charxpos pos) +) +{ + if (!(pos >= cache->prev_change && pos < cache->next_change)) + update_syntax_cache (cache, pos, 1); +} /* Make syntax cache state good for CHARPOS, assuming it is currently good for a position after CHARPOS. */ -#define UPDATE_SYNTAX_CACHE_BACKWARD(pos) \ - (lookup_syntax_properties \ - ? (update_syntax_cache ((pos), -1, 0), 1) \ - : 0) +DECLARE_INLINE_HEADER ( +void +UPDATE_SYNTAX_CACHE_BACKWARD (struct syntax_cache *cache, Charxpos pos) +) +{ + if (!(pos >= cache->prev_change && pos < cache->next_change)) + update_syntax_cache (cache, pos, -1); +} /* Make syntax cache state good for CHARPOS */ -#define UPDATE_SYNTAX_CACHE(pos) \ - (lookup_syntax_properties \ - ? (update_syntax_cache ((pos), 0, 0), 1) \ - : 0) - -#define SYNTAX_FROM_CACHE(table, c) \ - SYNTAX_FROM_CODE (SYNTAX_CODE_FROM_CACHE (table, c)) - -#define SYNTAX_CODE_FROM_CACHE(table, c) \ - ( syntax_cache.use_code \ - ? syntax_cache.syntax_code \ - : SYNTAX_CODE (XCHAR_TABLE (syntax_cache.current_syntax_table), \ - c) \ - ) - -/* Convert the byte offset BYTEPOS into a character position, - for the object recorded in syntax_cache with SETUP_SYNTAX_TABLE_FOR_OBJECT. - - The value is meant for use in the UPDATE_SYNTAX_TABLE... macros. - These macros do nothing when parse_sexp_lookup_properties is 0, - so we return 0 in that case, for speed. */ -#define SYNTAX_CACHE_BYTE_TO_CHAR(bytepos) \ - (! lookup_syntax_properties \ - ? 0 \ - : STRINGP (syntax_cache.object) \ - ? string_index_byte_to_char (syntax_cache.object, bytepos) \ - : (BUFFERP (syntax_cache.object) || NILP (syntax_cache.object)) \ - ? bytebpos_to_charbpos (syntax_cache.buffer, \ - bytepos + BI_BUF_BEGV (syntax_cache.buffer)) \ - : (bytepos)) - -#define SYNTAX_CACHE_OBJECT_BYTE_TO_CHAR(obj, buf, bytepos) \ - (! lookup_syntax_properties \ - ? 0 \ - : STRINGP (obj) \ - ? string_index_byte_to_char (obj, bytepos) \ - : (BUFFERP (obj) || NILP (obj)) \ - ? bytebpos_to_charbpos (buf, bytepos + BI_BUF_BEGV (buf)) \ - : (bytepos)) - -#else /* not emacs */ - -#define update_syntax_cache(pos, count, init) -#define UPDATE_SYNTAX_CACHE_FORWARD(pos) -#define UPDATE_SYNTAX_CACHE_BACKWARD(pos) -#define UPDATE_SYNTAX_CACHE(pos) -#define SYNTAX_FROM_CACHE SYNTAX -#define SYNTAX_CODE_FROM_CACHE SYNTAX_CODE - -#endif /* emacs */ - -#define SETUP_SYNTAX_CACHE(FROM, COUNT) \ - do { \ - syntax_cache.buffer = current_buffer; \ - syntax_cache.object = Qnil; \ - syntax_cache.current_syntax_table \ - = current_buffer->mirror_syntax_table; \ - syntax_cache.use_code = 0; \ - if (lookup_syntax_properties) \ - update_syntax_cache ((COUNT) > 0 ? (FROM) : (FROM) - 1, \ - (COUNT), 1); \ - } while (0) - -#define SETUP_SYNTAX_CACHE_FOR_BUFFER(BUFFER, FROM, COUNT) \ - do { \ - syntax_cache.buffer = (BUFFER); \ - syntax_cache.object = Qnil; \ - syntax_cache.current_syntax_table = \ - syntax_cache.buffer->mirror_syntax_table; \ - syntax_cache.use_code = 0; \ - if (lookup_syntax_properties) \ - update_syntax_cache ((FROM) + ((COUNT) > 0 ? 0 : -1), \ - (COUNT), 1); \ - } while (0) - -#define SETUP_SYNTAX_CACHE_FOR_OBJECT(OBJECT, BUFFER, FROM, COUNT) \ - do { \ - syntax_cache.buffer = (BUFFER); \ - syntax_cache.object = (OBJECT); \ - if (NILP (syntax_cache.object)) \ - { \ - /* do nothing */; \ - } \ - else if (EQ (syntax_cache.object, Qt)) \ - { \ - /* do nothing */; \ - } \ - else if (STRINGP (syntax_cache.object)) \ - { \ - /* do nothing */; \ - } \ - else if (BUFFERP (syntax_cache.object)) \ - { \ - syntax_cache.buffer = XBUFFER (syntax_cache.object); \ - } \ - else \ - { \ - /* OBJECT must be buffer/string/t/nil */ \ - assert(0); \ - } \ - syntax_cache.current_syntax_table \ - = syntax_cache.buffer->mirror_syntax_table; \ - syntax_cache.use_code = 0; \ - if (lookup_syntax_properties) \ - update_syntax_cache ((FROM) + ((COUNT) > 0 ? 0 : -1), \ - (COUNT), 1); \ - } while (0) +DECLARE_INLINE_HEADER ( +void +UPDATE_SYNTAX_CACHE (struct syntax_cache *cache, Charxpos pos) +) +{ + if (!(pos >= cache->prev_change && pos < cache->next_change)) + update_syntax_cache (cache, pos, 0); +} + +#define SYNTAX_FROM_CACHE(cache, c) \ + SYNTAX_FROM_CODE (SYNTAX_CODE_FROM_CACHE (cache, c)) + +#define SYNTAX_CODE_FROM_CACHE(cache, c) \ + ((cache)->use_code ? (cache)->syntax_code \ + : SYNTAX_CODE ((cache)->current_syntax_table, c)) + + +/***************************** syntax code macros ****************************/ #define SYNTAX_CODE_PREFIX(c) \ ((c >> 7) & 1) diff --text -u 'xemacs-21.5.6/src/sysdep.c' 'xemacs-21.5.7/src/sysdep.c' Index: ././src/sysdep.c --- ././src/sysdep.c Wed Apr 3 19:47:52 2002 +++ ././src/sysdep.c Fri Jun 21 06:18:47 2002 @@ -47,7 +47,7 @@ #include "buffer.h" -#include "device.h" +#include "device-impl.h" #include "events.h" #include "frame.h" #include "process.h" @@ -56,11 +56,11 @@ #include "window.h" #ifdef HAVE_TTY -#include "console-tty.h" +#include "console-tty-impl.h" #else #endif /* HAVE_TTY */ -#include "console-stream.h" +#include "console-stream-impl.h" #ifdef WIN32_NATIVE #include "syswindows.h" #endif @@ -70,7 +70,6 @@ #include "sysproc.h" #include "syspwd.h" #include "syssignal.h" -#include "syssignal.h" #include "systime.h" #include "systty.h" #include "syswait.h" @@ -129,6 +128,21 @@ /* subprocess control */ /************************************************************************/ +#ifdef NEED_SYNC_PROCESS_CODE + +/* True iff we are about to fork off a synchronous process or if we + are waiting for it. */ +volatile int synch_process_alive; + +/* Nonzero => this is a string explaining death of synchronous subprocess. */ +const char *synch_process_death; + +/* If synch_process_death is zero, + this is exit code of synchronous subprocess. */ +int synch_process_retcode; + +#endif /* NEED_SYNC_PROCESS_CODE */ + #ifdef HAVE_TTY #ifdef SIGTSTP @@ -172,7 +186,7 @@ It seems that O_NONBLOCK applies only to FIFOs? From lowry@watson.ibm.com (Andy Lowry). */ /* #### Should this be conditionalized on FIONBIO? */ -#if defined (STRIDE) || defined (pfa) || defined (AIX) +#if defined (STRIDE) || (defined (pfa) && defined (HAVE_PTYS)) || defined (AIX) { int one = 1; ioctl (fd, FIONBIO, &one); @@ -184,25 +198,10 @@ #endif } -#if defined (NO_SUBPROCESSES) +#ifdef NEED_SYNC_PROCESS_CODE /* #### Used only on super-ancient systems */ -#ifdef BSD -void -wait_without_blocking (void) -{ - wait3 (0, WNOHANG | WUNTRACED, 0); - synch_process_alive = 0; -} -#endif /* BSD */ - -#endif /* NO_SUBPROCESSES */ - - -#ifdef WIN32_NATIVE -void wait_for_termination (HANDLE pHandle) -#else -void wait_for_termination (int pid) -#endif +static void +wait_for_termination (int pid) { /* #### With the new improved SIGCHLD handling stuff, there is much less danger of race conditions and some of the comments below @@ -312,49 +311,6 @@ Since implementations may add their own error indicators on top, we ignore it by default. */ -#elif defined (WIN32_NATIVE) - int ret = 0, status = 0; - if (pHandle == NULL) - { - warn_when_safe (Qprocess, Qwarning, "Cannot wait for unknown process to terminate"); - return; - } - do - { - QUIT; - ret = WaitForSingleObject(pHandle, 100); - } - while (ret == WAIT_TIMEOUT); - if (ret == WAIT_FAILED) - { - warn_when_safe (Qprocess, Qwarning, "waiting for process failed"); - } - if (ret == WAIT_ABANDONED) - { - warn_when_safe (Qprocess, Qwarning, - "process to wait for has been abandoned"); - } - if (ret == WAIT_OBJECT_0) - { - ret = GetExitCodeProcess(pHandle, &status); - if (ret) - { - synch_process_alive = 0; - synch_process_retcode = status; - } - else - { - /* GetExitCodeProcess() didn't return a valid exit status, - nothing to do. APA */ - warn_when_safe (Qprocess, Qwarning, - "failure to obtain process exit value"); - } - } - if (pHandle != NULL && !CloseHandle(pHandle)) - { - warn_when_safe (Qprocess, Qwarning, - "failure to close unknown process"); - } #elif defined (EMACS_BLOCK_SIGNAL) && !defined (BROKEN_WAIT_FOR_SIGNAL) && defined (SIGCHLD) while (1) { @@ -386,7 +342,7 @@ Try defining BROKEN_WAIT_FOR_SIGNAL. */ EMACS_WAIT_FOR_SIGNAL (SIGCHLD); } -#else /* not HAVE_WAITPID and not WIN32_NATIVE and (not EMACS_BLOCK_SIGNAL or BROKEN_WAIT_FOR_SIGNAL) */ +#else /* not HAVE_WAITPID and (not EMACS_BLOCK_SIGNAL or BROKEN_WAIT_FOR_SIGNAL) */ /* This approach is kind of cheesy but is guaranteed(?!) to work for all systems. */ while (1) @@ -401,6 +357,7 @@ #endif /* OS features */ } +#endif /* NEED_SYNC_PROCESS_CODE */ #if !defined (NO_SUBPROCESSES) @@ -572,17 +529,13 @@ #if !defined (SIGTSTP) && !defined (USG_JOBCTRL) -#if defined(__STDC__) || defined(_MSC_VER) #define SIG_PARAM_TYPE int -#else -#define SIG_PARAM_TYPE -#endif /* Record a signal code and the handler for it. */ struct save_signal { int code; - SIGTYPE (*handler) (SIG_PARAM_TYPE); + RETSIGTYPE (XCDECL * handler) (SIG_PARAM_TYPE); }; static void @@ -591,7 +544,7 @@ while (saved_handlers->code) { saved_handlers->handler - = (SIGTYPE (*) (SIG_PARAM_TYPE)) EMACS_SIGNAL (saved_handlers->code, SIG_IGN); + = (RETSIGTYPE (XCDECL *) (SIG_PARAM_TYPE)) EMACS_SIGNAL (saved_handlers->code, SIG_IGN); saved_handlers++; } } @@ -612,10 +565,10 @@ sys_subshell (void) { Lisp_Object dir; - Intbyte *str = 0; + Ibyte *str = 0; Bytecount len; struct gcpro gcpro1; - Intbyte *sh = 0; + Ibyte *sh = 0; Extbyte *shext; /* Use our buffer's default directory for the subshell. */ @@ -623,7 +576,7 @@ /* Note: These calls are spread out to insure that the return values of the calls (which may be newly-created strings) are properly GC-protected. */ - + GCPRO1 (dir); dir = current_buffer->directory; @@ -633,7 +586,7 @@ dir = Funhandled_file_name_directory (dir); dir = expand_and_dir_to_file (dir, Qnil); - str = (Intbyte *) alloca (XSTRING_LENGTH (dir) + 2); + str = (Ibyte *) ALLOCA (XSTRING_LENGTH (dir) + 2); len = XSTRING_LENGTH (dir); memcpy (str, XSTRING_DATA (dir), len); if (!IS_ANY_SEP (str[len - 1])) @@ -786,10 +739,10 @@ /* Figure out the eof character for the FD. */ -Intbyte +Ibyte get_eof_char (int fd) { - const Intbyte ctrl_d = (Intbyte) '\004'; + const Ibyte ctrl_d = (Ibyte) '\004'; if (!isatty (fd)) return ctrl_d; @@ -802,9 +755,9 @@ if ((int) strlen ((const char *) t.c_cc) < (VEOF + 1)) return ctrl_d; else - return (Intbyte) t.c_cc[VEOF]; + return (Ibyte) t.c_cc[VEOF]; #endif - return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Intbyte) t.c_cc[VEOF]; + return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Ibyte) t.c_cc[VEOF]; } #else /* ! HAVE_TERMIOS */ /* On Berkeley descendants, the following IOCTL's retrieve the @@ -813,7 +766,7 @@ { struct tchars c; ioctl (fd, TIOCGETC, &c); - return (Intbyte) c.t_eofc; + return (Ibyte) c.t_eofc; } #else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ /* On SYSV descendants, the TCGETA ioctl retrieves the current control @@ -825,7 +778,7 @@ if ((int) strlen ((const char *) t.c_cc) < (VINTR + 1)) return ctrl_d; else - return (Intbyte) t.c_cc[VINTR]; + return (Ibyte) t.c_cc[VINTR]; } #else /* ! defined (TCGETA) */ /* Rather than complain, we'll just guess ^D, which is what @@ -925,9 +878,7 @@ { struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); int input_fd = CONSOLE_TTY_DATA (con)->infd; -#if defined (WIN32_NATIVE) - DEVICE_TTY_DATA (d)->ospeed = 15; -#elif defined (HAVE_TERMIOS) +#ifdef HAVE_TERMIOS struct termios sg; sg.c_cflag = B9600; @@ -973,7 +924,7 @@ /* SIGIO control */ /* ------------------------------------------------------ */ -#if defined(SIGIO) && !defined(BROKEN_SIGIO) +#if defined (SIGIO) && !defined (BROKEN_SIGIO) static void init_sigio_on_device (struct device *d) @@ -1398,7 +1349,7 @@ if (ioctl (fd, TCGETA, &settings->main) < 0) return -1; -#elif !defined (WIN32_NATIVE) +#else /* I give up - I hope you have the BSD ioctls. */ if (ioctl (fd, TIOCGETP, &settings->main) < 0) return -1; @@ -1472,7 +1423,7 @@ if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0) return -1; -#elif !defined (WIN32_NATIVE) +#else /* I give up - I hope you have the BSD ioctls. */ if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0) return -1; @@ -1665,14 +1616,12 @@ tty.main.c_iflag &= ~BRKINT; #endif /* AIX */ #else /* if not HAVE_TERMIO */ -#if !defined (WIN32_NATIVE) con->tty_erase_char = make_char (tty.main.sg_erase); tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); if (TTY_FLAGS (con).meta_key) tty.main.sg_flags |= ANYP; /* #### should we be using RAW mode here? */ tty.main.sg_flags |= /* interrupt_input ? RAW : */ CBREAK; -#endif /* not WIN32_NATIVE */ #endif /* not HAVE_TERMIO */ /* If going to use CBREAK mode, we must request C-g to interrupt @@ -2229,8 +2178,6 @@ extern void *minimum_address_seen; /* from xmalloc() */ extern void *maximum_address_seen; /* from xmalloc() */ -extern EMACS_INT consing_since_gc; - Bytecount total_data_usage (void) { @@ -2239,22 +2186,9 @@ #else void *data_start = minimum_address_seen; #endif - -#if !defined (WIN32_NATIVE) && !defined (CYGWIN) - void *data_end; - - static EMACS_INT last_consing_since_gc; - static void *last_sbrk; - /* Random hack to avoid calling sbrk constantly (every funcall). #### Is - it worth it? */ - if (!last_sbrk || !(consing_since_gc >= last_consing_since_gc && - (consing_since_gc - last_consing_since_gc) < 1000)) - { - last_sbrk = sbrk (0); - last_consing_since_gc = consing_since_gc; - } - data_end = last_sbrk; +#if !defined (WIN32_NATIVE) && !defined (CYGWIN) + void *data_end = sbrk (0); #else void *data_end = maximum_address_seen; #endif @@ -2299,7 +2233,7 @@ Vsystem_name = build_string (uts.nodename); #else /* HAVE_GETHOSTNAME */ int hostname_size = 256; - char *hostname = (char *) alloca (hostname_size); + char *hostname = (char *) ALLOCA (hostname_size); /* Try to get the host name; if the buffer is too short, try again. Apparently, the only indication gethostname gives of @@ -2315,7 +2249,7 @@ break; hostname_size <<= 1; - hostname = (char *) alloca (hostname_size); + hostname = (char *) ALLOCA (hostname_size); } # if defined( HAVE_SOCKETS) /* Turn the hostname into the official, fully-qualified hostname. @@ -2358,7 +2292,7 @@ if (*alias) fqdn = *alias; } - hostname = (char *) alloca (strlen (fqdn) + 1); + hostname = (char *) ALLOCA (strlen (fqdn) + 1); strcpy (hostname, fqdn); } # else /* !(HAVE_GETADDRINFO && HAVE_GETNAMEINFO) */ @@ -2375,7 +2309,7 @@ hints.ai_protocol = 0; if (!getaddrinfo (hostname, NULL, &hints, &res)) { - hostname = (char *) alloca (strlen (res->ai_canonname) + 1); + hostname = (char *) ALLOCA (strlen (res->ai_canonname) + 1); strcpy (hostname, res->ai_canonname); freeaddrinfo (res); @@ -2386,7 +2320,7 @@ Vsystem_name = build_string (hostname); #endif /* HAVE_GETHOSTNAME */ { - Intbyte *p; + Ibyte *p; Bytecount i; for (i = 0, p = XSTRING_DATA (Vsystem_name); @@ -2598,7 +2532,7 @@ /* Like qxe_open() below but operates on externally-encoded filenames. */ -int +int XCDECL retry_open (const Extbyte *path, int oflag, ...) { int mode; @@ -2624,8 +2558,8 @@ /* The basic external entry point to open(). Handles conversion to external encoding, interruptions, etc. */ -int -qxe_open (const Intbyte *path, int oflag, ...) +int XCDECL +qxe_open (const Ibyte *path, int oflag, ...) { Extbyte *pathout; int mode; @@ -2648,7 +2582,7 @@ is not interrupted by C-g. However, the worst that can happen is the fallback to simple open(). */ int -qxe_interruptible_open (const Intbyte *path, int oflag, int mode) +qxe_interruptible_open (const Ibyte *path, int oflag, int mode) { /* This function can GC */ Extbyte *pathout; @@ -2703,7 +2637,7 @@ && (errno == EINTR)) { if (allow_quit) - REALLY_QUIT; + QUIT; } return rtnval; } @@ -2726,7 +2660,7 @@ ssize_t rtnval = write (fildes, b, nbyte); if (allow_quit) - REALLY_QUIT; + QUIT; if (rtnval == -1) { @@ -2835,7 +2769,7 @@ } FILE * -qxe_fopen (const Intbyte *path, const Char_ASCII *mode) +qxe_fopen (const Ibyte *path, const Char_ASCII *mode) { Extbyte *pathout; PATHNAME_CONVERT_OUT (path, pathout); @@ -2916,7 +2850,7 @@ /********************* directory calls *******************/ int -qxe_chdir (const Intbyte *path) +qxe_chdir (const Ibyte *path) { Extbyte *pathout; PATHNAME_CONVERT_OUT (path, pathout); @@ -2931,7 +2865,7 @@ } int -qxe_mkdir (const Intbyte *path, mode_t mode) +qxe_mkdir (const Ibyte *path, mode_t mode) { Extbyte *pathout; PATHNAME_CONVERT_OUT (path, pathout); @@ -2946,7 +2880,7 @@ } DIR * -qxe_opendir (const Intbyte *filename) +qxe_opendir (const Ibyte *filename) { #ifdef WIN32_NATIVE return mswindows_opendir (filename); @@ -2983,7 +2917,7 @@ { const Extbyte * const external_name = (const Extbyte *) rtnval->d_name; Bytecount external_len = strlen (rtnval->d_name); - const Intbyte *internal_name; + const Ibyte *internal_name; Bytecount internal_len; TO_INTERNAL_FORMAT (DATA, (external_name, external_len), @@ -2996,13 +2930,13 @@ return rtnval; { /* Non-ASCII filename */ - static Intbyte_dynarr *internal_DIRENTRY; + static Ibyte_dynarr *internal_DIRENTRY; if (!internal_DIRENTRY) - internal_DIRENTRY = Dynarr_new (Intbyte); + internal_DIRENTRY = Dynarr_new (Ibyte); else Dynarr_reset (internal_DIRENTRY); - Dynarr_add_many (internal_DIRENTRY, (Intbyte *) rtnval, + Dynarr_add_many (internal_DIRENTRY, (Ibyte *) rtnval, offsetof (DIRENTRY, d_name)); @@ -3031,7 +2965,7 @@ } int -qxe_rmdir (const Intbyte *path) +qxe_rmdir (const Ibyte *path) { Extbyte *pathout; PATHNAME_CONVERT_OUT (path, pathout); @@ -3045,7 +2979,7 @@ #endif } -Intbyte * +Ibyte * qxe_allocating_getcwd (void) { #ifdef HAVE_GETCWD @@ -3067,7 +3001,7 @@ if (ret) { - Intbyte *retin; + Ibyte *retin; TSTR_TO_C_STRING_MALLOC (ret, retin); xfree (cwd); return retin; @@ -3076,7 +3010,7 @@ Extbyte *ret = getcwd (cwd, cwdsize); if (ret) { - Intbyte *retin; + Ibyte *retin; EXTERNAL_TO_C_STRING_MALLOC (ret, retin, Qfile_name); xfree (cwd); return retin; @@ -3096,7 +3030,7 @@ } #else Extbyte chingame_limitos_arbitrarios[PATH_MAX]; - Intbyte *ret2; + Ibyte *ret2; if (!getwd (chingame_limitos_arbitrarios)) return 0; @@ -3108,7 +3042,7 @@ /***************** file-information calls ******************/ int -qxe_access (const Intbyte *path, int mode) +qxe_access (const Ibyte *path, int mode) { #ifdef WIN32_NATIVE return mswindows_access (path, mode); @@ -3121,7 +3055,7 @@ #if defined (HAVE_EACCESS) int -qxe_eaccess (const Intbyte *path, int mode) +qxe_eaccess (const Ibyte *path, int mode) { Extbyte *pathout; PATHNAME_CONVERT_OUT (path, pathout); @@ -3130,7 +3064,7 @@ #endif /* defined (HAVE_EACCESS) */ int -qxe_lstat (const Intbyte *path, struct stat *buf) +qxe_lstat (const Ibyte *path, struct stat *buf) { /* if system does not have symbolic links, it does not have lstat. In that case, use ordinary stat instead. */ @@ -3145,7 +3079,7 @@ #if defined (HAVE_READLINK) int -qxe_readlink (const Intbyte *path, Intbyte *buf, size_t bufsiz) +qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz) { int retval; Extbyte *pathout; @@ -3155,7 +3089,7 @@ if (retval < 0) return retval; { - Intbyte *intbuf; + Ibyte *intbuf; Bytecount tamanho; TO_INTERNAL_FORMAT (DATA, (buf, retval), @@ -3180,7 +3114,7 @@ } int -qxe_stat (const Intbyte *path, struct stat *buf) +qxe_stat (const Ibyte *path, struct stat *buf) { #ifdef WIN32_NATIVE return mswindows_stat (path, buf); @@ -3195,7 +3129,7 @@ /****************** file-manipulation calls *****************/ int -qxe_chmod (const Intbyte *path, mode_t mode) +qxe_chmod (const Ibyte *path, mode_t mode) { Extbyte *pathout; PATHNAME_CONVERT_OUT (path, pathout); @@ -3211,7 +3145,7 @@ #if defined (HAVE_LINK) int -qxe_link (const Intbyte *existing, const Intbyte *new) +qxe_link (const Ibyte *existing, const Ibyte *new) { #ifdef WIN32_NATIVE return mswindows_link (existing, new); @@ -3225,7 +3159,7 @@ #endif /* defined (HAVE_LINK) */ int -qxe_rename (const Intbyte *old, const Intbyte *new) +qxe_rename (const Ibyte *old, const Ibyte *new) { #ifdef WIN32_NATIVE return mswindows_rename (old, new); @@ -3239,7 +3173,7 @@ #if defined (HAVE_SYMLINK) int -qxe_symlink (const Intbyte *name1, const Intbyte *name2) +qxe_symlink (const Ibyte *name1, const Ibyte *name2) { Extbyte *name1out, *name2out; PATHNAME_CONVERT_OUT (name1, name1out); @@ -3249,7 +3183,7 @@ #endif /* defined (HAVE_SYMLINK) */ int -qxe_unlink (const Intbyte *path) +qxe_unlink (const Ibyte *path) { #ifdef WIN32_NATIVE return mswindows_unlink (path); @@ -3264,8 +3198,8 @@ /****************** process calls *****************/ int -qxe_execve (const Intbyte *filename, Intbyte * const argv[], - Intbyte * const envp[]) +qxe_execve (const Ibyte *filename, Ibyte * const argv[], + Ibyte * const envp[]) { int i, argc, envc; Extbyte *pathext; @@ -3343,7 +3277,7 @@ } struct passwd * -qxe_getpwnam (const Intbyte *name) +qxe_getpwnam (const Ibyte *name) { #ifdef WIN32_NATIVE /* Synthetic versions are defined in nt.c and already do conversion. */ @@ -3380,14 +3314,14 @@ /****************** time calls *****************/ -static Intbyte *ctime_static; +static Ibyte *ctime_static; -Intbyte * +Ibyte * qxe_ctime (const time_t *t) { Extbyte *str = (Extbyte *) ctime (t); if (!str) /* can happen on MS Windows */ - return (Intbyte *) "Sun Jan 01 00:00:00 1970"; + return (Ibyte *) "Sun Jan 01 00:00:00 1970"; if (ctime_static) xfree (ctime_static); EXTERNAL_TO_C_STRING_MALLOC (str, ctime_static, Qnative); @@ -3716,35 +3650,34 @@ const char *sys_siglist[NSIG + 1] = { /* AIX has changed the signals a bit */ - /* $$####begin-snarf */ - "bogus signal", /* 0 */ - "hangup", /* 1 SIGHUP */ - "interrupt", /* 2 SIGINT */ - "quit", /* 3 SIGQUIT */ - "illegal instruction", /* 4 SIGILL */ - "trace trap", /* 5 SIGTRAP */ - "IOT instruction", /* 6 SIGIOT */ - "crash likely", /* 7 SIGDANGER */ - "floating point exception", /* 8 SIGFPE */ - "kill", /* 9 SIGKILL */ - "bus error", /* 10 SIGBUS */ - "segmentation violation", /* 11 SIGSEGV */ - "bad argument to system call", /* 12 SIGSYS */ - "write on a pipe with no one to read it", /* 13 SIGPIPE */ - "alarm clock", /* 14 SIGALRM */ - "software termination signum", /* 15 SIGTERM */ - "user defined signal 1", /* 16 SIGUSR1 */ - "user defined signal 2", /* 17 SIGUSR2 */ - "death of a child", /* 18 SIGCLD */ - "power-fail restart", /* 19 SIGPWR */ - "bogus signal", /* 20 */ - "bogus signal", /* 21 */ - "bogus signal", /* 22 */ - "bogus signal", /* 23 */ - "bogus signal", /* 24 */ - "LAN I/O interrupt", /* 25 SIGAIO */ - "PTY I/O interrupt", /* 26 SIGPTY */ - "I/O intervention required", /* 27 SIGIOINT */ + DEFER_GETTEXT ("bogus signal"), /* 0 */ + DEFER_GETTEXT ("hangup"), /* 1 SIGHUP */ + DEFER_GETTEXT ("interrupt"), /* 2 SIGINT */ + DEFER_GETTEXT ("quit"), /* 3 SIGQUIT */ + DEFER_GETTEXT ("illegal instruction"), /* 4 SIGILL */ + DEFER_GETTEXT ("trace trap"), /* 5 SIGTRAP */ + DEFER_GETTEXT ("IOT instruction"), /* 6 SIGIOT */ + DEFER_GETTEXT ("crash likely"), /* 7 SIGDANGER */ + DEFER_GETTEXT ("floating point exception"), /* 8 SIGFPE */ + DEFER_GETTEXT ("kill"), /* 9 SIGKILL */ + DEFER_GETTEXT ("bus error"), /* 10 SIGBUS */ + DEFER_GETTEXT ("segmentation violation"), /* 11 SIGSEGV */ + DEFER_GETTEXT ("bad argument to system call"), /* 12 SIGSYS */ + DEFER_GETTEXT ("write on a pipe with no one to read it"), /* 13 SIGPIPE */ + DEFER_GETTEXT ("alarm clock"), /* 14 SIGALRM */ + DEFER_GETTEXT ("software termination signal"), /* 15 SIGTERM */ + DEFER_GETTEXT ("user defined signal 1"), /* 16 SIGUSR1 */ + DEFER_GETTEXT ("user defined signal 2"), /* 17 SIGUSR2 */ + DEFER_GETTEXT ("death of a child"), /* 18 SIGCLD */ + DEFER_GETTEXT ("power-fail restart"), /* 19 SIGPWR */ + DEFER_GETTEXT ("bogus signal"), /* 20 */ + DEFER_GETTEXT ("bogus signal"), /* 21 */ + DEFER_GETTEXT ("bogus signal"), /* 22 */ + DEFER_GETTEXT ("bogus signal"), /* 23 */ + DEFER_GETTEXT ("bogus signal"), /* 24 */ + DEFER_GETTEXT ("LAN I/O interrupt"), /* 25 SIGAIO */ + DEFER_GETTEXT ("PTY I/O interrupt"), /* 26 SIGPTY */ + DEFER_GETTEXT ("I/O intervention required"), /* 27 SIGIOINT */ #ifdef AIXHFT "HFT grant", /* 28 SIGGRANT */ "HFT retract", /* 29 SIGRETRACT */ @@ -3757,27 +3690,26 @@ #else /* USG, not AIX */ const char *sys_siglist[NSIG + 1] = { - /* $$####begin-snarf */ - "bogus signal", /* 0 */ - "hangup", /* 1 SIGHUP */ - "interrupt", /* 2 SIGINT */ - "quit", /* 3 SIGQUIT */ - "illegal instruction", /* 4 SIGILL */ - "trace trap", /* 5 SIGTRAP */ - "IOT instruction", /* 6 SIGIOT */ - "EMT instruction", /* 7 SIGEMT */ - "floating point exception", /* 8 SIGFPE */ - "kill", /* 9 SIGKILL */ - "bus error", /* 10 SIGBUS */ - "segmentation violation", /* 11 SIGSEGV */ - "bad argument to system call", /* 12 SIGSYS */ - "write on a pipe with no one to read it", /* 13 SIGPIPE */ - "alarm clock", /* 14 SIGALRM */ - "software termination signum", /* 15 SIGTERM */ - "user defined signal 1", /* 16 SIGUSR1 */ - "user defined signal 2", /* 17 SIGUSR2 */ - "death of a child", /* 18 SIGCLD */ - "power-fail restart", /* 19 SIGPWR */ + DEFER_GETTEXT ("bogus signal"), /* 0 */ + DEFER_GETTEXT ("hangup"), /* 1 SIGHUP */ + DEFER_GETTEXT ("interrupt"), /* 2 SIGINT */ + DEFER_GETTEXT ("quit"), /* 3 SIGQUIT */ + DEFER_GETTEXT ("illegal instruction"), /* 4 SIGILL */ + DEFER_GETTEXT ("trace trap"), /* 5 SIGTRAP */ + DEFER_GETTEXT ("IOT instruction"), /* 6 SIGIOT */ + DEFER_GETTEXT ("EMT instruction"), /* 7 SIGEMT */ + DEFER_GETTEXT ("floating point exception"), /* 8 SIGFPE */ + DEFER_GETTEXT ("kill"), /* 9 SIGKILL */ + DEFER_GETTEXT ("bus error"), /* 10 SIGBUS */ + DEFER_GETTEXT ("segmentation violation"), /* 11 SIGSEGV */ + DEFER_GETTEXT ("bad argument to system call"), /* 12 SIGSYS */ + DEFER_GETTEXT ("write on a pipe with no one to read it"), /* 13 SIGPIPE */ + DEFER_GETTEXT ("alarm clock"), /* 14 SIGALRM */ + DEFER_GETTEXT ("software termination signal"), /* 15 SIGTERM */ + DEFER_GETTEXT ("user defined signal 1"), /* 16 SIGUSR1 */ + DEFER_GETTEXT ("user defined signal 2"), /* 17 SIGUSR2 */ + DEFER_GETTEXT ("death of a child"), /* 18 SIGCLD */ + DEFER_GETTEXT ("power-fail restart"), /* 19 SIGPWR */ #ifdef sun "window size changed", /* 20 SIGWINCH */ "urgent socket condition", /* 21 SIGURG */ diff --text -u 'xemacs-21.5.6/src/sysdep.h' 'xemacs-21.5.7/src/sysdep.h' Index: ././src/sysdep.h --- ././src/sysdep.h Mon Apr 1 12:58:50 2002 +++ ././src/sysdep.h Wed Jun 5 18:57:18 2002 @@ -1,6 +1,6 @@ /* System-dependent prototypes Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. @@ -44,16 +44,12 @@ void set_descriptor_non_blocking (int fd); -void wait_without_blocking (void); - int get_pty_max_bytes (int fd); -Intbyte get_eof_char (int fd); +Ibyte get_eof_char (int fd); /* Wait for subprocess with process id `pid' to terminate and make sure it will get eliminated (not remain forever as a zombie) */ -#ifndef WIN32_NATIVE void wait_for_termination (int pid); -#endif /* flush any pending output * (may flush input as well; it does not matter the way we use it) diff --text -u 'xemacs-21.5.6/src/sysdir.h' 'xemacs-21.5.7/src/sysdir.h' Index: ././src/sysdir.h --- ././src/sysdir.h Wed Mar 13 17:53:00 2002 +++ ././src/sysdir.h Wed Jun 5 18:57:18 2002 @@ -66,13 +66,13 @@ /* encapsulation: directory calls */ -int qxe_chdir (const Intbyte *path); -int qxe_mkdir (const Intbyte *path, mode_t mode); -DIR *qxe_opendir (const Intbyte *filename); +int qxe_chdir (const Ibyte *path); +int qxe_mkdir (const Ibyte *path, mode_t mode); +DIR *qxe_opendir (const Ibyte *filename); DIRENTRY *qxe_readdir (DIR *dirp); int qxe_closedir (DIR *dirp); -int qxe_rmdir (const Intbyte *path); +int qxe_rmdir (const Ibyte *path); -Intbyte *qxe_allocating_getcwd (void); +Ibyte *qxe_allocating_getcwd (void); #endif /* INCLUDED_sysdir_h_ */ diff --text -u 'xemacs-21.5.6/src/sysdll.c' 'xemacs-21.5.7/src/sysdll.c' Index: ././src/sysdll.c --- ././src/sysdll.c Fri Apr 13 03:24:22 2001 +++ ././src/sysdll.c Tue Jun 25 07:00:25 2002 @@ -38,8 +38,8 @@ # define RTLD_LAZY 1 #endif /* RTLD_LAZY isn't defined under FreeBSD - ick */ -#ifndef RTLD_GLOBAL -# define RTLD_GLOBAL 0 +#ifndef RTLD_NOW +# define RTLD_NOW 2 #endif int @@ -51,7 +51,7 @@ dll_handle dll_open (const char *fname) { - return (dll_handle) dlopen (fname, RTLD_LAZY | RTLD_GLOBAL); + return (dll_handle) dlopen (fname, RTLD_NOW); } int diff --text -u 'xemacs-21.5.6/src/sysfile.h' 'xemacs-21.5.7/src/sysfile.h' Index: ././src/sysfile.h --- ././src/sysfile.h Fri Mar 15 20:00:34 2002 +++ ././src/sysfile.h Wed Jun 5 18:57:18 2002 @@ -327,8 +327,8 @@ ssize_t retry_read (int, void *, size_t); ssize_t retry_write (int, const void *, size_t); int retry_open (const Extbyte *path, int oflag, ...); -int qxe_open (const Intbyte *path, int oflag, ...); -int qxe_interruptible_open (const Intbyte *path, int oflag, int mode); +int qxe_open (const Ibyte *path, int oflag, ...); +int qxe_interruptible_open (const Ibyte *path, int oflag, int mode); int retry_close (int); Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size); Bytecount write_allowing_quit (int fildes, const void *buf, @@ -339,34 +339,34 @@ size_t retry_fread (void *, size_t, size_t, FILE *); size_t retry_fwrite (const void *, size_t, size_t, FILE *); FILE *retry_fopen (const Extbyte *path, const Char_ASCII *mode); -FILE *qxe_fopen (const Intbyte *path, const Char_ASCII *mode); +FILE *qxe_fopen (const Ibyte *path, const Char_ASCII *mode); int retry_fclose (FILE *); /* encapsulations: file-information calls */ -int qxe_access (const Intbyte *path, int mode); -int qxe_eaccess (const Intbyte *path, int mode); -int qxe_lstat (const Intbyte *path, struct stat *buf); -int qxe_readlink (const Intbyte *path, Intbyte *buf, size_t bufsiz); +int qxe_access (const Ibyte *path, int mode); +int qxe_eaccess (const Ibyte *path, int mode); +int qxe_lstat (const Ibyte *path, struct stat *buf); +int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz); int qxe_fstat (int fd, struct stat *buf); -int qxe_stat (const Intbyte *path, struct stat *buf); -Intbyte *qxe_realpath (const Intbyte *path, Intbyte resolved_path []); +int qxe_stat (const Ibyte *path, struct stat *buf); +Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path []); /* encapsulations: file-manipulation calls */ -int qxe_chmod (const Intbyte *path, mode_t mode); +int qxe_chmod (const Ibyte *path, mode_t mode); #if defined (HAVE_LINK) -int qxe_link (const Intbyte *existing, const Intbyte *new); +int qxe_link (const Ibyte *existing, const Ibyte *new); #endif /* defined (HAVE_LINK) */ -int qxe_rename (const Intbyte *old, const Intbyte *new); +int qxe_rename (const Ibyte *old, const Ibyte *new); #if defined (HAVE_SYMLINK) -int qxe_symlink (const Intbyte *name1, const Intbyte *name2); +int qxe_symlink (const Ibyte *name1, const Ibyte *name2); #endif /* defined (HAVE_SYMLINK) */ -int qxe_unlink (const Intbyte *path); +int qxe_unlink (const Ibyte *path); #endif /* emacs */ @@ -426,7 +426,7 @@ #define SEPCHAR ';' #define DEFAULT_DIRECTORY_SEP '\\' -DECLARE_INLINE_HEADER (Intbyte sysfile_get_directory_sep (void)) +DECLARE_INLINE_HEADER (Ibyte sysfile_get_directory_sep (void)) { if (!CHARP (Vdirectory_sep_char) || (XCHAR (Vdirectory_sep_char) != '/' @@ -458,12 +458,12 @@ #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP) -DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Emchar c)) +DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Ichar c)) { return (c == '/' || c == '\\'); } -DECLARE_INLINE_HEADER (int IS_ANY_SEP (Emchar c)) +DECLARE_INLINE_HEADER (int IS_ANY_SEP (Ichar c)) { return (c == '/' || c == '\\' || c == ':'); } diff --text -u 'xemacs-21.5.6/src/sysproc.h' 'xemacs-21.5.7/src/sysproc.h' Index: ././src/sysproc.h --- ././src/sysproc.h Wed Mar 13 17:53:01 2002 +++ ././src/sysproc.h Wed Jun 5 18:57:19 2002 @@ -1,6 +1,6 @@ /* Copyright (C) 1995 Free Software Foundation, Inc. - Copyright (C) 2000 Ben Wing. + Copyright (C) 2000, 2002 Ben Wing. This file is part of XEmacs. @@ -178,8 +178,40 @@ #endif /* no FD_SET */ int poll_fds_for_input (SELECT_TYPE mask); -int qxe_execve (const Intbyte *filename, Intbyte * const argv[], - Intbyte * const envp[]); +int qxe_execve (const Ibyte *filename, Ibyte * const argv[], + Ibyte * const envp[]); pid_t qxe_getpid (void); + +/* #### I would really like to delete the remaining synchronous code entirely. + We are now using it only for *REALLY* old systems -- how many systems + nowadays + + (a) lack job control, or + (b) lack mkdir() or rmdir() + + ????? + + --ben +*/ + +#include "syssignal.h" /* needed for SIGTSTP */ + +#if !defined (WIN32_NATIVE) && ((!defined (SIGTSTP) && !defined (USG_JOBCTRL)) || !defined (HAVE_MKDIR) || !defined (HAVE_RMDIR)) + +#define NEED_SYNC_PROCESS_CODE + +/* True iff we are about to fork off a synchronous process or if we + are waiting for it. */ +extern volatile int synch_process_alive; + +/* Nonzero => this is a string explaining death of synchronous subprocess. */ +extern const char *synch_process_death; + +/* If synch_process_death is zero, + this is exit code of synchronous subprocess. */ +extern int synch_process_retcode; + +#endif + #endif /* INCLUDED_sysproc_h_ */ diff --text -u 'xemacs-21.5.6/src/syspwd.h' 'xemacs-21.5.7/src/syspwd.h' Index: ././src/syspwd.h --- ././src/syspwd.h Wed Mar 13 17:53:01 2002 +++ ././src/syspwd.h Wed Jun 5 18:57:19 2002 @@ -40,7 +40,7 @@ #ifdef emacs struct passwd *getpwuid (uid_t uid); -struct passwd *getpwnam (const Intbyte *name); +struct passwd *getpwnam (const Ibyte *name); uid_t getuid (void); uid_t geteuid (void); gid_t getgid (void); @@ -52,7 +52,7 @@ #ifdef emacs -struct passwd *qxe_getpwnam (const Intbyte *name); +struct passwd *qxe_getpwnam (const Ibyte *name); struct passwd *qxe_getpwuid (uid_t uid); struct passwd *qxe_getpwent (void); diff --text -u 'xemacs-21.5.6/src/syssignal.h' 'xemacs-21.5.7/src/syssignal.h' Index: ././src/syssignal.h --- ././src/syssignal.h Wed Mar 13 17:53:01 2002 +++ ././src/syssignal.h Fri Jun 21 06:18:47 2002 @@ -1,6 +1,7 @@ /* syssignal.h - System-dependent definitions for signals. Copyright (C) 1992, 1993 Free Software Foundation, Inc. - + Copyright (C) 1996 Ben Wing. + This file is part of XEmacs. XEmacs is free software; you can redistribute it and/or modify it @@ -107,7 +108,7 @@ */ #ifndef NeXT -typedef SIGTYPE (*signal_handler_t) (int); +typedef RETSIGTYPE (XCDECL * signal_handler_t) (int); #endif #if defined (HAVE_SIGPROCMASK) @@ -243,14 +244,10 @@ Must do that using the killpg call. */ #ifdef HAVE_KILLPG #define EMACS_KILLPG(pid, signo) killpg (pid, signo) -#else -#ifdef WIN32_NATIVE -/* Only needed in callproc.c, slated to go */ -int kill_will_disappear_soon (int pid, int sig); -#define EMACS_KILLPG(pid, signo) kill_will_disappear_soon (pid, signo) +#elif defined (WIN32_NATIVE) +#define EMACS_KILLPG(pid, signo) should never be called #else #define EMACS_KILLPG(pid, signo) kill (-(pid), signo) -#endif #endif #ifndef NSIG diff --text -u 'xemacs-21.5.6/src/systime.h' 'xemacs-21.5.7/src/systime.h' Index: ././src/systime.h --- ././src/systime.h Fri Mar 15 20:00:34 2002 +++ ././src/systime.h Wed Jun 5 18:57:19 2002 @@ -247,7 +247,7 @@ int set_file_times (Lisp_Object path, EMACS_TIME atime, EMACS_TIME mtime); void get_process_times (double *user_time, double *system_time, double *real_time); -Intbyte *qxe_ctime (const time_t *value); +Ibyte *qxe_ctime (const time_t *value); #endif diff --text -u 'xemacs-21.5.6/src/syswindows.h' 'xemacs-21.5.7/src/syswindows.h' Index: ././src/syswindows.h --- ././src/syswindows.h Sun Mar 31 17:29:08 2002 +++ ././src/syswindows.h Fri Jun 21 06:18:47 2002 @@ -410,11 +410,14 @@ #else #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDA #endif -#endif /* not BFFM_VALIDATEFAILED */ +#endif /* winnls.h defines */ +#ifndef MAC_CHARSET +#define MAC_CHARSET 77 +#endif #ifndef LOCALE_RETURN_NUMBER -#define LOCALE_RETURN_NUMBER 0x20000000 +#define LOCALE_RETURN_NUMBER 0x20000000 #endif /* OEM resources */ @@ -795,7 +798,7 @@ Extbyte *convert_multibyte_to_unicode_malloc (const Extbyte *src, Bytecount n, int cp, Bytecount *size_out); -Intbyte *convert_multibyte_to_internal_malloc (const Extbyte *src, +Ibyte *convert_multibyte_to_internal_malloc (const Extbyte *src, Bytecount n, int cp, Bytecount *size_out); void convert_multibyte_to_unicode_dynarr (const Extbyte *src, Bytecount n, @@ -824,7 +827,7 @@ #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ do { \ - Intbyte *lttff; \ + Ibyte *lttff; \ \ LOCAL_TO_WIN32_FILE_FORMAT (XSTRING_DATA (path), lttff); \ C_STRING_TO_TSTR (lttff, out); \ @@ -832,6 +835,15 @@ Lisp_Object tstr_to_local_file_format (Extbyte *pathout); +/* Convert from local file format, as used in XEmacs, to valid win32 + filenames as can be given to Windows API routines. Under native XEmacs, + this is a no-op, but under Cygwin, the local names look different -- + Cygwin mount points, forward slashes, etc. Currently, under Cygwin, we + actually allow local names to be of both formats, i.e. Cygwin or Win32 + native. So we check to see if we have Win32 native already (a cheesy + check, look for letter plus colon at beginning of name) and do nothing + in that case. */ + #ifdef CYGWIN #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \ do { \ @@ -842,14 +854,14 @@ get 7-bit ISO2022-encoded data. We know that our internal format \ is ASCII-compatible, and so these functions will work fine with \ this data. */ \ - Intbyte *ltwffp = (path); \ + Ibyte *ltwffp = (path); \ if (isalpha (ltwffp[0]) && (IS_DEVICE_SEP (ltwffp[1]))) \ pathout = ltwffp; \ else \ { \ int ltwff2 = \ cygwin_posix_to_win32_path_list_buf_size ((char *) ltwffp); \ - pathout = (Intbyte *) alloca (ltwff2); \ + pathout = (Ibyte *) ALLOCA (ltwff2); \ cygwin_posix_to_win32_path_list ((char *) ltwffp, (char *) pathout); \ } \ } while (0) @@ -863,10 +875,10 @@ #ifdef CYGWIN #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \ do { \ - Intbyte *wtlff1 = (path); \ + Ibyte *wtlff1 = (path); \ int wtlff2 = \ cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1); \ - Intbyte *wtlff3 = (Intbyte *) alloca (wtlff2); \ + Ibyte *wtlff3 = (Ibyte *) ALLOCA (wtlff2); \ cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3); \ (pathout) = wtlff3; \ } while (0) @@ -877,10 +889,60 @@ } while (0) #endif -Intbyte *urlify_filename (Intbyte *filename); -Intbyte *mswindows_canonicalize_filename (Intbyte *name); +/* Convert a local-format file name or URL in internal format into a Win32 + file name or URL in tstr format. */ + +#ifdef CYGWIN + +#define LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \ +do \ +{ \ + Ibyte *lffmutt_fname1; \ + Ibyte *lffmutt_pathint = XSTRING_DATA (lispstr); \ + \ + if ((lffmutt_fname1 = qxestrchr (lffmutt_pathint, ':')) != NULL \ + && *++lffmutt_fname1 == '/' && *++lffmutt_fname1 == '/') \ + { \ + /* If URL style file, the innards may have Cygwin mount points and \ + the like. so separate out the innards, process them, and put back \ + together. */ \ + if (qxestrncasecmp_c (lffmutt_pathint, "file://", 7) == 0) \ + { \ + Ibyte *lffmutt_path1, *lffmutt_path2; \ + LOCAL_TO_WIN32_FILE_FORMAT (lffmutt_pathint + 7, lffmutt_path1); \ + if (lffmutt_path1 == lffmutt_pathint + 7) /* Optimization */ \ + lffmutt_path2 = lffmutt_pathint; \ + else \ + { \ + lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \ + + 1); \ + qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \ + qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \ + } \ + C_STRING_TO_TSTR (lffmutt_path2, pathout); \ + } \ + else \ + /* A straight URL, just convert */ \ + LISP_STRING_TO_TSTR (lispstr, pathout); \ + } \ + else \ + /* Not URL-style, must be a straight filename. */ \ + LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \ +} while (0) + +#else /* not CYGWIN */ + + /* URL's (and everything else) are already in the right format */ +#define LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \ + LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout) + +#endif /* not CYGWIN */ + + +Ibyte *urlify_filename (Ibyte *filename); +Ibyte *mswindows_canonicalize_filename (Ibyte *name); #define MSWINDOWS_NORMALIZE_FILENAME(name) \ - INTBYTE_STRING_TO_ALLOCA (mswindows_canonicalize_filename (name), name) + IBYTE_STRING_TO_ALLOCA (mswindows_canonicalize_filename (name), name) /* ------------------- Functions needed dynamic binding ------------------- */ @@ -899,7 +961,7 @@ typedef struct file_data { - const Intbyte *name; + const Ibyte *name; unsigned long size; HANDLE file; HANDLE file_mapping; @@ -918,8 +980,8 @@ ((void *)(RVA_TO_OFFSET(var,section) + \ (char *)(filedata).file_base)) -int open_input_file (file_data *p_file, const Intbyte *name); -int open_output_file (file_data *p_file, const Intbyte *name, +int open_input_file (file_data *p_file, const Ibyte *name); +int open_output_file (file_data *p_file, const Ibyte *name, unsigned long size); void close_file_data (file_data *p_file); @@ -937,8 +999,8 @@ #define get_nt_major_version() nt_major_version #define get_nt_minor_version() nt_minor_version -extern unsigned char *get_data_start(); -extern unsigned char *get_data_end(); +unsigned char *get_data_start (void); +unsigned char *get_data_end (void); extern unsigned long data_region_size; extern unsigned long reserved_heap_size; extern SYSTEM_INFO sysinfo_cache; @@ -950,27 +1012,24 @@ #define UNINIT_PTR ((unsigned char*) 0xF0A0F0A0) #define UNINIT_LONG (0xF0A0F0A0L) -/* Emulation of Unix sbrk(). */ -extern void *sbrk (unsigned long size); - /* Recreate the heap created during dumping. */ -extern void recreate_heap (char *executable_path); +void recreate_heap (Extbyte *executable_path); /* Round the heap to this size. */ -extern void round_heap (unsigned long size); +void round_heap (unsigned long size); /* Load in the dumped .bss section. */ -extern void read_in_bss (char *name); +void read_in_bss (Extbyte *name); /* Map in the dumped heap. */ -extern void map_in_heap (char *name); +void map_in_heap (Extbyte *name); /* Cache system info, e.g., the NT page size. */ -extern void cache_system_info (void); +void cache_system_info (void); /* Round ADDRESS up to be aligned with ALIGN. */ -extern unsigned char *round_to_next (unsigned char *address, - unsigned long align); +unsigned char *round_to_next (unsigned char *address, + unsigned long align); #endif /* WIN32_NATIVE */ /* ------------------------- Misc prototypes ------------------------- */ @@ -978,55 +1037,35 @@ #ifdef WIN32_NATIVE DECLARE_INLINE_HEADER (int strcasecmp (const char *a, const char *b)) { - return qxestrcasecmp ((const Intbyte *) a, (const Intbyte *) b); + return qxestrcasecmp ((const Ibyte *) a, (const Ibyte *) b); } #endif /* WIN32_NATIVE */ /* in nt.c */ -int mswindows_access (const Intbyte *path, int mode); -int mswindows_link (const Intbyte *old, const Intbyte *new); -int mswindows_rename (const Intbyte *oldname, const Intbyte *newname); -int mswindows_unlink (const Intbyte *path); -int mswindows_stat (const Intbyte *path, struct stat *buf); +int mswindows_access (const Ibyte *path, int mode); +int mswindows_link (const Ibyte *old, const Ibyte *new); +int mswindows_rename (const Ibyte *oldname, const Ibyte *newname); +int mswindows_unlink (const Ibyte *path); +int mswindows_stat (const Ibyte *path, struct stat *buf); int mswindows_fstat (int desc, struct stat *buf); time_t mswindows_convert_time (FILETIME ft); -void mswindows_executable_type (const Intbyte * filename, int * is_dos_app, +void mswindows_executable_type (const Ibyte * filename, int * is_dos_app, int * is_cygnus_app); -Intbyte *mswindows_getdcwd (int drivelet); +Ibyte *mswindows_getdcwd (int drivelet); -/* In process-nt.c */ +/* in process-nt.c */ extern int mswindows_compare_env (const void *strp1, const void *strp2); -/* in sysdep.c */ -#ifdef WIN32_NATIVE -void wait_for_termination (HANDLE pid); -#endif - /* in win32.c */ +Extbyte *mswindows_get_module_file_name (void); void mswindows_output_last_error (char *frob); DECLARE_DOESNT_RETURN (mswindows_report_process_error (const char *string, Lisp_Object data, int errnum)); Lisp_Object mswindows_lisp_error (int errnum); - -/*--------------------------------------------------------------------*/ -/* stuff in ntproc.c */ -/* DIE DIE DIE */ -/*--------------------------------------------------------------------*/ - -/* Prepare our standard handles for proper inheritance by child processes. */ -extern void prepare_standard_handles (int in, int out, - int err, HANDLE handles[4]); -/* Reset our standard handles to their original state. */ -extern void reset_standard_handles (int in, int out, - int err, HANDLE handles[4]); -void set_process_dir (const char * dir); -extern void init_ntproc (void); -/* Will die as soon as callproc.c dies */ -int spawnve_will_die_soon (int mode, const Intbyte *cmdname, - const Intbyte * const *argv, - const Intbyte *const *envp); -int pipe_will_die_soon (int *phandles); +/* in intl-win32.c */ +extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode; +extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; #endif /* INCLUDED_syswindows_h_ */ diff --text -u 'xemacs-21.5.6/src/termcap.c' 'xemacs-21.5.7/src/termcap.c' Index: ././src/termcap.c --- ././src/termcap.c Wed Mar 13 17:53:01 2002 +++ ././src/termcap.c Wed Jun 5 18:57:20 2002 @@ -380,7 +380,7 @@ /* Here we know we must search a file and tem has its name. */ - fd = qxe_open ((Intbyte *) tem, 0, 0); + fd = qxe_open ((Ibyte *) tem, 0, 0); if (fd < 0) return -1; diff --text -u 'xemacs-21.5.6/src/tests.c' 'xemacs-21.5.7/src/tests.c' Index: ././src/tests.c --- ././src/tests.c Wed Mar 13 17:53:01 2002 +++ ././src/tests.c Wed Jun 5 18:57:21 2002 @@ -44,7 +44,7 @@ void *ptr; Bytecount len; Lisp_Object string, opaque; - Intbyte int_foo[] = "\n\nfoo\nbar"; + Ibyte int_foo[] = "\n\nfoo\nbar"; Extbyte ext_unix[]= "\n\nfoo\nbar"; Extbyte ext_dos[] = "\r\n\r\nfoo\r\nbar"; @@ -53,8 +53,8 @@ Lisp_Object string_foo = make_string (int_foo, sizeof (int_foo) - 1); Extbyte ext_latin[] = "f\372b\343\340"; - Intbyte int_latin1[] = "f\200\372b\200\343\200\340"; - Intbyte int_latin2[] = "f\201\372b\201\343\201\340"; + Ibyte int_latin1[] = "f\200\372b\200\343\200\340"; + Ibyte int_latin2[] = "f\201\372b\201\343\201\340"; #ifdef MULE Extbyte ext_latin12[]= "f\033-A\372b\343\340\033-B"; Extbyte ext_tilde[] = "f~b~~"; @@ -360,6 +360,7 @@ TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_dos, LISP_BUFFER, Fcurrent_buffer(), intern ("undecided")); + /* &&#### needs some 8-bit work here */ DFC_CHECK_DATA (BUF_BYTE_ADDRESS (current_buffer, BUF_PT (current_buffer)), sizeof (int_foo) - 1, int_foo); diff --text -u 'xemacs-21.5.6/src/text.c' 'xemacs-21.5.7/src/text.c' Index: ././src/text.c --- ././src/text.c Mon Apr 1 12:58:51 2002 +++ ././src/text.c Wed Jun 5 18:57:22 2002 @@ -39,188 +39,20 @@ /************************************************************************/ /* - There are three possible ways to specify positions in a buffer. All - of these are one-based: the beginning of the buffer is position or - index 1, and 0 is not a valid position. - - As a "buffer position" (typedef Charbpos): - - This is an index specifying an offset in characters from the - beginning of the buffer. Note that buffer positions are - logically *between* characters, not on a character. The - difference between two buffer positions specifies the number of - characters between those positions. Buffer positions are the - only kind of position externally visible to the user. - - As a "byte index" (typedef Bytebpos): - - This is an index over the bytes used to represent the characters - in the buffer. If there is no Mule support, this is identical - to a buffer position, because each character is represented - using one byte. However, with Mule support, many characters - require two or more bytes for their representation, and so a - byte index may be greater than the corresponding buffer - position. - - As a "memory index" (typedef Membpos): - - This is the byte index adjusted for the gap. For positions - before the gap, this is identical to the byte index. For - positions after the gap, this is the byte index plus the gap - size. There are two possible memory indices for the gap - position; the memory index at the beginning of the gap should - always be used, except in code that deals with manipulating the - gap, where both indices may be seen. The address of the - character "at" (i.e. following) a particular position can be - obtained from the formula - - buffer_start_address + memory_index(position) - 1 - - except in the case of characters at the gap position. - - Other typedefs: - =============== - - Emchar: - ------- - This typedef represents a single Emacs character, which can be - ASCII, ISO-8859, or some extended character, as would typically - be used for Kanji. Note that the representation of a character - as an Emchar is *not* the same as the representation of that - same character in a string; thus, you cannot do the standard - C trick of passing a pointer to a character to a function that - expects a string. - - An Emchar takes up 19 bits of representation and (for code - compatibility and such) is compatible with an int. This - representation is visible on the Lisp level. The important - characteristics of the Emchar representation are - - -- values 0x00 - 0x7f represent ASCII. - -- values 0x80 - 0xff represent the right half of ISO-8859-1. - -- values 0x100 and up represent all other characters. - - This means that Emchar values are upwardly compatible with - the standard 8-bit representation of ASCII/ISO-8859-1. - - Intbyte: - -------- - The data in a buffer or string is logically made up of Intbyte - objects, where a Intbyte takes up the same amount of space as a - char. (It is declared differently, though, to catch invalid - usages.) Strings stored using Intbytes are said to be in - "internal format". The important characteristics of internal - format are - - -- ASCII characters are represented as a single Intbyte, - in the range 0 - 0x7f. - -- All other characters are represented as a Intbyte in - the range 0x80 - 0x9f followed by one or more Intbytes - in the range 0xa0 to 0xff. - - This leads to a number of desirable properties: - - -- Given the position of the beginning of a character, - you can find the beginning of the next or previous - character in constant time. - -- When searching for a substring or an ASCII character - within the string, you need merely use standard - searching routines. - - array of char: - -------------- - Strings that go in or out of Emacs are in "external format", - typedef'ed as an array of char or a char *. There is more - than one external format (JIS, EUC, etc.) but they all - have similar properties. They are modal encodings, - which is to say that the meaning of particular bytes is - not fixed but depends on what "mode" the string is currently - in (e.g. bytes in the range 0 - 0x7f might be - interpreted as ASCII, or as Hiragana, or as 2-byte Kanji, - depending on the current mode). The mode starts out in - ASCII/ISO-8859-1 and is switched using escape sequences -- - for example, in the JIS encoding, 'ESC $ B' switches to a - mode where pairs of bytes in the range 0 - 0x7f - are interpreted as Kanji characters. - - External-formatted data is generally desirable for passing - data between programs because it is upwardly compatible - with standard ASCII/ISO-8859-1 strings and may require - less space than internal encodings such as the one - described above. In addition, some encodings (e.g. JIS) - keep all characters (except the ESC used to switch modes) - in the printing ASCII range 0x20 - 0x7e, which results in - a much higher probability that the data will avoid being - garbled in transmission. Externally-formatted data is - generally not very convenient to work with, however, and - for this reason is usually converted to internal format - before any work is done on the string. - - NOTE: filenames need to be in external format so that - ISO-8859-1 characters come out correctly. - - Charcount: - ---------- - This typedef represents a count of characters, such as - a character offset into a string or the number of - characters between two positions in a buffer. The - difference between two Charbpos's is a Charcount, and - character positions in a string are represented using - a Charcount. - - Bytecount: - ---------- - Similar to a Charcount but represents a count of bytes. - The difference between two Bytebpos's is a Bytecount. - - - Usage of the various representations: - ===================================== - - Memory indices are used in low-level functions in insdel.c and for - extent endpoints and marker positions. The reason for this is that - this way, the extents and markers don't need to be updated for most - insertions, which merely shrink the gap and don't move any - characters around in memory. - - (The beginning-of-gap memory index simplifies insertions w.r.t. - markers, because text usually gets inserted after markers. For - extents, it is merely for consistency, because text can get - inserted either before or after an extent's endpoint depending on - the open/closedness of the endpoint.) - - Byte indices are used in other code that needs to be fast, - such as the searching, redisplay, and extent-manipulation code. - - Buffer positions are used in all other code. This is because this - representation is easiest to work with (especially since Lisp - code always uses buffer positions), necessitates the fewest - changes to existing code, and is the safest (e.g. if the text gets - shifted underneath a buffer position, it will still point to a - character; if text is shifted under a byte index, it might point - to the middle of a character, which would be bad). - - Similarly, Charcounts are used in all code that deals with strings - except for code that needs to be fast, which used Bytecounts. - - Strings are always passed around internally using internal format. - Conversions between external format are performed at the time - that the data goes in or out of Emacs. - - Working with the various representations: - ========================================= */ - -/* We write things this way because it's very important the - MAX_BYTEBPOS_GAP_SIZE_3 is a multiple of 3. (As it happens, - 65535 is a multiple of 3, but this may not always be the - case.) */ - - -/* - 1. Character Sets - ================= + ========================================================================== + 1. Character Sets + ========================================================================== A character set (or "charset") is an ordered set of characters. + + A character (which is, BTW, a surprisingly complex concept) is, in a + written representation of text, the most basic written unit that has a + meaning of its own. It's comparable to a phoneme when analyzing words + in spoken speech. Just like with a phoneme (which is an abstract + concept, and is represented in actual spoken speech by one or more + allophones, ...&&#### finish this., a character is actually an abstract + concept + A particular character in a charset is indexed using one or more "position codes", which are non-negative integers. The number of position codes needed to identify a particular @@ -298,8 +130,9 @@ This is a bit ad-hoc but gets the job done. - 2. Encodings - ============ + ========================================================================== + 2. Encodings + ========================================================================== An "encoding" is a way of numerically representing characters from one or more character sets. If an encoding @@ -378,8 +211,9 @@ Initially, Printing-ASCII is invoked. - 3. Internal Mule Encodings - ========================== + ========================================================================== + 3. Internal Mule Encodings + ========================================================================== In XEmacs/Mule, each character set is assigned a unique number, called a "leading byte". This is used in the encodings of a @@ -489,10 +323,202 @@ Note that character codes 0 - 255 are the same as the "binary encoding" described above. -*/ -/* - About Unicode support: + Most of the code in XEmacs knows nothing of the representation of a + character other than that values 0 - 255 represent ASCII, Control 1, + and Latin 1. + + WARNING WARNING WARNING: The Boyer-Moore code in search.c, and the + code in search_buffer() that determines whether that code can be used, + knows that "field 3" in a character always corresponds to the last + byte in the textual representation of the character. (This is important + because the Boyer-Moore algorithm works by looking at the last byte + of the search string and &&#### finish this. + + ========================================================================== + 4. Buffer Positions and Other Typedefs + ========================================================================== + + A. Buffer Positions + + There are three possible ways to specify positions in a buffer. All + of these are one-based: the beginning of the buffer is position or + index 1, and 0 is not a valid position. + + As a "buffer position" (typedef Charbpos): + + This is an index specifying an offset in characters from the + beginning of the buffer. Note that buffer positions are + logically *between* characters, not on a character. The + difference between two buffer positions specifies the number of + characters between those positions. Buffer positions are the + only kind of position externally visible to the user. + + As a "byte index" (typedef Bytebpos): + + This is an index over the bytes used to represent the characters + in the buffer. If there is no Mule support, this is identical + to a buffer position, because each character is represented + using one byte. However, with Mule support, many characters + require two or more bytes for their representation, and so a + byte index may be greater than the corresponding buffer + position. + + As a "memory index" (typedef Membpos): + + This is the byte index adjusted for the gap. For positions + before the gap, this is identical to the byte index. For + positions after the gap, this is the byte index plus the gap + size. There are two possible memory indices for the gap + position; the memory index at the beginning of the gap should + always be used, except in code that deals with manipulating the + gap, where both indices may be seen. The address of the + character "at" (i.e. following) a particular position can be + obtained from the formula + + buffer_start_address + memory_index(position) - 1 + + except in the case of characters at the gap position. + + B. Other Typedefs + + Ichar: + ------- + This typedef represents a single Emacs character, which can be + ASCII, ISO-8859, or some extended character, as would typically + be used for Kanji. Note that the representation of a character + as an Ichar is *not* the same as the representation of that + same character in a string; thus, you cannot do the standard + C trick of passing a pointer to a character to a function that + expects a string. + + An Ichar takes up 19 bits of representation and (for code + compatibility and such) is compatible with an int. This + representation is visible on the Lisp level. The important + characteristics of the Ichar representation are + + -- values 0x00 - 0x7f represent ASCII. + -- values 0x80 - 0xff represent the right half of ISO-8859-1. + -- values 0x100 and up represent all other characters. + + This means that Ichar values are upwardly compatible with + the standard 8-bit representation of ASCII/ISO-8859-1. + + Ibyte: + -------- + The data in a buffer or string is logically made up of Ibyte + objects, where a Ibyte takes up the same amount of space as a + char. (It is declared differently, though, to catch invalid + usages.) Strings stored using Ibytes are said to be in + "internal format". The important characteristics of internal + format are + + -- ASCII characters are represented as a single Ibyte, + in the range 0 - 0x7f. + -- All other characters are represented as a Ibyte in + the range 0x80 - 0x9f followed by one or more Ibytes + in the range 0xa0 to 0xff. + + This leads to a number of desirable properties: + + -- Given the position of the beginning of a character, + you can find the beginning of the next or previous + character in constant time. + -- When searching for a substring or an ASCII character + within the string, you need merely use standard + searching routines. + + array of char: + -------------- + Strings that go in or out of Emacs are in "external format", + typedef'ed as an array of char or a char *. There is more + than one external format (JIS, EUC, etc.) but they all + have similar properties. They are modal encodings, + which is to say that the meaning of particular bytes is + not fixed but depends on what "mode" the string is currently + in (e.g. bytes in the range 0 - 0x7f might be + interpreted as ASCII, or as Hiragana, or as 2-byte Kanji, + depending on the current mode). The mode starts out in + ASCII/ISO-8859-1 and is switched using escape sequences -- + for example, in the JIS encoding, 'ESC $ B' switches to a + mode where pairs of bytes in the range 0 - 0x7f + are interpreted as Kanji characters. + + External-formatted data is generally desirable for passing + data between programs because it is upwardly compatible + with standard ASCII/ISO-8859-1 strings and may require + less space than internal encodings such as the one + described above. In addition, some encodings (e.g. JIS) + keep all characters (except the ESC used to switch modes) + in the printing ASCII range 0x20 - 0x7e, which results in + a much higher probability that the data will avoid being + garbled in transmission. Externally-formatted data is + generally not very convenient to work with, however, and + for this reason is usually converted to internal format + before any work is done on the string. + + NOTE: filenames need to be in external format so that + ISO-8859-1 characters come out correctly. + + Charcount: + ---------- + This typedef represents a count of characters, such as + a character offset into a string or the number of + characters between two positions in a buffer. The + difference between two Charbpos's is a Charcount, and + character positions in a string are represented using + a Charcount. + + Bytecount: + ---------- + Similar to a Charcount but represents a count of bytes. + The difference between two Bytebpos's is a Bytecount. + + + C. Usage of the Various Representations + + Memory indices are used in low-level functions in insdel.c and for + extent endpoints and marker positions. The reason for this is that + this way, the extents and markers don't need to be updated for most + insertions, which merely shrink the gap and don't move any + characters around in memory. + + (The beginning-of-gap memory index simplifies insertions w.r.t. + markers, because text usually gets inserted after markers. For + extents, it is merely for consistency, because text can get + inserted either before or after an extent's endpoint depending on + the open/closedness of the endpoint.) + + Byte indices are used in other code that needs to be fast, + such as the searching, redisplay, and extent-manipulation code. + + Buffer positions are used in all other code. This is because this + representation is easiest to work with (especially since Lisp + code always uses buffer positions), necessitates the fewest + changes to existing code, and is the safest (e.g. if the text gets + shifted underneath a buffer position, it will still point to a + character; if text is shifted under a byte index, it might point + to the middle of a character, which would be bad). + + Similarly, Charcounts are used in all code that deals with strings + except for code that needs to be fast, which used Bytecounts. + + Strings are always passed around internally using internal format. + Conversions between external format are performed at the time + that the data goes in or out of Emacs. + + D. Working With the Various Representations + + We write things this way because it's very important the + MAX_BYTEBPOS_GAP_SIZE_3 is a multiple of 3. (As it happens, + 65535 is a multiple of 3, but this may not always be the + case. #### unfinished + + ========================================================================== + 5. Miscellaneous + ========================================================================== + + A. Unicode Support Adding Unicode support is very desirable. Unicode will likely be a very common representation in the future, and thus we should @@ -508,10 +534,11 @@ leading bytes and move them into private space. The CNS charsets are good candidates since they are rarely used, and JAPANESE_JISX0208_1978 is becoming less and less used and could - also be dumped. */ + also be dumped. - -/* Composite characters are characters constructed by overstriking two + B. Composite Characters + + Composite characters are characters constructed by overstriking two or more regular characters. 1) The old Mule implementation involves storing composite characters @@ -538,7 +565,9 @@ over the XEmacs process lifetime, and you only need to increase the size of a Mule character from 19 to 21 bits. Or you could use 0x8D C1 C2 C3 C4, allowing for about - 85 million (slightly over 2^26) composite characters. */ + 85 million (slightly over 2^26) composite characters. + +*/ /************************************************************************/ @@ -560,7 +589,7 @@ rep_bytes_by_first_byte(c) is more efficient than the equivalent canonical computation: - XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c)) */ + XCHARSET_REP_BYTES (charset_by_leading_byte (c)) */ const Bytecount rep_bytes_by_first_byte[0xA0] = { /* 0x00 - 0x7f are for straight ASCII */ @@ -603,7 +632,7 @@ /* Most are inline functions in lisp.h */ int -qxesprintf (Intbyte *buffer, const CIntbyte *format, ...) +qxesprintf (Ibyte *buffer, const CIbyte *format, ...) { va_list args; int retval; @@ -616,7 +645,7 @@ } /* strcasecmp() implementation from BSD */ -static Intbyte strcasecmp_charmap[] = { +static Ibyte strcasecmp_charmap[] = { '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', @@ -662,9 +691,9 @@ */ int -qxestrcasecmp (const Intbyte *s1, const Intbyte *s2) +qxestrcasecmp (const Ibyte *s1, const Ibyte *s2) { - Intbyte *cm = strcasecmp_charmap; + Ibyte *cm = strcasecmp_charmap; while (cm[*s1] == cm[*s2++]) if (*s1++ == '\0') @@ -676,32 +705,32 @@ int ascii_strcasecmp (const Char_ASCII *s1, const Char_ASCII *s2) { - return qxestrcasecmp ((const Intbyte *) s1, (const Intbyte *) s2); + return qxestrcasecmp ((const Ibyte *) s1, (const Ibyte *) s2); } int -qxestrcasecmp_c (const Intbyte *s1, const Char_ASCII *s2) +qxestrcasecmp_c (const Ibyte *s1, const Char_ASCII *s2) { - return qxestrcasecmp (s1, (const Intbyte *) s2); + return qxestrcasecmp (s1, (const Ibyte *) s2); } /* An internationalized version that collapses case in a general fashion. */ int -qxestrcasecmp_i18n (const Intbyte *s1, const Intbyte *s2) +qxestrcasecmp_i18n (const Ibyte *s1, const Ibyte *s2) { while (*s1 && *s2) { - if (DOWNCASE (0, charptr_emchar (s1)) != - DOWNCASE (0, charptr_emchar (s2))) + if (DOWNCASE (0, itext_ichar (s1)) != + DOWNCASE (0, itext_ichar (s2))) break; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); } - return (DOWNCASE (0, charptr_emchar (s1)) - - DOWNCASE (0, charptr_emchar (s2))); + return (DOWNCASE (0, itext_ichar (s1)) - + DOWNCASE (0, itext_ichar (s2))); } /* The only difference between these next two and @@ -710,9 +739,9 @@ the mem...() versions would would run off the end. */ int -qxestrncasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len) +qxestrncasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len) { - Intbyte *cm = strcasecmp_charmap; + Ibyte *cm = strcasecmp_charmap; while (len--) { @@ -730,13 +759,13 @@ int ascii_strncasecmp (const Char_ASCII *s1, const Char_ASCII *s2, Bytecount len) { - return qxestrncasecmp ((const Intbyte *) s1, (const Intbyte *) s2, len); + return qxestrncasecmp ((const Ibyte *) s1, (const Ibyte *) s2, len); } int -qxestrncasecmp_c (const Intbyte *s1, const Char_ASCII *s2, Bytecount len) +qxestrncasecmp_c (const Ibyte *s1, const Char_ASCII *s2, Bytecount len) { - return qxestrncasecmp (s1, (const Intbyte *) s2, len); + return qxestrncasecmp (s1, (const Ibyte *) s2, len); } /* Compare LEN_FROM_S1 worth of characters from S1 with the same number of @@ -746,20 +775,20 @@ with S1. */ int -qxestrncasecmp_i18n (const Intbyte *s1, const Intbyte *s2, +qxestrncasecmp_i18n (const Ibyte *s1, const Ibyte *s2, Bytecount len_from_s1) { while (len_from_s1 > 0) { - const Intbyte *old_s1 = s1; - int diff = (DOWNCASE (0, charptr_emchar (s1)) - - DOWNCASE (0, charptr_emchar (s2))); + const Ibyte *old_s1 = s1; + int diff = (DOWNCASE (0, itext_ichar (s1)) - + DOWNCASE (0, itext_ichar (s2))); if (diff != 0) return diff; if (!*s1) return 0; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); len_from_s1 -= s1 - old_s1; } @@ -767,14 +796,14 @@ } int -qxememcmp (const Intbyte *s1, const Intbyte *s2, Bytecount len) +qxememcmp (const Ibyte *s1, const Ibyte *s2, Bytecount len) { return memcmp (s1, s2, len); } int -qxememcmp4 (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2) +qxememcmp4 (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2) { int retval = qxememcmp (s1, s2, min (len1, len2)); if (retval) @@ -783,9 +812,9 @@ } int -qxememcasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len) +qxememcasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len) { - Intbyte *cm = strcasecmp_charmap; + Ibyte *cm = strcasecmp_charmap; while (len--) { @@ -799,8 +828,8 @@ } int -qxememcasecmp4 (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2) +qxememcasecmp4 (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2) { int retval = qxememcasecmp (s1, s2, min (len1, len2)); if (retval) @@ -809,22 +838,22 @@ } /* Do a character-by-character comparison, returning "which is greater" by - comparing the Emchar values. (#### Should have option to compare Unicode + comparing the Ichar values. (#### Should have option to compare Unicode points) */ int -qxetextcmp (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2) +qxetextcmp (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2) { while (len1 > 0 && len2 > 0) { - const Intbyte *old_s1 = s1; - const Intbyte *old_s2 = s2; - int diff = charptr_emchar (s1) - charptr_emchar (s2); + const Ibyte *old_s1 = s1; + const Ibyte *old_s2 = s2; + int diff = itext_ichar (s1) - itext_ichar (s2); if (diff != 0) return diff; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); len1 -= s1 - old_s1; len2 -= s2 - old_s2; } @@ -834,20 +863,20 @@ } int -qxetextcmp_matching (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2, +qxetextcmp_matching (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2, Charcount *matching) { *matching = 0; while (len1 > 0 && len2 > 0) { - const Intbyte *old_s1 = s1; - const Intbyte *old_s2 = s2; - int diff = charptr_emchar (s1) - charptr_emchar (s2); + const Ibyte *old_s1 = s1; + const Ibyte *old_s2 = s2; + int diff = itext_ichar (s1) - itext_ichar (s2); if (diff != 0) return diff; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); len1 -= s1 - old_s1; len2 -= s2 - old_s2; (*matching)++; @@ -858,7 +887,7 @@ } /* Do a character-by-character comparison, returning "which is greater" by - comparing the Emchar values, case insensitively (by downcasing both + comparing the Ichar values, case insensitively (by downcasing both first). (#### Should have option to compare Unicode points) In this case, both lengths must be specified becaused downcasing can @@ -868,19 +897,19 @@ is "greater". */ int -qxetextcasecmp (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2) +qxetextcasecmp (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2) { while (len1 > 0 && len2 > 0) { - const Intbyte *old_s1 = s1; - const Intbyte *old_s2 = s2; - int diff = (DOWNCASE (0, charptr_emchar (s1)) - - DOWNCASE (0, charptr_emchar (s2))); + const Ibyte *old_s1 = s1; + const Ibyte *old_s2 = s2; + int diff = (DOWNCASE (0, itext_ichar (s1)) - + DOWNCASE (0, itext_ichar (s2))); if (diff != 0) return diff; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); len1 -= s1 - old_s1; len2 -= s2 - old_s2; } @@ -893,21 +922,21 @@ beginning that match. */ int -qxetextcasecmp_matching (const Intbyte *s1, Bytecount len1, - const Intbyte *s2, Bytecount len2, +qxetextcasecmp_matching (const Ibyte *s1, Bytecount len1, + const Ibyte *s2, Bytecount len2, Charcount *matching) { *matching = 0; while (len1 > 0 && len2 > 0) { - const Intbyte *old_s1 = s1; - const Intbyte *old_s2 = s2; - int diff = (DOWNCASE (0, charptr_emchar (s1)) - - DOWNCASE (0, charptr_emchar (s2))); + const Ibyte *old_s1 = s1; + const Ibyte *old_s2 = s2; + int diff = (DOWNCASE (0, itext_ichar (s1)) - + DOWNCASE (0, itext_ichar (s2))); if (diff != 0) return diff; - INC_CHARPTR (s1); - INC_CHARPTR (s2); + INC_IBYTEPTR (s1); + INC_IBYTEPTR (s2); len1 -= s1 - old_s1; len2 -= s2 - old_s2; (*matching)++; @@ -920,11 +949,11 @@ int lisp_strcasecmp (Lisp_Object s1, Lisp_Object s2) { - Intbyte *cm = strcasecmp_charmap; - Intbyte *p1 = XSTRING_DATA (s1); - Intbyte *p2 = XSTRING_DATA (s2); - Intbyte *e1 = p1 + XSTRING_LENGTH (s1); - Intbyte *e2 = p2 + XSTRING_LENGTH (s2); + Ibyte *cm = strcasecmp_charmap; + Ibyte *p1 = XSTRING_DATA (s1); + Ibyte *p2 = XSTRING_DATA (s2); + Ibyte *e1 = p1 + XSTRING_LENGTH (s1); + Ibyte *e2 = p2 + XSTRING_LENGTH (s2); /* again, we use a symmetric algorithm and favor clarity over nanosecond improvements. */ @@ -956,94 +985,242 @@ /* NOTE: Does not reset the Dynarr. */ void -convert_intbyte_string_into_emchar_dynarr (const Intbyte *str, Bytecount len, - Emchar_dynarr *dyn) +convert_ibyte_string_into_ichar_dynarr (const Ibyte *str, Bytecount len, + Ichar_dynarr *dyn) { - const Intbyte *strend = str + len; + const Ibyte *strend = str + len; while (str < strend) { - Emchar ch = charptr_emchar (str); + Ichar ch = itext_ichar (str); Dynarr_add (dyn, ch); - INC_CHARPTR (str); + INC_IBYTEPTR (str); } } Charcount -convert_intbyte_string_into_emchar_string (const Intbyte *str, Bytecount len, - Emchar *arr) +convert_ibyte_string_into_ichar_string (const Ibyte *str, Bytecount len, + Ichar *arr) { - const Intbyte *strend = str + len; + const Ibyte *strend = str + len; Charcount newlen = 0; while (str < strend) { - Emchar ch = charptr_emchar (str); + Ichar ch = itext_ichar (str); arr[newlen++] = ch; - INC_CHARPTR (str); + INC_IBYTEPTR (str); } return newlen; } -/* Convert an array of Emchars into the equivalent string representation. - Store into the given Intbyte dynarr. Does not reset the dynarr. +/* Convert an array of Ichars into the equivalent string representation. + Store into the given Ibyte dynarr. Does not reset the dynarr. Does not add a terminating zero. */ void -convert_emchar_string_into_intbyte_dynarr (Emchar *arr, int nels, - Intbyte_dynarr *dyn) +convert_ichar_string_into_ibyte_dynarr (Ichar *arr, int nels, + Ibyte_dynarr *dyn) { - Intbyte str[MAX_EMCHAR_LEN]; + Ibyte str[MAX_ICHAR_LEN]; int i; for (i = 0; i < nels; i++) { - Bytecount len = set_charptr_emchar (str, arr[i]); + Bytecount len = set_itext_ichar (str, arr[i]); Dynarr_add_many (dyn, str, len); } } -/* Convert an array of Emchars into the equivalent string representation. +/* Convert an array of Ichars into the equivalent string representation. Malloc the space needed for this and return it. If LEN_OUT is not a - NULL pointer, store into LEN_OUT the number of Intbytes in the - malloc()ed string. Note that the actual number of Intbytes allocated + NULL pointer, store into LEN_OUT the number of Ibytes in the + malloc()ed string. Note that the actual number of Ibytes allocated is one more than this: the returned string is zero-terminated. */ -Intbyte * -convert_emchar_string_into_malloced_string (Emchar *arr, int nels, - Bytecount *len_out) +Ibyte * +convert_ichar_string_into_malloced_string (Ichar *arr, int nels, + Bytecount *len_out) { /* Damn zero-termination. */ - Intbyte *str = (Intbyte *) alloca (nels * MAX_EMCHAR_LEN + 1); - Intbyte *strorig = str; + Ibyte *str = (Ibyte *) ALLOCA (nels * MAX_ICHAR_LEN + 1); + Ibyte *strorig = str; Bytecount len; int i; for (i = 0; i < nels; i++) - str += set_charptr_emchar (str, arr[i]); + str += set_itext_ichar (str, arr[i]); *str = '\0'; len = str - strorig; - str = (Intbyte *) xmalloc (1 + len); + str = (Ibyte *) xmalloc (1 + len); memcpy (str, strorig, 1 + len); if (len_out) *len_out = len; return str; } +#define COPY_TEXT_BETWEEN_FORMATS(srcfmt, dstfmt) \ +do \ +{ \ + if (dst) \ + { \ + Ibyte *dstend = dst + dstlen; \ + Ibyte *dstp = dst; \ + const Ibyte *srcend = src + srclen; \ + const Ibyte *srcp = src; \ + \ + while (srcp < srcend) \ + { \ + Ichar ch = itext_ichar_fmt (srcp, srcfmt, srcobj); \ + Bytecount len = ichar_len_fmt (ch, dstfmt); \ + \ + if (dstp + len <= dstend) \ + { \ + set_itext_ichar_fmt (dstp, ch, dstfmt, dstobj); \ + dstp += len; \ + } \ + else \ + break; \ + INC_IBYTEPTR_FMT (srcp, srcfmt); \ + } \ + text_checking_assert (srcp <= srcend); \ + if (src_used) \ + *src_used = srcp - src; \ + return dstp - dst; \ + } \ + else \ + { \ + const Ibyte *srcend = src + srclen; \ + const Ibyte *srcp = src; \ + Bytecount total = 0; \ + \ + while (srcp < srcend) \ + { \ + total += ichar_len_fmt (itext_ichar_fmt (srcp, srcfmt, \ + srcobj), dstfmt); \ + INC_IBYTEPTR_FMT (srcp, srcfmt); \ + } \ + text_checking_assert (srcp == srcend); \ + if (src_used) \ + *src_used = srcp - src; \ + return total; \ + } \ +} \ +while (0) + +/* Copy as much text from SRC/SRCLEN to DST/DSTLEN as will fit, converting + from SRCFMT/SRCOBJ to DSTFMT/DSTOBJ. Return number of bytes stored into + DST as return value, and number of bytes copied from SRC through + SRC_USED (if not NULL). If DST is NULL, don't actually store anything + and just return the size needed to store all the text. Will not copy + partial characters into DST. */ + +Bytecount +copy_text_between_formats (const Ibyte *src, Bytecount srclen, + Internal_Format srcfmt, + Lisp_Object srcobj, + Ibyte *dst, Bytecount dstlen, + Internal_Format dstfmt, + Lisp_Object dstobj, + Bytecount *src_used) +{ + if (srcfmt == dstfmt && + objects_have_same_internal_representation (srcobj, dstobj)) + { + if (dst) + { + srclen = min (srclen, dstlen); + srclen = validate_ibyte_string_backward (src, srclen); + memcpy (dst, src, srclen); + if (src_used) + *src_used = srclen; + return srclen; + } + else + return srclen; + } + /* Everything before the final else statement is an optimization. + The inner loops inside COPY_TEXT_BETWEEN_FORMATS() have a number + of calls to *_fmt(), each of which has a switch statement in it. + By using constants as the FMT argument, these switch statements + will be optimized out of existence. */ +#define ELSE_FORMATS(fmt1, fmt2) \ + else if (srcfmt == fmt1 && dstfmt == fmt2) \ + COPY_TEXT_BETWEEN_FORMATS (fmt1, fmt2) + ELSE_FORMATS (FORMAT_DEFAULT, FORMAT_8_BIT_FIXED); + ELSE_FORMATS (FORMAT_8_BIT_FIXED, FORMAT_DEFAULT); + ELSE_FORMATS (FORMAT_DEFAULT, FORMAT_32_BIT_FIXED); + ELSE_FORMATS (FORMAT_32_BIT_FIXED, FORMAT_DEFAULT); + else + COPY_TEXT_BETWEEN_FORMATS (srcfmt, dstfmt); +#undef ELSE_FORMATS +} + +/* Copy as much buffer text in BUF, starting at POS, of length LEN, as will + fit into DST/DSTLEN, converting to DSTFMT. Return number of bytes + stored into DST as return value, and number of bytes copied from BUF + through SRC_USED (if not NULL). If DST is NULL, don't actually store + anything and just return the size needed to store all the text. */ + +Bytecount +copy_buffer_text_out (struct buffer *buf, Bytebpos pos, + Bytecount len, Ibyte *dst, Bytecount dstlen, + Internal_Format dstfmt, Lisp_Object dstobj, + Bytecount *src_used) +{ + Bytecount dst_used = 0; + if (src_used) + *src_used = 0; + + { + BUFFER_TEXT_LOOP (buf, pos, len, runptr, runlen) + { + Bytecount the_src_used, the_dst_used; + + the_dst_used = copy_text_between_formats (runptr, runlen, + BUF_FORMAT (buf), + wrap_buffer (buf), + dst, dstlen, dstfmt, + dstobj, &the_src_used); + dst_used += the_dst_used; + if (src_used) + *src_used += the_src_used; + if (dst) + { + dst += the_dst_used; + dstlen -= the_dst_used; + /* Stop if we didn't use all of the source text. Also stop + if the destination is full. We need the first test because + there might be a couple bytes left in the destination, but + not enough to fit a full character. The first test will in + fact catch the vast majority of cases where the destination + is empty, too -- but in case the destination holds *exactly* + the run length, we put in the second check. (It shouldn't + really matter though -- next time through we'll just get a + 0.) */ + if (the_src_used < runlen || !dstlen) + break; + } + } + } + + return dst_used; +} + /************************************************************************/ /* charset properties of strings */ /************************************************************************/ void -find_charsets_in_intbyte_string (unsigned char *charsets, const Intbyte *str, +find_charsets_in_ibyte_string (unsigned char *charsets, const Ibyte *str, Bytecount len) { #ifndef MULE /* Telescope this. */ charsets[0] = 1; #else - const Intbyte *strend = str + len; + const Ibyte *strend = str + len; memset (charsets, 0, NUM_LEADING_BYTES); /* #### SJT doesn't like this. */ @@ -1055,15 +1232,15 @@ while (str < strend) { - charsets[CHAR_LEADING_BYTE (charptr_emchar (str)) - MIN_LEADING_BYTE] = + charsets[ichar_leading_byte (itext_ichar (str)) - MIN_LEADING_BYTE] = 1; - INC_CHARPTR (str); + INC_IBYTEPTR (str); } #endif } void -find_charsets_in_emchar_string (unsigned char *charsets, const Emchar *str, +find_charsets_in_ichar_string (unsigned char *charsets, const Ichar *str, Charcount len) { #ifndef MULE @@ -1083,40 +1260,40 @@ for (i = 0; i < len; i++) { - charsets[CHAR_LEADING_BYTE (str[i]) - MIN_LEADING_BYTE] = 1; + charsets[ichar_leading_byte (str[i]) - MIN_LEADING_BYTE] = 1; } #endif } int -intbyte_string_displayed_columns (const Intbyte *str, Bytecount len) +ibyte_string_displayed_columns (const Ibyte *str, Bytecount len) { int cols = 0; - const Intbyte *end = str + len; + const Ibyte *end = str + len; while (str < end) { #ifdef MULE - Emchar ch = charptr_emchar (str); - cols += XCHARSET_COLUMNS (CHAR_CHARSET (ch)); + Ichar ch = itext_ichar (str); + cols += XCHARSET_COLUMNS (ichar_charset (ch)); #else cols++; #endif - INC_CHARPTR (str); + INC_IBYTEPTR (str); } return cols; } int -emchar_string_displayed_columns (const Emchar *str, Charcount len) +ichar_string_displayed_columns (const Ichar *str, Charcount len) { #ifdef MULE int cols = 0; int i; for (i = 0; i < len; i++) - cols += XCHARSET_COLUMNS (CHAR_CHARSET (str[i])); + cols += XCHARSET_COLUMNS (ichar_charset (str[i])); return cols; #else /* not MULE */ @@ -1125,17 +1302,17 @@ } Charcount -intbyte_string_nonascii_chars (const Intbyte *str, Bytecount len) +ibyte_string_nonascii_chars (const Ibyte *str, Bytecount len) { #ifdef MULE - const Intbyte *end = str + len; + const Ibyte *end = str + len; Charcount retval = 0; while (str < end) { - if (!BYTE_ASCII_P (*str)) + if (!byte_ascii_p (*str)) retval++; - INC_CHARPTR (str); + INC_IBYTEPTR (str); } return retval; @@ -1150,17 +1327,17 @@ /***************************************************************************/ int -eistr_casefiddle_1 (Intbyte *olddata, Bytecount len, Intbyte *newdata, +eistr_casefiddle_1 (Ibyte *olddata, Bytecount len, Ibyte *newdata, int downp) { - Intbyte *endp = olddata + len; - Intbyte *newp = newdata; + Ibyte *endp = olddata + len; + Ibyte *newp = newdata; int changedp = 0; while (olddata < endp) { - Emchar c = charptr_emchar (olddata); - Emchar newc; + Ichar c = itext_ichar (olddata); + Ichar newc; if (downp) newc = DOWNCASE (0, c); @@ -1170,8 +1347,8 @@ if (c != newc) changedp = 1; - newp += set_charptr_emchar (newp, newc); - INC_CHARPTR (olddata); + newp += set_itext_ichar (newp, newc); + INC_IBYTEPTR (olddata); } *newp = '\0'; @@ -1199,11 +1376,11 @@ ei->mallocp_ = 1; if (ei->data_) { - Intbyte *newdata; + Ibyte *newdata; ei->max_size_allocated_ = eifind_large_enough_buffer (0, ei->bytelen_ + 1); - newdata = (Intbyte *) xmalloc (ei->max_size_allocated_); + newdata = (Ibyte *) xmalloc (ei->max_size_allocated_); memcpy (newdata, ei->data_, ei->bytelen_ + 1); ei->data_ = newdata; } @@ -1222,7 +1399,7 @@ int eicmp_1 (Eistring *ei, Bytecount off, Charcount charoff, - Bytecount len, Charcount charlen, const Intbyte *data, + Bytecount len, Charcount charlen, const Ibyte *data, const Eistring *ei2, int is_c, int fold_case) { assert ((off < 0) != (charoff < 0)); @@ -1245,7 +1422,7 @@ { Bytecount dstlen; - const Intbyte *src = ei->data_, *dst; + const Ibyte *src = ei->data_, *dst; if (data) { @@ -1267,13 +1444,14 @@ } } -Intbyte * -eicpyout_malloc_fmt (Eistring *eistr, Bytecount *len_out, Internal_Format fmt) +Ibyte * +eicpyout_malloc_fmt (Eistring *eistr, Bytecount *len_out, Internal_Format fmt, + Lisp_Object object) { - Intbyte *ptr; + Ibyte *ptr; assert (fmt == FORMAT_DEFAULT); - ptr = xnew_array (Intbyte, eistr->bytelen_ + 1); + ptr = xnew_array (Ibyte, eistr->bytelen_ + 1); if (len_out) *len_out = eistr->bytelen_; memcpy (ptr, eistr->data_, eistr->bytelen_ + 1); @@ -1289,32 +1467,22 @@ #ifdef MULE -/* We include the basic functions here that require no specific - knowledge of how data is Mule-encoded into a buffer other - than the basic (00 - 7F), (80 - 9F), (A0 - FF) scheme. - Anything that requires more specific knowledge goes into - mule-charset.c. */ - -/* Given a pointer to a text string and a length in bytes, return - the equivalent length in characters. */ - -Charcount -bytecount_to_charcount (const Intbyte *ptr, Bytecount len) -{ - Charcount count = 0; - const Intbyte *end = ptr + len; - -#if SIZEOF_LONG == 8 -# define STRIDE_TYPE long -# define HIGH_BIT_MASK 0x8080808080808080UL -#elif SIZEOF_LONG_LONG == 8 && !(defined (i386) || defined (__i386__)) -# define STRIDE_TYPE long long -# define HIGH_BIT_MASK 0x8080808080808080ULL -#elif SIZEOF_LONG == 4 -# define STRIDE_TYPE long -# define HIGH_BIT_MASK 0x80808080UL +/* Skip as many ASCII bytes as possible in the memory block [PTR, END). + Return pointer to the first non-ASCII byte. optimized for long + stretches of ASCII. */ +inline static const Ibyte * +skip_ascii (const Ibyte *ptr, const Ibyte *end) +{ +#ifdef EFFICIENT_INT_128_BIT +# define STRIDE_TYPE INT_128_BIT +# define HIGH_BIT_MASK \ + MAKE_128_BIT_UNSIGNED_CONSTANT (0x80808080808080808080808080808080) +#elif defined (EFFICIENT_INT_64_BIT) +# define STRIDE_TYPE INT_64_BIT +# define HIGH_BIT_MASK MAKE_64_BIT_UNSIGNED_CONSTANT (0x8080808080808080) #else -# error Add support for 128-bit systems here +# define STRIDE_TYPE INT_32_BIT +# define HIGH_BIT_MASK MAKE_32_BIT_UNSIGNED_CONSTANT (0x80808080) #endif #define ALIGN_BITS ((EMACS_UINT) (ALIGNOF (STRIDE_TYPE) - 1)) @@ -1322,39 +1490,52 @@ #define ALIGNED(ptr) ((((EMACS_UINT) ptr) & ALIGN_BITS) == 0) #define STRIDE sizeof (STRIDE_TYPE) - while (ptr < end) + const unsigned STRIDE_TYPE *ascii_end; + + /* Need to do in 3 sections -- before alignment start, aligned chunk, + after alignment end. */ + while (!ALIGNED (ptr)) + { + if (ptr == end || !byte_ascii_p (*ptr)) + return ptr; + ptr++; + } + ascii_end = (const unsigned STRIDE_TYPE *) ptr; + /* This loop screams, because we can detect ASCII + characters 4 or 8 at a time. */ + while ((const Ibyte *) ascii_end + STRIDE <= end + && !(*ascii_end & HIGH_BIT_MASK)) + ascii_end++; + ptr = (Ibyte *) ascii_end; + while (ptr < end && byte_ascii_p (*ptr)) + ptr++; + return ptr; +} + +/* Function equivalents of bytecount_to_charcount/charcount_to_bytecount. + These work on strings of all sizes but are more efficient than a simple + loop on large strings and probably less efficient on sufficiently small + strings. */ + +Charcount +bytecount_to_charcount_fun (const Ibyte *ptr, Bytecount len) +{ + Charcount count = 0; + const Ibyte *end = ptr + len; + while (1) { - if (BYTE_ASCII_P (*ptr)) - { - /* optimize for long stretches of ASCII */ - if (! ALIGNED (ptr)) - ptr++, count++; - else - { - const unsigned STRIDE_TYPE *ascii_end = - (const unsigned STRIDE_TYPE *) ptr; - /* This loop screams, because we can detect ASCII - characters 4 or 8 at a time. */ - while ((const Intbyte *) ascii_end + STRIDE <= end - && !(*ascii_end & HIGH_BIT_MASK)) - ascii_end++; - if ((Intbyte *) ascii_end == ptr) - ptr++, count++; - else - { - count += (Intbyte *) ascii_end - ptr; - ptr = (Intbyte *) ascii_end; - } - } - } - else - { - /* optimize for successive characters from the same charset */ - Intbyte leading_byte = *ptr; - int bytes = REP_BYTES_BY_FIRST_BYTE (leading_byte); - while ((ptr < end) && (*ptr == leading_byte)) - ptr += bytes, count++; - } + const Ibyte *newptr = skip_ascii (ptr, end); + count += newptr - ptr; + ptr = newptr; + if (ptr == end) + break; + { + /* Optimize for successive characters from the same charset */ + Ibyte leading_byte = *ptr; + int bytes = rep_bytes_by_first_byte (leading_byte); + while (ptr < end && *ptr == leading_byte) + ptr += bytes, count++; + } } /* Bomb out if the specified substring ends in the middle @@ -1368,33 +1549,28 @@ return count; } -/* Given a pointer to a text string and a length in characters, return - the equivalent length in bytes. */ - Bytecount -charcount_to_bytecount (const Intbyte *ptr, Charcount len) +charcount_to_bytecount_fun (const Ibyte *ptr, Charcount len) { - const Intbyte *newptr = ptr; - - text_checking_assert (len >= 0); - while (len > 0) + const Ibyte *newptr = ptr; + while (1) { - INC_CHARPTR (newptr); - len--; + const Ibyte *newnewptr = skip_ascii (newptr, newptr + len); + len -= newnewptr - newptr; + newptr = newnewptr; + if (!len) + break; + { + /* Optimize for successive characters from the same charset */ + Ibyte leading_byte = *newptr; + int bytes = rep_bytes_by_first_byte (leading_byte); + while (len > 0 && *newptr == leading_byte) + newptr += bytes, len--; + } } return newptr - ptr; } -inline static void -update_entirely_ascii_p_flag (struct buffer *buf) -{ - buf->text->entirely_ascii_p = - (buf->text->mule_bufmin == 1 && - buf->text->mule_bufmax == buf->text->bufz && - !buf->text->mule_shifter && - !buf->text->mule_three_p); -} - /* The next two functions are the actual meat behind the charbpos-to-bytebpos and bytebpos-to-charbpos conversions. Currently the method they use is fairly unsophisticated; see buffer.h. @@ -1426,11 +1602,11 @@ /* Check for some cached positions, for speed. */ if (x == BUF_PT (buf)) - return BI_BUF_PT (buf); + return BYTE_BUF_PT (buf); if (x == BUF_ZV (buf)) - return BI_BUF_ZV (buf); + return BYTE_BUF_ZV (buf); if (x == BUF_BEGV (buf)) - return BI_BUF_BEGV (buf); + return BYTE_BUF_BEGV (buf); bufmin = buf->text->mule_bufmin; bufmax = buf->text->mule_bufmax; @@ -1478,7 +1654,7 @@ if (diffpt < diffmax && diffpt <= diffzv) { bufmax = bufmin = BUF_PT (buf); - bytmax = bytmin = BI_BUF_PT (buf); + bytmax = bytmin = BYTE_BUF_PT (buf); /* We set the size to 1 even though it doesn't really matter because the new known region contains no characters. We do this because this is the most @@ -1490,7 +1666,7 @@ if (diffzv < diffmax) { bufmax = bufmin = BUF_ZV (buf); - bytmax = bytmin = BI_BUF_ZV (buf); + bytmax = bytmin = BYTE_BUF_ZV (buf); size = 1; } } @@ -1520,7 +1696,7 @@ if (diffpt < diffmin && diffpt <= diffbegv) { bufmax = bufmin = BUF_PT (buf); - bytmax = bytmin = BI_BUF_PT (buf); + bytmax = bytmin = BYTE_BUF_PT (buf); /* We set the size to 1 even though it doesn't really matter because the new known region contains no characters. We do this because this is the most @@ -1532,7 +1708,7 @@ if (diffbegv < diffmin) { bufmax = bufmin = BUF_BEGV (buf); - bytmax = bytmin = BI_BUF_BEGV (buf); + bytmax = bytmin = BYTE_BUF_BEGV (buf); size = 1; } } @@ -1664,7 +1840,6 @@ buf->text->mule_bufmax = bufmax; buf->text->mule_bytmin = bytmin; buf->text->mule_bytmax = bytmax; - update_entirely_ascii_p_flag (buf); if (add_to_cache) { @@ -1703,11 +1878,11 @@ int add_to_cache = 0; /* Check for some cached positions, for speed. */ - if (x == BI_BUF_PT (buf)) + if (x == BYTE_BUF_PT (buf)) return BUF_PT (buf); - if (x == BI_BUF_ZV (buf)) + if (x == BYTE_BUF_ZV (buf)) return BUF_ZV (buf); - if (x == BI_BUF_BEGV (buf)) + if (x == BYTE_BUF_BEGV (buf)) return BUF_BEGV (buf); bufmin = buf->text->mule_bufmin; @@ -1723,16 +1898,16 @@ when the size of the character just seen changes. We optimize this, however, by first shifting the known region to - one of the cached points if it's close by. (We don't check BI_BEG or - BI_Z, even though they're cached; most of the time these will be the - same as BI_BEGV and BI_ZV, and when they're not, they're not likely + one of the cached points if it's close by. (We don't check BYTE_BEG or + BYTE_Z, even though they're cached; most of the time these will be the + same as BYTE_BEGV and BYTE_ZV, and when they're not, they're not likely to be used.) */ if (x > bytmax) { Bytebpos diffmax = x - bytmax; - Bytebpos diffpt = x - BI_BUF_PT (buf); - Bytebpos diffzv = BI_BUF_ZV (buf) - x; + Bytebpos diffpt = x - BYTE_BUF_PT (buf); + Bytebpos diffzv = BYTE_BUF_ZV (buf) - x; /* #### This value could stand some more exploration. */ Bytecount heuristic_hack = (bytmax - bytmin) >> 2; @@ -1745,10 +1920,10 @@ diffzv = -diffzv; /* But also implement a heuristic that favors the known region - over BI_PT or BI_ZV. The reason for this is that switching to - BI_PT or BI_ZV will wipe out the knowledge in the known region, + over BYTE_PT or BYTE_ZV. The reason for this is that switching to + BYTE_PT or BYTE_ZV will wipe out the knowledge in the known region, which might be annoying if the known region is large and - BI_PT or BI_ZV is not that much closer than the end of the known + BYTE_PT or BYTE_ZV is not that much closer than the end of the known region. */ diffzv += heuristic_hack; @@ -1756,7 +1931,7 @@ if (diffpt < diffmax && diffpt <= diffzv) { bufmax = bufmin = BUF_PT (buf); - bytmax = bytmin = BI_BUF_PT (buf); + bytmax = bytmin = BYTE_BUF_PT (buf); /* We set the size to 1 even though it doesn't really matter because the new known region contains no characters. We do this because this is the most @@ -1768,7 +1943,7 @@ if (diffzv < diffmax) { bufmax = bufmin = BUF_ZV (buf); - bytmax = bytmin = BI_BUF_ZV (buf); + bytmax = bytmin = BYTE_BUF_ZV (buf); size = 1; } } @@ -1779,8 +1954,8 @@ else { Bytebpos diffmin = bytmin - x; - Bytebpos diffpt = BI_BUF_PT (buf) - x; - Bytebpos diffbegv = x - BI_BUF_BEGV (buf); + Bytebpos diffpt = BYTE_BUF_PT (buf) - x; + Bytebpos diffbegv = x - BYTE_BUF_BEGV (buf); /* #### This value could stand some more exploration. */ Bytecount heuristic_hack = (bytmax - bytmin) >> 2; @@ -1798,7 +1973,7 @@ if (diffpt < diffmin && diffpt <= diffbegv) { bufmax = bufmin = BUF_PT (buf); - bytmax = bytmin = BI_BUF_PT (buf); + bytmax = bytmin = BYTE_BUF_PT (buf); /* We set the size to 1 even though it doesn't really matter because the new known region contains no characters. We do this because this is the most @@ -1810,7 +1985,7 @@ if (diffbegv < diffmin) { bufmax = bufmin = BUF_BEGV (buf); - bytmax = bytmin = BI_BUF_BEGV (buf); + bytmax = bytmin = BYTE_BUF_BEGV (buf); size = 1; } } @@ -1942,7 +2117,6 @@ buf->text->mule_bufmax = bufmax; buf->text->mule_bytmin = bytmin; buf->text->mule_bytmax = bytmax; - update_entirely_ascii_p_flag (buf); if (add_to_cache) { @@ -1987,7 +2161,7 @@ } if (start >= buf->text->mule_bufmax) - goto done; + return; /* The insertion is either before the known region, in which case it shoves it forward; or within the known region, in which case @@ -2060,17 +2234,15 @@ } } } - done: - update_entirely_ascii_p_flag (buf); } -/* Text from START to END (equivalent in Bytebposs: from BI_START to - BI_END) was deleted. */ +/* Text from START to END (equivalent in Bytebpos's: from BYTE_START to + BYTE_END) was deleted. */ void buffer_mule_signal_deleted_region (struct buffer *buf, Charbpos start, - Charbpos end, Bytebpos bi_start, - Bytebpos bi_end) + Charbpos end, Bytebpos byte_start, + Bytebpos byte_end) { int i; @@ -2081,64 +2253,42 @@ if (buf->text->mule_charbpos_cache[i] > end) { buf->text->mule_charbpos_cache[i] -= end - start; - buf->text->mule_bytebpos_cache[i] -= bi_end - bi_start; + buf->text->mule_bytebpos_cache[i] -= byte_end - byte_start; } /* In the range; moves to start of range */ else if (buf->text->mule_charbpos_cache[i] > start) { buf->text->mule_charbpos_cache[i] = start; - buf->text->mule_bytebpos_cache[i] = bi_start; + buf->text->mule_bytebpos_cache[i] = byte_start; } } /* We don't care about any text after the end of the known region. */ end = min (end, buf->text->mule_bufmax); - bi_end = min (bi_end, buf->text->mule_bytmax); + byte_end = min (byte_end, buf->text->mule_bytmax); if (start >= end) - goto done; + return; /* The end of the known region offsets by the total amount of deletion, since it's all before it. */ buf->text->mule_bufmax -= end - start; - buf->text->mule_bytmax -= bi_end - bi_start; + buf->text->mule_bytmax -= byte_end - byte_start; /* Now we don't care about any text after the start of the known region. */ end = min (end, buf->text->mule_bufmin); - bi_end = min (bi_end, buf->text->mule_bytmin); + byte_end = min (byte_end, buf->text->mule_bytmin); if (start < end) { buf->text->mule_bufmin -= end - start; - buf->text->mule_bytmin -= bi_end - bi_start; + buf->text->mule_bytmin -= byte_end - byte_start; } - - done: - update_entirely_ascii_p_flag (buf); } #endif /* MULE */ -#ifdef ERROR_CHECK_TEXT - -Bytebpos -charbpos_to_bytebpos (struct buffer *buf, Charbpos x) -{ - Bytebpos retval = real_charbpos_to_bytebpos (buf, x); - ASSERT_VALID_BYTEBPOS_UNSAFE (buf, retval); - return retval; -} - -Charbpos -bytebpos_to_charbpos (struct buffer *buf, Bytebpos x) -{ - ASSERT_VALID_BYTEBPOS_UNSAFE (buf, x); - return real_bytebpos_to_charbpos (buf, x); -} - -#endif /* ERROR_CHECK_TEXT */ - /************************************************************************/ /* verifying buffer and string positions */ @@ -2256,7 +2406,8 @@ void get_buffer_range_char (struct buffer *b, Lisp_Object from, Lisp_Object to, - Charbpos *from_out, Charbpos *to_out, unsigned int flags) + Charbpos *from_out, Charbpos *to_out, + unsigned int flags) { /* Does not GC */ Charbpos min_allowed, max_allowed; @@ -2298,7 +2449,8 @@ void get_buffer_range_byte (struct buffer *b, Lisp_Object from, Lisp_Object to, - Bytebpos *from_out, Bytebpos *to_out, unsigned int flags) + Bytebpos *from_out, Bytebpos *to_out, + unsigned int flags) { Charbpos s, e; @@ -2345,7 +2497,7 @@ get_string_pos_char (Lisp_Object string, Lisp_Object pos, unsigned int flags) { return get_string_pos_char_1 (string, pos, flags, - XSTRING_CHAR_LENGTH (string)); + string_char_length (string)); } Bytecount @@ -2363,7 +2515,7 @@ unsigned int flags) { Charcount min_allowed = 0; - Charcount max_allowed = XSTRING_CHAR_LENGTH (string); + Charcount max_allowed = string_char_length (string); if (NILP (from) && (flags & GB_ALLOW_NIL)) *from_out = min_allowed; @@ -2414,7 +2566,7 @@ } -Charbpos +Charxpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos, unsigned int flags) { @@ -2423,7 +2575,7 @@ get_buffer_pos_char (XBUFFER (object), pos, flags); } -Bytebpos +Bytexpos get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos, unsigned int flags) { @@ -2434,76 +2586,146 @@ void get_buffer_or_string_range_char (Lisp_Object object, Lisp_Object from, - Lisp_Object to, Charbpos *from_out, - Charbpos *to_out, unsigned int flags) + Lisp_Object to, Charxpos *from_out, + Charxpos *to_out, unsigned int flags) { if (STRINGP (object)) get_string_range_char (object, from, to, from_out, to_out, flags); else - get_buffer_range_char (XBUFFER (object), from, to, from_out, to_out, flags); + get_buffer_range_char (XBUFFER (object), from, to, from_out, to_out, + flags); } void get_buffer_or_string_range_byte (Lisp_Object object, Lisp_Object from, - Lisp_Object to, Bytebpos *from_out, - Bytebpos *to_out, unsigned int flags) + Lisp_Object to, Bytexpos *from_out, + Bytexpos *to_out, unsigned int flags) { if (STRINGP (object)) get_string_range_byte (object, from, to, from_out, to_out, flags); else - get_buffer_range_byte (XBUFFER (object), from, to, from_out, to_out, flags); + get_buffer_range_byte (XBUFFER (object), from, to, from_out, to_out, + flags); } -Charbpos +Charxpos buffer_or_string_accessible_begin_char (Lisp_Object object) { return STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)); } -Charbpos +Charxpos buffer_or_string_accessible_end_char (Lisp_Object object) { return STRINGP (object) ? - XSTRING_CHAR_LENGTH (object) : BUF_ZV (XBUFFER (object)); + string_char_length (object) : BUF_ZV (XBUFFER (object)); } -Bytebpos +Bytexpos buffer_or_string_accessible_begin_byte (Lisp_Object object) { - return STRINGP (object) ? 0 : BI_BUF_BEGV (XBUFFER (object)); + return STRINGP (object) ? 0 : BYTE_BUF_BEGV (XBUFFER (object)); } -Bytebpos +Bytexpos buffer_or_string_accessible_end_byte (Lisp_Object object) { return STRINGP (object) ? - XSTRING_LENGTH (object) : BI_BUF_ZV (XBUFFER (object)); + XSTRING_LENGTH (object) : BYTE_BUF_ZV (XBUFFER (object)); } -Charbpos +Charxpos buffer_or_string_absolute_begin_char (Lisp_Object object) { return STRINGP (object) ? 0 : BUF_BEG (XBUFFER (object)); } -Charbpos +Charxpos buffer_or_string_absolute_end_char (Lisp_Object object) { return STRINGP (object) ? - XSTRING_CHAR_LENGTH (object) : BUF_Z (XBUFFER (object)); + string_char_length (object) : BUF_Z (XBUFFER (object)); } -Bytebpos +Bytexpos buffer_or_string_absolute_begin_byte (Lisp_Object object) { - return STRINGP (object) ? 0 : BI_BUF_BEG (XBUFFER (object)); + return STRINGP (object) ? 0 : BYTE_BUF_BEG (XBUFFER (object)); } -Bytebpos +Bytexpos buffer_or_string_absolute_end_byte (Lisp_Object object) { return STRINGP (object) ? - XSTRING_LENGTH (object) : BI_BUF_Z (XBUFFER (object)); + XSTRING_LENGTH (object) : BYTE_BUF_Z (XBUFFER (object)); +} + +Charbpos +charbpos_clip_to_bounds (Charbpos lower, Charbpos num, Charbpos upper) +{ + return (num < lower ? lower : + num > upper ? upper : + num); +} + +Bytebpos +bytebpos_clip_to_bounds (Bytebpos lower, Bytebpos num, Bytebpos upper) +{ + return (num < lower ? lower : + num > upper ? upper : + num); +} + +Charxpos +charxpos_clip_to_bounds (Charxpos lower, Charxpos num, Charxpos upper) +{ + return (num < lower ? lower : + num > upper ? upper : + num); +} + +Bytexpos +bytexpos_clip_to_bounds (Bytexpos lower, Bytexpos num, Bytexpos upper) +{ + return (num < lower ? lower : + num > upper ? upper : + num); +} + +/* These could be implemented in terms of the get_buffer_or_string() + functions above, but those are complicated and handle lots of weird + cases stemming from uncertain external input. */ + +Charxpos +buffer_or_string_clip_to_accessible_char (Lisp_Object object, Charxpos pos) +{ + return (charxpos_clip_to_bounds + (pos, buffer_or_string_accessible_begin_char (object), + buffer_or_string_accessible_end_char (object))); +} + +Bytexpos +buffer_or_string_clip_to_accessible_byte (Lisp_Object object, Bytexpos pos) +{ + return (bytexpos_clip_to_bounds + (pos, buffer_or_string_accessible_begin_byte (object), + buffer_or_string_accessible_end_byte (object))); +} + +Charxpos +buffer_or_string_clip_to_absolute_char (Lisp_Object object, Charxpos pos) +{ + return (charxpos_clip_to_bounds + (pos, buffer_or_string_absolute_begin_char (object), + buffer_or_string_absolute_end_char (object))); +} + +Bytexpos +buffer_or_string_clip_to_absolute_byte (Lisp_Object object, Bytexpos pos) +{ + return (bytexpos_clip_to_bounds + (pos, buffer_or_string_absolute_begin_byte (object), + buffer_or_string_absolute_end_byte (object))); } @@ -2513,8 +2735,8 @@ typedef struct { - Dynarr_declare (Intbyte_dynarr *); -} Intbyte_dynarr_dynarr; + Dynarr_declare (Ibyte_dynarr *); +} Ibyte_dynarr_dynarr; typedef struct { @@ -2522,25 +2744,11 @@ } Extbyte_dynarr_dynarr; static Extbyte_dynarr_dynarr *conversion_out_dynarr_list; -static Intbyte_dynarr_dynarr *conversion_in_dynarr_list; +static Ibyte_dynarr_dynarr *conversion_in_dynarr_list; static int dfc_convert_to_external_format_in_use; static int dfc_convert_to_internal_format_in_use; -static Lisp_Object -dfc_convert_to_external_format_reset_in_use (Lisp_Object value) -{ - dfc_convert_to_external_format_in_use = XINT (value); - return Qnil; -} - -static Lisp_Object -dfc_convert_to_internal_format_reset_in_use (Lisp_Object value) -{ - dfc_convert_to_internal_format_in_use = XINT (value); - return Qnil; -} - void dfc_convert_to_external_format (dfc_conversion_type source_type, dfc_conversion_data *source, @@ -2562,16 +2770,16 @@ ((sink_type == DFC_TYPE_DATA) || (sink_type == DFC_TYPE_LISP_LSTREAM && LSTREAMP (source->lisp_object)))); - record_unwind_protect (dfc_convert_to_external_format_reset_in_use, - make_int (dfc_convert_to_external_format_in_use)); if (Dynarr_length (conversion_out_dynarr_list) <= dfc_convert_to_external_format_in_use) Dynarr_add (conversion_out_dynarr_list, Dynarr_new (Extbyte)); conversion_out_dynarr = Dynarr_at (conversion_out_dynarr_list, dfc_convert_to_external_format_in_use); - dfc_convert_to_external_format_in_use++; Dynarr_reset (conversion_out_dynarr); + internal_bind_int (&dfc_convert_to_external_format_in_use, + dfc_convert_to_external_format_in_use + 1); + coding_system = get_coding_system_for_text_file (coding_system, 0); /* Here we optimize in the case where the coding system does no @@ -2583,7 +2791,7 @@ sink_type != DFC_TYPE_LISP_LSTREAM && coding_system_is_binary (coding_system)) { - const Intbyte *ptr; + const Ibyte *ptr; Bytecount len; if (source_type == DFC_TYPE_LISP_STRING) @@ -2593,23 +2801,23 @@ } else { - ptr = (Intbyte *) source->data.ptr; + ptr = (Ibyte *) source->data.ptr; len = source->data.len; } #ifdef MULE { - const Intbyte *end; + const Ibyte *end; for (end = ptr + len; ptr < end;) { - Intbyte c = - (BYTE_ASCII_P (*ptr)) ? *ptr : + Ibyte c = + (byte_ascii_p (*ptr)) ? *ptr : (*ptr == LEADING_BYTE_CONTROL_1) ? (*(ptr+1) - 0x20) : (*ptr == LEADING_BYTE_LATIN_ISO8859_1) ? (*(ptr+1)) : '~'; Dynarr_add (conversion_out_dynarr, (Extbyte) c); - INC_CHARPTR (ptr); + INC_IBYTEPTR (ptr); } text_checking_assert (ptr == end); } @@ -2624,9 +2832,9 @@ sink_type != DFC_TYPE_LISP_LSTREAM && dfc_coding_system_is_unicode (coding_system)) { - const Intbyte *ptr, *p; + const Ibyte *ptr, *p; Bytecount len; - const Intbyte *end; + const Ibyte *end; if (source_type == DFC_TYPE_LISP_STRING) { @@ -2635,14 +2843,14 @@ } else { - ptr = (Intbyte *) source->data.ptr; + ptr = (Ibyte *) source->data.ptr; len = source->data.len; } end = ptr + len; for (p = ptr; p < end; p++) { - if (!BYTE_ASCII_P (*p)) + if (!byte_ascii_p (*p)) goto the_hard_way; } @@ -2748,7 +2956,7 @@ esp. given that this code conversion occurs in many very hidden places. */ int count = begin_gc_forbidden (); - Intbyte_dynarr *conversion_in_dynarr; + Ibyte_dynarr *conversion_in_dynarr; type_checking_assert ((source_type == DFC_TYPE_DATA || @@ -2757,16 +2965,16 @@ (sink_type == DFC_TYPE_DATA || sink_type == DFC_TYPE_LISP_LSTREAM)); - record_unwind_protect (dfc_convert_to_internal_format_reset_in_use, - make_int (dfc_convert_to_internal_format_in_use)); if (Dynarr_length (conversion_in_dynarr_list) <= dfc_convert_to_internal_format_in_use) - Dynarr_add (conversion_in_dynarr_list, Dynarr_new (Intbyte)); + Dynarr_add (conversion_in_dynarr_list, Dynarr_new (Ibyte)); conversion_in_dynarr = Dynarr_at (conversion_in_dynarr_list, dfc_convert_to_internal_format_in_use); - dfc_convert_to_internal_format_in_use++; Dynarr_reset (conversion_in_dynarr); + internal_bind_int (&dfc_convert_to_internal_format_in_use, + dfc_convert_to_internal_format_in_use + 1); + coding_system = get_coding_system_for_text_file (coding_system, 1); if (source_type != DFC_TYPE_LISP_LSTREAM && @@ -2774,17 +2982,17 @@ coding_system_is_binary (coding_system)) { #ifdef MULE - const Intbyte *ptr = (const Intbyte *) source->data.ptr; + const Ibyte *ptr = (const Ibyte *) source->data.ptr; Bytecount len = source->data.len; - const Intbyte *end = ptr + len; + const Ibyte *end = ptr + len; for (; ptr < end; ptr++) { - Intbyte c = *ptr; + Ibyte c = *ptr; - if (BYTE_ASCII_P (c)) + if (byte_ascii_p (c)) Dynarr_add (conversion_in_dynarr, c); - else if (BYTE_C1_P (c)) + else if (byte_c1_p (c)) { Dynarr_add (conversion_in_dynarr, LEADING_BYTE_CONTROL_1); Dynarr_add (conversion_in_dynarr, c + 0x20); @@ -2805,9 +3013,9 @@ sink_type != DFC_TYPE_LISP_LSTREAM && dfc_coding_system_is_unicode (coding_system)) { - const Intbyte *ptr = (const Intbyte *) source->data.ptr + 1; + const Ibyte *ptr = (const Ibyte *) source->data.ptr + 1; Bytecount len = source->data.len; - const Intbyte *end = ptr + len; + const Ibyte *end = ptr + len; if (len & 1) goto the_hard_way; @@ -2818,17 +3026,17 @@ goto the_hard_way; } - ptr = (const Intbyte *) source->data.ptr; + ptr = (const Ibyte *) source->data.ptr; end = ptr + len; for (; ptr < end; ptr += 2) { - Intbyte c = *ptr; + Ibyte c = *ptr; - if (BYTE_ASCII_P (c)) + if (byte_ascii_p (c)) Dynarr_add (conversion_in_dynarr, c); #ifdef MULE - else if (BYTE_C1_P (c)) + else if (byte_c1_p (c)) { Dynarr_add (conversion_in_dynarr, LEADING_BYTE_CONTROL_1); Dynarr_add (conversion_in_dynarr, c + 0x20); @@ -2927,29 +3135,29 @@ /************************************************************************/ -/* Basic Emchar functions */ +/* Basic Ichar functions */ /************************************************************************/ #ifdef MULE /* Convert a non-ASCII Mule character C into a one-character Mule-encoded string in STR. Returns the number of bytes stored. - Do not call this directly. Use the macro set_charptr_emchar() instead. + Do not call this directly. Use the macro set_itext_ichar() instead. */ Bytecount -non_ascii_set_charptr_emchar (Intbyte *str, Emchar c) +non_ascii_set_itext_ichar (Ibyte *str, Ichar c) { - Intbyte *p; - Intbyte lb; + Ibyte *p; + Ibyte lb; int c1, c2; Lisp_Object charset; p = str; - BREAKUP_CHAR (c, charset, c1, c2); - lb = CHAR_LEADING_BYTE (c); - if (LEADING_BYTE_PRIVATE_P (lb)) - *p++ = PRIVATE_LEADING_BYTE_PREFIX (lb); + BREAKUP_ICHAR (c, charset, c1, c2); + lb = ichar_leading_byte (c); + if (leading_byte_private_p (lb)) + *p++ = private_leading_byte_prefix (lb); *p++ = lb; if (EQ (charset, Vcharset_control_1)) c1 += 0x20; @@ -2962,34 +3170,34 @@ /* Return the first character from a Mule-encoded string in STR, assuming it's non-ASCII. Do not call this directly. - Use the macro charptr_emchar() instead. */ + Use the macro itext_ichar() instead. */ -Emchar -non_ascii_charptr_emchar (const Intbyte *str) +Ichar +non_ascii_itext_ichar (const Ibyte *str) { - Intbyte i0 = *str, i1, i2 = 0; + Ibyte i0 = *str, i1, i2 = 0; Lisp_Object charset; if (i0 == LEADING_BYTE_CONTROL_1) - return (Emchar) (*++str - 0x20); + return (Ichar) (*++str - 0x20); - if (LEADING_BYTE_PREFIX_P (i0)) + if (leading_byte_prefix_p (i0)) i0 = *++str; i1 = *++str & 0x7F; - charset = CHARSET_BY_LEADING_BYTE (i0); + charset = charset_by_leading_byte (i0); if (XCHARSET_DIMENSION (charset) == 2) i2 = *++str & 0x7F; - return MAKE_CHAR (charset, i1, i2); + return make_ichar (charset, i1, i2); } -/* Return whether CH is a valid Emchar, assuming it's non-ASCII. - Do not call this directly. Use the macro valid_char_p() instead. */ +/* Return whether CH is a valid Ichar, assuming it's non-ASCII. + Do not call this directly. Use the macro valid_ichar_p() instead. */ int -non_ascii_valid_char_p (Emchar ch) +non_ascii_valid_ichar_p (Ichar ch) { int f1, f2, f3; @@ -2997,9 +3205,9 @@ if (ch & ~0x7FFFF) return 0; - f1 = CHAR_FIELD1 (ch); - f2 = CHAR_FIELD2 (ch); - f3 = CHAR_FIELD3 (ch); + f1 = ichar_field1 (ch); + f2 = ichar_field2 (ch); + f3 = ichar_field3 (ch); if (f1 == 0) { @@ -3007,9 +3215,9 @@ Lisp_Object charset; /* leading byte must be correct */ - if (f2 < MIN_CHAR_FIELD2_OFFICIAL || - (f2 > MAX_CHAR_FIELD2_OFFICIAL && f2 < MIN_CHAR_FIELD2_PRIVATE) || - f2 > MAX_CHAR_FIELD2_PRIVATE) + if (f2 < MIN_ICHAR_FIELD2_OFFICIAL || + (f2 > MAX_ICHAR_FIELD2_OFFICIAL && f2 < MIN_ICHAR_FIELD2_PRIVATE) || + f2 > MAX_ICHAR_FIELD2_PRIVATE) return 0; /* octet not out of range */ if (f3 < 0x20) @@ -3020,7 +3228,7 @@ FIELD2_TO_OFFICIAL_LEADING_BYTE and FIELD2_TO_PRIVATE_LEADING_BYTE are the same. */ - charset = CHARSET_BY_LEADING_BYTE (f2 + FIELD2_TO_OFFICIAL_LEADING_BYTE); + charset = charset_by_leading_byte (f2 + FIELD2_TO_OFFICIAL_LEADING_BYTE); if (EQ (charset, Qnil)) return 0; /* check range as per size (94 or 96) of charset */ @@ -3032,9 +3240,9 @@ Lisp_Object charset; /* leading byte must be correct */ - if (f1 < MIN_CHAR_FIELD1_OFFICIAL || - (f1 > MAX_CHAR_FIELD1_OFFICIAL && f1 < MIN_CHAR_FIELD1_PRIVATE) || - f1 > MAX_CHAR_FIELD1_PRIVATE) + if (f1 < MIN_ICHAR_FIELD1_OFFICIAL || + (f1 > MAX_ICHAR_FIELD1_OFFICIAL && f1 < MIN_ICHAR_FIELD1_PRIVATE) || + f1 > MAX_ICHAR_FIELD1_PRIVATE) return 0; /* octets not out of range */ if (f2 < 0x20 || f3 < 0x20) @@ -3052,12 +3260,12 @@ #endif /* ENABLE_COMPOSITE_CHARS */ /* charset exists */ - if (f1 <= MAX_CHAR_FIELD1_OFFICIAL) + if (f1 <= MAX_ICHAR_FIELD1_OFFICIAL) charset = - CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE); + charset_by_leading_byte (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE); else charset = - CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_PRIVATE_LEADING_BYTE); + charset_by_leading_byte (f1 + FIELD1_TO_PRIVATE_LEADING_BYTE); if (EQ (charset, Qnil)) return 0; @@ -3068,13 +3276,13 @@ } /* Copy the character pointed to by SRC into DST. Do not call this - directly. Use the macro charptr_copy_char() instead. + directly. Use the macro itext_copy_ichar() instead. Return the number of bytes copied. */ Bytecount -non_ascii_charptr_copy_char (const Intbyte *src, Intbyte *dst) +non_ascii_itext_copy_ichar (const Ibyte *src, Ibyte *dst) { - Bytecount bytes = REP_BYTES_BY_FIRST_BYTE (*src); + Bytecount bytes = rep_bytes_by_first_byte (*src); Bytecount i; for (i = bytes; i; i--, dst++, src++) *dst = *src; @@ -3085,46 +3293,46 @@ /************************************************************************/ -/* streams of Emchars */ +/* streams of Ichars */ /************************************************************************/ #ifdef MULE -/* Treat a stream as a stream of Emchar's rather than a stream of bytes. +/* Treat a stream as a stream of Ichar's rather than a stream of bytes. The functions below are not meant to be called directly; use the macros in insdel.h. */ -Emchar -Lstream_get_emchar_1 (Lstream *stream, int ch) +Ichar +Lstream_get_ichar_1 (Lstream *stream, int ch) { - Intbyte str[MAX_EMCHAR_LEN]; - Intbyte *strptr = str; + Ibyte str[MAX_ICHAR_LEN]; + Ibyte *strptr = str; Bytecount bytes; - str[0] = (Intbyte) ch; + str[0] = (Ibyte) ch; - for (bytes = REP_BYTES_BY_FIRST_BYTE (ch) - 1; bytes; bytes--) + for (bytes = rep_bytes_by_first_byte (ch) - 1; bytes; bytes--) { int c = Lstream_getc (stream); text_checking_assert (c >= 0); - *++strptr = (Intbyte) c; + *++strptr = (Ibyte) c; } - return charptr_emchar (str); + return itext_ichar (str); } int -Lstream_fput_emchar (Lstream *stream, Emchar ch) +Lstream_fput_ichar (Lstream *stream, Ichar ch) { - Intbyte str[MAX_EMCHAR_LEN]; - Bytecount len = set_charptr_emchar (str, ch); + Ibyte str[MAX_ICHAR_LEN]; + Bytecount len = set_itext_ichar (str, ch); return Lstream_write (stream, str, len); } void -Lstream_funget_emchar (Lstream *stream, Emchar ch) +Lstream_funget_ichar (Lstream *stream, Ichar ch) { - Intbyte str[MAX_EMCHAR_LEN]; - Bytecount len = set_charptr_emchar (str, ch); + Ibyte str[MAX_ICHAR_LEN]; + Bytecount len = set_itext_ichar (str, ch); Lstream_unread (stream, str, len); } @@ -3230,7 +3438,7 @@ if (!NILP (arg2)) invalid_argument ("Charset is of dimension one; second octet must be nil", arg2); - return make_char (MAKE_CHAR (charset, a1, 0)); + return make_char (make_ichar (charset, a1, 0)); } CHECK_INT (arg2); @@ -3238,7 +3446,7 @@ if (a2 < lowlim || a2 > highlim) args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim)); - return make_char (MAKE_CHAR (charset, a1, a2)); + return make_char (make_ichar (charset, a1, a2)); #else int a1; int lowlim, highlim; @@ -3271,8 +3479,8 @@ { CHECK_CHAR_COERCE_INT (ch); - return XCHARSET_NAME (CHARSET_BY_LEADING_BYTE - (CHAR_LEADING_BYTE (XCHAR (ch)))); + return XCHARSET_NAME (charset_by_leading_byte + (ichar_leading_byte (XCHAR (ch)))); } DEFUN ("char-octet", Fchar_octet, 1, 2, 0, /* @@ -3286,7 +3494,7 @@ CHECK_CHAR_COERCE_INT (ch); - BREAKUP_CHAR (XCHAR (ch), charset, octet0, octet1); + BREAKUP_ICHAR (XCHAR (ch), charset, octet0, octet1); if (NILP (n) || EQ (n, Qzero)) return make_int (octet0); @@ -3310,7 +3518,7 @@ GCPRO2 (charset, rc); CHECK_CHAR_COERCE_INT (character); - BREAKUP_CHAR (XCHAR (character), charset, c1, c2); + BREAKUP_ICHAR (XCHAR (character), charset, c1, c2); if (XCHARSET_DIMENSION (Fget_charset (charset)) == 2) { @@ -3334,20 +3542,20 @@ #ifdef ENABLE_COMPOSITE_CHARS -Emchar -lookup_composite_char (Intbyte *str, int len) +Ichar +lookup_composite_char (Ibyte *str, int len) { Lisp_Object lispstr = make_string (str, len); Lisp_Object ch = Fgethash (lispstr, Vcomposite_char_string2char_hash_table, Qunbound); - Emchar emch; + Ichar emch; if (UNBOUNDP (ch)) { if (composite_char_row_next >= 128) invalid_operation ("No more composite chars available", lispstr); - emch = MAKE_CHAR (Vcharset_composite, composite_char_row_next, + emch = make_ichar (Vcharset_composite, composite_char_row_next, composite_char_col_next); Fputhash (make_char (emch), lispstr, Vcomposite_char_char2string_hash_table); @@ -3366,7 +3574,7 @@ } Lisp_Object -composite_char_string (Emchar ch) +composite_char_string (Ichar ch) { Lisp_Object str = Fgethash (make_char (ch), Vcomposite_char_char2string_hash_table, @@ -3375,7 +3583,7 @@ return str; } -xxDEFUN ("make-composite-char", Fmake_composite_char, 1, 1, 0, /* +DEFUN ("make-composite-char", Fmake_composite_char, 1, 1, 0, /* Convert a string into a single composite character. The character is the result of overstriking all the characters in the string. @@ -3387,16 +3595,16 @@ XSTRING_LENGTH (string))); } -xxDEFUN ("composite-char-string", Fcomposite_char_string, 1, 1, 0, /* +DEFUN ("composite-char-string", Fcomposite_char_string, 1, 1, 0, /* Return a string of the characters comprising a composite character. */ (ch)) { - Emchar emch; + Ichar emch; CHECK_CHAR (ch); emch = XCHAR (ch); - if (CHAR_LEADING_BYTE (emch) != LEADING_BYTE_COMPOSITE) + if (ichar_leading_byte (emch) != LEADING_BYTE_COMPOSITE) invalid_argument ("Must be composite char", ch); return composite_char_string (emch); } @@ -3408,13 +3616,19 @@ /************************************************************************/ void -init_eistring_once_early (void) +reinit_eistring_once_early (void) { the_eistring_malloc_zero_init = the_eistring_zero_init; the_eistring_malloc_zero_init.mallocp_ = 1; } void +init_eistring_once_early (void) +{ + reinit_eistring_once_early (); +} + +void syms_of_text (void) { DEFSUBR (Fmake_char); @@ -3436,8 +3650,8 @@ { int i; - conversion_in_dynarr_list = Dynarr_new2 (Intbyte_dynarr_dynarr, - Intbyte_dynarr *); + conversion_in_dynarr_list = Dynarr_new2 (Ibyte_dynarr_dynarr, + Ibyte_dynarr *); conversion_out_dynarr_list = Dynarr_new2 (Extbyte_dynarr_dynarr, Extbyte_dynarr *); diff --text -u 'xemacs-21.5.6/src/text.h' 'xemacs-21.5.7/src/text.h' Index: ././src/text.h --- ././src/text.h Sun Mar 31 17:29:09 2002 +++ ././src/text.h Wed Jun 5 18:57:24 2002 @@ -52,32 +52,68 @@ #ifndef MULE -#define REP_BYTES_BY_FIRST_BYTE(fb) 1 -#define BYTE_ASCII_P(byte) 1 -# define MAX_EMCHAR_LEN 1 +#define rep_bytes_by_first_byte(fb) 1 +#define byte_ascii_p(byte) 1 +#define MAX_ICHAR_LEN 1 #else /* MULE */ /* These are carefully designed to work if BYTE is signed or unsigned. */ /* Note that SPC and DEL are considered ASCII, not control. */ -#define BYTE_ASCII_P(byte) (((byte) & ~0x7f) == 0) -#define BYTE_C0_P(byte) (((byte) & ~0x1f) == 0) -#define BYTE_C1_P(byte) (((byte) & ~0x1f) == 0x80) +#define byte_ascii_p(byte) (((byte) & ~0x7f) == 0) +#define byte_c0_p(byte) (((byte) & ~0x1f) == 0) +#define byte_c1_p(byte) (((byte) & ~0x1f) == 0x80) /* Does BYTE represent the first byte of a character? */ -#define INTBYTE_FIRST_BYTE_P(byte) ((byte) < 0xA0) +#ifdef ERROR_CHECK_TEXT + +DECLARE_INLINE_HEADER ( +int +ibyte_first_byte_p_1 (int byte, const char *file, int line) +) +{ + assert_at_line (byte >= 0 && byte < 256, file, line); + return byte < 0xA0; +} + +#define ibyte_first_byte_p(byte) \ + ibyte_first_byte_p_1 (byte, __FILE__, __LINE__) + +#else + +#define ibyte_first_byte_p(byte) ((byte) < 0xA0) + +#endif + +#ifdef ERROR_CHECK_TEXT /* Does BYTE represent the first byte of a multi-byte character? */ -#define INTBYTE_LEADING_BYTE_P(byte) BYTE_C1_P (byte) +DECLARE_INLINE_HEADER ( +int +ibyte_leading_byte_p_1 (int byte, const char *file, int line) +) +{ + assert_at_line (byte >= 0 && byte < 256, file, line); + return byte_c1_p (byte); +} + +#define ibyte_leading_byte_p(byte) \ + ibyte_leading_byte_p_1 (byte, __FILE__, __LINE__) + +#else + +#define ibyte_leading_byte_p(byte) byte_c1_p (byte) + +#endif /* Table of number of bytes in the string representation of a character indexed by the first byte of that representation. This value can be derived in other ways -- e.g. something like - XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (first_byte)) + XCHARSET_REP_BYTES (charset_by_leading_byte (first_byte)) but it's faster this way. */ extern const Bytecount rep_bytes_by_first_byte[0xA0]; @@ -85,31 +121,208 @@ #ifdef ERROR_CHECK_TEXT -INLINE_HEADER int REP_BYTES_BY_FIRST_BYTE_1 (int fb, const char *file, - int line); -INLINE_HEADER int -REP_BYTES_BY_FIRST_BYTE_1 (int fb, const char *file, int line) +DECLARE_INLINE_HEADER ( +Bytecount +rep_bytes_by_first_byte_1 (int fb, const char *file, int line) +) { - assert_at_line (fb < 0xA0, file, line); + assert_at_line (fb >= 0 && fb < 0xA0, file, line); return rep_bytes_by_first_byte[fb]; } -#define REP_BYTES_BY_FIRST_BYTE(fb) \ - REP_BYTES_BY_FIRST_BYTE_1 (fb, __FILE__, __LINE__) +#define rep_bytes_by_first_byte(fb) \ + rep_bytes_by_first_byte_1 (fb, __FILE__, __LINE__) #else /* ERROR_CHECK_TEXT */ -#define REP_BYTES_BY_FIRST_BYTE(fb) (rep_bytes_by_first_byte[fb]) +#define rep_bytes_by_first_byte(fb) (rep_bytes_by_first_byte[fb]) #endif /* ERROR_CHECK_TEXT */ -/* Is this character represented by more than one byte in a string? */ +/* Is this character represented by more than one byte in a string in the + default format? */ + +#define ichar_multibyte_p(c) ((c) >= 0x80) + +#define ichar_ascii_p(c) (!ichar_multibyte_p (c)) + +/* Maximum number of bytes per Emacs character when represented as text, in + any format. + */ + +#define MAX_ICHAR_LEN 4 + +#endif /* not MULE */ + +/* ---------------- Handling non-default formats ----------------- */ -#define CHAR_MULTIBYTE_P(c) ((c) >= 0x80) +/* We support, at least to some extent, formats other than the default + variable-width format, for speed; all of these alternative formats are + fixed-width. Currently we only handle these non-default formats in + buffers, because access to their text is strictly controlled and thus + the details of the format mostly compartmentalized. The only really + tricky part is the search code -- the regex, Boyer-Moore, and + simple-search algorithms in search.c and regex.c. All other code that + knows directly about the buffer representation is the basic code to + modify or retrieve the buffer text. + + Supporting fixed-width formats in Lisp strings is harder, but possible + -- FSF currently does this, for example. In this case, however, + probably only 8-bit-fixed is reasonable for Lisp strings -- getting + non-ASCII-compatible fixed-width formats to work is much, much harder + because a lot of code assumes that strings are ASCII-compatible + (i.e. ASCII + other characters represented exclusively using high-bit + bytes) and a lot of code mixes Lisp strings and non-Lisp strings freely. + + The different possible fixed-width formats are 8-bit fixed, 16-bit + fixed, and 32-bit fixed. The latter can represent all possible + characters, but at a substantial memory penalty. The other two can + represent only a subset of the possible characters. How these subsets + are defined can be simple or very tricky. + + Currently we support only the default format and the 8-bit fixed format, + and in the latter, we only allow these to be the first 256 characters in + an Ichar (ASCII and Latin 1). + + One reasonable approach for 8-bit fixed is to allow the upper half to + represent any 1-byte charset, which is specified on a per-buffer basis. + This should work fairly well in practice since most documents are in + only one foreign language (possibly with some English mixed in). I + think FSF does something like this; or at least, they have something + called nonascii-translation-table and use it when converting from + 8-bit-fixed text ("unibyte text") to default text ("multibyte text"). + With 16-bit fixed, you could do something like assign chunks of the 64K + worth of characters to charsets as they're encountered in documents. + This should work well with most Asian documents. + + If/when we switch to using Unicode internally, we might have formats more + like this: + + -- UTF-8 or some extension as the default format. Perl uses an + extension that handles 64-bit chars and requires as much as 13 bytes per + char, vs. the standard of 31-bit chars and 6 bytes max. UTF-8 has the + same basic properties as our own variable-width format (see text.c, + Internal String Encoding) and so most code would not need to be changed. + + -- UTF-16 as a "pseudo-fixed" format (i.e. 16-bit fixed plus surrogates + for representing characters not in the BMP, aka >= 65536). The vast + majority of documents will have no surrogates in them so byte/char + conversion will be very fast. + + -- an 8-bit fixed format, like currently. + + -- possibly, UCS-4 as a 32-bit fixed format. + + The fixed-width formats essentially treat the buffer as an array of + 8-bit, 16-bit or 32-bit integers. This means that how they are stored + in memory (in particular, big-endian or little-endian) depends on the + native format of the machine's processor. It also means we have to + worry a bit about alignment (basically, we just need to keep the gap an + integral size of the character size, and get things aligned properly + when converting the buffer between formats). + */ +typedef enum internal_format +{ + FORMAT_DEFAULT, + FORMAT_8_BIT_FIXED, + FORMAT_16_BIT_FIXED, /* not implemented */ + FORMAT_32_BIT_FIXED /* not implemented */ +} Internal_Format; -#define CHAR_ASCII_P(c) (!CHAR_MULTIBYTE_P (c)) +#ifdef MULE +/* "OBJECT" below will usually be a buffer, string, or nil. This needs to + be passed in because the interpretation of 8-bit-fixed and 16-bit-fixed + values may depend on the buffer, e.g. depending on what language the + text in the buffer is in. */ + +/* True if Ichar CH can be represented in 8-bit-fixed format. */ +#define ichar_8_bit_fixed_p(ch, object) (((ch) & ~0xff) == 0) +/* Convert Ichar CH to an 8-bit int, as will be stored in the buffer. */ +#define ichar_to_raw_8_bit_fixed(ch, object) ((Ibyte) (ch)) +/* Convert the other way. */ +#define raw_8_bit_fixed_to_ichar(ch, object) ((Ichar) (ch)) + +#define ichar_16_bit_fixed_p(ch, object) (((ch) & ~0xffff) == 0) +/* Convert Ichar CH to a 16-bit int, as will be stored in the buffer. */ +#define ichar_to_raw_16_bit_fixed(ch, object) ((UINT_16_BIT) (ch)) +/* Convert the other way. */ +#define raw_16_bit_fixed_to_ichar(ch, object) ((Ichar) (ch)) + +/* Convert Ichar CH to a 32-bit int, as will be stored in the buffer. */ +#define ichar_to_raw_32_bit_fixed(ch, object) ((UINT_32_BIT) (ch)) +/* Convert the other way. */ +#define raw_32_bit_fixed_to_ichar(ch, object) ((Ichar) (ch)) + +/* Return the "raw value" of a character as stored in the buffer. In the + default format, this is just the same as the character. In fixed-width + formats, this is the actual value in the buffer, which will be limited + to the range as established by the format. This is used when searching + for a character in a buffer -- it's faster to convert the character to + the raw value and look for that, than repeatedly convert each raw value + in the buffer into a character. */ -#define MAX_EMCHAR_LEN 4 +DECLARE_INLINE_HEADER ( +Raw_Ichar +ichar_to_raw (Ichar ch, Internal_Format fmt, Lisp_Object object) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return (Raw_Ichar) ch; + case FORMAT_16_BIT_FIXED: + text_checking_assert (ichar_16_bit_fixed_p (ch, object)); + return (Raw_Ichar) ichar_to_raw_16_bit_fixed (ch, object); + case FORMAT_32_BIT_FIXED: + return (Raw_Ichar) ichar_to_raw_32_bit_fixed (ch, object); + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + text_checking_assert (ichar_8_bit_fixed_p (ch, object)); + return (Raw_Ichar) ichar_to_raw_8_bit_fixed (ch, object); + } +} + +/* Return whether CH is representable in the given format in the given + object. */ + +DECLARE_INLINE_HEADER ( +int +ichar_fits_in_format (Ichar ch, Internal_Format fmt, Lisp_Object object) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return 1; + case FORMAT_16_BIT_FIXED: + return ichar_16_bit_fixed_p (ch, object); + case FORMAT_32_BIT_FIXED: + return 1; + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return ichar_8_bit_fixed_p (ch, object); + } +} + +/* Assuming the formats are the same, return whether the two objects + represent text in exactly the same way. */ + +DECLARE_INLINE_HEADER ( +int +objects_have_same_internal_representation (Lisp_Object srcobj, + Lisp_Object dstobj) +) +{ + /* &&#### implement this properly when we allow per-object format + differences */ + return 1; +} + +#else + +#define ichar_to_raw(ch, fmt, object) ((Raw_Ichar) (ch)) +#define ichar_fits_in_format(ch, fmt, object) 1 +#define objects_have_same_internal_representation(srcobj, dstobj) 1 #endif /* MULE */ @@ -132,329 +345,690 @@ /* */ /************************************************************************/ -/* NOTE: In all the following macros, we follow these rules concerning - multiple evaluation of the arguments: +/* + Use the following functions/macros on contiguous text in any of the + internal formats. Those that take a format arg work on all internal + formats; the others work only on the default (variable-width under Mule) + format. If the text you're operating on is known to come from a buffer, + use the buffer-level functions in buffer.h, which automatically know the + correct format and handle the gap. + + Some terminology: + + "itext" appearing in the macros means "internal-format text" -- type + `Ibyte *'. Operations on such pointers themselves, rather than on the + text being pointed to, have "itext" instead of "itext" in the macro + name. "ichar" in the macro names means an Ichar -- the representation + of a character as a single integer rather than a series of bytes, as part + of "itext". Many of the macros below are for converting between the + two representations of characters. + + Note also that we try to consistently distinguish between an "Ichar" and + a Lisp character. Stuff working with Lisp characters often just says + "char", so we consistently use "Ichar" when that's what we're working + with. */ + +/* The three golden rules of macros: 1) Anything that's an lvalue can be evaluated more than once. - 2) Anything that's a Lisp Object can be evaluated more than once. - This should probably be changed, but this follows the way - that all the macros in lisp.h do things. - 3) 'struct buffer *' arguments can be evaluated more than once. - 4) Nothing else can be evaluated more than once. Use inline + + 2) Macros where anything else can be evaluated more than once should + have the word "unsafe" in their name (exceptions may be made for + large sets of macros that evaluate arguments of certain types more + than once, e.g. struct buffer * arguments, when clearly indicated in + the macro documentation). These macros are generally meant to be + called only by other macros that have already stored the calling + values in temporary variables. + + 3) Nothing else can be evaluated more than once. Use inline functions, if necessary, to prevent multiple evaluation. - 5) An exception to (4) is that there are some macros below that - may evaluate their arguments more than once. They are all - denoted with the word "unsafe" in their name and are generally - meant to be called only by other macros that have already - stored the calling values in temporary variables. - - - Use the following functions/macros on contiguous strings of data. - If the text you're operating on is known to come from a buffer, use - the buffer-level functions below -- they know about the gap and may - be more efficient. - - - ---------------------------------------------------------------------------- - (A) For working with charptr's (pointers to internally-formatted text): - ---------------------------------------------------------------------------- - - VALID_CHARPTR_P (ptr): - Given a charptr, does it point to the beginning of a character? - - ASSERT_VALID_CHARPTR (ptr): - If error-checking is enabled, assert that the given charptr - points to the beginning of a character. Otherwise, do nothing. - - INC_CHARPTR (ptr): - Given a charptr (assumed to point at the beginning of a character), - modify that pointer so it points to the beginning of the next - character. - - DEC_CHARPTR (ptr): - Given a charptr (assumed to point at the beginning of a - character or at the very end of the text), modify that pointer - so it points to the beginning of the previous character. - - VALIDATE_CHARPTR_BACKWARD (ptr): - Make sure that PTR is pointing to the beginning of a character. - If not, back up until this is the case. Note that there are not - too many places where it is legitimate to do this sort of thing. - It's an error if you're passed an "invalid" char * pointer. - NOTE: PTR *must* be pointing to a valid part of the string (i.e. - not the very end, unless the string is zero-terminated or - something) in order for this function to not cause crashes. - - VALIDATE_CHARPTR_FORWARD (ptr): - Make sure that PTR is pointing to the beginning of a character. - If not, move forward until this is the case. Note that there - are not too many places where it is legitimate to do this sort - of thing. It's an error if you're passed an "invalid" char * - pointer. - - --------------------------------------------------------------------- - (B) For working with the length (in bytes and characters) of a - section of internally-formatted text: - --------------------------------------------------------------------- - - bytecount_to_charcount (ptr, nbi): - Given a pointer to a text string and a length in bytes, - return the equivalent length in characters. - - charcount_to_bytecount (ptr, nch): - Given a pointer to a text string and a length in characters, - return the equivalent length in bytes. - - charptr_n_addr (ptr, n): - Return a pointer to the beginning of the character offset N - (in characters) from PTR. - - ------------------------------------------------------------------------- - (C) For retrieving or changing the character pointed to by a charptr: - ------------------------------------------------------------------------- - - charptr_emchar (ptr): - Retrieve the character pointed to by PTR as an Emchar. - - charptr_emchar_n (ptr, n): - Retrieve the character at offset N (in characters) from PTR, - as an Emchar. - - set_charptr_emchar (ptr, ch): - Store the character CH (an Emchar) as internally-formatted - text starting at PTR. Return the number of bytes stored. - - charptr_copy_char (src, dst): - Retrieve the character pointed to by SRC and store it as - internally-formatted text in DST. - - ---------------------------------- - (D) For working with Emchars: - ---------------------------------- - - [Note that there are other functions/macros for working with Emchars - in charset.h, for retrieving the charset of an Emchar and such.] - - valid_char_p (ch): - Return whether the given Emchar is valid. - - CHARP (ch): - Return whether the given Lisp_Object is a character. - - CHECK_CHAR_COERCE_INT (ch): - Signal an error if CH is not a valid character or integer Lisp_Object. - If CH is an integer Lisp_Object, convert it to a character Lisp_Object, - but merely by repackaging, without performing tests for char validity. - MAX_EMCHAR_LEN: - Maximum number of buffer bytes per Emacs character. + NOTE: The functions and macros below are given full prototypes in their + docs, even when the implementation is a macro. In such cases, passing + an argument of a type other than expected will produce undefined + results. Also, given that macros can do things functions can't (in + particular, directly modify arguments as if they were passed by + reference), the declaration syntax has been extended to include the + call-by-reference syntax from C++, where an & after a type indicates + that the argument is an lvalue and is passed by reference, i.e. the + function can modify its value. (This is equivalent in C to passing a + pointer to the argument, but without the need to explicitly worry about + pointers.) + + When to capitalize macros: + + -- Capitalize macros doing stuff obviously impossible with (C) + functions, e.g. directly modifying arguments as if they were passed by + reference. + + -- Capitalize macros that evaluate *any* argument more than once regardless + of whether that's "allowed" (e.g. buffer arguments). + + -- Capitalize macros that directly access a field in a Lisp_Object or + its equivalent underlying structure. In such cases, access through the + Lisp_Object precedes the macro with an X, and access through the underlying + structure doesn't. + + -- Capitalize certain other basic macros relating to Lisp_Objects; e.g. + FRAMEP, CHECK_FRAME, etc. + + -- Try to avoid capitalizing any other macros. */ /* ---------------------------------------------------------------------- */ -/* (A) For working with charptr's (pointers to internally-formatted text) */ +/* Working with itext's (pointers to internally-formatted text) */ /* ---------------------------------------------------------------------- */ +/* Given an itext, does it point to the beginning of a character? + */ + #ifdef MULE -# define VALID_CHARPTR_P(ptr) INTBYTE_FIRST_BYTE_P (* (unsigned char *) ptr) +# define valid_ibyteptr_p(ptr) ibyte_first_byte_p (* (ptr)) #else -# define VALID_CHARPTR_P(ptr) 1 +# define valid_ibyteptr_p(ptr) 1 #endif -#ifdef ERROR_CHECK_TEXT -# define ASSERT_VALID_CHARPTR(ptr) assert (VALID_CHARPTR_P (ptr)) -#else -# define ASSERT_VALID_CHARPTR(ptr) -#endif +/* If error-checking is enabled, assert that the given itext points to + the beginning of a character. Otherwise, do nothing. + */ -/* Note that INC_CHARPTR() and DEC_CHARPTR() have to be written in - completely separate ways. INC_CHARPTR() cannot use the DEC_CHARPTR() +#define assert_valid_ibyteptr(ptr) text_checking_assert (valid_ibyteptr_p (ptr)) + +/* Given a itext (assumed to point at the beginning of a character), + modify that pointer so it points to the beginning of the next character. + + Note that INC_IBYTEPTR() and DEC_IBYTEPTR() have to be written in + completely separate ways. INC_IBYTEPTR() cannot use the DEC_IBYTEPTR() trick of looking for a valid first byte because it might run off - the end of the string. DEC_CHARPTR() can't use the INC_CHARPTR() + the end of the string. DEC_IBYTEPTR() can't use the INC_IBYTEPTR() method because it doesn't have easy access to the first byte of the character it's moving over. */ -#define REAL_INC_CHARPTR(ptr) \ - ((void) ((ptr) += REP_BYTES_BY_FIRST_BYTE (* (unsigned char *) (ptr)))) +#define INC_IBYTEPTR(ptr) do { \ + assert_valid_ibyteptr (ptr); \ + (ptr) += rep_bytes_by_first_byte (* (ptr)); \ +} while (0) -#define REAL_INC_CHARBYTEBPOS(ptr, pos) \ - (pos += REP_BYTES_BY_FIRST_BYTE (* (unsigned char *) (ptr))) +#define INC_IBYTEPTR_FMT(ptr, fmt) \ +do { \ + Internal_Format __icf_fmt = (fmt); \ + switch (__icf_fmt) \ + { \ + case FORMAT_DEFAULT: \ + INC_IBYTEPTR (ptr); \ + break; \ + case FORMAT_16_BIT_FIXED: \ + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); \ + (ptr) += 2; \ + break; \ + case FORMAT_32_BIT_FIXED: \ + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); \ + (ptr) += 4; \ + break; \ + default: \ + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); \ + (ptr)++; \ + break; \ + } \ +} while (0) -#define REAL_DEC_CHARPTR(ptr) do { \ - (ptr)--; \ -} while (!VALID_CHARPTR_P (ptr)) +/* Given a itext (assumed to point at the beginning of a character or at + the very end of the text), modify that pointer so it points to the + beginning of the previous character. + */ #ifdef ERROR_CHECK_TEXT -#define INC_CHARPTR(ptr) do { \ - ASSERT_VALID_CHARPTR (ptr); \ - REAL_INC_CHARPTR (ptr); \ -} while (0) - -#define INC_CHARBYTEBPOS(ptr, pos) do { \ - ASSERT_VALID_CHARPTR (ptr); \ - REAL_INC_CHARBYTEBPOS (ptr, pos); \ -} while (0) - -#define DEC_CHARPTR(ptr) do { \ - const Intbyte *dc_ptr1 = (ptr); \ - const Intbyte *dc_ptr2 = dc_ptr1; \ - REAL_DEC_CHARPTR (dc_ptr2); \ - assert (dc_ptr1 - dc_ptr2 == \ - REP_BYTES_BY_FIRST_BYTE (*dc_ptr2)); \ - (ptr) = (Intbyte *) dc_ptr2; \ -} while (0) - -#else /* ! ERROR_CHECK_TEXT */ -#define INC_CHARBYTEBPOS(ptr, pos) REAL_INC_CHARBYTEBPOS (ptr, pos) -#define INC_CHARPTR(ptr) REAL_INC_CHARPTR (ptr) -#define DEC_CHARPTR(ptr) REAL_DEC_CHARPTR (ptr) -#endif /* ! ERROR_CHECK_TEXT */ +/* We use a separate definition to avoid warnings about unused dc_ptr1 */ +#define DEC_IBYTEPTR(ptr) do { \ + const Ibyte *dc_ptr1 = (ptr); \ + do { \ + (ptr)--; \ + } while (!valid_ibyteptr_p (ptr)); \ + text_checking_assert (dc_ptr1 - (ptr) == rep_bytes_by_first_byte (*(ptr))); \ +} while (0) +#else +#define DEC_IBYTEPTR(ptr) do { \ + do { \ + (ptr)--; \ + } while (!valid_ibyteptr_p (ptr)); \ +} while (0) +#endif /* ERROR_CHECK_TEXT */ + +#define DEC_IBYTEPTR_FMT(ptr, fmt) \ +do { \ + Internal_Format __icf_fmt = (fmt); \ + switch (__icf_fmt) \ + { \ + case FORMAT_DEFAULT: \ + DEC_IBYTEPTR (ptr); \ + break; \ + case FORMAT_16_BIT_FIXED: \ + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); \ + (ptr) -= 2; \ + break; \ + case FORMAT_32_BIT_FIXED: \ + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); \ + (ptr) -= 4; \ + break; \ + default: \ + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); \ + (ptr)--; \ + break; \ + } \ +} while (0) #ifdef MULE +/* Make sure that PTR is pointing to the beginning of a character. If not, + back up until this is the case. Note that there are not too many places + where it is legitimate to do this sort of thing. It's an error if + you're passed an "invalid" char * pointer. NOTE: PTR *must* be pointing + to a valid part of the string (i.e. not the very end, unless the string + is zero-terminated or something) in order for this function to not cause + crashes. + */ + /* Note that this reads the byte at *PTR! */ -#define VALIDATE_CHARPTR_BACKWARD(ptr) do { \ - while (!VALID_CHARPTR_P (ptr)) ptr--; \ +#define VALIDATE_IBYTEPTR_BACKWARD(ptr) do { \ + while (!valid_ibyteptr_p (ptr)) ptr--; \ +} while (0) + +/* Make sure that PTR is pointing to the beginning of a character. If not, + move forward until this is the case. Note that there are not too many + places where it is legitimate to do this sort of thing. It's an error + if you're passed an "invalid" char * pointer. + */ + +/* This needs to be trickier than VALIDATE_IBYTEPTR_BACKWARD() to avoid the + possibility of running off the end of the string. */ + +#define VALIDATE_IBYTEPTR_FORWARD(ptr) do { \ + Ibyte *vcf_ptr = (ptr); \ + VALIDATE_IBYTEPTR_BACKWARD (vcf_ptr); \ + if (vcf_ptr != (ptr)) \ + { \ + (ptr) = vcf_ptr; \ + INC_IBYTEPTR (ptr); \ + } \ } while (0) -/* Given a Intbyte string at PTR of size N, possibly with a partial +#else /* not MULE */ +#define VALIDATE_IBYTEPTR_BACKWARD(ptr) +#define VALIDATE_IBYTEPTR_FORWARD(ptr) +#endif /* not MULE */ + +#ifdef MULE + +/* Given a Ibyte string at PTR of size N, possibly with a partial character at the end, return the size of the longest substring of complete characters. Does not assume that the byte at *(PTR + N) is - readable. */ + readable. Note that there are not too many places where it is + legitimate to do this sort of thing. It's an error if you're passed an + "invalid" offset. */ + DECLARE_INLINE_HEADER ( Bytecount -validate_intbyte_string_backward (Intbyte *ptr, Bytecount n) +validate_ibyte_string_backward (const Ibyte *ptr, Bytecount n) ) { - Intbyte *ptr2; + const Ibyte *ptr2; if (n == 0) return n; ptr2 = ptr + n - 1; - VALIDATE_CHARPTR_BACKWARD (ptr2); - if (ptr2 + REP_BYTES_BY_FIRST_BYTE (*ptr2) != ptr + n) + VALIDATE_IBYTEPTR_BACKWARD (ptr2); + if (ptr2 + rep_bytes_by_first_byte (*ptr2) != ptr + n) return ptr2 - ptr; return n; } -/* This needs to be trickier than VALIDATE_CHARPTR_BACKWARD() to avoid the - possibility of running off the end of the string. */ +#else -#define VALIDATE_CHARPTR_FORWARD(ptr) do { \ - Intbyte *vcf_ptr = (ptr); \ - VALIDATE_CHARPTR_BACKWARD (vcf_ptr); \ - if (vcf_ptr != (ptr)) \ - { \ - (ptr) = vcf_ptr; \ - INC_CHARPTR (ptr); \ - } \ -} while (0) +#define validate_ibyte_string_backward(ptr, n) (n) -#else /* not MULE */ -#define VALIDATE_CHARPTR_BACKWARD(ptr) -#define VALIDATE_CHARPTR_FORWARD(ptr) -#define validate_intbyte_string_backward(ptr, n) (n) -#endif /* not MULE */ +#endif /* MULE */ /* -------------------------------------------------------------- */ -/* (B) For working with the length (in bytes and characters) of a */ -/* section of internally-formatted text */ +/* Working with the length (in bytes and characters) of a */ +/* section of internally-formatted text */ /* -------------------------------------------------------------- */ -INLINE_HEADER const Intbyte * -charptr_n_addr (const Intbyte *ptr, Charcount offset); -INLINE_HEADER const Intbyte * -charptr_n_addr (const Intbyte *ptr, Charcount offset) +#ifdef MULE + +Charcount bytecount_to_charcount_fun (const Ibyte *ptr, Bytecount len); +Bytecount charcount_to_bytecount_fun (const Ibyte *ptr, Charcount len); + +/* Given a pointer to a text string and a length in bytes, return + the equivalent length in characters. */ + +DECLARE_INLINE_HEADER ( +Charcount +bytecount_to_charcount (const Ibyte *ptr, Bytecount len) +) +{ + if (len < 20) /* Just a random guess, but it should be more or less correct. + If number of bytes is small, just do a simple loop, + which should be more efficient. */ + { + Charcount count = 0; + const Ibyte *end = ptr + len; + while (ptr < end) + { + INC_IBYTEPTR (ptr); + count++; + } + /* Bomb out if the specified substring ends in the middle + of a character. Note that we might have already gotten + a core dump above from an invalid reference, but at least + we will get no farther than here. + + This also catches len < 0. */ + text_checking_assert (ptr == end); + + return count; + } + else + return bytecount_to_charcount_fun (ptr, len); +} + +/* Given a pointer to a text string and a length in characters, return the + equivalent length in bytes. +*/ + +DECLARE_INLINE_HEADER ( +Bytecount +charcount_to_bytecount (const Ibyte *ptr, Charcount len) +) +{ + text_checking_assert (len >= 0); + if (len < 20) /* See above */ + { + const Ibyte *newptr = ptr; + while (len > 0) + { + INC_IBYTEPTR (newptr); + len--; + } + return newptr - ptr; + } + else + return charcount_to_bytecount_fun (ptr, len); +} + +/* Given a pointer to a text string in the specified format and a length in + bytes, return the equivalent length in characters. +*/ + +DECLARE_INLINE_HEADER ( +Charcount +bytecount_to_charcount_fmt (const Ibyte *ptr, Bytecount len, + Internal_Format fmt) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return bytecount_to_charcount (ptr, len); + case FORMAT_16_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); + return (Charcount) (len << 1); + case FORMAT_32_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); + return (Charcount) (len << 2); + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return (Charcount) len; + } +} + +/* Given a pointer to a text string in the specified format and a length in + characters, return the equivalent length in bytes. +*/ + +DECLARE_INLINE_HEADER ( +Bytecount +charcount_to_bytecount_fmt (const Ibyte *ptr, Charcount len, + Internal_Format fmt) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return charcount_to_bytecount (ptr, len); + case FORMAT_16_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); + text_checking_assert (!(len & 1)); + return (Bytecount) (len >> 1); + case FORMAT_32_BIT_FIXED: + text_checking_assert (!(len & 3)); + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); + return (Bytecount) (len >> 2); + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return (Bytecount) len; + } +} + +#else + +#define bytecount_to_charcount(ptr, len) ((Charcount) (len)) +#define bytecount_to_charcount_fmt(ptr, len, fmt) ((Charcount) (len)) +#define charcount_to_bytecount(ptr, len) ((Bytecount) (len)) +#define charcount_to_bytecount_fmt(ptr, len, fmt) ((Bytecount) (len)) + +#endif /* MULE */ + +/* Return the length of the first character at PTR. Equivalent to + charcount_to_bytecount (ptr, 1). + + [Since charcount_to_bytecount() is Written as inline, a smart compiler + should really optimize charcount_to_bytecount (ptr, 1) to the same as + the following, with no error checking. But since this idiom occurs so + often, we'll be helpful and define a special macro for it.] +*/ + +#define itext_ichar_len(ptr) rep_bytes_by_first_byte (*(ptr)) + +/* Return the length of the first character at PTR, which is in the + specified internal format. Equivalent to charcount_to_bytecount_fmt + (ptr, 1, fmt). +*/ + +DECLARE_INLINE_HEADER ( +Bytecount +itext_ichar_len_fmt (const Ibyte *ptr, Internal_Format fmt) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return itext_ichar_len (ptr); + case FORMAT_16_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); + return 2; + case FORMAT_32_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); + return 4; + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return 1; + } +} + +/* Return a pointer to the beginning of the character offset N (in + characters) from PTR. +*/ + +DECLARE_INLINE_HEADER ( +const Ibyte * +itext_n_addr (const Ibyte *ptr, Charcount offset) +) { return ptr + charcount_to_bytecount (ptr, offset); } +/* Given a itext and an offset into the text pointed to by the itext, + modify the offset so it points to the beginning of the next character. +*/ + +#define INC_BYTECOUNT(ptr, pos) do { \ + assert_valid_ibyteptr (ptr); \ + (pos += rep_bytes_by_first_byte (* ((ptr) + (pos)))); \ +} while (0) + /* -------------------------------------------------------------------- */ -/* (C) For retrieving or changing the character pointed to by a charptr */ +/* Retrieving or changing the character pointed to by a itext */ /* -------------------------------------------------------------------- */ -#define simple_charptr_emchar(ptr) ((Emchar) (ptr)[0]) -#define simple_set_charptr_emchar(ptr, x) ((ptr)[0] = (Intbyte) (x), 1) -#define simple_charptr_copy_char(src, dst) ((dst)[0] = *(src), 1) +#define simple_itext_ichar(ptr) ((Ichar) (ptr)[0]) +#define simple_set_itext_ichar(ptr, x) \ + ((ptr)[0] = (Ibyte) (x), (Bytecount) 1) +#define simple_itext_copy_ichar(src, dst) \ + ((dst)[0] = *(src), (Bytecount) 1) #ifdef MULE -Emchar non_ascii_charptr_emchar (const Intbyte *ptr); -Bytecount non_ascii_set_charptr_emchar (Intbyte *ptr, Emchar c); -Bytecount non_ascii_charptr_copy_char (const Intbyte *src, Intbyte *dst); +Ichar non_ascii_itext_ichar (const Ibyte *ptr); +Bytecount non_ascii_set_itext_ichar (Ibyte *ptr, Ichar c); +Bytecount non_ascii_itext_copy_ichar (const Ibyte *src, Ibyte *dst); + +/* Retrieve the character pointed to by PTR as an Ichar. */ + +DECLARE_INLINE_HEADER ( +Ichar +itext_ichar (const Ibyte *ptr) +) +{ + return byte_ascii_p (*ptr) ? + simple_itext_ichar (ptr) : + non_ascii_itext_ichar (ptr); +} + +/* Retrieve the character pointed to by PTR (a pointer to text in the + format FMT, coming from OBJECT [a buffer, string?, or nil]) as an + Ichar. + + Note: For these and other *_fmt() functions, if you pass in a constant + FMT, the switch will be optimized out of existence. Therefore, there is + no need to create separate versions for the various formats for + "efficiency reasons". In fact, we don't really need itext_ichar() + and such written separately, but they are used often so it's simpler + that way. */ + +DECLARE_INLINE_HEADER ( +Ichar +itext_ichar_fmt (const Ibyte *ptr, Internal_Format fmt, + Lisp_Object object) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return itext_ichar (ptr); + case FORMAT_16_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); + return raw_16_bit_fixed_to_ichar (* (UINT_16_BIT *) ptr, object); + case FORMAT_32_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); + return raw_32_bit_fixed_to_ichar (* (UINT_32_BIT *) ptr, object); + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return raw_8_bit_fixed_to_ichar (*ptr, object); + } +} + +/* Return the character at PTR (which is in format FMT), suitable for + comparison with an ASCII character. This guarantees that if the + character at PTR is ASCII (range 0 - 127), that character will be + returned; otherwise, some character outside of the ASCII range will be + returned, but not necessarily the character actually at PTR. This will + be faster than itext_ichar_fmt() for some formats -- in particular, + FORMAT_DEFAULT. */ + +DECLARE_INLINE_HEADER ( +Ichar +itext_ichar_ascii_fmt (const Ibyte *ptr, Internal_Format fmt, + Lisp_Object object) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return (Ichar) *ptr; + case FORMAT_16_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); + return raw_16_bit_fixed_to_ichar (* (UINT_16_BIT *) ptr, object); + case FORMAT_32_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); + return raw_32_bit_fixed_to_ichar (* (UINT_32_BIT *) ptr, object); + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return raw_8_bit_fixed_to_ichar (*ptr, object); + } +} + +/* Return the "raw value" of the character at PTR, in format FMT. This is + useful when searching for a character; convert the character using + ichar_to_raw(). */ + +DECLARE_INLINE_HEADER ( +Raw_Ichar +itext_ichar_raw_fmt (const Ibyte *ptr, Internal_Format fmt) +) +{ + switch (fmt) + { + case FORMAT_DEFAULT: + return (Raw_Ichar) itext_ichar (ptr); + case FORMAT_16_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); + return (Raw_Ichar) (* (UINT_16_BIT *) ptr); + case FORMAT_32_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); + return (Raw_Ichar) (* (UINT_32_BIT *) ptr); + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + return (Raw_Ichar) (*ptr); + } +} -INLINE_HEADER Emchar charptr_emchar (const Intbyte *ptr); -INLINE_HEADER Emchar -charptr_emchar (const Intbyte *ptr) +/* Store the character CH (an Ichar) as internally-formatted text starting + at PTR. Return the number of bytes stored. +*/ + +DECLARE_INLINE_HEADER ( +Bytecount +set_itext_ichar (Ibyte *ptr, Ichar x) +) { - return BYTE_ASCII_P (*ptr) ? - simple_charptr_emchar (ptr) : - non_ascii_charptr_emchar (ptr); + return !ichar_multibyte_p (x) ? + simple_set_itext_ichar (ptr, x) : + non_ascii_set_itext_ichar (ptr, x); } -INLINE_HEADER Bytecount set_charptr_emchar (Intbyte *ptr, Emchar x); -INLINE_HEADER Bytecount -set_charptr_emchar (Intbyte *ptr, Emchar x) +/* Store the character CH (an Ichar) as internally-formatted text of + format FMT starting at PTR, which comes from OBJECT. Return the number + of bytes stored. +*/ + +DECLARE_INLINE_HEADER ( +Bytecount +set_itext_ichar_fmt (Ibyte *ptr, Ichar x, Internal_Format fmt, + Lisp_Object object) +) { - return !CHAR_MULTIBYTE_P (x) ? - simple_set_charptr_emchar (ptr, x) : - non_ascii_set_charptr_emchar (ptr, x); + switch (fmt) + { + case FORMAT_DEFAULT: + return set_itext_ichar (ptr, x); + case FORMAT_16_BIT_FIXED: + text_checking_assert (ichar_16_bit_fixed_p (x, object)); + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_16_BIT)); + * (UINT_16_BIT *) ptr = ichar_to_raw_16_bit_fixed (x, object); + return 2; + case FORMAT_32_BIT_FIXED: + text_checking_assert (ptr == ALIGN_PTR (ptr, UINT_32_BIT)); + * (UINT_32_BIT *) ptr = ichar_to_raw_32_bit_fixed (x, object); + return 4; + default: + text_checking_assert (fmt == FORMAT_8_BIT_FIXED); + text_checking_assert (ichar_8_bit_fixed_p (x, object)); + *ptr = ichar_to_raw_8_bit_fixed (x, object); + return 1; + } } -INLINE_HEADER Bytecount -charptr_copy_char (const Intbyte *src, Intbyte *dst); -INLINE_HEADER Bytecount -charptr_copy_char (const Intbyte *src, Intbyte *dst) +/* Retrieve the character pointed to by SRC and store it as + internally-formatted text in DST. +*/ + +DECLARE_INLINE_HEADER ( +Bytecount +itext_copy_ichar (const Ibyte *src, Ibyte *dst) +) { - return BYTE_ASCII_P (*src) ? - simple_charptr_copy_char (src, dst) : - non_ascii_charptr_copy_char (src, dst); + return byte_ascii_p (*src) ? + simple_itext_copy_ichar (src, dst) : + non_ascii_itext_copy_ichar (src, dst); } #else /* not MULE */ -# define charptr_emchar(ptr) simple_charptr_emchar (ptr) -# define set_charptr_emchar(ptr, x) simple_set_charptr_emchar (ptr, x) -# define charptr_copy_char(src, dst) simple_charptr_copy_char (src, dst) +# define itext_ichar(ptr) simple_itext_ichar (ptr) +# define itext_ichar_fmt(ptr, fmt, object) itext_ichar (ptr) +# define itext_ichar_ascii_fmt(ptr, fmt, object) itext_ichar (ptr) +# define itext_ichar_raw_fmt(ptr, fmt) itext_ichar (ptr) +# define set_itext_ichar(ptr, x) simple_set_itext_ichar (ptr, x) +# define set_itext_ichar_fmt(ptr, x, fmt, obj) set_itext_ichar (ptr, x) +# define itext_copy_ichar(src, dst) simple_itext_copy_ichar (src, dst) #endif /* not MULE */ -#define charptr_emchar_n(ptr, offset) \ - charptr_emchar (charptr_n_addr (ptr, offset)) +/* Retrieve the character at offset N (in characters) from PTR, as an + Ichar. +*/ + +#define itext_ichar_n(ptr, offset) \ + itext_ichar (itext_n_addr (ptr, offset)) /* ---------------------------- */ -/* (D) For working with Emchars */ +/* Working with Ichars */ /* ---------------------------- */ +/* NOTE: There are other functions/macros for working with Ichars in + charset.h, for retrieving the charset of an Ichar, the length of an + Ichar when converted to text, etc. +*/ + #ifdef MULE -int non_ascii_valid_char_p (Emchar ch); +int non_ascii_valid_ichar_p (Ichar ch); -INLINE_HEADER int valid_char_p (Emchar ch); -INLINE_HEADER int -valid_char_p (Emchar ch) +/* Return whether the given Ichar is valid. + */ + +DECLARE_INLINE_HEADER ( +int +valid_ichar_p (Ichar ch) +) { - return (! (ch & ~0xFF)) || non_ascii_valid_char_p (ch); + return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch); } #else /* not MULE */ -#define valid_char_p(ch) (! (ch & ~0xFF)) +#define valid_ichar_p(ch) (! (ch & ~0xFF)) #endif /* not MULE */ -#define CHAR_INTP(x) (INTP (x) && valid_char_p (XINT (x))) +DECLARE_INLINE_HEADER ( +Lisp_Object +make_char (Ichar val) +) +{ + type_checking_assert (valid_ichar_p (val)); + return make_char_1 (val); +} + +#define CHAR_INTP(x) (INTP (x) && valid_ichar_p (XINT (x))) #define CHAR_OR_CHAR_INTP(x) (CHARP (x) || CHAR_INTP (x)) -INLINE_HEADER Emchar XCHAR_OR_CHAR_INT (Lisp_Object obj); -INLINE_HEADER Emchar +DECLARE_INLINE_HEADER ( +Ichar XCHAR_OR_CHAR_INT (Lisp_Object obj) +) { return CHARP (obj) ? XCHAR (obj) : XINT (obj); } +/* Signal an error if CH is not a valid character or integer Lisp_Object. + If CH is an integer Lisp_Object, convert it to a character Lisp_Object, + but merely by repackaging, without performing tests for char validity. + */ + #define CHECK_CHAR_COERCE_INT(x) do { \ if (CHARP (x)) \ ; \ @@ -468,6 +1042,222 @@ /************************************************************************/ /* */ +/* working with Lisp strings */ +/* */ +/************************************************************************/ + +#define string_char_length(s) \ + string_index_byte_to_char (s, XSTRING_LENGTH (s)) +#define string_byte(s, i) (XSTRING_DATA (s)[i] + 0) +/* In case we ever allow strings to be in a different format ... */ +#define set_string_byte(s, i, c) (XSTRING_DATA (s)[i] = (c)) + +#define ASSERT_VALID_CHAR_STRING_INDEX_UNSAFE(s, x) do { \ + text_checking_assert ((x) >= 0 && x <= string_char_length (s)); \ +} while (0) + +#define ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE(s, x) do { \ + text_checking_assert ((x) >= 0 && x <= XSTRING_LENGTH (s)); \ + text_checking_assert (valid_ibyteptr_p (string_byte_addr (s, x))); \ +} while (0) + +/* Convert offset I in string S to a pointer to text there. */ +#define string_byte_addr(s, i) (&(XSTRING_DATA (s)[i])) +/* Convert pointer to text in string S into the byte offset to that text. */ +#define string_addr_to_byte(s, ptr) ((Bytecount) ((ptr) - XSTRING_DATA (s))) +/* Return the Ichar at *CHARACTER* offset I. */ +#define string_ichar(s, i) itext_ichar (string_char_addr (s, i)) + +#ifdef ERROR_CHECK_TEXT +#define SLEDGEHAMMER_CHECK_ASCII_BEGIN +#endif + +#ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN +void sledgehammer_check_ascii_begin (Lisp_Object str); +#else +#define sledgehammer_check_ascii_begin(str) +#endif + +/* Make an alloca'd copy of a Lisp string */ +#define LISP_STRING_TO_ALLOCA(s, lval) \ +do { \ + Ibyte **_lta_ = (Ibyte **) &(lval); \ + Lisp_Object _lta_2 = (s); \ + *_lta_ = alloca_array (Ibyte, 1 + XSTRING_LENGTH (_lta_2)); \ + memcpy (*_lta_, XSTRING_DATA (_lta_2), 1 + XSTRING_LENGTH (_lta_2)); \ +} while (0) + +/* Make an alloca'd copy of a Ibyte * */ +#define IBYTE_STRING_TO_ALLOCA(p, lval) \ +do { \ + Ibyte **_bsta_ = (Ibyte **) &(lval); \ + const Ibyte *_bsta_2 = (p); \ + Bytecount _bsta_3 = qxestrlen (_bsta_2); \ + *_bsta_ = alloca_array (Ibyte, 1 + _bsta_3); \ + memcpy (*_bsta_, _bsta_2, 1 + _bsta_3); \ +} while (0) + + +#define alloca_ibytes(num) alloca_array (Ibyte, num) +#define alloca_extbytes(num) alloca_array (Extbyte, num) + +void resize_string (Lisp_Object s, Bytecount pos, Bytecount delta); + +/* Convert a byte index into a string into a char index. */ +DECLARE_INLINE_HEADER ( +Charcount +string_index_byte_to_char (Lisp_Object s, Bytecount idx) +) +{ + Charcount retval; + ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE (s, idx); +#ifdef MULE + if (idx <= (Bytecount) XSTRING_ASCII_BEGIN (s)) + retval = (Charcount) idx; + else + retval = (XSTRING_ASCII_BEGIN (s) + + bytecount_to_charcount (XSTRING_DATA (s) + + XSTRING_ASCII_BEGIN (s), + idx - XSTRING_ASCII_BEGIN (s))); +# ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN + assert (retval == bytecount_to_charcount (XSTRING_DATA (s), idx)); +# endif +#else + retval = (Charcount) idx; +#endif + /* Don't call ASSERT_VALID_CHAR_STRING_INDEX_UNSAFE() here because it will + call string_index_byte_to_char(). */ + return retval; +} + +/* Convert a char index into a string into a byte index. */ +DECLARE_INLINE_HEADER ( +Bytecount +string_index_char_to_byte (Lisp_Object s, Charcount idx) +) +{ + Bytecount retval; + ASSERT_VALID_CHAR_STRING_INDEX_UNSAFE (s, idx); +#ifdef MULE + if (idx <= (Charcount) XSTRING_ASCII_BEGIN (s)) + retval = (Bytecount) idx; + else + retval = (XSTRING_ASCII_BEGIN (s) + + charcount_to_bytecount (XSTRING_DATA (s) + + XSTRING_ASCII_BEGIN (s), + idx - XSTRING_ASCII_BEGIN (s))); +# ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN + assert (retval == charcount_to_bytecount (XSTRING_DATA (s), idx)); +# endif +#else + retval = (Bytecount) idx; +#endif + ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE (s, retval); + return retval; +} + +/* Convert a substring length (starting at byte offset OFF) from bytes to + chars. */ +DECLARE_INLINE_HEADER ( +Charcount +string_offset_byte_to_char_len (Lisp_Object s, Bytecount off, Bytecount len) +) +{ + Charcount retval; + ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE (s, off); + ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE (s, off + len); +#ifdef MULE + if (off + len <= (Bytecount) XSTRING_ASCII_BEGIN (s)) + retval = (Charcount) len; + else if (off < (Bytecount) XSTRING_ASCII_BEGIN (s)) + retval = + XSTRING_ASCII_BEGIN (s) - (Charcount) off + + bytecount_to_charcount (XSTRING_DATA (s) + XSTRING_ASCII_BEGIN (s), + len - (XSTRING_ASCII_BEGIN (s) - off)); + else + retval = bytecount_to_charcount (XSTRING_DATA (s) + off, len); +# ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN + assert (retval == bytecount_to_charcount (XSTRING_DATA (s) + off, len)); +# endif +#else + retval = (Charcount) len; +#endif + return retval; +} + +/* Convert a substring length (starting at byte offset OFF) from chars to + bytes. */ +DECLARE_INLINE_HEADER ( +Bytecount +string_offset_char_to_byte_len (Lisp_Object s, Bytecount off, Charcount len) +) +{ + Bytecount retval; + ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE (s, off); +#ifdef MULE + /* casts to avoid errors from combining Bytecount/Charcount and warnings + from signed/unsigned comparisons */ + if (off + (Bytecount) len <= (Bytecount) XSTRING_ASCII_BEGIN (s)) + retval = (Bytecount) len; + else if (off < (Bytecount) XSTRING_ASCII_BEGIN (s)) + retval = + XSTRING_ASCII_BEGIN (s) - off + + charcount_to_bytecount (XSTRING_DATA (s) + XSTRING_ASCII_BEGIN (s), + len - (XSTRING_ASCII_BEGIN (s) - + (Charcount) off)); + else + retval = charcount_to_bytecount (XSTRING_DATA (s) + off, len); +# ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN + assert (retval == charcount_to_bytecount (XSTRING_DATA (s) + off, len)); +# endif +#else + retval = (Bytecount) len; +#endif + ASSERT_VALID_BYTE_STRING_INDEX_UNSAFE (s, off + retval); + return retval; +} + +DECLARE_INLINE_HEADER ( +const Ibyte * +string_char_addr (Lisp_Object s, Charcount idx) +) +{ + return XSTRING_DATA (s) + string_index_char_to_byte (s, idx); +} + +/* WARNING: If you modify an existing string, you must call + bump_string_modiff() afterwards. */ +#ifdef MULE +void set_string_char (Lisp_Object s, Charcount i, Ichar c); +#else +#define set_string_char(s, i, c) set_string_byte (s, i, c) +#endif /* not MULE */ + +/* Return index to character before the one at IDX. */ +DECLARE_INLINE_HEADER ( +Bytecount +prev_string_index (Lisp_Object s, Bytecount idx) +) +{ + const Ibyte *ptr = string_byte_addr (s, idx); + DEC_IBYTEPTR (ptr); + return string_addr_to_byte (s, ptr); +} + +/* Return index to character after the one at IDX. */ +DECLARE_INLINE_HEADER ( +Bytecount +next_string_index (Lisp_Object s, Bytecount idx) +) +{ + const Ibyte *ptr = string_byte_addr (s, idx); + INC_IBYTEPTR (ptr); + return string_addr_to_byte (s, ptr); +} + + +/************************************************************************/ +/* */ /* working with Eistrings */ /* */ /************************************************************************/ @@ -483,7 +1273,7 @@ (a) it is Mule-correct (b) it does dynamic allocation so you never have to worry about size restrictions - (c) it comes in an alloca() variety (all allocation is stack-local, + (c) it comes in an ALLOCA() variety (all allocation is stack-local, so there is no need to explicitly clean up) as well as a malloc() variety (d) it knows its own length, so it does not suffer from standard null @@ -491,8 +1281,8 @@ it can be passed to standard routines (e) it provides a much more powerful set of operations and knows about all the standard places where string data might reside: Lisp_Objects, - other Eistrings, Intbyte * data with or without an explicit length, - ASCII strings, Emchars, etc. + other Eistrings, Ibyte * data with or without an explicit length, + ASCII strings, Ichars, etc. (f) it provides easy operations to convert to/from externally-formatted data, and is easier to use than the standard TO_INTERNAL_FORMAT and TO_EXTERNAL_FORMAT macros. (An Eistring can store both the internal @@ -527,7 +1317,7 @@ is declared as an Eistring *, and its storage declared on the stack. DECLARE_EISTRING_MALLOC (name); - Declare a new Eistring, which uses malloc()ed instead of alloca()ed + Declare a new Eistring, which uses malloc()ed instead of ALLOCA()ed data. This is a standard local variable declaration and can go anywhere in the variable declaration section. Once you initialize the Eistring, you will have to free it using eifree() to avoid @@ -578,8 +1368,8 @@ ... from another Eistring. void eicpy_lstr (Eistring *eistr, Lisp_Object lisp_string); ... from a Lisp_Object string. - void eicpy_ch (Eistring *eistr, Emchar ch); - ... from an Emchar (this can be a conventional C character). + void eicpy_ch (Eistring *eistr, Ichar ch); + ... from an Ichar (this can be a conventional C character). void eicpy_lstr_off (Eistring *eistr, Lisp_Object lisp_string, Bytecount off, Charcount charoff, @@ -589,17 +1379,17 @@ Bytecount off, Charcount charoff, Bytecount len, Charcount charlen); ... from a section of a Lisp_Object buffer. - void eicpy_raw (Eistring *eistr, const Intbyte *data, Bytecount len); + void eicpy_raw (Eistring *eistr, const Ibyte *data, Bytecount len); ... from raw internal-format data in the default internal format. - void eicpy_rawz (Eistring *eistr, const Intbyte *data); + void eicpy_rawz (Eistring *eistr, const Ibyte *data); ... from raw internal-format data in the default internal format that is "null-terminated" (the meaning of this depends on the nature of the default internal format). - void eicpy_raw_fmt (Eistring *eistr, const Intbyte *data, Bytecount len, - Internal_Format intfmt); + void eicpy_raw_fmt (Eistring *eistr, const Ibyte *data, Bytecount len, + Internal_Format intfmt, Lisp_Object object); ... from raw internal-format data in the specified format. - void eicpy_rawz_fmt (Eistring *eistr, const Intbyte *data, - Internal_Format intfmt); + void eicpy_rawz_fmt (Eistring *eistr, const Ibyte *data, + Internal_Format intfmt, Lisp_Object object); ... from raw internal-format data in the specified format that is "null-terminated" (the meaning of this depends on the nature of the specific format). @@ -624,7 +1414,7 @@ * Getting the data out of the Eistring * ********************************************** - Intbyte *eidata (Eistring *eistr); + Ibyte *eidata (Eistring *eistr); Return a pointer to the raw data in an Eistring. This is NOT a copy. @@ -636,33 +1426,33 @@ Bytecount len, Charcount charlen); Make a Lisp string out of a section of the Eistring. - void eicpyout_alloca (Eistring *eistr, LVALUE: Intbyte *ptr_out, + void eicpyout_alloca (Eistring *eistr, LVALUE: Ibyte *ptr_out, LVALUE: Bytecount len_out); - Make an alloca() copy of the data in the Eistring, using the - default internal format. Due to the nature of alloca(), this + Make an ALLOCA() copy of the data in the Eistring, using the + default internal format. Due to the nature of ALLOCA(), this must be a macro, with all lvalues passed in as parameters. (More specifically, not all compilers correctly handle using - alloca() as the argument to a function call -- GCC on x86 - didn't used to, for example.) A pointer to the alloca()ed data + ALLOCA() as the argument to a function call -- GCC on x86 + didn't used to, for example.) A pointer to the ALLOCA()ed data is stored in PTR_OUT, and the length of the data (not including the terminating zero) is stored in LEN_OUT. - void eicpyout_alloca_fmt (Eistring *eistr, LVALUE: Intbyte *ptr_out, + void eicpyout_alloca_fmt (Eistring *eistr, LVALUE: Ibyte *ptr_out, LVALUE: Bytecount len_out, - Internal_Format intfmt); + Internal_Format intfmt, Lisp_Object object); Like eicpyout_alloca(), but converts to the specified internal format. (No formats other than FORMAT_DEFAULT are currently implemented, and you get an assertion failure if you try.) - Intbyte *eicpyout_malloc (Eistring *eistr, Bytecount *intlen_out); + Ibyte *eicpyout_malloc (Eistring *eistr, Bytecount *intlen_out); Make a malloc() copy of the data in the Eistring, using the default internal format. This is a real function. No lvalues passed in. Returns the new data, and stores the length (not including the terminating zero) using INTLEN_OUT, unless it's a NULL pointer. - Intbyte *eicpyout_malloc_fmt (Eistring *eistr, Internal_Format intfmt, - Bytecount *intlen_out); + Ibyte *eicpyout_malloc_fmt (Eistring *eistr, Internal_Format intfmt, + Bytecount *intlen_out, Lisp_Object object); Like eicpyout_malloc(), but converts to the specified internal format. (No formats other than FORMAT_DEFAULT are currently implemented, and you get an assertion failure if you try.) @@ -720,9 +1510,9 @@ * Getting the character at a position * ********************************************** - Emchar eigetch (Eistring *eistr, Bytecount bytepos); + Ichar eigetch (Eistring *eistr, Bytecount bytepos); Return the character at a particular byte offset. - Emchar eigetch_char (Eistring *eistr, Charcount charpos); + Ichar eigetch_char (Eistring *eistr, Charcount charpos); Return the character at a particular character offset. @@ -730,9 +1520,9 @@ * Setting the character at a position * ********************************************** - Emchar eisetch (Eistring *eistr, Bytecount bytepos, Emchar chr); + Ichar eisetch (Eistring *eistr, Bytecount bytepos, Ichar chr); Set the character at a particular byte offset. - Emchar eisetch_char (Eistring *eistr, Charcount charpos, Emchar chr); + Ichar eisetch_char (Eistring *eistr, Charcount charpos, Ichar chr); Set the character at a particular character offset. @@ -749,16 +1539,16 @@ void eicat_c (Eistring *eistr, Char_ASCII *c_string); ... from an ASCII null-terminated string. Non-ASCII characters in the string are *ILLEGAL* (read abort() with error-checking defined). - void eicat_raw (ei, const Intbyte *data, Bytecount len); + void eicat_raw (ei, const Ibyte *data, Bytecount len); ... from raw internal-format data in the default internal format. - void eicat_rawz (ei, const Intbyte *data); + void eicat_rawz (ei, const Ibyte *data); ... from raw internal-format data in the default internal format that is "null-terminated" (the meaning of this depends on the nature of the default internal format). void eicat_lstr (ei, Lisp_Object lisp_string); ... from a Lisp_Object string. - void eicat_ch (ei, Emchar ch); - ... from an Emchar. + void eicat_ch (ei, Ichar ch); + ... from an Ichar. (All except the first variety are convenience functions. In the general case, create another Eistring from the source.) @@ -780,8 +1570,8 @@ ... with an ASCII null-terminated string. Non-ASCII characters in the string are *ILLEGAL* (read abort() with error-checking defined). void eisub_ch (Eistring *eistr, Bytecount off, Charcount charoff, - Bytecount len, Charcount charlen, Emchar ch); - ... with an Emchar. + Bytecount len, Charcount charlen, Ichar ch); + ... with an Ichar. void eidel (Eistring *eistr, Bytecount off, Charcount charoff, Bytecount len, Charcount charlen); @@ -812,17 +1602,17 @@ * Searching in the Eistring for a character * ********************************************** - Bytecount eichr (Eistring *eistr, Emchar chr); - Charcount eichr_char (Eistring *eistr, Emchar chr); - Bytecount eichr_off (Eistring *eistr, Emchar chr, Bytecount off, + Bytecount eichr (Eistring *eistr, Ichar chr); + Charcount eichr_char (Eistring *eistr, Ichar chr); + Bytecount eichr_off (Eistring *eistr, Ichar chr, Bytecount off, Charcount charoff); - Charcount eichr_off_char (Eistring *eistr, Emchar chr, Bytecount off, + Charcount eichr_off_char (Eistring *eistr, Ichar chr, Bytecount off, Charcount charoff); - Bytecount eirchr (Eistring *eistr, Emchar chr); - Charcount eirchr_char (Eistring *eistr, Emchar chr); - Bytecount eirchr_off (Eistring *eistr, Emchar chr, Bytecount off, + Bytecount eirchr (Eistring *eistr, Ichar chr); + Charcount eirchr_char (Eistring *eistr, Ichar chr); + Bytecount eirchr_off (Eistring *eistr, Ichar chr, Bytecount off, Charcount charoff); - Charcount eirchr_off_char (Eistring *eistr, Emchar chr, Bytecount off, + Charcount eirchr_off_char (Eistring *eistr, Ichar chr, Bytecount off, Charcount charoff); @@ -921,7 +1711,7 @@ /* Principles for writing Eistring functions: (1) Unfortunately, we have to write most of the Eistring functions - as macros, because of the use of alloca(). The principle used + as macros, because of the use of ALLOCA(). The principle used below to assure no conflict in local variables is to prefix all local variables with "ei" plus a number, which should be unique among macros. In practice, when finding a new number, find the @@ -949,11 +1739,11 @@ practice it's a hassle, so we suggest that you provide convenience functions. In particular, there are two paths you can take. One is minimalist -- it only allows other Eistrings - and ASCII data, and Emchars if the particular operation makes + and ASCII data, and Ichars if the particular operation makes sense with a character. The other provides interfaces for the most commonly-used forms -- Eistring, ASCII data, Lisp string, raw internal-format string with length, raw internal-format - string without, and possibly Emchar. (In the function names, + string without, and possibly Ichar. (In the function names, these are designated `ei', `c', `lstr', `raw', `rawz', and `ch', respectively.) @@ -978,8 +1768,8 @@ temporary variable for all access to the Eistring. Essentially, we want it to appear as if these Eistring macros are functions -- we would like to declare them as functions but - they use alloca(), so we can't (and we can't make them inline - functions either -- alloca() is explicitly disallowed in inline + they use ALLOCA(), so we can't (and we can't make them inline + functions either -- ALLOCA() is explicitly disallowed in inline functions.) (7) Note that our rules regarding multiple evaluation are *more* @@ -994,7 +1784,7 @@ { /* Data for the Eistring, stored in the default internal format. Always includes terminating null. */ - Intbyte *data_; + Ibyte *data_; /* Total number of bytes allocated in DATA (including null). */ Bytecount max_size_allocated_; Bytecount bytelen_; @@ -1005,14 +1795,6 @@ Bytecount extlen_; } Eistring; -typedef enum internal_format -{ - FORMAT_DEFAULT, - FORMAT_FIXED_8, - FORMAT_FIXED_16, - FORMAT_FIXED_32 -} Internal_Format; - extern Eistring the_eistring_zero_init, the_eistring_malloc_zero_init; #define DECLARE_EISTRING(name) \ @@ -1088,13 +1870,13 @@ { \ if ((ei)->mallocp_) \ /* xrealloc always preserves existing data as much as possible */ \ - (ei)->data_ = (Intbyte *) xrealloc ((ei)->data_, ei1newsize); \ + (ei)->data_ = (Ibyte *) xrealloc ((ei)->data_, ei1newsize); \ else \ { \ - /* We don't have realloc, so alloca() more space and copy the \ + /* We don't have realloc, so ALLOCA() more space and copy the \ data into it. */ \ - Intbyte *ei1oldeidata = (ei)->data_; \ - (ei)->data_ = (Intbyte *) alloca (ei1newsize); \ + Ibyte *ei1oldeidata = (ei)->data_; \ + (ei)->data_ = (Ibyte *) ALLOCA (ei1newsize); \ if (ei1oldeidata) \ memcpy ((ei)->data_, ei1oldeidata, ei1oldeibytelen + 1); \ } \ @@ -1144,7 +1926,7 @@ do { \ Lisp_Object ei3 = (lisp_string); \ EI_ALLOC_AND_COPY (ei, XSTRING_DATA (ei3), XSTRING_LENGTH (ei3), \ - XSTRING_CHAR_LENGTH (ei3)); \ + string_char_length (ei3)); \ } while (0) #define eicpy_lstr_off(ei, lisp_string, off, charoff, len, charlen) \ @@ -1154,7 +1936,7 @@ int ei23charoff = (charoff); \ int ei23len = (len); \ int ei23charlen = (charlen); \ - const Intbyte *ei23data = XSTRING_DATA (ei23lstr); \ + const Ibyte *ei23data = XSTRING_DATA (ei23lstr); \ \ int ei23oldbytelen = (ei)->bytelen_; \ \ @@ -1164,9 +1946,9 @@ EI_ALLOC_AND_COPY (ei, ei23data + ei23off, ei23len, ei23charlen); \ } while (0) -#define eicpy_raw_fmt(ei, ptr, len, fmt) \ +#define eicpy_raw_fmt(ei, ptr, len, fmt, object) \ do { \ - const Intbyte *ei12ptr = (ptr); \ + const Ibyte *ei12ptr = (ptr); \ Internal_Format ei12fmt = (fmt); \ int ei12len = (len); \ assert (ei12fmt == FORMAT_DEFAULT); \ @@ -1174,22 +1956,23 @@ bytecount_to_charcount (ei12ptr, ei12len)); \ } while (0) -#define eicpy_raw(ei, ptr, len) eicpy_raw_fmt (ei, ptr, len, FORMAT_DEFAULT) +#define eicpy_raw(ei, ptr, len) \ + eicpy_raw_fmt (ei, ptr, len, FORMAT_DEFAULT, Qnil) -#define eicpy_rawz_fmt(ei, ptr, fmt) \ -do { \ - const Intbyte *ei12p1ptr = (ptr); \ - Internal_Format ei12p1fmt = (fmt); \ - assert (ei12p1fmt == FORMAT_DEFAULT); \ - eicpy_raw_fmt (ei, ei12p1ptr, qxestrlen (ei12p1ptr), fmt); \ +#define eicpy_rawz_fmt(ei, ptr, fmt, object) \ +do { \ + const Ibyte *ei12p1ptr = (ptr); \ + Internal_Format ei12p1fmt = (fmt); \ + assert (ei12p1fmt == FORMAT_DEFAULT); \ + eicpy_raw_fmt (ei, ei12p1ptr, qxestrlen (ei12p1ptr), fmt, object); \ } while (0) -#define eicpy_rawz(ei, ptr) eicpy_rawz_fmt (ei, ptr, FORMAT_DEFAULT) +#define eicpy_rawz(ei, ptr) eicpy_rawz_fmt (ei, ptr, FORMAT_DEFAULT, Qnil) #define eicpy_ch(ei, ch) \ do { \ - Intbyte ei12p2[MAX_EMCHAR_LEN]; \ - Bytecount ei12p2len = set_charptr_emchar (ei12p2, ch); \ + Ibyte ei12p2[MAX_ICHAR_LEN]; \ + Bytecount ei12p2len = set_itext_ichar (ei12p2, ch); \ EI_ALLOC_AND_COPY (ei, ei12p2, ei12p2len, 1); \ } while (0) @@ -1236,7 +2019,7 @@ #define eicpy_lstream(eistr, lstream) \ NOT YET IMPLEMENTED -#define eireset(eistr) eicpy_rawz (eistr, (Intbyte *) "") +#define eireset(eistr) eicpy_rawz (eistr, (Ibyte *) "") /* ----- Getting the data out of the Eistring ----- */ @@ -1259,21 +2042,21 @@ } while (0) #define eicpyout_alloca(eistr, ptrout, lenout) \ - eicpyout_alloca_fmt (eistr, ptrout, lenout, FORMAT_DEFAULT) + eicpyout_alloca_fmt (eistr, ptrout, lenout, FORMAT_DEFAULT, Qnil) #define eicpyout_malloc(eistr, lenout) \ - eicpyout_malloc_fmt (eistr, lenout, FORMAT_DEFAULT) -Intbyte *eicpyout_malloc_fmt (Eistring *eistr, Bytecount *len_out, - Internal_Format fmt); -#define eicpyout_alloca_fmt(eistr, ptrout, lenout, fmt) \ + eicpyout_malloc_fmt (eistr, lenout, FORMAT_DEFAULT, Qnil) +Ibyte *eicpyout_malloc_fmt (Eistring *eistr, Bytecount *len_out, + Internal_Format fmt, Lisp_Object object); +#define eicpyout_alloca_fmt(eistr, ptrout, lenout, fmt, object) \ do { \ Internal_Format ei23fmt = (fmt); \ - Intbyte *ei23ptrout = &(ptrout); \ + Ibyte *ei23ptrout = &(ptrout); \ Bytecount *ei23lenout = &(lenout); \ \ assert (ei23fmt == FORMAT_DEFAULT); \ \ *ei23lenout = (eistr)->bytelen_; \ - *ei23ptrout = alloca_array (Intbyte, (eistr)->bytelen_ + 1); \ + *ei23ptrout = alloca_array (Ibyte, (eistr)->bytelen_ + 1); \ memcpy (*ei23ptrout, (eistr)->data_, (eistr)->bytelen_ + 1); \ } while (0) @@ -1305,11 +2088,11 @@ (ei)->mallocp_ = 0; \ if ((ei)->data_) \ { \ - Intbyte *ei13newdata; \ + Ibyte *ei13newdata; \ \ (ei)->max_size_allocated_ = \ eifind_large_enough_buffer (0, (ei)->bytelen_ + 1); \ - ei13newdata = (Intbyte *) alloca ((ei)->max_size_allocated_); \ + ei13newdata = (Ibyte *) ALLOCA ((ei)->max_size_allocated_); \ memcpy (ei13newdata, (ei)->data_, (ei)->bytelen_ + 1); \ xfree ((ei)->data_); \ (ei)->data_ = ei13newdata; \ @@ -1317,7 +2100,7 @@ \ if ((ei)->extdata_) \ { \ - Extbyte *ei13newdata = (Extbyte *) alloca ((ei)->extlen_ + 2); \ + Extbyte *ei13newdata = (Extbyte *) ALLOCA ((ei)->extlen_ + 2); \ \ memcpy (ei13newdata, (ei)->extdata_, (ei)->extlen_); \ /* Double null-terminate in case of Unicode data */ \ @@ -1346,8 +2129,8 @@ Bytecount bytepos, Charcount n)) { - Intbyte *pos = eistr->data_ + bytepos; - int i; + Ibyte *pos = eistr->data_ + bytepos; + Charcount i; text_checking_assert (bytepos >= 0 && bytepos <= eistr->bytelen_); text_checking_assert (n >= 0 && n <= eistr->charlen_); @@ -1355,10 +2138,10 @@ call to bytecount_to_charcount(), which would be needlessly expensive (it would convert O(N) algorithms into O(N^2) algorithms with ERROR_CHECK_TEXT, which would be bad). If N is bad, we are - guaranteed to catch it either inside INC_CHARPTR() or in the check + guaranteed to catch it either inside INC_IBYTEPTR() or in the check below. */ for (i = 0; i < n; i++) - INC_CHARPTR (pos); + INC_IBYTEPTR (pos); text_checking_assert (pos - eistr->data_ <= eistr->bytelen_); return pos - eistr->data_; } @@ -1370,14 +2153,14 @@ Bytecount bytepos, Charcount n)) { - Intbyte *pos = eistr->data_ + bytepos; + Ibyte *pos = eistr->data_ + bytepos; int i; text_checking_assert (bytepos >= 0 && bytepos <= eistr->bytelen_); text_checking_assert (n >= 0 && n <= eistr->charlen_); /* We could check N more correctly now, but ... see above. */ for (i = 0; i < n; i++) - DEC_CHARPTR (pos); + DEC_IBYTEPTR (pos); text_checking_assert (pos - eistr->data_ <= eistr->bytelen_); return pos - eistr->data_; } @@ -1389,8 +2172,8 @@ /* ----- Getting the character at a position ----- */ #define eigetch(ei, bytepos) \ - charptr_emchar ((ei)->data_ + (bytepos)) -#define eigetch_char(ei, charpos) charptr_emchar_n ((ei)->data_, charpos) + itext_ichar ((ei)->data_ + (bytepos)) +#define eigetch_char(ei, charpos) itext_ichar_n ((ei)->data_, charpos) /* ----- Setting the character at a position ----- */ @@ -1426,20 +2209,20 @@ \ EI_ASSERT_ASCII (ei15, ei15len); \ eicat_1 (ei, ei15, ei15len, \ - bytecount_to_charcount ((Intbyte *) ei15, ei15len)); \ + bytecount_to_charcount ((Ibyte *) ei15, ei15len)); \ } while (0) #define eicat_raw(ei, data, len) \ do { \ int ei16len = (len); \ - const Intbyte *ei16data = (data); \ + const Ibyte *ei16data = (data); \ eicat_1 (ei, ei16data, ei16len, \ bytecount_to_charcount (ei16data, ei16len)); \ } while (0) #define eicat_rawz(ei, ptr) \ do { \ - const Intbyte *ei16p5ptr = (ptr); \ + const Ibyte *ei16p5ptr = (ptr); \ eicat_raw (ei, ei16p5ptr, qxestrlen (ei16p5ptr)); \ } while (0) @@ -1447,13 +2230,13 @@ do { \ Lisp_Object ei17 = (lisp_string); \ eicat_1 (ei, XSTRING_DATA (ei17), XSTRING_LENGTH (ei17), \ - XSTRING_CHAR_LENGTH (ei17)); \ + string_char_length (ei17)); \ } while (0) #define eicat_ch(ei, ch) \ do { \ - Intbyte ei22ch[MAX_EMCHAR_LEN]; \ - Bytecount ei22len = set_charptr_emchar (ei22ch, ch); \ + Ibyte ei22ch[MAX_ICHAR_LEN]; \ + Bytecount ei22len = set_itext_ichar (ei22ch, ch); \ eicat_1 (ei, ei22ch, ei22len, 1); \ } while (0) @@ -1470,7 +2253,7 @@ int ei18charoff = (charoff); \ int ei18len = (len); \ int ei18charlen = (charlen); \ - Intbyte *ei18src = (Intbyte *) (src); \ + Ibyte *ei18src = (Ibyte *) (src); \ int ei18srclen = (srclen); \ int ei18srccharlen = (srccharlen); \ \ @@ -1508,8 +2291,8 @@ #define eisub_ch(ei, off, charoff, len, charlen, ch) \ do { \ - Intbyte ei21ch[MAX_EMCHAR_LEN]; \ - Bytecount ei21len = set_charptr_emchar (ei21ch, ch); \ + Ibyte ei21ch[MAX_ICHAR_LEN]; \ + Bytecount ei21len = set_itext_ichar (ei21ch, ch); \ eisub_1 (ei, off, charoff, len, charlen, ei21ch, ei21len, 1); \ } while (0) @@ -1602,7 +2385,7 @@ /* ----- Comparison ----- */ int eicmp_1 (Eistring *ei, Bytecount off, Charcount charoff, - Bytecount len, Charcount charlen, const Intbyte *data, + Bytecount len, Charcount charlen, const Ibyte *data, const Eistring *ei2, int is_c, int fold_case); #define eicmp_ei(eistr, eistr2) \ @@ -1634,14 +2417,14 @@ /* ----- Case-changing the Eistring ----- */ -int eistr_casefiddle_1 (Intbyte *olddata, Bytecount len, Intbyte *newdata, +int eistr_casefiddle_1 (Ibyte *olddata, Bytecount len, Ibyte *newdata, int downp); #define EI_CASECHANGE(ei, downp) \ do { \ - int ei11new_allocmax = (ei)->charlen_ * MAX_EMCHAR_LEN + 1; \ - Intbyte *ei11storage = (Intbyte *) alloca_array (Intbyte, \ - ei11new_allocmax); \ + int ei11new_allocmax = (ei)->charlen_ * MAX_ICHAR_LEN + 1; \ + Ibyte *ei11storage = \ + (Ibyte *) alloca_array (Ibyte, ei11new_allocmax); \ int ei11newlen = eistr_casefiddle_1 ((ei)->data_, (ei)->bytelen_, \ ei11storage, downp); \ \ @@ -1684,7 +2467,7 @@ The source or sink can be specified in one of these ways: DATA, (ptr, len), // input data is a fixed buffer of size len - ALLOCA, (ptr, len), // output data is in a alloca()ed buffer of size len + ALLOCA, (ptr, len), // output data is in a ALLOCA()ed buffer of size len MALLOC, (ptr, len), // output data is in a malloc()ed buffer of size len C_STRING_ALLOCA, ptr, // equivalent to ALLOCA (ptr, len_ignored) on output C_STRING_MALLOC, ptr, // equivalent to MALLOC (ptr, len_ignored) on output @@ -1819,8 +2602,16 @@ DFC_##sink_type##_USE_CONVERTED_DATA (sink); \ } while (0) +#ifdef __cplusplus + +/* Error if you try to use a union here: "member `struct {anonymous +union}::{anonymous} {anonymous union}::data' with constructor not allowed +in union" (Bytecount is a class) */ +typedef struct +#else typedef union +#endif { struct { const void *ptr; Bytecount len; } data; Lisp_Object lisp_object; @@ -1936,7 +2727,7 @@ /* + 2 because we double zero-extended to account for Unicode conversion */ typedef union { char c; void *p; } *dfc_aliasing_voidpp; #define DFC_ALLOCA_USE_CONVERTED_DATA(sink) do { \ - void * dfc_sink_ret = alloca (dfc_sink.data.len + 2); \ + void * dfc_sink_ret = ALLOCA (dfc_sink.data.len + 2); \ memcpy (dfc_sink_ret, dfc_sink.data.ptr, dfc_sink.data.len + 2); \ ((dfc_aliasing_voidpp) &(DFC_CPP_CAR sink))->p = dfc_sink_ret; \ (DFC_CPP_CDR sink) = dfc_sink.data.len; \ @@ -1948,7 +2739,7 @@ (DFC_CPP_CDR sink) = dfc_sink.data.len; \ } while (0) #define DFC_C_STRING_ALLOCA_USE_CONVERTED_DATA(sink) do { \ - void * dfc_sink_ret = alloca (dfc_sink.data.len + 2); \ + void * dfc_sink_ret = ALLOCA (dfc_sink.data.len + 2); \ memcpy (dfc_sink_ret, dfc_sink.data.ptr, dfc_sink.data.len + 2); \ ((dfc_aliasing_voidpp) &(sink))->p = dfc_sink_ret; \ } while (0) @@ -1958,7 +2749,7 @@ ((dfc_aliasing_voidpp) &(sink))->p = dfc_sink_ret; \ } while (0) #define DFC_LISP_STRING_USE_CONVERTED_DATA(sink) \ - sink = make_string ((Intbyte *) dfc_sink.data.ptr, dfc_sink.data.len) + sink = make_string ((Ibyte *) dfc_sink.data.ptr, dfc_sink.data.len) #define DFC_LISP_OPAQUE_USE_CONVERTED_DATA(sink) \ sink = make_opaque (dfc_sink.data.ptr, dfc_sink.data.len) #define DFC_LISP_LSTREAM_USE_CONVERTED_DATA(sink) /* data already used */ @@ -2013,75 +2804,11 @@ \ if (!__gserr__) \ { \ - var = alloca_intbytes (99); \ + var = alloca_ibytes (99); \ qxesprintf (var, "Unknown error %d", __gsnum__); \ } \ else \ EXTERNAL_TO_C_STRING (__gserr__, var, Qstrerror_encoding); \ } while (0) - -/************************************************************************/ -/* Lisp string representation convenience functions */ -/************************************************************************/ - -/* Because the representation of internally formatted data is subject - to change, it's bad style to do something like - - strcmp (XSTRING_DATA (s), "foo") - - Instead, use the portable: - - intbyte_strcmp (XSTRING_DATA (s), "foo") or - intbyte_memcmp (XSTRING_DATA (s), "foo", 3) - -*/ - -/* Like strcmp, except first arg points at internally formatted data, - while the second points at a string of only ASCII chars. */ -DECLARE_INLINE_HEADER ( -int -intbyte_strcmp (const Intbyte *bp, const char *ascii_string) -) -{ -#ifdef MULE - while (1) - { - int diff; - type_checking_assert (BYTE_ASCII_P (*ascii_string)); - if ((diff = charptr_emchar (bp) - *(Intbyte *) ascii_string) != 0) - return diff; - if (*ascii_string == '\0') - return 0; - ascii_string++; - INC_CHARPTR (bp); - } -#else - return strcmp ((char *)bp, ascii_string); -#endif -} - -/* Like memcmp, except first arg points at internally formatted data, - while the second points at a string of only ASCII chars. */ - -DECLARE_INLINE_HEADER ( -int -intbyte_memcmp (const Intbyte *bp, const char *ascii_string, Bytecount len) -) -{ -#ifdef MULE - while (len--) - { - int diff = charptr_emchar (bp) - *(Intbyte *) ascii_string; - type_checking_assert (BYTE_ASCII_P (*ascii_string)); - if (diff != 0) - return diff; - ascii_string++; - INC_CHARPTR (bp); - } - return 0; -#else - return memcmp (bp, ascii_string, len); -#endif -} #endif /* INCLUDED_text_h_ */ diff --text -u 'xemacs-21.5.6/src/toolbar-common.c' 'xemacs-21.5.7/src/toolbar-common.c' Index: ././src/toolbar-common.c --- ././src/toolbar-common.c Sun Mar 31 17:29:10 2002 +++ ././src/toolbar-common.c Fri Jun 21 06:18:48 2002 @@ -26,9 +26,9 @@ #include #include "lisp.h" -#include "device.h" +#include "device-impl.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "toolbar.h" #include "window.h" @@ -53,12 +53,12 @@ ** Use __INTERNAL_FLUSH to do this. It is passed a device. */ #if defined(HAVE_GTK) -#include "console-gtk.h" +#include "console-gtk-impl.h" #define __INTERNAL_MAPPED_P(f) GTK_WIDGET_REALIZED (FRAME_GTK_TEXT_WIDGET (f)) #define __INTERNAL_FLUSH(d) gdk_flush() #define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_GTK_P (f)) #elif defined(HAVE_X_WINDOWS) -#include "console-x.h" +#include "console-x-impl.h" #define __INTERNAL_MAPPED_P(f) XtIsRealized (FRAME_X_SHELL_WIDGET (f)) #define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_X_P (f)) #define __INTERNAL_FLUSH(d) XFlush (DEVICE_X_DISPLAY (d)) @@ -274,7 +274,7 @@ struct display_line dl; Lisp_Object string = IMAGE_INSTANCE_TEXT_STRING (p); unsigned char charsets[NUM_LEADING_BYTES]; - Emchar_dynarr *buf; + Ichar_dynarr *buf; struct font_metric_info fm; /* This could be true if we were called via the Expose event @@ -286,10 +286,10 @@ MARK_TOOLBAR_CHANGED; return; } - buf = Dynarr_new (Emchar); - convert_intbyte_string_into_emchar_dynarr + buf = Dynarr_new (Ichar); + convert_ibyte_string_into_ichar_dynarr (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); - find_charsets_in_emchar_string (charsets, Dynarr_atp (buf, 0), + find_charsets_in_ichar_string (charsets, Dynarr_atp (buf, 0), Dynarr_length (buf)); ensure_face_cachel_complete (cachel, window, charsets); face_cachel_charset_font_metric_info (cachel, charsets, &fm); diff --text -u 'xemacs-21.5.6/src/toolbar-gtk.c' 'xemacs-21.5.7/src/toolbar-gtk.c' Index: ././src/toolbar-gtk.c --- ././src/toolbar-gtk.c Mon Dec 24 05:28:22 2001 +++ ././src/toolbar-gtk.c Fri Jun 21 06:18:48 2002 @@ -25,9 +25,12 @@ #include #include "lisp.h" + #include "frame.h" + #include "toolbar-common.h" -#include "console-gtk.h" + +#include "console-gtk-impl.h" /* We should really create a 'common' console type and fill it with ** all the shared code. We would then just use diff --text -u 'xemacs-21.5.6/src/toolbar-msw.c' 'xemacs-21.5.7/src/toolbar-msw.c' Index: ././src/toolbar-msw.c --- ././src/toolbar-msw.c Sun Mar 31 17:29:11 2002 +++ ././src/toolbar-msw.c Fri Jun 21 06:18:48 2002 @@ -38,14 +38,14 @@ #include "device.h" #include "elhash.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "gui.h" #include "toolbar.h" #include "window.h" -#include "console-msw.h" +#include "console-msw-impl.h" #include "glyphs-msw.h" -#include "objects-msw.h" +// #include "objects-msw.h" #define TOOLBAR_ITEM_ID_MIN 0x4000 #define TOOLBAR_ITEM_ID_MAX 0x7FFF @@ -100,9 +100,9 @@ mswindows_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change) { - HIMAGELIST ilist=NULL; + HIMAGELIST ilist = NULL; int i; - HWND toolbarwnd = TOOLBAR_HANDLE(f, pos); + HWND toolbarwnd = TOOLBAR_HANDLE (f, pos); if (toolbarwnd) { TBBUTTON info; @@ -584,14 +584,6 @@ DELETE_TOOLBAR(LEFT_TOOLBAR); DELETE_TOOLBAR(RIGHT_TOOLBAR); #undef DELETE_TOOLBAR -} - -/* map toolbar hwnd to pos */ -static int -mswindows_find_toolbar_pos (struct frame *f, HWND ctrl) -{ - int id = GetDlgCtrlID (ctrl); - return id ? id - TOOLBAR_ID_BIAS : -1; } Lisp_Object diff --text -u 'xemacs-21.5.6/src/toolbar-x.c' 'xemacs-21.5.7/src/toolbar-x.c' Index: ././src/toolbar-x.c --- ././src/toolbar-x.c Tue Feb 5 00:44:52 2002 +++ ././src/toolbar-x.c Fri Jun 21 06:18:48 2002 @@ -28,18 +28,19 @@ #include #include "lisp.h" -#include "console-x.h" -#include "glyphs-x.h" -#include "objects-x.h" -#include "EmacsFrame.h" -#include "EmacsFrameP.h" - #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "toolbar.h" #include "window.h" #include "toolbar-common.h" + +#include "console-x-impl.h" +#include "glyphs-x.h" +#include "objects-x.h" + +#include "EmacsFrame.h" +#include "EmacsFrameP.h" /* We should really create a 'common' console type and fill it with ** all the shared code. We would then just use diff --text -u 'xemacs-21.5.6/src/toolbar.c' 'xemacs-21.5.7/src/toolbar.c' Index: ././src/toolbar.c --- ././src/toolbar.c Mon Apr 1 12:58:52 2002 +++ ././src/toolbar.c Fri Jun 21 06:18:48 2002 @@ -30,8 +30,8 @@ #include "lisp.h" #include "buffer.h" -#include "frame.h" -#include "device.h" +#include "frame-impl.h" +#include "device-impl.h" #include "glyphs.h" #include "redisplay.h" #include "toolbar.h" @@ -242,7 +242,7 @@ flags to be set; we delay frame size changes to avoid lots of frame flickering. */ /* #### I think this should be GC protected. -sb */ - hold_frame_size_changes (); + int depth = enter_redisplay_critical_section (); set_specifier_fallback (Vtoolbar[cur], list1 (Fcons (Qnil, Qnil))); set_specifier_fallback (Vtoolbar[new], Vdefault_toolbar); set_specifier_fallback (Vtoolbar_size[cur], list1 (Fcons (Qnil, Qzero))); @@ -259,7 +259,7 @@ set_specifier_fallback (Vtoolbar_visible_p[new], Vdefault_toolbar_visible_p); Vdefault_toolbar_position = position; - unhold_frame_size_changes (); + exit_redisplay_critical_section (depth); } return position; @@ -527,13 +527,14 @@ tb->enabled = !NILP (tb->enabled_p); else { + /* #### do we really need to protect this call? */ Lisp_Object result = - eval_in_buffer_trapping_errors + eval_in_buffer_trapping_problems ("Error in toolbar enabled-p form", XBUFFER (WINDOW_BUFFER (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)))), - tb->enabled_p); + tb->enabled_p, 0); if (UNBOUNDP (result)) /* #### if there was an error in the enabled-p form, should we pretend like it's enabled diff --text -u 'xemacs-21.5.6/src/tooltalk.c' 'xemacs-21.5.7/src/tooltalk.c' Index: ././src/tooltalk.c --- ././src/tooltalk.c Sun Mar 31 17:29:11 2002 +++ ././src/tooltalk.c Wed Jun 5 18:57:28 2002 @@ -1,6 +1,7 @@ /* Tooltalk support for Emacs. Copyright (C) 1993, 1994 Sun Microsystems, Inc. Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 2002 Ben Wing. This file is part of XEmacs. @@ -295,7 +296,7 @@ { if (tt_is_err (st)) { - CIntbyte *err; + CIbyte *err; EXTERNAL_TO_C_STRING (tt_status_message (st), err, Qnative); signal_error (Qtooltalk_error, err, Qunbound); @@ -345,7 +346,7 @@ fflush (tooltalk_log_file); #endif - VOID_TO_LISP (message_, tt_message_user (m, TOOLTALK_MESSAGE_KEY)); + message_ = VOID_TO_LISP (tt_message_user (m, TOOLTALK_MESSAGE_KEY)); pattern = make_tooltalk_pattern (p); cb = XTOOLTALK_MESSAGE (message_)->callback; GCPRO2 (message_, pattern); @@ -389,7 +390,7 @@ #endif message_ = make_tooltalk_message (m); - VOID_TO_LISP (pattern, tt_pattern_user (p, TOOLTALK_PATTERN_KEY)); + pattern = VOID_TO_LISP (tt_pattern_user (p, TOOLTALK_PATTERN_KEY)); cb = XTOOLTALK_PATTERN (pattern)->callback; GCPRO2 (message_, pattern); if (!NILP (Vtooltalk_pattern_handler_hook)) @@ -526,7 +527,7 @@ tt_message_arg_bval_vector (Tt_message m, int n) { /* !!#### This function has not been Mule-ized */ - Intbyte *value; + Ibyte *value; int len = 0; check_status (tt_message_arg_bval (m, n, &value, &len)); @@ -1257,7 +1258,7 @@ /* Don't ask the user for confirmation when exiting Emacs */ Fprocess_kill_without_query (lp, Qnil); fil = wrap_subr (&SFreceive_tooltalk_message); - set_process_filter (lp, fil, 1); + set_process_filter (lp, fil, 1, 0); } else { diff --text -u 'xemacs-21.5.6/src/ui-byhand.c' 'xemacs-21.5.7/src/ui-byhand.c' Index: ././src/ui-byhand.c --- ././src/ui-byhand.c Thu May 24 16:51:32 2001 +++ ././src/ui-byhand.c Thu May 23 20:46:35 2002 @@ -348,7 +348,7 @@ wtaerror ("Object is not a GtkCurve", curve); } - vector = (gfloat *) alloca (sizeof (gfloat) * XINT (length)); + vector = (gfloat *) ALLOCA (sizeof (gfloat) * XINT (length)); gtk_curve_get_vector (GTK_CURVE (XGTK_OBJECT (curve)->object), XINT (length), vector); lisp_vector = make_vector (XINT (length), Qnil); @@ -380,7 +380,7 @@ wtaerror ("Object is not a GtkCurve", curve); } - c_vector = (gfloat *) alloca (sizeof (gfloat) * vec_length); + c_vector = (gfloat *) ALLOCA (sizeof (gfloat) * vec_length); for (i = 0; i < vec_length; i++) { @@ -473,7 +473,7 @@ Lisp_Object callback; Lisp_Object lisp_user_data; - VOID_TO_LISP (callback, user_data); + callback = VOID_TO_LISP (user_data); lisp_user_data = XCAR (callback); callback = XCDR (callback); @@ -582,7 +582,7 @@ { Lisp_Object closure; - VOID_TO_LISP (closure, user_data); + closure = VOID_TO_LISP (user_data); call3 (XCAR (closure), build_gtk_object (GTK_OBJECT (ctree)), diff --text -u 'xemacs-21.5.6/src/ui-gtk.c' 'xemacs-21.5.7/src/ui-gtk.c' Index: ././src/ui-gtk.c --- ././src/ui-gtk.c Sun Mar 31 17:29:12 2002 +++ ././src/ui-gtk.c Wed Jun 5 18:57:29 2002 @@ -771,11 +771,11 @@ if (print_readably) printing_unreadable_object ("#", XGTK_OBJECT (obj)->object); - write_c_string ("#alive_p) - write_c_string (gtk_type_name (GTK_OBJECT_TYPE (XGTK_OBJECT (obj)->object)), printcharfun); + write_c_string (printcharfun, gtk_type_name (GTK_OBJECT_TYPE (XGTK_OBJECT (obj)->object))); else - write_c_string ("dead", printcharfun); + write_c_string (printcharfun, "dead"); write_fmt_string (printcharfun, ") %p>", (void *) XGTK_OBJECT (obj)->object); } @@ -984,7 +984,7 @@ { Lisp_Object lisp_data; - VOID_TO_LISP (lisp_data, data); + lisp_data = VOID_TO_LISP (data); ungcpro_popup_callbacks (XINT (XCAR (lisp_data))); } @@ -1000,7 +1000,7 @@ struct gcpro gcpro1; int i; - VOID_TO_LISP (callback_fn, data); + callback_fn = VOID_TO_LISP (data); /* Nuke the GUI_ID off the front */ callback_fn = XCDR (callback_fn); @@ -1079,8 +1079,8 @@ if (print_readably) printing_unreadable_object ("#", XGTK_BOXED (obj)->object); - write_c_string ("#object_type), printcharfun); + write_c_string (printcharfun, "#object_type)); write_fmt_string (printcharfun, ") %p>", (void *) XGTK_BOXED (obj)->object); } @@ -1479,7 +1479,7 @@ { Lisp_Object rval; - VOID_TO_LISP (rval, GTK_VALUE_POINTER (*arg)); + rval = VOID_TO_LISP (GTK_VALUE_POINTER (*arg)); return (rval); } else @@ -1494,7 +1494,7 @@ { Lisp_Object rval; - VOID_TO_LISP (rval, GTK_VALUE_CALLBACK (*arg).data); + rval = VOID_TO_LISP (GTK_VALUE_CALLBACK (*arg).data); return (rval); } @@ -1525,7 +1525,7 @@ return (0); case GTK_TYPE_CHAR: { - Emchar c; + Ichar c; CHECK_CHAR_COERCE_INT (obj); c = XCHAR (obj); @@ -1534,7 +1534,7 @@ break; case GTK_TYPE_UCHAR: { - Emchar c; + Ichar c; CHECK_CHAR_COERCE_INT (obj); c = XCHAR (obj); diff --text -u 'xemacs-21.5.6/src/undo.c' 'xemacs-21.5.7/src/undo.c' Index: ././src/undo.c --- ././src/undo.c Fri Mar 29 13:48:46 2002 +++ ././src/undo.c Tue May 28 17:45:05 2002 @@ -104,14 +104,6 @@ -static Lisp_Object -restore_inside_undo (Lisp_Object val) -{ - inside_undo = XINT (val); - return val; -} - - /* Record an insertion that just happened or is about to happen, for LENGTH characters at position BEG. (It is possible to record an insertion before or after the fact @@ -367,10 +359,7 @@ Lisp_Object next = Qnil; /* This function can GC */ int arg; - int speccount = specpdl_depth (); - - record_unwind_protect (restore_inside_undo, make_int (inside_undo)); - inside_undo = 1; + int speccount = internal_bind_int (&inside_undo, 1); #if 0 /* This is a good feature, but would make undo-start unable to do what is expected. */ diff --text -u 'xemacs-21.5.6/src/unexfreebsd.c' 'xemacs-21.5.7/src/unexfreebsd.c' Index: ././src/unexfreebsd.c --- ././src/unexfreebsd.c Fri Apr 13 03:24:27 2001 +++ ././src/unexfreebsd.c Tue May 28 17:45:05 2002 @@ -546,7 +546,7 @@ #if 0 /* never write protect the variable "environ", defined in /lib/crt0.o, and - set in process.c and callproc.c */ + set in process.c */ mprotect_bottom_addr = ((unsigned long) &environ) + sizeof (char **); /* never protect ABOVE the end of data emacs_edata specified */ mprotect_top_addr = MIN (emacs_edata, N_DATADDR (old_hdr) + old_hdr.a_data); diff --text -u 'xemacs-21.5.6/src/unexnt.c' 'xemacs-21.5.7/src/unexnt.c' Index: ././src/unexnt.c --- ././src/unexnt.c Wed Mar 13 17:53:02 2002 +++ ././src/unexnt.c Wed Jun 5 18:57:30 2002 @@ -22,6 +22,8 @@ /* Adapted for XEmacs by David Hobley */ +/* This file has been Mule-ized, Ben Wing, 4-13-02. */ + /* The linkers that come with MSVC >= 4.0 merge .bss into .data and reorder * uninitialised data so that the .data section looks like: * @@ -118,6 +120,8 @@ /* Cache system info, e.g., the NT page size. */ cache_system_info (); + /* Set OS type, so that tchar stuff below works */ + init_win32_very_early (); /* If we're a dumped version of emacs then we need to recreate our heap and play tricks with our .bss section. Do this before @@ -126,9 +130,11 @@ won't work.) */ if (heap_state == HEAP_UNLOADED) { - char executable_path[PATH_MAX]; + Extbyte executable_path[MAX_PATH * MAX_XETCHAR_SIZE]; - if (GetModuleFileName (NULL, executable_path, PATH_MAX) == 0) + /* Don't use mswindows_get_module_file_name() because it uses + xmalloc() */ + if (qxeGetModuleFileName (NULL, executable_path, MAX_PATH) == 0) { exit (1); } @@ -137,10 +143,12 @@ the renamed file still loads its heap from xemacs.exe --kkm */ #if 0 { + Extbyte *p; + /* To allow profiling, make sure executable_path names the .exe file, not the file created by the profiler */ - char *p = strrchr (executable_path, '\\'); - strcpy (p+1, PATH_PROGNAME ".exe"); + p = xetcsrchr (executable_path, '\\'); + xetcscpy (p + 1, XETEXT (PATH_PROGNAME ".exe")); } #endif @@ -168,29 +176,30 @@ /* Dump out .data and .bss sections into a new executable. */ int -unexec (char *new_name, char *old_name, unsigned int start_data, +unexec (Ibyte *new_name, Ibyte *old_name, unsigned int start_data, unsigned int start_bss, unsigned int entry_address) { file_data in_file, out_file; - char out_filename[PATH_MAX], in_filename[PATH_MAX]; + Ibyte *out_filename = alloca_ibytes (qxestrlen (new_name) + 10); + Ibyte *in_filename = alloca_ibytes (qxestrlen (old_name) + 10); unsigned long size; - char *ptr; + Ibyte *ptr; HINSTANCE hImagehelp; /* Make sure that the input and output filenames have the ".exe" extension...patch them up if they don't. */ - strcpy (in_filename, old_name); - ptr = in_filename + strlen (in_filename) - 4; - if (strcmp (ptr, ".exe")) - strcat (in_filename, ".exe"); - - strcpy (out_filename, new_name); - ptr = out_filename + strlen (out_filename) - 4; - if (strcmp (ptr, ".exe")) - strcat (out_filename, ".exe"); + qxestrcpy (in_filename, old_name); + ptr = in_filename + qxestrlen (in_filename) - 4; + if (qxestrcmp (ptr, ".exe")) + qxestrcat (in_filename, ".exe"); + + qxestrcpy (out_filename, new_name); + ptr = out_filename + qxestrlen (out_filename) - 4; + if (qxestrcmp (ptr, ".exe")) + qxestrcat (out_filename, ".exe"); - printf ("Dumping from %s\n", in_filename); - printf (" to %s\n", out_filename); + stdout_out ("Dumping from %s\n", in_filename); + stdout_out (" to %s\n", out_filename); /* We need to round off our heap to NT's allocation unit (64KB). */ round_heap (get_allocation_unit ()); @@ -198,8 +207,8 @@ /* Open the undumped executable file. */ if (!open_input_file (&in_file, in_filename)) { - printf ("Failed to open %s (%d)...bailing.\n", - in_filename, GetLastError ()); + stdout_out ("Failed to open %s (%d)...bailing.\n", + in_filename, GetLastError ()); exit (1); } @@ -209,12 +218,12 @@ /* The size of the dumped executable is the size of the original executable plus the size of the heap and the size of the .bss section. */ heap_index_in_executable = (unsigned long) - round_to_next ((unsigned char *) in_file.size, get_allocation_unit ()); + round_to_next ((UChar_Binary *) in_file.size, get_allocation_unit ()); size = heap_index_in_executable + get_committed_heap_size () + bss_size; if (!open_output_file (&out_file, out_filename, size)) { - printf ("Failed to open %s (%d)...bailing.\n", - out_filename, GetLastError ()); + stdout_out ("Failed to open %s (%d)...bailing.\n", + out_filename, GetLastError ()); exit (1); } @@ -225,7 +234,7 @@ dump_bss_and_heap (&in_file, &out_file); /* Patch up header fields; profiler is picky about this. */ - hImagehelp = LoadLibrary ("imagehlp.dll"); + hImagehelp = LoadLibraryA ("imagehlp.dll"); if (hImagehelp) { PIMAGE_DOS_HEADER dos_header; @@ -236,7 +245,8 @@ pfnCheckSumMappedFile_t pfnCheckSumMappedFile; dos_header = (PIMAGE_DOS_HEADER) out_file.file_base; - nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); + nt_header = (PIMAGE_NT_HEADERS) ((UChar_Binary *) dos_header + + dos_header->e_lfanew); nt_header->OptionalHeader.CheckSum = 0; #if 0 @@ -276,21 +286,21 @@ DWORD *p_bss_size) { int n, start, len; - char map_filename[PATH_MAX]; - char buffer[256]; + Ibyte *map_filename = alloca_ibytes (qxestrlen (p_infile->name) + 10); + Extbyte buffer[256]; FILE *map; /* Overwrite the .exe extension on the executable file name with the .map extension. */ - strcpy (map_filename, p_infile->name); - n = strlen (map_filename) - 3; - strcpy (&map_filename[n], "map"); + qxestrcpy (map_filename, p_infile->name); + n = qxestrlen (map_filename) - 3; + qxestrcpy (&map_filename[n], "map"); - map = fopen (map_filename, "r"); + map = qxe_fopen (map_filename, "r"); if (!map) { - printf ("Failed to open map file %s, error %d...bailing out.\n", - map_filename, GetLastError ()); + stdout_out ("Failed to open map file %s, error %d...bailing out.\n", + map_filename, GetLastError ()); exit (-1); } @@ -301,6 +311,7 @@ n = sscanf (buffer, " %*d:%x %x", &start, &len); if (n != 2) { + /* printf with external data, stdout_out with internal */ printf ("Failed to scan the .bss section line:\n%s", buffer); exit (-1); } @@ -318,29 +329,29 @@ PIMAGE_DOS_HEADER dos_header; PIMAGE_NT_HEADERS nt_header; PIMAGE_SECTION_HEADER section, data_section; - unsigned char *ptr; + UChar_Binary *ptr; int i; dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) { - printf ("Unknown EXE header in %s...bailing.\n", p_infile->name); + stdout_out ("Unknown EXE header in %s...bailing.\n", p_infile->name); exit (1); } nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + dos_header->e_lfanew); if (nt_header == NULL) { - printf ("Failed to find IMAGE_NT_HEADER in %s...bailing.\n", - p_infile->name); + stdout_out ("Failed to find IMAGE_NT_HEADER in %s...bailing.\n", + p_infile->name); exit (1); } /* Check the NT header signature ... */ if (nt_header->Signature != IMAGE_NT_SIGNATURE) { - printf ("Invalid IMAGE_NT_SIGNATURE 0x%x in %s...bailing.\n", - nt_header->Signature, p_infile->name); + stdout_out ("Invalid IMAGE_NT_SIGNATURE 0x%x in %s...bailing.\n", + nt_header->Signature, p_infile->name); } /* Flip through the sections for .data and .bss ... */ @@ -352,10 +363,10 @@ { extern int my_ebss; /* From lastfile.c */ - ptr = (char *) nt_header->OptionalHeader.ImageBase + + ptr = (UChar_Binary *) nt_header->OptionalHeader.ImageBase + section->VirtualAddress; bss_start = ptr; - bss_size = (char*)&my_ebss - (char*)bss_start; + bss_size = (UChar_Binary*) &my_ebss - (UChar_Binary*) bss_start; } if (!strcmp (section->Name, ".data")) @@ -363,11 +374,11 @@ if (!strcmp (section->Name, "xdata")) #endif { - extern char my_edata[]; /* From lastfile.c */ + extern Char_Binary my_edata[]; /* From lastfile.c */ /* The .data section. */ data_section = section; - ptr = (char *) nt_header->OptionalHeader.ImageBase + + ptr = (UChar_Binary *) nt_header->OptionalHeader.ImageBase + section->VirtualAddress; data_start_va = ptr; data_start_file = section->PointerToRawData; @@ -382,8 +393,8 @@ /* This code doesn't know how to grow the raw size of a section. */ if (section->SizeOfRawData < section->Misc.VirtualSize) { - printf ("The emacs data section is smaller than expected" - "...bailing.\n"); + stdout_out ("The emacs data section is smaller than expected" + "...bailing.\n"); exit (1); } #endif @@ -407,7 +418,7 @@ get_bss_info_from_map_file (p_infile, &ptr, &bss_size); bss_start = ptr + nt_header->OptionalHeader.ImageBase + data_section->VirtualAddress; - bss_size = (char*)&my_ebss - (char*)bss_start; + bss_size = (UChar_Binary *) &my_ebss - (UChar_Binary *) bss_start; } #else bss_size = 0; @@ -418,6 +429,7 @@ /* The dump routines. */ #ifdef DEBUG_XEMACS +/* printf with external data, stdout_out with internal */ #define DUMP_MSG(x) printf x #else #define DUMP_MSG(x) @@ -427,11 +439,11 @@ copy_executable_and_dump_data_section (file_data *p_infile, file_data *p_outfile) { - unsigned char *data_file, *data_va; + UChar_Binary *data_file, *data_va; unsigned long size, index; /* Get a pointer to where the raw data should go in the executable file. */ - data_file = (char *) p_outfile->file_base + data_start_file; + data_file = (UChar_Binary *) p_outfile->file_base + data_start_file; /* Get a pointer to the raw data in our address space. */ data_va = data_start_va; @@ -447,7 +459,8 @@ DUMP_MSG (("Dumping data section...\n")); DUMP_MSG (("\t0x%08x Address in process.\n", data_va)); DUMP_MSG (("\t0x%08x Offset in output file.\n", - (char*) data_file - (char *) p_outfile->file_base)); + (UChar_Binary *) data_file - + (UChar_Binary *) p_outfile->file_base)); DUMP_MSG (("\t0x%08x Size in bytes.\n", size)); memcpy (data_file, data_va, size); @@ -457,38 +470,38 @@ DUMP_MSG (("\t0x%08x Offset in input file.\n", index)); DUMP_MSG (("\t0x%08x Offset in output file.\n", index)); DUMP_MSG (("\t0x%08x Size in bytes.\n", size)); - memcpy ((char *) p_outfile->file_base + index, - (char *) p_infile->file_base + index, size); + memcpy ((UChar_Binary *) p_outfile->file_base + index, + (UChar_Binary *) p_infile->file_base + index, size); } static void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile) { - unsigned char *heap_data; - unsigned long size, index; + UChar_Binary *heap_data; + unsigned long size, index; - DUMP_MSG (("Dumping heap onto end of executable...\n")); + DUMP_MSG (("Dumping heap onto end of executable...\n")); - index = heap_index_in_executable; - size = get_committed_heap_size (); - heap_data = get_heap_start (); + index = heap_index_in_executable; + size = get_committed_heap_size (); + heap_data = get_heap_start (); - DUMP_MSG (("\t0x%08x Heap start in process.\n", heap_data)); - DUMP_MSG (("\t0x%08x Heap offset in executable.\n", index)); - DUMP_MSG (("\t0x%08x Heap size in bytes.\n", size)); + DUMP_MSG (("\t0x%08x Heap start in process.\n", heap_data)); + DUMP_MSG (("\t0x%08x Heap offset in executable.\n", index)); + DUMP_MSG (("\t0x%08x Heap size in bytes.\n", size)); - memcpy ((PUCHAR) p_outfile->file_base + index, heap_data, size); + memcpy ((PUCHAR) p_outfile->file_base + index, heap_data, size); #ifndef DUMP_SEPARATE_SECTION - DUMP_MSG (("Dumping bss onto end of executable...\n")); + DUMP_MSG (("Dumping bss onto end of executable...\n")); - index += size; - size = bss_size; + index += size; + size = bss_size; - DUMP_MSG (("\t0x%08x BSS start in process.\n", bss_start)); - DUMP_MSG (("\t0x%08x BSS offset in executable.\n", index)); - DUMP_MSG (("\t0x%08x BSS size in bytes.\n", size)); - memcpy ((char *) p_outfile->file_base + index, bss_start, size); + DUMP_MSG (("\t0x%08x BSS start in process.\n", bss_start)); + DUMP_MSG (("\t0x%08x BSS offset in executable.\n", index)); + DUMP_MSG (("\t0x%08x BSS size in bytes.\n", size)); + memcpy ((UChar_Binary *) p_outfile->file_base + index, bss_start, size); #endif } @@ -500,14 +513,14 @@ /* Load the dumped .bss section into the .bss area of our address space. */ /* Already done if the .bss was part of a separate emacs data section */ void -read_in_bss (char *filename) +read_in_bss (Extbyte *filename) { #ifndef DUMP_SEPARATE_SECTION HANDLE file; unsigned long index, n_read; - file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + file = qxeCreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (file == INVALID_HANDLE_VALUE) abort (); @@ -527,21 +540,21 @@ /* Map the heap dumped into the executable file into our address space. */ void -map_in_heap (char *filename) +map_in_heap (Extbyte *filename) { HANDLE file; HANDLE file_mapping; void *file_base; unsigned long size, upper_size, n_read; - file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + file = qxeCreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (file == INVALID_HANDLE_VALUE) abort (); size = GetFileSize (file, &upper_size); - file_mapping = CreateFileMapping (file, NULL, PAGE_WRITECOPY, - 0, size, NULL); + file_mapping = qxeCreateFileMapping (file, NULL, PAGE_WRITECOPY, + 0, size, NULL); if (!file_mapping) abort (); diff --text -u 'xemacs-21.5.6/src/unexsunos4.c' 'xemacs-21.5.7/src/unexsunos4.c' Index: ././src/unexsunos4.c --- ././src/unexsunos4.c Fri Apr 13 03:24:28 2001 +++ ././src/unexsunos4.c Tue May 28 17:45:05 2002 @@ -487,7 +487,7 @@ plt_end = (caddr_t) N_DATADDR (old_hdr); /* never write protect the variable "environ", defined in /lib/crt0.o, and - set in process.c and callproc.c */ + set in process.c */ mprotect_bottom_addr = ((unsigned long) &environ) + sizeof (char **); /* never protect ABOVE the end of data emacs_edata specified */ mprotect_top_addr = MIN (emacs_edata, N_DATADDR (old_hdr) + old_hdr.a_data); diff --text -u 'xemacs-21.5.6/src/unicode.c' 'xemacs-21.5.7/src/unicode.c' Index: ././src/unicode.c --- ././src/unicode.c Sun Mar 31 17:29:13 2002 +++ ././src/unicode.c Tue Jul 2 21:32:37 2002 @@ -27,10 +27,10 @@ Written by Ben Wing , June, 2001. Separated out into this file, August, 2001. Includes Unicode coding systems, some parts of which have been written - by someone else. + by someone else. #### Morioka and Hayashi, I think. As of September 2001, the detection code is here and abstraction of the - detection system is finished. the unicode detectors have been rewritten + detection system is finished. The unicode detectors have been rewritten to include multiple levels of likelihood. */ @@ -47,7 +47,15 @@ problem in that they can't handle two characters mapping to a single Unicode codepoint or vice-versa in a single charset table. It's not clear there is any way to handle this and still make the - sledgehammer routines useful. */ + sledgehammer routines useful. + + Inquiring Minds Want To Know Dept: does the above WARNING mean that + _if_ it happens, then it will signal error, or then it will do + something evil and unpredictable? Signaling an error is OK: for + all national standards, the national to Unicode map is an inclusion + (1-to-1). Any character set that does not behave that way is + broken according to the Unicode standard. */ + /* #define SLEDGEHAMMER_CHECK_UNICODE */ /* We currently use the following format for tables: @@ -61,7 +69,7 @@ -- If from_unicode_levels == 1, from_unicode_table is a 256-element array of shorts (octet 1 in high byte, octet 2 in low byte; we don't - store Emchars directly to save space). + store Ichars directly to save space). -- If from_unicode_levels == 2, from_unicode_table is a 256-element array of short * pointers, each of which points to a @@ -153,6 +161,8 @@ #ifdef MULE +/* #### Using ints for to_unicode is OK (as long as they are >= 32 bits). + However, shouldn't the shorts below be unsigned? */ static int *to_unicode_blank_1; static int **to_unicode_blank_2; @@ -302,6 +312,8 @@ from_unicode_blank_4 = xnew_array (short ***, 256); for (i = 0; i < 256; i++) { + /* #### IMWTK: Why does using -1 here work? Simply because there are + no existing 96x96 charsets? */ from_unicode_blank_1[i] = (short) -1; from_unicode_blank_2[i] = from_unicode_blank_1; from_unicode_blank_3[i] = from_unicode_blank_2; @@ -312,6 +324,7 @@ to_unicode_blank_2 = xnew_array (int *, 96); for (i = 0; i < 96; i++) { + /* Here -1 is guaranteed OK. */ to_unicode_blank_1[i] = -1; to_unicode_blank_2[i] = to_unicode_blank_1; } @@ -354,6 +367,8 @@ } } +/* Allocate and blank the tables. + Loading them up is done by parse-unicode-translation-table. */ void init_charset_unicode_tables (Lisp_Object charset) { @@ -586,8 +601,8 @@ Lisp_Object char_charset; int c1, c2; - assert (valid_char_p (tab[i])); - BREAKUP_CHAR (tab[i], char_charset, c1, c2); + assert (valid_ichar_p (tab[i])); + BREAKUP_ICHAR (tab[i], char_charset, c1, c2); assert (EQ (charset, char_charset)); if (XCHARSET_DIMENSION (charset) == 1) { @@ -669,15 +684,15 @@ if (tab[i] != -1) { int u4, u3, u2, u1, levels; - Emchar ch; - Emchar this_ch; + Ichar ch; + Ichar this_ch; short val; void *frtab = XCHARSET_FROM_UNICODE_TABLE (charset); if (XCHARSET_DIMENSION (charset) == 1) - this_ch = MAKE_CHAR (charset, i + 32, 0); + this_ch = make_ichar (charset, i + 32, 0); else - this_ch = MAKE_CHAR (charset, codetop + 32, i + 32); + this_ch = make_ichar (charset, codetop + 32, i + 32); assert (tab[i] >= 0); BREAKUP_UNICODE_CODE (tab[i], u4, u3, u2, u1, levels); @@ -692,7 +707,7 @@ default: abort (); } - ch = MAKE_CHAR (charset, val >> 8, val & 0xFF); + ch = make_ichar (charset, val >> 8, val & 0xFF); assert (ch == this_ch); switch (XCHARSET_FROM_UNICODE_LEVELS (charset)) @@ -776,15 +791,21 @@ #endif /* SLEDGEHAMMER_CHECK_UNICODE */ static void -set_unicode_conversion (Emchar chr, int code) +set_unicode_conversion (Ichar chr, int code) { Lisp_Object charset; int c1, c2; - BREAKUP_CHAR (chr, charset, c1, c2); + BREAKUP_ICHAR (chr, charset, c1, c2); - assert (!EQ (charset, Vcharset_ascii)); - assert (!EQ (charset, Vcharset_control_1)); + /* I tried an assert on code > 255 || chr == code, but that fails because + Mule gives many Latin characters separate code points for different + ISO 8859 coded character sets. Obvious in hindsight.... */ + assert (!EQ (charset, Vcharset_ascii) || chr == code); + assert (!EQ (charset, Vcharset_latin_iso8859_1) || chr == code); + assert (!EQ (charset, Vcharset_control_1) || chr == code); + + /* This assert is needed because it is simply unimplemented. */ assert (!EQ (charset, Vcharset_composite)); #ifdef SLEDGEHAMMER_CHECK_UNICODE @@ -913,16 +934,17 @@ } int -char_to_unicode (Emchar chr) +ichar_to_unicode (Ichar chr) { Lisp_Object charset; int c1, c2; - type_checking_assert (valid_char_p (chr)); + type_checking_assert (valid_ichar_p (chr)); + /* This shortcut depends on the representation of an Ichar, see text.c. */ if (chr < 256) return (int) chr; - BREAKUP_CHAR (chr, charset, c1, c2); + BREAKUP_ICHAR (chr, charset, c1, c2); if (EQ (charset, Vcharset_composite)) return -1; /* #### don't know how to handle */ else if (XCHARSET_DIMENSION (charset) == 1) @@ -931,8 +953,8 @@ return ((int **) XCHARSET_TO_UNICODE_TABLE (charset))[c1 - 32][c2 - 32]; } -static Emchar -unicode_to_char (int code, Lisp_Object_dynarr *charsets) +static Ichar +unicode_to_ichar (int code, Lisp_Object_dynarr *charsets) { int u1, u2, u3, u4; int code_levels; @@ -940,8 +962,12 @@ int n = Dynarr_length (charsets); type_checking_assert (code >= 0); - if (code < 256) - return (Emchar) code; + /* This shortcut depends on the representation of an Ichar, see text.c. + Note that it may _not_ be extended to U+00A0 to U+00FF (many ISO 8859 + coded character sets have points that map into that region, so this + function is many-valued). */ + if (code < 0xA0) + return (Ichar) code; BREAKUP_UNICODE_CODE (code, u4, u3, u2, u1, code_levels); @@ -964,13 +990,17 @@ } if (retval != -1) - return MAKE_CHAR (charset, retval >> 8, retval & 0xFF); + return make_ichar (charset, retval >> 8, retval & 0xFF); } } - return (Emchar) -1; + return (Ichar) -1; } +/* Add charsets to precedence list. + LIST must be a list of charsets. Charsets which are in the list more + than once are given the precedence implied by their earliest appearance. + Later appearances are ignored. */ static void add_charsets_to_precedence_list (Lisp_Object list, int *lbs, Lisp_Object_dynarr *dynarr) @@ -982,13 +1012,18 @@ int lb = XCHARSET_LEADING_BYTE (charset); if (lbs[lb - MIN_LEADING_BYTE] == 0) { - Dynarr_add (unicode_precedence_dynarr, charset); + Dynarr_add (dynarr, charset); lbs[lb - MIN_LEADING_BYTE] = 1; } } } } +/* Rebuild the charset precedence array. + The "charsets preferred for the current language" get highest precedence, + followed by the "charsets preferred by default", ordered as in + Vlanguage_unicode_precedence_list and Vdefault_unicode_precedence_list, + respectively. All remaining charsets follow in an arbitrary order. */ void recalculate_unicode_precedence (void) { @@ -1009,26 +1044,57 @@ { if (lbs[i] == 0) { - Lisp_Object charset = CHARSET_BY_LEADING_BYTE (i + MIN_LEADING_BYTE); + Lisp_Object charset = charset_by_leading_byte (i + MIN_LEADING_BYTE); if (!NILP (charset)) Dynarr_add (unicode_precedence_dynarr, charset); } } } -DEFUN ("set-language-unicode-precedence-list", - Fset_language_unicode_precedence_list, - 1, 1, 0, /* -Set the language-specific precedence list used for Unicode decoding. -This is a list of charsets, which are consulted in order for a translation -matching a given Unicode character. If no matches are found, the charsets -in the default precedence list (see `set-default-unicode-precedence-list') -are consulted, and then all remaining charsets, in some arbitrary order. +DEFUN ("unicode-precedence-list", + Funicode_precedence_list, + 0, 0, 0, /* +Return the precedence order among charsets used for Unicode decoding. + +Value is a list of charsets, which are searched in order for a translation +matching a given Unicode character. + +The highest precedence is given to the language-specific precedence list of +charsets, defined by `set-language-unicode-precedence-list'. These are +followed by charsets in the default precedence list, defined by +`set-default-unicode-precedence-list'. Charsets occurring multiple times are +given precedence according to their first occurrance in either list. These +are followed by the remaining charsets, in some arbitrary order. The language-specific precedence list is meant to be set as part of the language environment initialization; the default precedence list is meant to be set by the user. */ + ()) +{ + int i; + Lisp_Object list = Qnil; + + for (i = Dynarr_length (unicode_precedence_dynarr) - 1; i >= 0; i--) + list = Fcons (Dynarr_at (unicode_precedence_dynarr, i), list); + return list; +} + + +/* #### This interface is wrong. Cyrillic users and Chinese users are going + to have varying opinions about whether ISO Cyrillic, KOI8-R, or Windows + 1251 should take precedence, and whether Big Five or CNS should take + precedence, respectively. This means that users are sometimes going to + want to set Vlanguage_unicode_precedence_list. + Furthermore, this should be language-local (buffer-local would be a + reasonable approximation). */ +DEFUN ("set-language-unicode-precedence-list", + Fset_language_unicode_precedence_list, + 1, 1, 0, /* +Set the language-specific precedence of charsets in Unicode decoding. +LIST is a list of charsets. +See `unicode-precedence-list' for more information. +*/ (list)) { { @@ -1045,7 +1111,7 @@ Flanguage_unicode_precedence_list, 0, 0, 0, /* Return the language-specific precedence list used for Unicode decoding. -See `set-language-unicode-precedence-list' for more information. +See `unicode-precedence-list' for more information. */ ()) { @@ -1056,8 +1122,8 @@ Fset_default_unicode_precedence_list, 1, 1, 0, /* Set the default precedence list used for Unicode decoding. -This is meant to be set by the user. See -`set-language-unicode-precedence-list' for more information. +This is intended to be set by the user. See +`unicode-precedence-list' for more information. */ (list)) { @@ -1075,7 +1141,7 @@ Fdefault_unicode_precedence_list, 0, 0, 0, /* Return the default precedence list used for Unicode decoding. -See `set-language-unicode-precedence-list' for more information. +See `unicode-precedence-list' for more information. */ ()) { @@ -1085,29 +1151,48 @@ DEFUN ("set-unicode-conversion", Fset_unicode_conversion, 2, 2, 0, /* Add conversion information between Unicode codepoints and characters. +Conversions for U+0000 to U+00FF are hardwired to ASCII, Control-1, and +Latin-1. Attempts to set these values will raise an error. + CHARACTER is one of the following: -- A character (in which case CODE must be a non-negative integer; values above 2^20 - 1 are allowed for the purpose of specifying private - characters, but will cause errors when converted to utf-16) + characters, but are illegal in standard Unicode---they will cause errors + when converted to utf-16) -- A vector of characters (in which case CODE must be a vector of integers of the same length) */ (character, code)) { Lisp_Object charset; + int ichar, unicode; CHECK_CHAR (character); CHECK_NATNUM (code); - charset = CHAR_CHARSET (XCHAR (character)); - if (EQ (charset, Vcharset_ascii) || - EQ (charset, Vcharset_control_1) || - EQ (charset, Vcharset_composite)) - signal_error (Qinvalid_argument, "Cannot set Unicode translation for ASCII, Control-1 or Composite chars", + unicode = XINT (code); + ichar = XCHAR (character); + charset = ichar_charset (ichar); + + /* The translations of ASCII, Control-1, and Latin-1 code points are + hard-coded in ichar_to_unicode and unicode_to_ichar. + + Checking unicode < 256 && ichar != unicode is wrong because Mule gives + many Latin characters code points in a few different character sets. */ + if ((EQ (charset, Vcharset_ascii) || + EQ (charset, Vcharset_control_1) || + EQ (charset, Vcharset_latin_iso8859_1)) + && unicode != ichar) + signal_error (Qinvalid_argument, "Can't change Unicode translation for ASCII, Control-1 or Latin-1 character", character); - set_unicode_conversion (XCHAR (character), XINT (code)); + /* #### Composite characters are not properly implemented yet. */ + if (EQ (charset, Vcharset_composite)) + signal_error (Qinvalid_argument, "Can't set Unicode translation for Composite char", + character); + + set_unicode_conversion (ichar, unicode); return Qnil; } @@ -1115,14 +1200,14 @@ DEFUN ("char-to-unicode", Fchar_to_unicode, 1, 1, 0, /* Convert character to Unicode codepoint. -When there is no international support (i.e. MULE is not defined), -this function simply does `char-to-int'. +When there is no international support (i.e. the 'mule feature is not +present), this function simply does `char-to-int'. */ (character)) { CHECK_CHAR (character); #ifdef MULE - return make_int (char_to_unicode (XCHAR (character))); + return make_int (ichar_to_unicode (XCHAR (character))); #else return Fchar_to_int (character); #endif /* MULE */ @@ -1136,9 +1221,9 @@ Otherwise, the default ordering of all charsets will be given (see `set-unicode-charset-precedence'). -When there is no international support (i.e. MULE is not defined), -this function simply does `int-to-char' and ignores the CHARSETS -argument.. +When there is no international support (i.e. the 'mule feature is not +present), this function simply does `int-to-char' and ignores the CHARSETS +argument. */ (code, charsets)) { @@ -1156,7 +1241,7 @@ if (NILP (charsets)) { - Emchar ret = unicode_to_char (c, unicode_precedence_dynarr); + Ichar ret = unicode_to_ichar (c, unicode_precedence_dynarr); if (ret == -1) return Qnil; return make_char (ret); @@ -1166,7 +1251,7 @@ memset (lbs, 0, NUM_LEADING_BYTES * sizeof (int)); add_charsets_to_precedence_list (charsets, lbs, dyn); { - Emchar ret = unicode_to_char (c, unicode_precedence_dynarr); + Ichar ret = unicode_to_ichar (c, dyn); Dynarr_free (dyn); if (ret == -1) return Qnil; @@ -1178,6 +1263,8 @@ #endif /* MULE */ } +#ifdef MULE + static Lisp_Object cerrar_el_fulano (Lisp_Object fulano) { @@ -1186,38 +1273,37 @@ return Qnil; } -#ifdef MULE - +/* #### shouldn't this interface be called load-unicode-mapping-table + for consistency with Unicode Consortium terminology? */ DEFUN ("parse-unicode-translation-table", Fparse_unicode_translation_table, 2, 6, 0, /* -Parse Unicode translation data in FILENAME for CHARSET. +Load Unicode tables with the Unicode mapping data in FILENAME for CHARSET. Data is text, in the form of one translation per line -- charset codepoint followed by Unicode codepoint. Numbers are decimal or hex \(preceded by 0x). Comments are marked with a #. Charset codepoints -for two-dimensional charsets should have the first octet stored in the +for two-dimensional charsets have the first octet stored in the high 8 bits of the hex number and the second in the low 8 bits. If START and END are given, only charset codepoints within the given -range will be processed. If OFFSET is given, that value will be added -to all charset codepoints in the file to obtain the internal charset -codepoint. START and END apply to the codepoints in the file, before -OFFSET is applied. - -\(Note that, as usual, we assume that octets are in the range 32 to -127 or 33 to 126. If you have a table in kuten form, with octets in -the range 1 to 94, you will have to use an offset of 5140, -i.e. 0x2020.) +range will be processed. (START and END apply to the codepoints in the +file, before OFFSET is applied.) + +If OFFSET is given, that value will be added to all charset codepoints +in the file to obtain the internal charset codepoint. \(We assume +that octets in the table are in the range 33 to 126 or 32 to 127. If +you have a table in ku-ten form, with octets in the range 1 to 94, you +will have to use an offset of 5140, i.e. 0x2020.) FLAGS, if specified, control further how the tables are interpreted -and are used to special-case certain known table weirdnesses in the -Unicode tables: +and are used to special-case certain known format deviations in the +Unicode tables or in the charset: `ignore-first-column' - Exactly as it sounds. The JIS X 0208 tables have 3 columns of data instead - of 2; the first is the Shift-JIS codepoint. + The JIS X 0208 tables have 3 columns of data instead of 2. The first + column contains the Shift-JIS codepoint, which we ignore. `big5' - The charset codepoint is a Big Five codepoint; convert it to the - proper hacked-up codepoint in `chinese-big5-1' or `chinese-big5-2'. + The charset codepoints are Big Five codepoints; convert it to the + hacked-up Mule codepoint in `chinese-big5-1' or `chinese-big5-2'. */ (filename, charset, start, end, offset, flags)) { @@ -1259,7 +1345,7 @@ big5 = 1; else invalid_constant - ("Unrecognized `parse-unicode-table' flag", elt); + ("Unrecognized `parse-unicode-translation-table' flag", elt); } } @@ -1323,7 +1409,7 @@ if (big5) { - Emchar ch = decode_big5_char (cp1high, cp1low); + Ichar ch = decode_big5_char (cp1high, cp1low); if (ch == -1) warn_when_safe (Qunicode, Qwarning, @@ -1336,7 +1422,7 @@ else { int l1, h1, l2, h2; - Emchar emch; + Ichar emch; switch (XCHARSET_TYPE (charset)) { @@ -1352,8 +1438,8 @@ if (cp1high < l2 || cp1high > h2 || cp1low < l1 || cp1low > h1) goto out_of_range; - emch = (cp1high == 0 ? MAKE_CHAR (charset, cp1low, 0) : - MAKE_CHAR (charset, cp1high, cp1low)); + emch = (cp1high == 0 ? make_ichar (charset, cp1low, 0) : + make_ichar (charset, cp1high, cp1low)); set_unicode_conversion (emch, cp2); } } @@ -1434,14 +1520,14 @@ else { #ifdef MULE - Emchar chr = unicode_to_char (ch, unicode_precedence_dynarr); + Ichar chr = unicode_to_ichar (ch, unicode_precedence_dynarr); if (chr != -1) { - Intbyte work[MAX_EMCHAR_LEN]; + Ibyte work[MAX_ICHAR_LEN]; int len; - len = set_charptr_emchar (work, chr); + len = set_itext_ichar (work, chr); Dynarr_add_many (dst, work, len); } else @@ -1451,7 +1537,7 @@ Dynarr_add (dst, 46 + 128); } #else - Dynarr_add (dst, (Intbyte) ch); + Dynarr_add (dst, (Ibyte) ch); #endif /* MULE */ } @@ -1548,7 +1634,7 @@ int little_endian) { #ifdef MULE - int code = char_to_unicode (MAKE_CHAR (charset, h & 127, l & 127)); + int code = ichar_to_unicode (make_ichar (charset, h & 127, l & 127)); if (code == -1) { @@ -1697,7 +1783,7 @@ /* flags for handling composite chars. We do a little switcheroo on the source while we're outputting the composite char. */ Bytecount saved_n = 0; - const Intbyte *saved_src = NULL; + const Ibyte *saved_src = NULL; int in_composite = 0; back_to_square_n: @@ -1711,10 +1797,10 @@ while (n--) { - Intbyte c = *src++; + Ibyte c = *src++; #ifdef MULE - if (BYTE_ASCII_P (c)) + if (byte_ascii_p (c)) #endif /* MULE */ { /* Processing ASCII character */ ch = 0; @@ -1724,11 +1810,11 @@ char_boundary = 1; } #ifdef MULE - else if (INTBYTE_LEADING_BYTE_P (c) || INTBYTE_LEADING_BYTE_P (ch)) + else if (ibyte_leading_byte_p (c) || ibyte_leading_byte_p (ch)) { /* Processing Leading Byte */ ch = 0; - charset = CHARSET_BY_LEADING_BYTE (c); - if (LEADING_BYTE_PREFIX_P(c)) + charset = charset_by_leading_byte (c); + if (leading_byte_prefix_p(c)) ch = c; char_boundary = 0; } @@ -1768,7 +1854,7 @@ } else { - Emchar emch = MAKE_CHAR (Vcharset_composite, + Ichar emch = make_ichar (Vcharset_composite, ch & 0x7F, c & 0x7F); Lisp_Object lstr = @@ -2114,10 +2200,10 @@ { write_fmt_string_lisp (printcharfun, "(%s", 1, unicode_getprop (cs, Qtype)); if (XCODING_SYSTEM_UNICODE_LITTLE_ENDIAN (cs)) - write_c_string (", little-endian", printcharfun); + write_c_string (printcharfun, ", little-endian"); if (XCODING_SYSTEM_UNICODE_NEED_BOM (cs)) - write_c_string (", need-bom", printcharfun); - write_c_string (")", printcharfun); + write_c_string (printcharfun, ", need-bom"); + write_c_string (printcharfun, ")"); } int @@ -2143,6 +2229,7 @@ syms_of_unicode (void) { #ifdef MULE + DEFSUBR (Funicode_precedence_list); DEFSUBR (Fset_language_unicode_precedence_list); DEFSUBR (Flanguage_unicode_precedence_list); DEFSUBR (Fset_default_unicode_precedence_list); diff --text -u 'xemacs-21.5.6/src/win32.c' 'xemacs-21.5.7/src/win32.c' Index: ././src/win32.c --- ././src/win32.c Wed Mar 13 17:53:03 2002 +++ ././src/win32.c Wed Jun 5 18:57:32 2002 @@ -47,13 +47,13 @@ #### This comes from code that just prepended `file:', which is not good. See comment in mswindows_dde_callback(), case XTYP_EXECUTE. */ -Intbyte * -urlify_filename (Intbyte *filename) +Ibyte * +urlify_filename (Ibyte *filename) { - Intbyte *pseudo_url; + Ibyte *pseudo_url; WIN32_TO_LOCAL_FILE_FORMAT (filename, filename); - pseudo_url = xnew_array (Intbyte, 5 + qxestrlen (filename) + 1); + pseudo_url = xnew_array (Ibyte, 5 + qxestrlen (filename) + 1); qxestrcpy_c (pseudo_url, "file:"); qxestrcat (pseudo_url, filename); /* URL's only have /, no backslash */ @@ -66,12 +66,15 @@ return pseudo_url; } +/* Convert a Win32 file name in tstr format into a local-format file name + in internal format. */ + Lisp_Object -tstr_to_local_file_format (Extbyte *pathout) +tstr_to_local_file_format (Extbyte *path) { - Intbyte *ttlff; + Ibyte *ttlff; - TSTR_TO_C_STRING (pathout, ttlff); + TSTR_TO_C_STRING (path, ttlff); WIN32_TO_LOCAL_FILE_FORMAT (ttlff, ttlff); return build_intstring (ttlff); @@ -82,10 +85,10 @@ components to lower case. Return a newly malloc()ed string. */ -Intbyte * -mswindows_canonicalize_filename (Intbyte *name) +Ibyte * +mswindows_canonicalize_filename (Ibyte *name) { - Intbyte *fp = name; + Ibyte *fp = name; DECLARE_EISTRING (newname); DECLARE_EISTRING (component); int do_casefrob = 1; @@ -104,7 +107,7 @@ while (1) { - Emchar ch = charptr_emchar (fp); + Ichar ch = itext_ichar (fp); if (LOWERCASEP (0, ch)) do_casefrob = 0; /* don't convert this element */ @@ -125,12 +128,33 @@ else eicat_ch (component, ch); - INC_CHARPTR (fp); + INC_IBYTEPTR (fp); } return eicpyout_malloc (newname, 0); } +Extbyte * +mswindows_get_module_file_name (void) +{ + Extbyte *path = NULL; + int bufsize = 4096; + int cchpathsize; + + while (1) + { + path = (Extbyte *) xrealloc (path, bufsize * XETCHAR_SIZE); + cchpathsize = qxeGetModuleFileName (NULL, path, bufsize); + if (!cchpathsize) + return 0; + if (cchpathsize + 1 <= bufsize) + break; + bufsize *= 2; + } + + return path; +} + static void init_potentially_nonexistent_functions (void) { @@ -158,7 +182,7 @@ { LPTSTR lpMsgBuf; Lisp_Object result; - Intbyte *inres; + Ibyte *inres; Bytecount len; int i; @@ -232,7 +256,7 @@ TSTR_TO_C_STRING (lpMsgBuf, inres); len = qxestrlen (inres); /* Messages tend to end with a period and newline */ - if (len >= 3 && !intbyte_strcmp (inres + len - 3, ".\r\n")) + if (len >= 3 && !qxestrcmp_c (inres + len - 3, ".\r\n")) len -= 3; result = make_string (inres, len); @@ -308,28 +332,8 @@ LISP_STRING_TO_TSTR (parameters, parmext); if (STRINGP (current_dir)) LOCAL_FILE_FORMAT_TO_TSTR (current_dir, path); - if (STRINGP (document)) - { -#ifdef CYGWIN - Intbyte *docint = XSTRING_DATA (document); - /* If URL style file, the innards may have Cygwin mount points and - the like. so separate out the innards, process them, and put back - together. */ - if (qxestrncasecmp_c (docint, "file://", 7) == 0) - { - Intbyte *fname_windows; - Intbyte *docint_windows; - - LOCAL_TO_WIN32_FILE_FORMAT (docint + 7, fname_windows); - docint_windows = alloca_intbytes (7 + qxestrlen (fname_windows) + 1); - qxestrcpy_c (docint_windows, "file://"); - qxestrcat (docint_windows, fname_windows); - C_STRING_TO_TSTR (docint, doc); - } - else -#endif - LOCAL_FILE_FORMAT_TO_TSTR (document, doc); - } + if (STRINGP (document)) + LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR (document, doc); ret = (int) qxeShellExecute (NULL, opext, doc, parmext, path, (INTP (show_flag) ? @@ -371,7 +375,7 @@ */ (path)) { - Intbyte *p; + Ibyte *p; CHECK_STRING (path); /* There appears to be a bug in the cygwin conversion routines in @@ -547,12 +551,12 @@ /* Divide time in ms specified by IT by DENOM. Return 1 ms if division results in zero */ static UINT -setitimer_helper_period (const struct itimerval* it, UINT denom) +setitimer_helper_period (const struct itimerval *it, UINT denom) { static TIMECAPS time_caps; UINT res; - const struct timeval* tv = + const struct timeval *tv = (it->it_value.tv_sec == 0 && it->it_value.tv_usec == 0) ? &it->it_interval : &it->it_value; @@ -574,9 +578,9 @@ } static int -setitimer_helper (const struct itimerval* itnew, - struct itimerval* itold, struct itimerval* itcurrent, - MMRESULT* tid, DWORD sigkind) +setitimer_helper (const struct itimerval *itnew, + struct itimerval *itold, struct itimerval *itcurrent, + MMRESULT *tid, DWORD sigkind) { UINT delay, resolution, event_type; diff --text -u /dev/null 'xemacs-21.5.7/src/window-impl.h' Index: ././src/window-impl.h --- ././src/window-impl.h Thu Jan 1 09:00:00 1970 +++ ././src/window-impl.h Fri Jun 21 06:18:49 2002 @@ -0,0 +1,287 @@ +/* Window definitions for XEmacs. + Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995 + Free Software Foundation, Inc. + Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. + Copyright (C) 1995, 1996, 2002 Ben Wing. + Copyright (C) 1996 Chuck Thompson. + +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 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. */ + +/* Synched up with: FSF 19.30. */ + +#ifndef INCLUDED_window_impl_h_ +#define INCLUDED_window_impl_h_ + +#include "window.h" + +/* All windows in use are arranged into a tree, with pointers up and down. + +Windows that are leaves of the tree are actually displayed +and show the contents of buffers. Windows that are not leaves +are used for representing the way groups of leaf windows are +arranged on the frame. Leaf windows never become non-leaves. +They are deleted only by calling delete-window on them (but +this can be done implicitly). Combination windows can be created +and deleted at any time. + +A leaf window has a non-nil buffer field, and also + has markers in its start and pointm fields. Non-leaf windows + have nil in these fields. + +Non-leaf windows are either vertical or horizontal combinations. + +A vertical combination window has children that are arranged on the frame +one above the next. Its vchild field points to the uppermost child. +The parent field of each of the children points to the vertical +combination window. The next field of each child points to the +child below it, or is nil for the lowest child. The prev field +of each child points to the child above it, or is nil for the +highest child. + +A horizontal combination window has children that are side by side. +Its hchild field points to the leftmost child. In each child +the next field points to the child to the right and the prev field +points to the child to the left. + +The children of a vertical combination window may be leaf windows +or horizontal combination windows. The children of a horizontal +combination window may be leaf windows or vertical combination windows. + +At the top of the tree are two windows which have nil as parent. +The second of these is minibuf_window. The first one manages all +the frame area that is not minibuffer, and is called the root window. +Different windows can be the root at different times; +initially the root window is a leaf window, but if more windows +are created then that leaf window ceases to be root and a newly +made combination window becomes root instead. + +In any case, on screens which have an ordinary window and a +minibuffer, prev of the minibuf window is the root window and next of +the root window is the minibuf window. On minibufferless screens or +minibuffer-only screens, the root window and the minibuffer window are +one and the same, so its prev and next members are nil. + +A dead window has the `dead' flag set on it. Note that unlike other +dead objects, dead windows can be made live again through restoring a +window configuration. This means that the values in a dead window +need to be preserved, except for those that are reconstructed by from +the window configuration. */ + +struct window +{ + struct lcrecord_header header; + + /* The upper left corner coordinates of this window, + as integers (pixels) relative to upper left corner of frame = 0, 0 */ + int pixel_left; + int pixel_top; + /* The size of the window (in pixels) */ + int pixel_height; + int pixel_width; + + /* Number of columns display within the window is scrolled to the left. */ + int hscroll; + /* Idem for the window's modeline */ + Charcount modeline_hscroll; + /* Amount to clip off the top line for pixel-based scrolling. Point + will remain constant but this will be incremented to + incrementally shift lines up. */ + int top_yoffset; + /* Amount to clip off the left of the lines for pixel-based + scrolling. Hscroll will remain constant but this will be + incremented to incrementally shift lines left.*/ + int left_xoffset; + + /* face cache elements correct for this window and its current buffer */ + face_cachel_dynarr *face_cachels; + /* glyph cache elements correct for this window and its current buffer */ + glyph_cachel_dynarr *glyph_cachels; + /* List of starting positions for display lines. Only valid if + buffer has not changed. */ + line_start_cache_dynarr *line_start_cache; + int line_cache_validation_override; + + /* Length of longest line currently displayed. Used to control the + width of the horizontal scrollbars. */ + int max_line_len; + + /* Frame coords of point at that time */ + int last_point_x[3]; + int last_point_y[3]; + + /* Number of characters in buffer past bottom of window, + as of last redisplay that finished. */ + /* need one for each set of display structures */ + int window_end_pos[3]; + + /* Set by the extent code when extents in the gutter are changed. */ + int gutter_extent_modiff[4]; + + /* Set by redisplay to the last position seen. This is used + to implement the redisplay-end-trigger-functions. */ + Charbpos last_redisplay_pos; + +#define WINDOW_SLOT_DECLARATION +#define WINDOW_SLOT(slot) Lisp_Object slot; +#include "winslots.h" + + /* one-bit flags: */ + + /* marker used when restoring a window configuration */ + unsigned int config_mark :1; + /* Non-zero means window was dead. */ + unsigned int dead :1; + /* Non-zero means next redisplay must use the value of start + set up for it in advance. Set by scrolling commands. */ + unsigned int force_start :1; + /* Non-zero means must regenerate modeline of this window */ + unsigned int redo_modeline :1; + /* Non-zero means current value of `start' + was the beginning of a line when it was chosen. */ + unsigned int start_at_line_beg :1; + /* new redisplay flag */ + unsigned int windows_changed :1; + unsigned int shadow_thickness_changed :1; + /* Vertical divider flag and validity of it */ + unsigned int need_vertical_divider_p :1; + unsigned int need_vertical_divider_valid_p :1; +}; + +#define CURRENT_DISP 0 +#define DESIRED_DISP 1 +#define CMOTION_DISP 2 + +struct window_mirror +{ + struct lcrecord_header header; + + /* Frame this mirror is on. */ + struct frame *frame; + + /* Following child (to right or down) at same level of tree */ + struct window_mirror *next; + + /* There is no prev field because we never traverse this structure + backwards. Same goes for the parent field. */ + + /* First child of this window. */ + /* vchild is used if this is a vertical combination, + hchild if this is a horizontal combination. */ + struct window_mirror *hchild, *vchild; + + /* Dynamic array of display lines */ + display_line_dynarr *current_display_lines; + display_line_dynarr *desired_display_lines; + + /* Buffer current_display_lines represent. */ + struct buffer *buffer; + +#ifdef HAVE_SCROLLBARS + /* Scrollbars associated with window, if any. */ + struct scrollbar_instance *scrollbar_vertical_instance; + struct scrollbar_instance *scrollbar_horizontal_instance; +#endif /* HAVE_SCROLLBARS */ + + /* Flag indicating whether a subwindow is currently being displayed. */ + unsigned int subwindows_being_displayed :1; + + /* Keep track of the truncation status in this window so we can + detect when it has changed. #### Magic variables would be a huge + win here. */ + unsigned int truncate_win :1; +}; + +/* Redefine basic properties more efficiently */ + +#undef WINDOW_LIVE_P +#define WINDOW_LIVE_P(x) (!(x)->dead) +#undef WINDOW_FRAME +#define WINDOW_FRAME(w) ((w)->frame) +#undef WINDOW_BUFFER +#define WINDOW_BUFFER(w) ((w)->buffer) + +/* 1 if W is a minibuffer window. */ +#define MINI_WINDOW_P(W) (!NILP ((W)->mini_p)) + +/* 1 if we are dealing with a parentless window (this includes the + root window on a frame and the minibuffer window; both of these + are siblings). */ +#define TOP_LEVEL_WINDOW_P(w) NILP ((w)->parent) + +/* Set all redisplay flags indicating a window has changed */ +#define MARK_WINDOWS_CHANGED(w) do { \ + (w)->windows_changed = 1; \ + if (!NILP (w->frame)) \ + { \ + struct frame *mwc_frame = XFRAME (w->frame); \ + MARK_FRAME_WINDOWS_CHANGED (mwc_frame); \ + } \ + else \ + windows_changed = 1; \ +} while (0) + +/* #### This should be fixed not to call MARK_FRAME_CHANGED because + faces are cached per window. Also, other code which changes window's + face should use this macro. +*/ +#define MARK_WINDOW_FACES_CHANGED(w) \ + MARK_FRAME_FACES_CHANGED (XFRAME ((w)->frame)) + +#define WINDOW_TTY_P(w) FRAME_TTY_P (XFRAME ((w)->frame)) +#define WINDOW_X_P(w) FRAME_X_P (XFRAME ((w)->frame)) +#define WINDOW_NS_P(w) FRAME_NS_P (XFRAME ((w)->frame)) +#define WINDOW_WIN_P(w) FRAME_WIN_P (XFRAME ((w)->frame)) + +/* XEmacs window size and positioning macros. */ +#define WINDOW_TOP(w) ((w)->pixel_top) +#define WINDOW_TEXT_TOP(w) (WINDOW_TOP (w) + window_top_gutter_height (w)) +#define WINDOW_TEXT_TOP_CLIP(w) ((w)->top_yoffset) +#define WINDOW_BOTTOM(w) ((w)->pixel_top + (w)->pixel_height) +#define WINDOW_TEXT_BOTTOM(w) (WINDOW_BOTTOM (w) - window_bottom_gutter_height (w)) +#define WINDOW_LEFT(w) ((w)->pixel_left) +#define WINDOW_TEXT_LEFT(w) (WINDOW_LEFT (w) + window_left_gutter_width (w, 0)) +#define WINDOW_MODELINE_LEFT(w) \ + (WINDOW_LEFT (w) + window_left_gutter_width (w, 1)) +#define WINDOW_RIGHT(w) ((w)->pixel_left + (w)->pixel_width) +#define WINDOW_TEXT_RIGHT(w) \ + (WINDOW_RIGHT (w) - window_right_gutter_width (w, 0)) +#define WINDOW_MODELINE_RIGHT(w) \ + (WINDOW_RIGHT (w) - window_right_gutter_width (w, 1)) + +#define WINDOW_HEIGHT(w) ((w)->pixel_height) +#define WINDOW_TEXT_HEIGHT(w) (WINDOW_TEXT_BOTTOM (w) - WINDOW_TEXT_TOP (w)) +#define WINDOW_WIDTH(w) ((w)->pixel_width) +#define WINDOW_TEXT_WIDTH(w) (WINDOW_TEXT_RIGHT (w) - WINDOW_TEXT_LEFT (w)) + +#define WINDOW_HAS_MODELINE_P(w) (!NILP (w->has_modeline_p)) + +#define MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED(win) \ + abs ((!WINDOW_HAS_MODELINE_P (win) \ + ? ((XINT (win->modeline_shadow_thickness) > 1) \ + ? XINT (win->modeline_shadow_thickness) - 1 \ + : ((XINT (win->modeline_shadow_thickness) < -1) \ + ? XINT (win->modeline_shadow_thickness) + 1 \ + : XINT (win->modeline_shadow_thickness))) \ + : XINT (win->modeline_shadow_thickness))) + +#define MODELINE_SHADOW_THICKNESS(win) \ + (MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win) > 10 \ + ? 10 \ + : MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win)) + +#endif /* INCLUDED_window_impl_h_ */ diff --text -u 'xemacs-21.5.6/src/window.c' 'xemacs-21.5.7/src/window.c' Index: ././src/window.c --- ././src/window.c Sun Mar 31 17:29:13 2002 +++ ././src/window.c Fri Jun 21 06:18:49 2002 @@ -24,6 +24,16 @@ /* Synched up with: FSF 19.30. */ /* Beginning to diverge significantly. */ +/* Authorship: + + Based on code from pre-release FSF 19, c. 1991. + Significantly reworked by Chuck Thompson, 1993-1996. + window mirror stuff added by Chuck Thompson c. 1993. + various cleanup by Ben Wing c. 1995 (window slots, window init code, + memory usage, synch. up to FSF 19.30, other). + Unknown work by Andy Piper. + new window-width/height fns. by Ben Wing, Mar 2000. */ + /* This file has been Mule-ized. */ #include @@ -31,15 +41,15 @@ #include "buffer.h" #include "commands.h" -#include "device.h" +#include "device-impl.h" #include "elhash.h" #include "faces.h" -#include "frame.h" +#include "frame-impl.h" #include "glyphs.h" #include "gutter.h" #include "objects.h" #include "redisplay.h" -#include "window.h" +#include "window-impl.h" Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configurationp; Lisp_Object Qdisplay_buffer; @@ -168,7 +178,7 @@ if (print_readably) printing_unreadable_object ("#", XWINDOW (obj)->header.uid); - write_c_string ("#buffer)) { Lisp_Object name = XBUFFER (XWINDOW (obj)->buffer)->name; @@ -212,6 +222,15 @@ } } +/* These caches map buffers to markers. They are key-weak so that entries + remain around as long as the buffers do. */ + +static Lisp_Object +make_saved_buffer_point_cache (void) +{ + return make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); +} + DEFINE_LRECORD_IMPLEMENTATION ("window", window, mark_window, print_window, finalize_window, 0, 0, 0, struct window); @@ -248,6 +267,8 @@ INIT_DISP_VARIABLE (start, Fmake_marker ()); INIT_DISP_VARIABLE (pointm, Fmake_marker ()); p->sb_point = Fmake_marker (); + p->saved_point_cache = make_saved_buffer_point_cache (); + p->saved_last_window_start_cache = make_saved_buffer_point_cache (); p->use_time = Qzero; INIT_DISP_VARIABLE (last_modified, Qzero); INIT_DISP_VARIABLE (last_point, Fmake_marker ()); @@ -1332,6 +1353,24 @@ return XWINDOW (window); } +int +window_live_p (struct window *w) +{ + return WINDOW_LIVE_P (w); +} + +Lisp_Object +window_frame (struct window *w) +{ + return WINDOW_FRAME (w); +} + +Lisp_Object +window_buffer (struct window *w) +{ + return WINDOW_BUFFER (w); +} + DEFUN ("window-buffer", Fwindow_buffer, 0, 1, 0, /* Return the buffer that WINDOW is displaying. */ @@ -1601,7 +1640,7 @@ #if 0 /* bogus FSF crock */ -xxDEFUN ("window-redisplay-end-trigger", +DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, 0, 1, 0, /* Return WINDOW's redisplay end trigger value. See `set-window-redisplay-end-trigger' for more information. @@ -1611,7 +1650,7 @@ return decode_window (window)->redisplay_end_trigger; } -xxDEFUN ("set-window-redisplay-end-trigger", +DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, 2, 2, 0, /* Set WINDOW's redisplay end trigger value to VALUE. VALUE should be a buffer position (typically a marker) or nil. @@ -1757,14 +1796,20 @@ DEFUN ("set-window-point", Fset_window_point, 2, 2, 0, /* Make point value in WINDOW be at position POS in WINDOW's buffer. +If WINDOW is the selected window, this actually changes the buffer's point +instead of the window's point. (The equivalence of the selected window's +point with its buffer's point is maintained throughout XEmacs.) */ (window, pos)) { struct window *w = decode_window (window); CHECK_INT_COERCE_MARKER (pos); - if (w == XWINDOW (Fselected_window (Qnil))) - Fgoto_char (pos, Qnil); + /* Don't dereference selected-window because there may not + be one -- e.g. at startup */ + if (EQ (wrap_window (w), Fselected_window (Qnil))) + /* Even though window selected, buffer may not be current */ + Fgoto_char (pos, w->buffer); else set_marker_restricted (w->pointm[CURRENT_DISP], pos, w->buffer); @@ -1834,8 +1879,9 @@ unshow_buffer (struct window *w) { Lisp_Object buf = w->buffer; + struct buffer *b = XBUFFER (buf); - if (XBUFFER (buf) != XMARKER (w->pointm[CURRENT_DISP])->buffer) + if (b != XMARKER (w->pointm[CURRENT_DISP])->buffer) abort (); /* FSF disables this check, so I'll do it too. I hope it won't @@ -1860,12 +1906,34 @@ is actually stored in that buffer, and the window's pointm isn't used. So don't clobber point in that buffer. */ if (! EQ (buf, XWINDOW (Fselected_window (Qnil))->buffer)) - { - struct buffer *b= XBUFFER (buf); - BUF_SET_PT (b, charbpos_clip_to_bounds (BUF_BEGV (b), - marker_position (w->pointm[CURRENT_DISP]), - BUF_ZV (b))); - } + BUF_SET_PT (b, + charbpos_clip_to_bounds + (BUF_BEGV (b), + marker_position (w->pointm[CURRENT_DISP]), + BUF_ZV (b))); + + { + Lisp_Object marker = Fgethash (buf, w->saved_point_cache, Qnil); + int selected = EQ (wrap_window (w), Fselected_window (Qnil)); + + if (NILP (marker)) + { + marker = Fmake_marker (); + Fputhash (buf, marker, w->saved_point_cache); + } + Fset_marker (marker, + selected ? make_int (BUF_PT (b)) : w->pointm[CURRENT_DISP], + buf); + + marker = Fgethash (buf, w->saved_last_window_start_cache, Qnil); + + if (NILP (marker)) + { + marker = Fmake_marker (); + Fputhash (buf, marker, w->saved_last_window_start_cache); + } + Fset_marker (marker, w->start[CURRENT_DISP], buf); + } } /* Put REPLACEMENT into the window structure in place of OLD. */ @@ -1987,6 +2055,7 @@ w->subwindow_instance_cache = Qnil; w->dead = 1; + note_object_deleted (wrap_window (w)); } DEFUN ("delete-window", Fdelete_window, 0, 2, "", /* @@ -2023,6 +2092,8 @@ if (! WINDOW_LIVE_P (w)) return Qnil; + check_allowed_operation (OPERATION_DELETE_OBJECT, window, Qnil); + frame = WINDOW_FRAME (w); f = XFRAME (frame); d = XDEVICE (FRAME_DEVICE (f)); @@ -3490,17 +3561,44 @@ w->window_end_pos[CURRENT_DISP] = 0; w->hscroll = 0; w->modeline_hscroll = 0; +#if 0 /* pre point caches */ Fset_marker (w->pointm[CURRENT_DISP], make_int (BUF_PT (XBUFFER (buffer))), buffer); set_marker_restricted (w->start[CURRENT_DISP], make_int (XBUFFER (buffer)->last_window_start), buffer); +#else + { + Lisp_Object marker = Fgethash (buffer, w->saved_point_cache, Qnil); + Lisp_Object newpoint = + !NILP (marker) ? make_int (marker_position (marker)) : + make_int (BUF_PT (XBUFFER (buffer))); + /* Previously, we had in here set-window-point, which did one of the + following two, but not both. However, that could result in pointm + being in a different buffer from the window's buffer! Probably + not a travesty since it always occurred when the window was + selected, meaning its value of point was ignored in favor of the + buffer's; but it tripped an assert() in unshow_buffer(). */ + set_marker_restricted (w->pointm[CURRENT_DISP], newpoint, buffer); + if (EQ (wrap_window (w), Fselected_window (Qnil))) + Fgoto_char (newpoint, buffer); /* this will automatically clip to + accessible */ + marker = Fgethash (buffer, w->saved_last_window_start_cache, Qnil); + set_marker_restricted (w->start[CURRENT_DISP], + !NILP (marker) ? + make_int (marker_position (marker)) : + make_int (XBUFFER (buffer)->last_window_start), + buffer); + } +#endif + Fset_marker (w->sb_point, w->start[CURRENT_DISP], buffer); /* set start_at_line_beg correctly. GE */ - w->start_at_line_beg = beginning_of_line_p (XBUFFER (buffer), - marker_position (w->start[CURRENT_DISP])); - w->force_start = 0; /* Lucid fix */ + w->start_at_line_beg = + beginning_of_line_p (XBUFFER (buffer), + marker_position (w->start[CURRENT_DISP])); + w->force_start = 0; /* XEmacs fix */ SET_LAST_MODIFIED (w, 1); SET_LAST_FACECHANGE (w); MARK_WINDOWS_CHANGED (w); @@ -3687,6 +3785,8 @@ p->pointm[DESIRED_DISP] = Qnil; p->pointm[CMOTION_DISP] = Qnil; p->sb_point = Qnil; + p->saved_point_cache = make_saved_buffer_point_cache (); + p->saved_last_window_start_cache = make_saved_buffer_point_cache (); p->buffer = Qnil; } @@ -3829,6 +3929,9 @@ } XFRAME (p->frame)->mirror_dirty = 1; + + note_object_created (new); + /* do this last (after the window is completely initialized and the mirror-dirty flag is set) so that specifier recomputation caused as a result of this will work properly and not abort. */ @@ -4429,14 +4532,7 @@ MARK_WINDOWS_CHANGED (w); if (!point_would_be_visible (w, startp, XINT (point))) - { - if (selected) - BUF_SET_PT (b, startp); - else - set_marker_restricted (w->pointm[CURRENT_DISP], - make_int (startp), - w->buffer); - } + Fset_window_point (wrap_window (w), make_int (startp)); } } } @@ -4512,12 +4608,7 @@ else new_point = start_of_last_line (w, startp); - if (selected) - BUF_SET_PT (b, new_point); - else - set_marker_restricted (w->pointm[CURRENT_DISP], - make_int (new_point), - w->buffer); + Fset_window_point (wrap_window (w), make_int (new_point)); } } } @@ -4557,12 +4648,7 @@ { Charbpos new_point = start_of_last_line (w, startp); - if (selected) - BUF_SET_PT (b, new_point); - else - set_marker_restricted (w->pointm[CURRENT_DISP], - make_int (new_point), - w->buffer); + Fset_window_point (wrap_window (w), make_int (new_point)); } } } @@ -4775,6 +4861,9 @@ { new_point = point_at_center (w, CURRENT_DISP, 0, 0); + /* #### Here we are checking the selected window of the frame + instead of the selected window period. Elsewhere we check + the selected window of the device. What a mess! */ if (selected) BUF_SET_PT (b, new_point); else @@ -5158,7 +5247,7 @@ if (print_readably) printing_unreadable_object ("#", config->header.uid); - write_c_string ("#", config->header.uid); } @@ -5491,6 +5580,8 @@ w->gutter_extent_modiff[3] = 0; w->dead = 0; + note_object_created (p->window); + if (p->parent_index >= 0) w->parent = SAVED_WINDOW_N (config, p->parent_index)->window; else @@ -6049,20 +6140,20 @@ { dl = Dynarr_atp (dla, i); /* find the vertical location first */ - if (point >= dl->charbpos && point <= dl->end_charbpos) + if (point >= dl->charpos && point <= dl->end_charpos) { db = get_display_block_from_line (dl, TEXT); for (i = 0; i < Dynarr_length (db->runes); i++) { rb = Dynarr_atp (db->runes, i); - if (point <= rb->charbpos) - goto found_charbpos; + if (point <= rb->charpos) + goto found_charpos; } return Qnil; } } return Qnil; - found_charbpos: + found_charpos: ; } else diff --text -u 'xemacs-21.5.6/src/window.h' 'xemacs-21.5.7/src/window.h' Index: ././src/window.h --- ././src/window.h Fri Mar 29 13:48:50 2002 +++ ././src/window.h Fri Jun 21 06:18:49 2002 @@ -2,7 +2,7 @@ Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996 Ben Wing. + Copyright (C) 1995, 1996, 2002 Ben Wing. Copyright (C) 1996 Chuck Thompson. This file is part of XEmacs. @@ -32,138 +32,7 @@ #include "scrollbar.h" #endif -/* All windows in use are arranged into a tree, with pointers up and down. - -Windows that are leaves of the tree are actually displayed -and show the contents of buffers. Windows that are not leaves -are used for representing the way groups of leaf windows are -arranged on the frame. Leaf windows never become non-leaves. -They are deleted only by calling delete-window on them (but -this can be done implicitly). Combination windows can be created -and deleted at any time. - -A leaf window has a non-nil buffer field, and also - has markers in its start and pointm fields. Non-leaf windows - have nil in these fields. - -Non-leaf windows are either vertical or horizontal combinations. - -A vertical combination window has children that are arranged on the frame -one above the next. Its vchild field points to the uppermost child. -The parent field of each of the children points to the vertical -combination window. The next field of each child points to the -child below it, or is nil for the lowest child. The prev field -of each child points to the child above it, or is nil for the -highest child. - -A horizontal combination window has children that are side by side. -Its hchild field points to the leftmost child. In each child -the next field points to the child to the right and the prev field -points to the child to the left. - -The children of a vertical combination window may be leaf windows -or horizontal combination windows. The children of a horizontal -combination window may be leaf windows or vertical combination windows. - -At the top of the tree are two windows which have nil as parent. -The second of these is minibuf_window. The first one manages all -the frame area that is not minibuffer, and is called the root window. -Different windows can be the root at different times; -initially the root window is a leaf window, but if more windows -are created then that leaf window ceases to be root and a newly -made combination window becomes root instead. - -In any case, on screens which have an ordinary window and a -minibuffer, prev of the minibuf window is the root window and next of -the root window is the minibuf window. On minibufferless screens or -minibuffer-only screens, the root window and the minibuffer window are -one and the same, so its prev and next members are nil. - -A dead window has the `dead' flag set on it. Note that unlike other -dead objects, dead windows can be made live again through restoring a -window configuration. This means that the values in a dead window -need to be preserved, except for those that are reconstructed by from -the window configuration. */ - -struct window -{ - struct lcrecord_header header; - - /* The upper left corner coordinates of this window, - as integers (pixels) relative to upper left corner of frame = 0, 0 */ - int pixel_left; - int pixel_top; - /* The size of the window (in pixels) */ - int pixel_height; - int pixel_width; - - /* Number of columns display within the window is scrolled to the left. */ - int hscroll; - /* Idem for the window's modeline */ - Charcount modeline_hscroll; - /* Amount to clip off the top line for pixel-based scrolling. Point - will remain constant but this will be incremented to - incrementally shift lines up. */ - int top_yoffset; - /* Amount to clip off the left of the lines for pixel-based - scrolling. Hscroll will remain constant but this will be - incremented to incrementally shift lines left.*/ - int left_xoffset; - - /* face cache elements correct for this window and its current buffer */ - face_cachel_dynarr *face_cachels; - /* glyph cache elements correct for this window and its current buffer */ - glyph_cachel_dynarr *glyph_cachels; - /* List of starting positions for display lines. Only valid if - buffer has not changed. */ - line_start_cache_dynarr *line_start_cache; - int line_cache_validation_override; - - /* Length of longest line currently displayed. Used to control the - width of the horizontal scrollbars. */ - int max_line_len; - - /* Frame coords of point at that time */ - int last_point_x[3]; - int last_point_y[3]; - - /* Number of characters in buffer past bottom of window, - as of last redisplay that finished. */ - /* need one for each set of display structures */ - int window_end_pos[3]; - - /* Set by the extent code when extents in the gutter are changed. */ - int gutter_extent_modiff[4]; - - /* Set by redisplay to the last position seen. This is used - to implement the redisplay-end-trigger-functions. */ - Charbpos last_redisplay_pos; - -#define WINDOW_SLOT_DECLARATION -#define WINDOW_SLOT(slot) Lisp_Object slot; -#include "winslots.h" - - /* one-bit flags: */ - - /* marker used when restoring a window configuration */ - unsigned int config_mark :1; - /* Non-zero means window was dead. */ - unsigned int dead :1; - /* Non-zero means next redisplay must use the value of start - set up for it in advance. Set by scrolling commands. */ - unsigned int force_start :1; - /* Non-zero means must regenerate modeline of this window */ - unsigned int redo_modeline :1; - /* Non-zero means current value of `start' - was the beginning of a line when it was chosen. */ - unsigned int start_at_line_beg :1; - /* new redisplay flag */ - unsigned int windows_changed :1; - unsigned int shadow_thickness_changed :1; - /* Vertical divider flag and validity of it */ - unsigned int need_vertical_divider_p :1; - unsigned int need_vertical_divider_valid_p :1; -}; +struct window; DECLARE_LRECORD (window, struct window); #define XWINDOW(x) XRECORD (x, window, struct window) @@ -172,58 +41,33 @@ #define CHECK_WINDOW(x) CHECK_RECORD (x, window) #define CONCHECK_WINDOW(x) CONCHECK_RECORD (x, window) -#define CURRENT_DISP 0 -#define DESIRED_DISP 1 -#define CMOTION_DISP 2 - -struct window_mirror -{ - struct lcrecord_header header; - - /* Frame this mirror is on. */ - struct frame *frame; - - /* Following child (to right or down) at same level of tree */ - struct window_mirror *next; - - /* There is no prev field because we never traverse this structure - backwards. Same goes for the parent field. */ - - /* First child of this window. */ - /* vchild is used if this is a vertical combination, - hchild if this is a horizontal combination. */ - struct window_mirror *hchild, *vchild; - - /* Dynamic array of display lines */ - display_line_dynarr *current_display_lines; - display_line_dynarr *desired_display_lines; +/* Basic properties available to non-privileged users; redefined in + window-impl.h */ - /* Buffer current_display_lines represent. */ - struct buffer *buffer; +int window_live_p (struct window *w); +Lisp_Object window_frame (struct window *w); +Lisp_Object window_buffer (struct window *w); + +#define WINDOW_LIVE_P(w) window_live_p (w) +#define WINDOW_FRAME(w) window_frame (w) +#define WINDOW_BUFFER(w) window_buffer (w) -#ifdef HAVE_SCROLLBARS - /* Scrollbars associated with window, if any. */ - struct scrollbar_instance *scrollbar_vertical_instance; - struct scrollbar_instance *scrollbar_horizontal_instance; -#endif /* HAVE_SCROLLBARS */ - - /* Flag indicating whether a subwindow is currently being displayed. */ - unsigned int subwindows_being_displayed :1; - - /* Keep track of the truncation status in this window so we can - detect when it has changed. #### Magic variables would be a huge - win here. */ - unsigned int truncate_win :1; -}; +#define WINDOW_XFRAME(w) XFRAME (WINDOW_FRAME (w)) +#define WINDOW_DEVICE(w) XFRAME_DEVICE (WINDOW_FRAME (w)) +#define WINDOW_XDEVICE(w) XDEVICE (WINDOW_DEVICE (w)) +#define WINDOW_CONSOLE(w) XDEVICE_CONSOLE (WINDOW_DEVICE (w)) +#define WINDOW_XCONSOLE(w) XCONSOLE (WINDOW_CONSOLE (w)) +#define WINDOW_XBUFFER(w) XBUFFER (WINDOW_BUFFER (w)) -DECLARE_LRECORD (window_mirror, struct window_mirror); -#define XWINDOW_MIRROR(x) XRECORD (x, window_mirror, struct window_mirror) -#define wrap_window_mirror(p) wrap_record (p, window_mirror) -#define WINDOW_MIRRORP(x) RECORDP (x, window_mirror) -#define CHECK_WINDOW_MIRROR(x) CHECK_RECORD (x, window_mirror) -#define CONCHECK_WINDOW_MIRROR(x) CONCHECK_RECORD (x, window_mirror) +#define XWINDOW_FRAME(w) WINDOW_FRAME (XWINDOW (w)) +#define XWINDOW_XFRAME(w) XFRAME (XWINDOW_FRAME (w)) +#define XWINDOW_DEVICE(w) XFRAME_DEVICE (XWINDOW_FRAME (w)) +#define XWINDOW_XDEVICE(w) XDEVICE (XWINDOW_DEVICE (w)) +#define XWINDOW_CONSOLE(w) XDEVICE_CONSOLE (XWINDOW_DEVICE (w)) +#define XWINDOW_XCONSOLE(w) XCONSOLE (XWINDOW_CONSOLE (w)) +#define XWINDOW_BUFFER(w) WINDOW_BUFFER (XWINDOW (w)) +#define XWINDOW_XBUFFER(w) XBUFFER (XWINDOW_BUFFER (w)) -#define WINDOW_LIVE_P(x) (!(x)->dead) #define CHECK_LIVE_WINDOW(x) do { \ CHECK_WINDOW (x); \ if (!WINDOW_LIVE_P (XWINDOW (x))) \ @@ -235,37 +79,14 @@ x = wrong_type_argument (Qwindow_live_p, (x)); \ } while (0) -/* 1 if W is a minibuffer window. */ -#define MINI_WINDOW_P(W) (!NILP ((W)->mini_p)) - -/* 1 if we are dealing with a parentless window (this includes the - root window on a frame and the minibuffer window; both of these - are siblings). */ -#define TOP_LEVEL_WINDOW_P(w) NILP ((w)->parent) - -/* Set all redisplay flags indicating a window has changed */ -#define MARK_WINDOWS_CHANGED(w) do { \ - (w)->windows_changed = 1; \ - if (!NILP (w->frame)) \ - { \ - struct frame *mwc_frame = XFRAME (w->frame); \ - MARK_FRAME_WINDOWS_CHANGED (mwc_frame); \ - } \ - else \ - windows_changed = 1; \ -} while (0) +struct window_mirror; -/* #### This should be fixed not to call MARK_FRAME_CHANGED because - faces are cached per window. Also, other code which changes window's - face should use this macro. -*/ -#define MARK_WINDOW_FACES_CHANGED(w) \ - MARK_FRAME_FACES_CHANGED (XFRAME ((w)->frame)) - -#define WINDOW_TTY_P(w) FRAME_TTY_P (XFRAME ((w)->frame)) -#define WINDOW_X_P(w) FRAME_X_P (XFRAME ((w)->frame)) -#define WINDOW_NS_P(w) FRAME_NS_P (XFRAME ((w)->frame)) -#define WINDOW_WIN_P(w) FRAME_WIN_P (XFRAME ((w)->frame)) +DECLARE_LRECORD (window_mirror, struct window_mirror); +#define XWINDOW_MIRROR(x) XRECORD (x, window_mirror, struct window_mirror) +#define wrap_window_mirror(p) wrap_record (p, window_mirror) +#define WINDOW_MIRRORP(x) RECORDP (x, window_mirror) +#define CHECK_WINDOW_MIRROR(x) CHECK_RECORD (x, window_mirror) +#define CONCHECK_WINDOW_MIRROR(x) CONCHECK_RECORD (x, window_mirror) DECLARE_LRECORD (window_configuration, struct window_config); @@ -283,6 +104,10 @@ EXFUN (Fwindow_highest_p, 1); EXFUN (Fwindow_point, 1); EXFUN (Fwindow_start, 1); +EXFUN (Fcurrent_window_configuration, 1); + +Lisp_Object save_window_excursion_unwind (Lisp_Object); +Lisp_Object display_buffer (Lisp_Object, Lisp_Object, Lisp_Object); /* The minibuffer window of the selected frame. Note that you cannot test for minibufferness of an arbitrary window @@ -346,51 +171,5 @@ int invalidate_vertical_divider_cache_in_window (struct window *w, void *u_n_u_s_e_d); int window_divider_width (struct window *w); - -#define WINDOW_FRAME(w) ((w)->frame) -#define WINDOW_XFRAME(w) XFRAME (WINDOW_FRAME (w)) -#define WINDOW_BUFFER(w) ((w)->buffer) -#define WINDOW_XBUFFER(w) XBUFFER (WINDOW_BUFFER (w)) -#define WINDOW_DEVICE(w) FRAME_DEVICE (XFRAME (WINDOW_FRAME (w))) -#define WINDOW_XDEVICE(w) XDEVICE (WINDOW_DEVICE (w)) -#define WINDOW_CONSOLE(w) DEVICE_CONSOLE (XDEVICE (WINDOW_DEVICE (w))) -#define WINDOW_XCONSOLE(w) XCONSOLE (WINDOW_CONSOLE (w)) - -/* XEmacs window size and positioning macros. */ -#define WINDOW_TOP(w) ((w)->pixel_top) -#define WINDOW_TEXT_TOP(w) (WINDOW_TOP (w) + window_top_gutter_height (w)) -#define WINDOW_TEXT_TOP_CLIP(w) ((w)->top_yoffset) -#define WINDOW_BOTTOM(w) ((w)->pixel_top + (w)->pixel_height) -#define WINDOW_TEXT_BOTTOM(w) (WINDOW_BOTTOM (w) - window_bottom_gutter_height (w)) -#define WINDOW_LEFT(w) ((w)->pixel_left) -#define WINDOW_TEXT_LEFT(w) (WINDOW_LEFT (w) + window_left_gutter_width (w, 0)) -#define WINDOW_MODELINE_LEFT(w) \ - (WINDOW_LEFT (w) + window_left_gutter_width (w, 1)) -#define WINDOW_RIGHT(w) ((w)->pixel_left + (w)->pixel_width) -#define WINDOW_TEXT_RIGHT(w) \ - (WINDOW_RIGHT (w) - window_right_gutter_width (w, 0)) -#define WINDOW_MODELINE_RIGHT(w) \ - (WINDOW_RIGHT (w) - window_right_gutter_width (w, 1)) - -#define WINDOW_HEIGHT(w) ((w)->pixel_height) -#define WINDOW_TEXT_HEIGHT(w) (WINDOW_TEXT_BOTTOM (w) - WINDOW_TEXT_TOP (w)) -#define WINDOW_WIDTH(w) ((w)->pixel_width) -#define WINDOW_TEXT_WIDTH(w) (WINDOW_TEXT_RIGHT (w) - WINDOW_TEXT_LEFT (w)) - -#define WINDOW_HAS_MODELINE_P(w) (!NILP (w->has_modeline_p)) - -#define MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED(win) \ - abs ((!WINDOW_HAS_MODELINE_P (win) \ - ? ((XINT (win->modeline_shadow_thickness) > 1) \ - ? XINT (win->modeline_shadow_thickness) - 1 \ - : ((XINT (win->modeline_shadow_thickness) < -1) \ - ? XINT (win->modeline_shadow_thickness) + 1 \ - : XINT (win->modeline_shadow_thickness))) \ - : XINT (win->modeline_shadow_thickness))) - -#define MODELINE_SHADOW_THICKNESS(win) \ - (MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win) > 10 \ - ? 10 \ - : MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win)) #endif /* INCLUDED_window_h_ */ diff --text -u 'xemacs-21.5.6/src/winslots.h' 'xemacs-21.5.7/src/winslots.h' Index: ././src/winslots.h --- ././src/winslots.h Tue Feb 5 00:44:52 2002 +++ ././src/winslots.h Thu May 16 22:30:32 2002 @@ -1,7 +1,7 @@ /* Definitions of marked slots in windows and window configs Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. - Copyright (C) 1995, 1996, 2001 Ben Wing. + Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. Copyright (C) 1996 Chuck Thompson. This file is part of XEmacs. @@ -28,7 +28,9 @@ NOTE: No semicolons after slot declarations in this file! The definitions of WINDOW_SLOT (and possibly WINDOW_SAVED_SLOT) need - to include a semicolon. + to include a semicolon. This is because these may be defined as + nothing, and some compilers don't tolerate extra semicolons in + structure definitions. WINDOW_SLOT declares a Lisp_Object that is not copied into the saved_window struct of a window configuration, or is handled in @@ -110,6 +112,20 @@ /* A marker pointing to where in the text the scrollbar is pointing; #### moved to scrollbar.c? */ WINDOW_SLOT (sb_point) + /* A table that remembers (in marker form) the value of point in buffers + previously displayed in this window. Switching back to those buffers + causes the remembered point value to become current, rather than the + buffer's point. This is so that you get sensible behavior if you have + a buffer displayed in multiple windows and temporarily switch away and + then back in one window. We don't save or restore this table in a + window configuration, since that would be counterproductive -- we + always want to remember the most recent value of point in buffers we + switched away from. */ + WINDOW_SLOT (saved_point_cache) + /* A table that remembers (in marker form) the value of window start in + buffers previously displayed in this window. Save reason as for + the previous table. */ + WINDOW_SLOT (saved_last_window_start_cache) /* Number saying how recently window was selected */ WINDOW_SLOT (use_time) diff --text -u 'xemacs-21.5.6/tests/ChangeLog' 'xemacs-21.5.7/tests/ChangeLog' Index: ././tests/ChangeLog --- ././tests/ChangeLog Fri Apr 5 16:43:07 2002 +++ ././tests/ChangeLog Wed Jul 3 00:35:34 2002 @@ -1,3 +1,32 @@ +2002-07-02 Stephen J. Turnbull + + * XEmacs 21.5.7 "broccoflower" is released. + +2002-06-27 Mike Sperber + + * automated/weak-tests.el: Create. + +2002-06-23 Stephen J. Turnbull + + * automated/mule-tests.el ((featurep 'mule)): Fix unicode test. + +2002-04-27 Stephen J. Turnbull + + * automated/test-harness.el (test-harness-from-buffer): Clean up + Check-Message and Check-Error-Message when done. + +2002-05-05 Ben Wing + + * automated/lisp-tests.el: + * automated/symbol-tests.el: + * automated/test-harness.el: + * automated/test-harness.el (test-harness-from-buffer): + Fix test harness to output FAIL messages to stderr when in + batch mode. + + Fix up some problems in lisp-tests/symbol-tests that were + causing spurious failures. + 2002-04-05 Stephen J. Turnbull * XEmacs 21.5.6 "bok choi" is released. diff --text -u 'xemacs-21.5.6/tests/automated/lisp-tests.el' 'xemacs-21.5.7/tests/automated/lisp-tests.el' Index: ././tests/automated/lisp-tests.el --- ././tests/automated/lisp-tests.el Fri Apr 13 03:24:54 2001 +++ ././tests/automated/lisp-tests.el Sun May 5 20:33:20 2002 @@ -997,18 +997,27 @@ (Assert (string= (format "%o" 8) "10")) (Assert (string= (format "%x" 31) "1f")) (Assert (string= (format "%X" 31) "1F")) -(Assert (string= (format "%e" 100) "1.000000e+02")) -(Assert (string= (format "%E" 100) "1.000000E+02")) +;; MS-Windows uses +002 in its floating-point numbers. #### We should +;; perhaps fix this, but writing our own floating-point support in doprnt.c +;; is very hard. +(Assert (or (string= (format "%e" 100) "1.000000e+02") + (string= (format "%e" 100) "1.000000e+002"))) +(Assert (or (string= (format "%E" 100) "1.000000E+02") + (string= (format "%E" 100) "1.000000E+002"))) +(Assert (or (string= (format "%E" 100) "1.000000E+02") + (string= (format "%E" 100) "1.000000E+002"))) (Assert (string= (format "%f" 100) "100.000000")) (Assert (string= (format "%7.3f" 12.12345) " 12.123")) (Assert (string= (format "%07.3f" 12.12345) "012.123")) (Assert (string= (format "%-7.3f" 12.12345) "12.123 ")) (Assert (string= (format "%-07.3f" 12.12345) "12.123 ")) (Assert (string= (format "%g" 100.0) "100")) -(Assert (string= (format "%g" 0.000001) "1e-06")) +(Assert (or (string= (format "%g" 0.000001) "1e-06") + (string= (format "%g" 0.000001) "1e-006"))) (Assert (string= (format "%g" 0.0001) "0.0001")) (Assert (string= (format "%G" 100.0) "100")) -(Assert (string= (format "%G" 0.000001) "1E-06")) +(Assert (or (string= (format "%G" 0.000001) "1E-06") + (string= (format "%G" 0.000001) "1E-006"))) (Assert (string= (format "%G" 0.0001) "0.0001")) (Assert (string= (format "%2$d%1$d" 10 20) "2010")) @@ -1033,14 +1042,18 @@ (Assert (string= (format "%#d" 10) "10")) (Assert (string= (format "%#o" 8) "010")) (Assert (string= (format "%#x" 16) "0x10")) -(Assert (string= (format "%#e" 100) "1.000000e+02")) -(Assert (string= (format "%#E" 100) "1.000000E+02")) +(Assert (or (string= (format "%#e" 100) "1.000000e+02") + (string= (format "%#e" 100) "1.000000e+002"))) +(Assert (or (string= (format "%#E" 100) "1.000000E+02") + (string= (format "%#E" 100) "1.000000E+002"))) (Assert (string= (format "%#f" 100) "100.000000")) (Assert (string= (format "%#g" 100.0) "100.000")) -(Assert (string= (format "%#g" 0.000001) "1.00000e-06")) +(Assert (or (string= (format "%#g" 0.000001) "1.00000e-06") + (string= (format "%#g" 0.000001) "1.00000e-006"))) (Assert (string= (format "%#g" 0.0001) "0.000100000")) (Assert (string= (format "%#G" 100.0) "100.000")) -(Assert (string= (format "%#G" 0.000001) "1.00000E-06")) +(Assert (or (string= (format "%#G" 0.000001) "1.00000E-06") + (string= (format "%#G" 0.000001) "1.00000E-006"))) (Assert (string= (format "%#G" 0.0001) "0.000100000")) (Assert (string= (format "%.1d" 10) "10")) (Assert (string= (format "%.4d" 10) "0010")) diff --text -u 'xemacs-21.5.6/tests/automated/mule-tests.el' 'xemacs-21.5.7/tests/automated/mule-tests.el' Index: ././tests/automated/mule-tests.el --- ././tests/automated/mule-tests.el Sun Mar 31 17:29:26 2002 +++ ././tests/automated/mule-tests.el Sun Jun 23 15:53:49 2002 @@ -319,7 +319,8 @@ ;; Test Unicode-related functions ;;--------------------------------------------------------------- (let* ((scaron (make-char 'latin-iso8859-2 57))) - (loop for code in '(#x0000 #x2222 #x4444 #xffff) do + ;; Used to try #x0000, but you can't change ASCII or Latin-1 + (loop for code in '(#x0100 #x2222 #x4444 #xffff) do (progn (set-unicode-conversion scaron code) (Assert (eq code (char-to-unicode scaron))) diff --text -u 'xemacs-21.5.6/tests/automated/symbol-tests.el' 'xemacs-21.5.7/tests/automated/symbol-tests.el' Index: ././tests/automated/symbol-tests.el --- ././tests/automated/symbol-tests.el Fri Apr 13 03:24:55 2001 +++ ././tests/automated/symbol-tests.el Sun May 5 20:33:21 2002 @@ -299,20 +299,21 @@ (Assert (eq save 'makunbound)) ) -(when (featurep 'file-coding) - (Assert (eq pathname-coding-system file-name-coding-system)) - (let ((val1 file-name-coding-system) - (val2 pathname-coding-system)) - (Assert (eq val1 val2)) - (let ((file-name-coding-system 'no-conversion-dos)) - (Assert (eq file-name-coding-system 'no-conversion-dos)) - (Assert (eq pathname-coding-system file-name-coding-system))) - (let ((pathname-coding-system 'no-conversion-mac)) - (Assert (eq file-name-coding-system 'no-conversion-mac)) - (Assert (eq pathname-coding-system file-name-coding-system))) - (Assert (eq file-name-coding-system pathname-coding-system)) - (Assert (eq val1 file-name-coding-system))) - (Assert (eq pathname-coding-system file-name-coding-system))) +;; pathname-coding-system is no more. +; (when (featurep 'file-coding) +; (Assert (eq pathname-coding-system file-name-coding-system)) +; (let ((val1 file-name-coding-system) +; (val2 pathname-coding-system)) +; (Assert (eq val1 val2)) +; (let ((file-name-coding-system 'no-conversion-dos)) +; (Assert (eq file-name-coding-system 'no-conversion-dos)) +; (Assert (eq pathname-coding-system file-name-coding-system))) +; (let ((pathname-coding-system 'no-conversion-mac)) +; (Assert (eq file-name-coding-system 'no-conversion-mac)) +; (Assert (eq pathname-coding-system file-name-coding-system))) +; (Assert (eq file-name-coding-system pathname-coding-system)) +; (Assert (eq val1 file-name-coding-system))) +; (Assert (eq pathname-coding-system file-name-coding-system))) ;(let ((mysym (make-symbol "test-symbol"))) diff --text -u 'xemacs-21.5.6/tests/automated/test-harness.el' 'xemacs-21.5.7/tests/automated/test-harness.el' Index: ././tests/automated/test-harness.el --- ././tests/automated/test-harness.el Fri Apr 13 03:24:55 2001 +++ ././tests/automated/test-harness.el Tue Jun 4 15:05:53 2002 @@ -1,6 +1,7 @@ ;; test-harness.el --- Run Emacs Lisp test suites. ;;; Copyright (C) 1998 Free Software Foundation, Inc. +;;; Copyright (C) 2002 Ben Wing. ;; Author: Martin Buchholz ;; Keywords: testing @@ -125,20 +126,32 @@ (trick-optimizer nil) (unexpected-test-suite-failure nil) - (debug-on-error t)) + (debug-on-error t) + (pass-stream nil)) (with-output-to-temp-buffer "*Test-Log*" + (princ (format "Testing %s...\n\n" filename)) + + (defun Print-Failure (fmt &rest args) + (setq fmt (concat "FAIL: " fmt)) + (if (noninteractive) (apply #'message fmt args)) + (princ (concat (apply #'format fmt args) "\n"))) + + (defun Print-Pass (fmt &rest args) + (setq fmt (concat "PASS: " fmt)) + (and test-harness-verbose + (princ (concat (apply #'format fmt args) "\n")))) + (defmacro Assert (assertion) `(condition-case error-info (progn (assert ,assertion) - (princ (format "PASS: %S" (quote ,assertion))) - (terpri) + (Print-Pass "%S" (quote ,assertion)) (incf passes)) (cl-assertion-failed - (princ (format "FAIL: Assertion failed: %S\n" (quote ,assertion))) + (Print-Failure "Assertion failed: %S" (quote ,assertion)) (incf assertion-failures)) - (t (princ (format "FAIL: %S ==> error: %S\n" (quote ,assertion) error-info)) + (t (Print-Failure "%S ==> error: %S" (quote ,assertion) error-info) (incf other-failures) ))) @@ -148,42 +161,42 @@ `(condition-case error-info (progn (setq trick-optimizer (progn ,@body)) - (princ (format "FAIL: %S executed successfully, but expected error %S\n" + (Print-Failure "%S executed successfully, but expected error %S" ,quoted-body - ',expected-error)) + ',expected-error) (incf no-error-failures)) (,expected-error - (princ (format "PASS: %S ==> error %S, as expected\n" - ,quoted-body ',expected-error)) + (Print-Pass "%S ==> error %S, as expected" + ,quoted-body ',expected-error) (incf passes)) (error - (princ (format "FAIL: %S ==> expected error %S, got error %S instead\n" - ,quoted-body ',expected-error error-info)) + (Print-Failure "%S ==> expected error %S, got error %S instead" + ,quoted-body ',expected-error error-info) (incf wrong-error-failures))))) - (defmacro Check-Error-Message (expected-error expected-error-regexp &rest body) + (defmacro Check-Error-Message (expected-error expected-error-regexp + &rest body) (let ((quoted-body (if (= 1 (length body)) `(quote ,(car body)) `(quote (progn ,@body))))) `(condition-case error-info (progn (setq trick-optimizer (progn ,@body)) - (princ (format "FAIL: %S executed successfully, but expected error %S\n" - ,quoted-body - ',expected-error)) + (Print-Failure "%S executed successfully, but expected error %S" + ,quoted-body ',expected-error) (incf no-error-failures)) (,expected-error (let ((error-message (second error-info))) (if (string-match ,expected-error-regexp error-message) (progn - (princ (format "PASS: %S ==> error %S %S, as expected\n" - ,quoted-body error-message ',expected-error)) + (Print-Pass "%S ==> error %S %S, as expected" + ,quoted-body error-message ',expected-error) (incf passes)) - (princ (format "FAIL: %S ==> got error %S as expected, but error message %S did not match regexp %S\n" - ,quoted-body ',expected-error error-message ,expected-error-regexp)) + (Print-Failure "%S ==> got error %S as expected, but error message %S did not match regexp %S" + ,quoted-body ',expected-error error-message ,expected-error-regexp) (incf wrong-error-failures)))) (error - (princ (format "FAIL: %S ==> expected error %S, got error %S instead\n" - ,quoted-body ',expected-error error-info)) + (Print-Failure "%S ==> expected error %S, got error %S instead" + ,quoted-body ',expected-error error-info) (incf wrong-error-failures))))) @@ -201,15 +214,16 @@ (setq trick-optimizer (progn ,@body)) (if (string-match ,expected-message-regexp messages) (progn - (princ (format "PASS: %S ==> value %S, message %S, matching %S, as expected\n" - ,quoted-body trick-optimizer messages ',expected-message-regexp)) + (Print-Pass "%S ==> value %S, message %S, matching %S, as expected" + ,quoted-body trick-optimizer messages ',expected-message-regexp) (incf passes)) - (princ (format "FAIL: %S ==> value %S, message %S, NOT matching expected %S\n" - ,quoted-body trick-optimizer messages ',expected-message-regexp)) + (Print-Failure "%S ==> value %S, message %S, NOT matching expected %S" + ,quoted-body trick-optimizer messages + ',expected-message-regexp) (incf missing-message-failures))) (error - (princ (format "FAIL: %S ==> unexpected error %S\n" - ,quoted-body error-info)) + (Print-Failure "%S ==> unexpected error %S" + ,quoted-body error-info) (incf other-failures))) (ad-unadvise 'message)))) @@ -252,7 +266,7 @@ (message "Unexpected error %S while executing byte-compiled code." error-info) (message "Test suite execution aborted." error-info) ))) - (princ "\nSUMMARY:\n") + (princ (format "\nSUMMARY for %s:\n" filename)) (princ (format "\t%5d passes\n" passes)) (princ (format "\t%5d assertion failures\n" assertion-failures)) (princ (format "\t%5d errors that should have been generated, but weren't\n" no-error-failures)) @@ -276,6 +290,8 @@ (message "Test suite execution failed unexpectedly.")) (fmakunbound 'Assert) (fmakunbound 'Check-Error) + (fmakunbound 'Check-Message) + (fmakunbound 'Check-Error-Message) (fmakunbound 'Ignore-Ebola) (fmakunbound 'Int-to-Marker) ))) diff --text -u /dev/null 'xemacs-21.5.7/tests/automated/weak-tests.el' Index: ././tests/automated/weak-tests.el --- ././tests/automated/weak-tests.el Thu Jan 1 09:00:00 1970 +++ ././tests/automated/weak-tests.el Fri Jun 28 23:24:45 2002 @@ -0,0 +1,65 @@ +;; Copyright (C) 1998 Free Software Foundation, Inc. + +;; Author: Mike Sperber +;; Maintainer: Mike Sperber +;; Created: 2002 +;; Keywords: tests, database + +;; 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 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. + +;;; Synched up with: Not in FSF. + +;;; Commentary: + +;;; Test implementation of weak boxes and ephemerons +;;; See test-harness.el + +(condition-case err + (require 'test-harness) + (file-error + (when (and (boundp 'load-file-name) (stringp load-file-name)) + (push (file-name-directory load-file-name) load-path) + (require 'test-harness)))) + +(garbage-collect) +(let ((w (make-weak-box (cons 2 3)))) + (Assert (equal (cons 2 3) (weak-box-ref w))) + (garbage-collect) + (Assert (not (weak-box-ref w)))) + +(garbage-collect) + +(let* ((p (cons 3 4)) + (finalized-p nil) + (eph1 (make-ephemeron (cons 1 2) p + '(lambda (value) + (setq finalized-p t)))) + (eph2 (make-ephemeron p p))) + (Assert (eq p (ephemeron-ref (make-ephemeron (cons 1 2) p)))) + (Assert (ephemeron-p (make-ephemeron (cons 1 2) p))) + + (garbage-collect) + (garbage-collect) ; ensure the post-gc hook runs + + (Assert finalized-p) + (Assert (not (ephemeron-ref eph1))) + + (garbage-collect) + + (Assert (eq p (ephemeron-ref eph2)))) + diff --text -u 'xemacs-21.5.6/tests/gutter-test.el' 'xemacs-21.5.7/tests/gutter-test.el' Index: ././tests/gutter-test.el --- ././tests/gutter-test.el Fri Apr 13 03:24:47 2001 +++ ././tests/gutter-test.el Tue Jun 4 15:05:51 2002 @@ -21,10 +21,10 @@ (set-gutter-element bottom-gutter 'str (make-glyph - [layout :orientation vertical - :justify left :margin-width 4 + [layout :orientation vertical :margin-width 4 + :vertically-justify center :horizontally-justify left :items ([string :data "Fontifying glyphs.c..."] - [layout :orientation horizontal + [layout :orientation horizontal :items ([progress-gauge :value 0 :pixel-height 24 :pixel-width 250 :descriptor @@ -33,7 +33,7 @@ :descriptor " Stop " :callback (quote quit)])])])) -(set-gutter-element bottom-gutter 'str2 str2) (set-gutter-element-visible-p bottom-gutter-visible-p 'str t) -(set-gutter-element-visible-p bottom-gutter-visible-p 'str2 t) +(set-gutter-element left-gutter 'str2 str2) +(set-gutter-element-visible-p left-gutter-visible-p 'str2 t) diff --text -u 'xemacs-21.5.6/version.sh' 'xemacs-21.5.7/version.sh' Index: ././version.sh --- ././version.sh Fri Apr 5 21:28:56 2002 +++ ././version.sh Wed Jul 3 00:35:34 2002 @@ -2,8 +2,8 @@ emacs_is_beta=t emacs_major_version=21 emacs_minor_version=5 -emacs_beta_version=6 -xemacs_codename="bok choi" +emacs_beta_version=7 +xemacs_codename="broccoflower" emacs_kit_version= infodock_major_version=4 infodock_minor_version=0 diff --text -u /dev/null 'xemacs-21.5.7/version.sh~' Index: ././version.sh~ --- ././version.sh~ Thu Jan 1 09:00:00 1970 +++ ././version.sh~ Wed Jul 3 00:32:38 2002 @@ -0,0 +1,11 @@ +#!/bin/sh +emacs_is_beta=t +emacs_major_version=21 +emacs_minor_version=5 +emacs_beta_version=7 +xemacs_codename="broccoflower" +emacs_kit_version= +emacs_kit_version= +infodock_major_version=4 +infodock_minor_version=0 +infodock_build_version=8 #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Wed Jul 3 00:36:41 2002 # Generated by : makepatch 2.00_03 # Recurse directories : Yes # Excluded files : (\A|/).*\.png\Z # (\A|/).*\.bmp\Z # (\A|/).*\.info.*\Z # (\A|/).*\.elc\Z # (\A|/)MANIFEST\Z # (\A|/)\.precious\Z # r './src/ntproc.c' 33645 0 # r './src/README.integral-types' 12717 0 # r './nt/xemacs-vc50.dsw' 513 0 # r './nt/xemacs-vc50.dsp' 23395 0 # r './nt/minitar.mak' 243 0 # r './lisp/mule/custom-load.el' 190 0 # r './lisp/mule/auto-autoloads.el' 35394 0 # r './lisp/custom-load.el' 4806 0 # r './lisp/auto-autoloads.el' 113701 0 # r './.#version.sh.1.173' 213 0 # p './CHANGES-beta' 20623 1025611933 0100644 # p './CHANGES-msw' 1450 1023171091 0100644 # p './ChangeLog' 136027 1025624134 0100644 # p './INSTALL' 32479 1021561883 0100644 # p './PROBLEMS' 74945 1025612874 0100644 # p './README.packages' 10320 1020598437 0100644 # p './TODO.ben-mule-21-5' 5822 1018788210 0100644 # p './build-msw-release.sh' 3131 1023171151 0100755 # p './configure' 451069 1025623181 0100755 # p './configure.in' 172473 1023171140 0100644 # p './etc/ChangeLog' 38160 1025624134 0100644 # p './etc/sample.init.el' 53131 1023170639 0100644 # p './lib-src/ChangeLog' 42781 1025624134 0100644 # p './lib-src/Makefile.in.in' 12461 1019757803 0100644 # p './lib-src/gnuclient.c' 18342 1024992542 0100644 # p './lib-src/i.c' 4630 1020598216 0100644 # p './lib-src/make-docfile.c' 25564 1022575466 0100644 # c './lib-src/winclient.c' 0 1022575466 0100644 # p './lisp/ChangeLog' 396058 1025624134 0100644 # p './lisp/abbrev.el' 20791 1018788124 0100644 # p './lisp/bytecomp-runtime.el' 23468 1020598223 0100644 # p './lisp/cl-macs.el' 119158 1024607882 0100644 # p './lisp/code-files.el' 22791 1025050276 0100644 # p './lisp/code-init.el' 15049 1022575470 0100644 # p './lisp/code-process.el' 11046 1022829292 0100644 # p './lisp/compat.el' 7009 1020598223 0100644 # p './lisp/cus-edit.el' 125272 1021660125 0100644 # p './lisp/dialog-items.el' 3776 1023170655 0100644 # p './lisp/dialog.el' 25237 1023170656 0100644 # p './lisp/dumped-lisp.el' 8782 1025274042 0100644 # p './lisp/faces.el' 78665 1024607882 0100644 # p './lisp/files.el' 134899 1023170657 0100644 # p './lisp/find-paths.el' 11387 1023209154 0100644 # p './lisp/font-lock.el' 118396 1024607883 0100644 # p './lisp/font-menu.el' 15818 1024607883 0100644 # p './lisp/font.el' 48726 1024607883 0100644 # p './lisp/gtk-faces.el' 12304 1024607883 0100644 # p './lisp/gtk-marshal.el' 10206 1020952179 0100644 # p './lisp/gutter-items.el' 17606 1023170659 0100644 # p './lisp/help.el' 64167 1023170661 0100644 # p './lisp/indent.el' 17981 1018788124 0100644 # p './lisp/info.el' 118345 1020788044 0100644 # p './lisp/keydefs.el' 27477 1020933226 0100644 # p './lisp/lisp-mode.el' 41334 1024607883 0100644 # p './lisp/make-docfile.el' 6311 1018788124 0100644 # p './lisp/menubar-items.el' 76648 1022154370 0100644 # p './lisp/minibuf.el' 92783 1023170662 0100644 # p './lisp/msw-faces.el' 8610 1024607884 0100644 # p './lisp/msw-font-menu.el' 7852 1024607884 0100644 # p './lisp/msw-init.el' 2230 1020933226 0100644 # p './lisp/mule/chinese.el' 13959 1018199450 0100644 # p './lisp/mule/european.el' 14717 1023170669 0100644 # p './lisp/mule/japanese.el' 18518 1018199450 0100644 # p './lisp/mule/mule-charset.el' 31840 1019976033 0100644 # p './lisp/mule/mule-msw-init-late.el' 2410 1024607891 0100644 # p './lisp/mule/mule-x-init.el' 4625 1024607891 0100644 # p './lisp/multicast.el' 3443 1022575470 0100644 # p './lisp/obsolete.el' 13525 1025050276 0100644 # p './lisp/package-get.el' 42408 1020350132 0100644 # p './lisp/package-ui.el' 24071 1022291730 0100644 # c './lisp/post-gc.el' 0 1025274042 0100644 # p './lisp/process.el' 23094 1023107036 0100644 # p './lisp/select.el' 30865 1022154370 0100644 # p './lisp/simple.el' 182667 1021555858 0100644 # p './lisp/specifier.el' 24478 1024607884 0100644 # p './lisp/startup.el' 52998 1023212388 0100644 # p './lisp/subr.el' 43352 1025050276 0100644 # p './lisp/unicode.el' 10730 1024826076 0100644 # p './lisp/x-faces.el' 31406 1024607884 0100644 # p './lisp/x-init.el' 13910 1024607885 0100644 # p './lwlib/ChangeLog' 22967 1025624134 0100644 # p './lwlib/lwlib-Xm.c' 63685 1018003051 0100644 # p './lwlib/lwlib.c' 36252 1024607893 0100644 # p './man/ChangeLog' 88258 1025624134 0100644 # p './man/custom.texi' 13515 1023170674 0100644 # p './man/emodules.texi' 42118 1024956017 0100644 # p './man/external-widget.texi' 7786 1023170675 0100644 # p './man/internals/internals.texi' 394943 1023278446 0100644 # p './man/lispref/packaging.texi' 54132 1023099012 0100644 # p './man/xemacs-faq.texi' 252221 1025612878 0100644 # p './man/xemacs/custom.texi' 101681 1023823702 0100644 # p './man/xemacs/mule.texi' 25197 1024609161 0100644 # p './man/xemacs/packages.texi' 29789 1020241552 0100644 # p './modules/ChangeLog' 365 1025624134 0100644 # p './netinstall/ChangeLog' 10647 1025624134 0100644 # p './netinstall/desktop.cc' 13616 1019757821 0100644 # c './netinstall/init.cc' 0 1019757822 0100644 # p './netinstall/install.cc' 11158 1019757822 0100644 # p './netinstall/res.rc' 22286 1019757823 0100644 # p './nt/ChangeLog' 42860 1025624134 0100644 # p './nt/README' 13387 1020694476 0100644 # p './nt/config.inc.samp' 2658 1024607896 0100644 # p './nt/installer/Wise/ChangeLog' 750 1025624134 0100644 # p './nt/minitar.c' 4763 1018729888 0100644 # p './nt/xemacs.dsp' 23431 1024607896 0100644 # p './nt/xemacs.mak' 43609 1025040047 0100644 # p './nt/xpm.mak' 1177 1019522670 0100644 # p './src/ChangeLog' 516378 1025624134 0100644 # p './src/EmacsFrame.c' 23569 1024607900 0100644 # p './src/EmacsFrameP.h' 3843 1023456890 0100644 # p './src/ExternalShell.c' 22678 1024826080 0100644 # p './src/Makefile.in.in' 27342 1022575484 0100644 # c './src/README.global-renaming' 0 1023278469 0100644 # p './src/abbrev.c' 14430 1023270892 0100644 # p './src/alloc.c' 131165 1025274101 0100644 # p './src/alloca.c' 14856 1022154379 0100644 # p './src/backtrace.h' 11093 1022575484 0100644 # p './src/balloon-x.c' 3572 1024607901 0100644 # p './src/buffer.c' 93282 1024607901 0100644 # p './src/buffer.h' 39378 1023270896 0100644 # p './src/bytecode.c' 60110 1024607901 0100644 # p './src/bytecode.h' 4806 1018788134 0100644 # p './src/callint.c' 33711 1024607901 0100644 # p './src/callproc.c' 30831 1022575485 0100644 # p './src/casefiddle.c' 10248 1023270900 0100644 # p './src/casetab.c' 14489 1023270900 0100644 # p './src/casetab.h' 2590 1020598250 0100644 # p './src/charset.h' 20571 1023270901 0100644 # p './src/chartab.c' 49964 1023270901 0100644 # p './src/chartab.h' 7441 1023270902 0100644 # p './src/cm.c' 11862 1024607901 0100644 # p './src/cmdloop.c' 21320 1024607902 0100644 # p './src/cmds.c' 16450 1024607902 0100644 # p './src/config.h.in' 29258 1024607902 0100644 # c './src/console-gtk-impl.h' 0 1024607902 0100644 # p './src/console-gtk.c' 3183 1024607902 0100644 # p './src/console-gtk.h' 9144 1024607903 0100644 # c './src/console-impl.h' 0 1024607903 0100644 # c './src/console-msw-impl.h' 0 1024607903 0100644 # p './src/console-msw.c' 18972 1024607903 0100644 # p './src/console-msw.h' 13906 1024607903 0100644 # c './src/console-stream-impl.h' 0 1024607903 0100644 # p './src/console-stream.c' 8792 1024607903 0100644 # p './src/console-stream.h' 1718 1024607904 0100644 # c './src/console-tty-impl.h' 0 1024607904 0100644 # p './src/console-tty.c' 11394 1024607904 0100644 # p './src/console-tty.h' 9552 1024607904 0100644 # c './src/console-x-impl.h' 0 1024607904 0100644 # p './src/console-x.c' 8381 1024607904 0100644 # p './src/console-x.h' 17604 1024607904 0100644 # p './src/console.c' 44647 1024607904 0100644 # p './src/console.h' 26335 1024766085 0100644 # p './src/data.c' 60421 1025274247 0100644 # p './src/depend' 38632 1024607905 0100644 # p './src/device-gtk.c' 21409 1024607905 0100644 # c './src/device-impl.h' 0 1024607905 0100644 # p './src/device-msw.c' 39351 1024607905 0100644 # p './src/device-tty.c' 5778 1024607906 0100644 # p './src/device-x.c' 64691 1024607906 0100644 # p './src/device.c' 39716 1024607906 0100644 # p './src/device.h' 14062 1024607906 0100644 # p './src/devslots.h' 5142 1024607906 0100644 # p './src/dialog-gtk.c' 1723 1024824311 0100644 # p './src/dialog-msw.c' 24820 1024607906 0100644 # p './src/dialog-x.c' 8854 1024607907 0100644 # p './src/dialog.c' 2104 1024607907 0100644 # p './src/dired-msw.c' 17354 1024607907 0100644 # p './src/dired.c' 28975 1023270911 0100644 # p './src/doc.c' 28444 1023270912 0100644 # p './src/doprnt.c' 26080 1023270913 0100644 # p './src/dumper.c' 46374 1020598262 0100644 # p './src/editfns.c' 79688 1024826081 0100644 # p './src/eldap.c' 23796 1024826081 0100644 # p './src/elhash.c' 51438 1020598264 0100644 # p './src/emacs-marshals.c' 74323 1020952182 0100644 # p './src/emacs.c' 129218 1024607907 0100644 # p './src/emodules.c' 19073 1023270915 0100644 # p './src/eval.c' 160872 1025274101 0100644 # p './src/event-Xt.c' 112686 1024607908 0100644 # p './src/event-gtk.c' 67837 1024824312 0100644 # p './src/event-msw.c' 138652 1024607909 0100644 # p './src/event-stream.c' 169254 1024607909 0100644 # p './src/event-tty.c' 8009 1024607909 0100644 # p './src/event-unixoid.c' 9917 1024607909 0100644 # p './src/events.c' 67105 1024607910 0100644 # p './src/events.h' 30965 1023270929 0100644 # c './src/extents-impl.h' 0 1024607910 0100644 # p './src/extents.c' 218601 1024607910 0100644 # p './src/extents.h' 17025 1024607910 0100644 # p './src/faces.c' 65769 1024766085 0100644 # p './src/file-coding.c' 161883 1023270930 0100644 # p './src/file-coding.h' 45272 1023270935 0100644 # p './src/fileio.c' 132869 1024607911 0100644 # p './src/filelock.c' 14580 1023270940 0100644 # p './src/fns.c' 114101 1024607911 0100644 # p './src/font-lock.c' 26672 1023270943 0100644 # p './src/frame-gtk.c' 41300 1024607911 0100644 # c './src/frame-impl.h' 0 1025613157 0100644 # p './src/frame-msw.c' 37048 1024607912 0100644 # p './src/frame-tty.c' 6030 1024607912 0100644 # p './src/frame-x.c' 85995 1024607912 0100644 # p './src/frame.c' 107777 1024607912 0100644 # p './src/frame.h' 29868 1024607913 0100644 # p './src/general-slots.h' 6277 1023170710 0100644 # p './src/glade.c' 3176 1020598294 0100644 # p './src/glyphs-eimage.c' 40329 1024607913 0100644 # p './src/glyphs-gtk.c' 80741 1024607913 0100644 # p './src/glyphs-msw.c' 91592 1024607913 0100644 # p './src/glyphs-msw.h' 4086 1020598298 0100644 # p './src/glyphs-widget.c' 55176 1024607914 0100644 # p './src/glyphs-x.c' 88912 1024607914 0100644 # p './src/glyphs.c' 165452 1024607914 0100644 # p './src/glyphs.h' 44936 1024607915 0100644 # p './src/gpmevent.c' 16685 1024824312 0100644 # p './src/gtk-glue.c' 6667 1024824312 0100644 # p './src/gtk-xemacs.c' 10603 1024824312 0100644 # p './src/gui-gtk.c' 2686 1024607915 0100644 # p './src/gui-msw.c' 3337 1024607915 0100644 # p './src/gui-x.c' 19098 1024607915 0100644 # p './src/gui-x.h' 3076 1023270961 0100644 # p './src/gui.c' 19690 1024607915 0100644 # p './src/gui.h' 4052 1023270963 0100644 # p './src/gutter.c' 50818 1024607915 0100644 # p './src/gutter.h' 5077 1020598305 0100644 # p './src/hash.h' 2776 1020598306 0100644 # p './src/hpplay.c' 7759 1023270964 0100644 # p './src/indent.c' 26489 1023270965 0100644 # p './src/inline.c' 2854 1025218229 0100644 # p './src/input-method-xlib.c' 33521 1024607915 0100644 # p './src/insdel.c' 53710 1023270967 0100644 # p './src/insdel.h' 6113 1023270969 0100644 # p './src/intl-auto-encap-win32.c' 129746 1020694541 0100644 # p './src/intl-auto-encap-win32.h' 118894 1020694543 0100644 # p './src/intl-encap-win32.c' 81788 1024607916 0100644 # p './src/intl-win32.c' 59848 1024607916 0100644 # p './src/intl.c' 6095 1022575495 0100644 # p './src/keymap.c' 137206 1024607916 0100644 # c './src/libinterface.c' 0 1023713021 0100644 # c './src/libinterface.h' 0 1023713022 0100644 # p './src/line-number.c' 11061 1023270975 0100644 # p './src/line-number.h' 1194 1023270976 0100644 # p './src/lisp-disunion.h' 4764 1023270976 0100644 # p './src/lisp-union.h' 4829 1023270977 0100644 # p './src/lisp.h' 152169 1025274248 0100644 # p './src/lread.c' 92001 1023270980 0100644 # p './src/lrecord.h' 35037 1025274248 0100644 # p './src/lstream.c' 50222 1023270984 0100644 # p './src/lstream.h' 19537 1023270985 0100644 # p './src/macros.c' 9549 1024607917 0100644 # p './src/marker.c' 14882 1021381440 0100644 # p './src/md5.c' 17990 1023270986 0100644 # p './src/menubar-gtk.c' 35637 1024824312 0100644 # p './src/menubar-msw.c' 28352 1024607917 0100644 # p './src/menubar-x.c' 37281 1024607917 0100644 # p './src/menubar.c' 27867 1024607917 0100644 # p './src/menubar.h' 2324 1024607917 0100644 # p './src/minibuf.c' 27354 1024607918 0100644 # p './src/mule-ccl.c' 63495 1023270991 0100644 # p './src/mule-charset.c' 43403 1024607918 0100644 # p './src/mule-coding.c' 96881 1023270993 0100644 # p './src/mule-wnnfns.c' 58002 1023270995 0100644 # p './src/nas.c' 21992 1020598327 0100644 # p './src/ndir.h' 2090 1023270996 0100644 # p './src/nt.c' 58247 1024607918 0100644 # p './src/ntheap.c' 10519 1018788141 0100644 # c './src/objects-gtk-impl.h' 0 1024607918 0100644 # p './src/objects-gtk.c' 16581 1024607918 0100644 # p './src/objects-gtk.h' 2361 1024607919 0100644 # c './src/objects-impl.h' 0 1024607919 0100644 # c './src/objects-msw-impl.h' 0 1024607919 0100644 # p './src/objects-msw.c' 72777 1024607919 0100644 # p './src/objects-msw.h' 2606 1024607919 0100644 # c './src/objects-tty-impl.h' 0 1024607919 0100644 # p './src/objects-tty.c' 9573 1024607919 0100644 # p './src/objects-tty.h' 1595 1024607920 0100644 # c './src/objects-x-impl.h' 0 1024607920 0100644 # p './src/objects-x.c' 33968 1024607920 0100644 # p './src/objects-x.h' 2265 1024607920 0100644 # p './src/objects.c' 32464 1024766085 0100644 # p './src/objects.h' 6614 1024607920 0100644 # p './src/opaque.c' 5115 1022575497 0100644 # p './src/postgresql.c' 49083 1024607920 0100644 # p './src/print.c' 60719 1024607921 0100644 # p './src/process-nt.c' 42926 1023271008 0100644 # p './src/process-unix.c' 60035 1023271009 0100644 # p './src/process.c' 66351 1023271011 0100644 # p './src/process.h' 4308 1024607921 0100644 # p './src/procimpl.h' 6445 1023271012 0100644 # p './src/profile.c' 10402 1022575499 0100644 # p './src/rangetab.c' 22292 1020598335 0100644 # p './src/realpath.c' 9305 1023271013 0100644 # p './src/redisplay-gtk.c' 59023 1024607921 0100644 # p './src/redisplay-msw.c' 42911 1024607921 0100644 # p './src/redisplay-output.c' 73447 1024607922 0100644 # p './src/redisplay-tty.c' 42443 1024607922 0100644 # p './src/redisplay-x.c' 64775 1024607922 0100644 # p './src/redisplay.c' 285565 1024607923 0100644 # p './src/redisplay.h' 28064 1024607923 0100644 # p './src/regex.c' 211971 1023271025 0100644 # p './src/regex.h' 20006 1020598343 0100644 # p './src/s/cygwin32.h' 2571 1024607950 0100644 # p './src/s/linux.h' 6604 1023170747 0100644 # p './src/s/win32-common.h' 1417 1024607950 0100644 # p './src/s/windowsnt.h' 9305 1024607950 0100644 # p './src/scrollbar-gtk.c' 15215 1024607924 0100644 # p './src/scrollbar-msw.c' 15868 1024607924 0100644 # p './src/scrollbar-x.c' 22775 1024607924 0100644 # p './src/scrollbar.c' 31364 1024607924 0100644 # p './src/search.c' 92882 1024912882 0100644 # p './src/select-common.h' 10532 1023271029 0100644 # p './src/select-gtk.c' 14516 1024607925 0100644 # p './src/select-msw.c' 17406 1024607925 0100644 # p './src/select-x.c' 46415 1024607925 0100644 # p './src/select.c' 30763 1024607925 0100644 # p './src/sheap.c' 4286 1022575501 0100644 # p './src/signal.c' 39299 1024607926 0100644 # p './src/sound.c' 20459 1024607926 0100644 # p './src/sound.h' 1577 1023271032 0100644 # p './src/specifier.c' 104873 1024607926 0100644 # p './src/specifier.h' 21036 1020598348 0100644 # p './src/symbols.c' 112743 1024607926 0100644 # p './src/symsinit.h' 18464 1023170738 0100644 # p './src/syntax.c' 60889 1024607927 0100644 # p './src/syntax.h' 17863 1023271035 0100644 # p './src/sysdep.c' 113669 1024607927 0100644 # p './src/sysdep.h' 4669 1023271038 0100644 # p './src/sysdir.h' 2492 1023271038 0100644 # p './src/sysdll.c' 5197 1024956025 0100644 # p './src/sysfile.h' 11677 1023271038 0100644 # p './src/sysproc.h' 5863 1023271039 0100644 # p './src/syspwd.h' 1369 1023271039 0100644 # p './src/syssignal.h' 9764 1024607927 0100644 # p './src/systime.h' 10688 1023271039 0100644 # p './src/syswindows.h' 32289 1024607927 0100644 # p './src/termcap.c' 14027 1023271040 0100644 # p './src/tests.c' 16076 1023271041 0100644 # p './src/text.c' 102838 1023271042 0100644 # p './src/text.h' 79717 1023271044 0100644 # p './src/toolbar-common.c' 19720 1024607928 0100644 # p './src/toolbar-gtk.c' 2336 1024607928 0100644 # p './src/toolbar-msw.c' 18228 1024607928 0100644 # p './src/toolbar-x.c' 2768 1024607928 0100644 # p './src/toolbar.c' 59563 1024607928 0100644 # p './src/tooltalk.c' 41762 1023271048 0100644 # p './src/ui-byhand.c' 18912 1022154395 0100644 # p './src/ui-gtk.c' 45660 1023271049 0100644 # p './src/undo.c' 15301 1022575505 0100644 # p './src/unexfreebsd.c' 20927 1022575505 0100644 # p './src/unexnt.c' 17962 1023271050 0100644 # p './src/unexsunos4.c' 19284 1022575505 0100644 # p './src/unicode.c' 60467 1025613157 0100644 # p './src/win32.c' 18701 1023271052 0100644 # c './src/window-impl.h' 0 1024607929 0100644 # p './src/window.c' 200618 1024607929 0100644 # p './src/window.h' 15670 1024607929 0100644 # p './src/winslots.h' 10480 1021555832 0100644 # p './tests/ChangeLog' 11596 1025624134 0100644 # p './tests/automated/lisp-tests.el' 40065 1020598400 0100644 # p './tests/automated/mule-tests.el' 14629 1024815229 0100644 # p './tests/automated/symbol-tests.el' 11045 1020598401 0100644 # p './tests/automated/test-harness.el' 13414 1023170753 0100644 # c './tests/automated/weak-tests.el' 0 1025274285 0100644 # p './tests/gutter-test.el' 1159 1023170751 0100644 # p './version.sh' 213 1025624134 0100644 # c './version.sh~' 0 1025623958 0100644 #### End of ApplyPatch data #### #### End of Patch kit [created: Wed Jul 3 00:36:41 2002] #### #### Patch checksum: 97203 3395314 21907 #### #### Checksum: 97287 3398187 195 ####