Mercurial > emacs
view src/sheap.c @ 83449:ff74a86c2b16
Overhaul and simplify single_kboard API. Allow calls to `recursive-edit' in process filters. Small fixes.
* lisp/server.el (server-process-filter): Protect `display-splash-screen'
call in a condition-case. Explain why.
* src/callint.c (Fcall_interactively): Update call to
`temporarily_switch_to_single_kboard'.
* src/fns.c (Fy_or_n_p): Ditto.
* src/frame.c (Fdelete_frame): Remove unused variable `count'.
* src/keyboard.c (wrong_kboard_jmpbuf): Remove global variable.
* src/keyboard.c (read_char): Add wrong_kboard_jmpbuf parameter to allow
for recursive calls. Update longjmp invocations. Remember the
original current_kboard, and longjmp to `wrong_kboard_jmpbuf' when a
filter, timer or sentinel changes it. Comment out unnecessary calls to
`record_single_kboard_state' and `any_kboard_state'. Update recursive
calls.
* src/keyboard.c (read_key_sequence): Add `wrong_kboard_jmpbuf' local
variable. Update setjmp and read_char calls. Abort if
interrupted_kboard died in read_char.
* src/keyboard.c (any_kboard_state, single_kboard_state)
(record_single_kboard_state): Comment out obsolete functions.
(push_frame_kboard): Remove function.
(pop_kboard): Switch out of single_kboard mode if the
kboard has been deleted.
(temporarily_switch_to_single_kboard): Change first
parameter to a frame pointer. Throw an error when caller wants to
change kboards while in single_kboard mode.
(restore_kboard_configuration): Abort if pop_kboard changed
the kboard in single_kboard mode.
(Frecursive_edit): Switch to single_kboard mode only in
nested command loops.
(cmd_error, command_loop, command_loop_1, timer_check):
Comment out unnecessary call to `any_kboard_state' and
`record_single_kboard_state'.
* src/keyboard.c (delete_kboard): Exit single_kboard mode if we have just
deleted that kboard.
* src/keyboard.c (interrupt_signal): Use `Fkill_emacs' to exit Emacs, not
`fatal_error_signal'.
* src/keyboard.h (read_char, single_kboard_state)
(record_single_kboard_state): Remove.
(temporarily_switch_to_single_kboard): Update.
* src/lread.c: Include setjmp.h. Update declaration of `read_char'.
(read_filtered_event): Call `read_char' with a local
`wrong_kboard_jmpbuf'.
* src/minibuf.c (read_minibuf): Update call to
`temporarily_switch_to_single_kboard'.
* src/termchar.h (tty_display_info): Rename `previous_terminal_frame'
member to `previous_frame'.
* src/xdisp.c (redisplay_internal): Update references to
`previous_terminal_frame'.
(display_mode_line, Fformat_mode_line): Replace calls to
`push_frame_kboard' with `push_kboard'.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-489
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Tue, 03 Jan 2006 01:50:46 +0000 |
parents | d74deb025f5a |
children | 3bd95f4f2941 7beb78bc1f8e |
line wrap: on
line source
/* simulate `sbrk' with an array in .bss, for `unexec' support for Cygwin; complete rewrite of xemacs Cygwin `unexec' code Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs 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. GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> #include <stdio.h> #include "lisp.h" #include <unistd.h> #ifdef HAVE_X_WINDOWS #define STATIC_HEAP_SIZE (8 * 1024 * 1024) #else #define STATIC_HEAP_SIZE (8 * 1024 * 1024) #endif int debug_sheap = 0; #define BLOCKSIZE 4096 char bss_sbrk_buffer[STATIC_HEAP_SIZE]; char *bss_sbrk_ptr; int bss_sbrk_did_unexec; void * bss_sbrk (ptrdiff_t request_size) { if (!bss_sbrk_ptr) { bss_sbrk_ptr = bss_sbrk_buffer; #ifdef CYGWIN sbrk (BLOCKSIZE); /* force space for fork to work */ #endif } if (!(int) request_size) { return (bss_sbrk_ptr); } else if (bss_sbrk_ptr + (int) request_size < bss_sbrk_buffer) { printf ("attempt to free too much: avail %d used %d failed request %d\n", STATIC_HEAP_SIZE, bss_sbrk_ptr - bss_sbrk_buffer, (int) request_size); exit (-1); return 0; } else if (bss_sbrk_ptr + (int) request_size > bss_sbrk_buffer + STATIC_HEAP_SIZE) { printf ("static heap exhausted: avail %d used %d failed request %d\n", STATIC_HEAP_SIZE, bss_sbrk_ptr - bss_sbrk_buffer, (int) request_size); exit (-1); return 0; } else if ((int) request_size < 0) { bss_sbrk_ptr += (int) request_size; if (debug_sheap) printf ("freed size %d\n", request_size); return bss_sbrk_ptr; } else { char *ret = bss_sbrk_ptr; if (debug_sheap) printf ("allocated 0x%08x size %d\n", ret, request_size); bss_sbrk_ptr += (int) request_size; return ret; } } void report_sheap_usage (int die_if_pure_storage_exceeded) { char buf[200]; sprintf (buf, "Static heap usage: %d of %d bytes", bss_sbrk_ptr - bss_sbrk_buffer, STATIC_HEAP_SIZE); message ("%s", buf); } /* arch-tag: 1bc386e8-71c2-4da4-b8b5-c1674a9cf926 (do not change this comment) */