Mercurial > hg > xemacs-beta
view lisp/disp-table.el @ 938:0391335b65dc
[xemacs-hg @ 2002-07-31 07:14:49 by michaels]
2002-07-17 Marcus Crestani <crestani@informatik.uni-tuebingen.de>
Markus Kaltenbach <makalten@informatik.uni-tuebingen.de>
Mike Sperber <mike@xemacs.org>
configure flag to turn these changes on: --use-kkcc
First we added a dumpable flag to lrecord_implementation. It shows,
if the object is dumpable and should be processed by the dumper.
* lrecord.h (struct lrecord_implementation): added dumpable flag
(MAKE_LRECORD_IMPLEMENTATION): fitted the different makro definitions
to the new lrecord_implementation and their calls.
Then we changed mark_object, that it no longer needs a mark method for
those types that have pdump descritions.
* alloc.c:
(mark_object): If the object has a description, the new mark algorithm
is called, and the object is marked according to its description.
Otherwise it uses the mark method like before.
These procedures mark objects according to their descriptions. They
are modeled on the corresponding pdumper procedures.
(mark_with_description):
(get_indirect_count):
(structure_size):
(mark_struct_contents):
These procedures still call mark_object, this is needed while there are
Lisp_Objects without descriptions left.
We added pdump descriptions for many Lisp_Objects:
* extents.c: extent_auxiliary_description
* database.c: database_description
* gui.c: gui_item_description
* scrollbar.c: scrollbar_instance_description
* toolbar.c: toolbar_button_description
* event-stream.c: command_builder_description
* mule-charset.c: charset_description
* device-msw.c: devmode_description
* dialog-msw.c: mswindows_dialog_id_description
* eldap.c: ldap_description
* postgresql.c: pgconn_description
pgresult_description
* tooltalk.c: tooltalk_message_description
tooltalk_pattern_description
* ui-gtk.c: emacs_ffi_description
emacs_gtk_object_description
* events.c:
* events.h:
* event-stream.c:
* event-Xt.c:
* event-gtk.c:
* event-tty.c:
To write a pdump description for Lisp_Event, we converted every struct
in the union event to a Lisp_Object. So we created nine new
Lisp_Objects: Lisp_Key_Data, Lisp_Button_Data, Lisp_Motion_Data,
Lisp_Process_Data, Lisp_Timeout_Data, Lisp_Eval_Data,
Lisp_Misc_User_Data, Lisp_Magic_Data, Lisp_Magic_Eval_Data.
We also wrote makro selectors and mutators for the fields of the new
designed Lisp_Event and added everywhere these new abstractions.
We implemented XD_UNION support in (mark_with_description), so
we can describe exspecially console/device specific data with XD_UNION.
To describe with XD_UNION, we added a field to these objects, which
holds the variant type of the object. This field is initialized in
the appendant constructor. The variant is an integer, it has also to
be described in an description, if XD_UNION is used.
XD_UNION is used in following descriptions:
* console.c: console_description
(get_console_variant): returns the variant
(create_console): added variant initialization
* console.h (console_variant): the different console types
* console-impl.h (struct console): added enum console_variant contype
* device.c: device_description
(Fmake_device): added variant initialization
* device-impl.h (struct device): added enum console_variant devtype
* objects.c: image_instance_description
font_instance_description
(Fmake_color_instance): added variant initialization
(Fmake_font_instance): added variant initialization
* objects-impl.h (struct Lisp_Color_Instance): added color_instance_type
* objects-impl.h (struct Lisp_Font_Instance): added font_instance_type
* process.c: process_description
(make_process_internal): added variant initialization
* process.h (process_variant): the different process types
author | michaels |
---|---|
date | Wed, 31 Jul 2002 07:14:49 +0000 |
parents | 262b8bb4a523 |
children | e214ff9f9507 3742ea8250b5 |
line wrap: on
line source
;;; disp-table.el --- functions for dealing with char tables. ;; Copyright (C) 1987, 1994, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1995 Sun Microsystems. ;; Author: Howard Gayle ;; Maintainer: XEmacs Development Team ;; Keywords: i18n, internal ;; 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 synched with FSF. ;;; Commentary: ;; #### Need lots of work. make-display-table depends on a value ;; that is a define in the C code. Maybe we should just move the ;; function into C. ;; #### display-tables-as-vectors is really evil and a big pain in ;; the ass. ;; Rewritten for XEmacs July 1995, Ben Wing. ;;; Code: (defun describe-display-table (dt) "Describe the display table DT in a help buffer." (with-displaying-help-buffer (lambda () (princ "\nCharacter display glyph sequences:\n") (save-excursion (let ((vector (make-vector 256 nil)) (i 0)) (while (< i 256) (aset vector i (aref dt i)) (incf i)) ;; FSF calls `describe-vector' here, but it is so incredibly ;; lame a function for that name that I cannot bring myself ;; to porting it. Here is what `describe-vector' does: (terpri) (let ((old (aref vector 0)) (oldpos 0) (i 1) str) (while (<= i 256) (when (or (= i 256) (not (equal old (aref vector i)))) (if (eq oldpos (1- i)) (princ (format "%s\t\t%s\n" (single-key-description (int-char oldpos)) old)) (setq str (format "%s - %s" (single-key-description (int-char oldpos)) (single-key-description (int-char (1- i))))) (princ str) (princ (make-string (max (- 2 (/ (length str) tab-width)) 1) ?\t)) (princ old) (terpri)) (or (= i 256) (setq old (aref vector i) oldpos i))) (incf i)))))))) ;;;###autoload (defun describe-current-display-table (&optional domain) "Describe the display table in use in the selected window and buffer." (interactive) (or domain (setq domain (selected-window))) (let ((disptab (specifier-instance current-display-table domain))) (if disptab (describe-display-table disptab) (message "No display table")))) ;;;###autoload (defun make-display-table () "Return a new, empty display table." (make-vector 256 nil)) ;; #### we need a generic frob-specifier function. ;; #### this also needs to be redone like frob-face-property. ;; Let me say one more time how much dynamic scoping sucks. (defun frob-display-table (fdt-function fdt-locale) (or fdt-locale (setq fdt-locale 'global)) (or (specifier-spec-list current-display-table fdt-locale) (add-spec-to-specifier current-display-table (make-display-table) fdt-locale)) (add-spec-list-to-specifier current-display-table (list (cons fdt-locale (mapcar (lambda (fdt-x) (funcall fdt-function (cdr fdt-x)) fdt-x) (cdar (specifier-spec-list current-display-table fdt-locale))))))) (defun standard-display-8bit-1 (dt l h) (while (<= l h) (aset dt l (char-to-string l)) (setq l (1+ l)))) ;;;###autoload (defun standard-display-8bit (l h &optional locale) "Display characters in the range L to H literally." (frob-display-table (lambda (x) (standard-display-8bit-1 x l h)) locale)) (defun standard-display-default-1 (dt l h) (while (<= l h) (aset dt l nil) (setq l (1+ l)))) ;;;###autoload (defun standard-display-default (l h &optional locale) "Display characters in the range L to H using the default notation." (frob-display-table (lambda (x) (standard-display-default-1 x l h)) locale)) ;;;###autoload (defun standard-display-ascii (c s &optional locale) "Display character C using printable string S." (frob-display-table (lambda (x) (aset x c s)) locale)) ;;; #### should frob in a 'tty locale. ;;;###autoload (defun standard-display-g1 (c sc &optional locale) "Display character C as character SC in the g1 character set. This function assumes that your terminal uses the SO/SI characters; it is meaningless for an X frame." (frob-display-table (lambda (x) (aset x c (concat "\016" (char-to-string sc) "\017"))) locale)) ;;; #### should frob in a 'tty locale. ;;;###autoload (defun standard-display-graphic (c gc &optional locale) "Display character C as character GC in graphics character set. This function assumes VT100-compatible escapes; it is meaningless for an X frame." (frob-display-table (lambda (x) (aset x c (concat "\e(0" (char-to-string gc) "\e(B"))) locale)) ;;; #### should frob in a 'tty locale. ;;; #### the FSF equivalent of this makes this character be displayed ;;; in the 'underline face. There's no current way to do this with ;;; XEmacs display tables. ;;;###autoload (defun standard-display-underline (c uc &optional locale) "Display character C as character UC plus underlining." (frob-display-table (lambda (x) (aset x c (concat "\e[4m" (char-to-string uc) "\e[m"))) locale)) ;;;###autoload (defun standard-display-european (arg &optional locale) "Toggle display of European characters encoded with ISO 8859. When enabled, characters in the range of 160 to 255 display not as octal escapes, but as accented characters. With prefix argument, enable European character display iff arg is positive." (interactive "P") (frob-display-table (lambda (x) (if (or (<= (prefix-numeric-value arg) 0) (and (null arg) (equal (aref x 160) (char-to-string 160)))) (standard-display-default-1 x 160 255) (standard-display-8bit-1 x 160 255))) locale)) (provide 'disp-table) ;;; disp-table.el ends here