Mercurial > emacs
annotate lisp/byte-run.el @ 1717:aa7d6d57504b
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'.
(FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New
accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
(VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR,
WINDOW_VERTICAL_SCROLLBAR_COLUMN,
WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros.
* window.h (struct window): New field `vertical_scrollbar'.
* xterm.h (struct x_display): vertical_scrollbars,
judge_timestamp, vertical_scrollbar_extra: New fields.
(struct scrollbar): New struct.
(VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT,
VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER,
VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER,
CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH,
PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
* frame.c (make_frame): Initialize the `can_have_scrollbars' and
`has_vertical_scrollbars' fields of the frame.
* term.c (term_init): Note that TERMCAP terminals don't support
scrollbars.
(mouse_position_hook): Document new args.
(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
* termhooks.h: Declare and document them.
(enum scrollbar_part): New type.
(struct input_event): Describe the new form of the scrollbar_click
event type. Change `part' from a Lisp_Object to an enum
scrollbar_part. Add a new field `scrollbar'.
* keyboard.c (kbd_buffer_get_event): Pass appropriate new
parameters to *mouse_position_hook, and make_lispy_movement.
* xfns.c (x_set_vertical_scrollbar): New function.
(x_figure_window_size): Use new macros to calculate frame size.
(Fx_create_frame): Note that X Windows frames do support scroll
bars. Default to "yes".
* xterm.c: #include <X11/cursorfont.h> and "window.h".
(x_vertical_scrollbar_cursor): New variable.
(x_term_init): Initialize it.
(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
variables.
(XTmouse_position): Use them to return scrollbar movement events.
Take new arguments, for that purpose.
(x_window_to_scrollbar, x_scrollbar_create,
x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
XTjudge_scrollbars, x_scrollbar_expose,
x_scrollbar_background_expose, x_scrollbar_handle_click,
x_scrollbar_handle_motion): New functions to implement scrollbars.
(x_term_init): Set the termhooks.h hooks to point to them.
(x_set_window_size): Use new macros to calculate frame size. Set
vertical_scrollbar_extra field.
(x_make_frame_visible): Use the frame accessor
FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
frame's subwindows as well.
(XTread_socket): Use new size-calculation macros from xterm.h when
processing ConfigureNotify events.
(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
PIXEL_TO_CHAR_HEIGHT macros.
* ymakefile (xdisp.o): This now depends on termhooks.h.
(xterm.o): This now depends on window.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 24 Dec 1992 06:17:18 +0000 |
| parents | 2619b7a9c11e |
| children | bd3c525fa6fc |
| rev | line source |
|---|---|
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
1 ;; byte-run.el --- byte-compiler support for inlining |
| 757 | 2 |
|
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
3 ;; Copyright (C) 1992 Free Software Foundation, Inc. |
|
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
4 |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
5 ;; Author: Jamie Zawinski <jwz@lucid.com> |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
6 ;; Hallvard Furuseth <hbf@ulrik.uio.no> |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
7 ;; Keywords: internal |
| 757 | 8 |
| 9 ;; This file is part of GNU Emacs. | |
| 10 | |
| 11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
| 12 ;; it under the terms of the GNU General Public License as published by | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
| 757 | 14 ;; any later version. |
| 15 | |
| 16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
| 17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 ;; GNU General Public License for more details. | |
| 20 | |
| 21 ;; You should have received a copy of the GNU General Public License | |
| 22 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
| 23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 24 | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
25 ;;; Commentary: |
| 757 | 26 |
| 27 ;;; interface to selectively inlining functions. | |
| 28 ;;; This only happens when source-code optimization is turned on. | |
| 29 | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
30 ;;; Code: |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
31 |
| 757 | 32 ;; Redefined in byte-optimize.el. |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
33 ;; This is not documented--it's not clear that we should promote it. |
| 757 | 34 (fset 'inline 'progn) |
| 35 (put 'inline 'lisp-indent-hook 0) | |
| 36 | |
| 37 | |
| 38 ;;; Interface to inline functions. | |
| 39 | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
40 ;; (defmacro proclaim-inline (&rest fns) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
41 ;; "Cause the named functions to be open-coded when called from compiled code. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
42 ;; They will only be compiled open-coded when byte-compile-optimize is true." |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
43 ;; (cons 'eval-and-compile |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
44 ;; (mapcar '(lambda (x) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
45 ;; (or (memq (get x 'byte-optimizer) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
46 ;; '(nil byte-compile-inline-expand)) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
47 ;; (error |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
48 ;; "%s already has a byte-optimizer, can't make it inline" |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
49 ;; x)) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
50 ;; (list 'put (list 'quote x) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
51 ;; ''byte-optimizer ''byte-compile-inline-expand)) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
52 ;; fns))) |
| 757 | 53 |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
54 ;; (defmacro proclaim-notinline (&rest fns) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
55 ;; "Cause the named functions to no longer be open-coded." |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
56 ;; (cons 'eval-and-compile |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
57 ;; (mapcar '(lambda (x) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
58 ;; (if (eq (get x 'byte-optimizer) 'byte-compile-inline-expand) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
59 ;; (put x 'byte-optimizer nil)) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
60 ;; (list 'if (list 'eq (list 'get (list 'quote x) ''byte-optimizer) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
61 ;; ''byte-compile-inline-expand) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
62 ;; (list 'put x ''byte-optimizer nil))) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
63 ;; fns))) |
| 757 | 64 |
| 65 ;; This has a special byte-hunk-handler in bytecomp.el. | |
| 66 (defmacro defsubst (name arglist &rest body) | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
67 "Define an inline function. The syntax is just like that of `defun'." |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
68 (or (memq (get name 'byte-optimizer) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
69 '(nil byte-compile-inline-expand)) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
70 (error "`%s' is a primitive" name)) |
| 757 | 71 (list 'prog1 |
| 72 (cons 'defun (cons name (cons arglist body))) | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
73 (list 'eval-and-compile |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
74 (list 'put (list 'quote name) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
75 ''byte-optimizer ''byte-compile-inline-expand)))) |
| 757 | 76 |
| 77 (defun make-obsolete (fn new) | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
78 "Make the byte-compiler warn that FUNCTION is obsolete. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
79 The warning will say that NEW should be used instead. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
80 If NEW is a string, that is the `use instead' message." |
| 757 | 81 (interactive "aMake function obsolete: \nxObsoletion replacement: ") |
| 82 (let ((handler (get fn 'byte-compile))) | |
| 83 (if (eq 'byte-compile-obsolete handler) | |
| 84 (setcar (get fn 'byte-obsolete-info) new) | |
| 85 (put fn 'byte-obsolete-info (cons new handler)) | |
| 86 (put fn 'byte-compile 'byte-compile-obsolete))) | |
| 87 fn) | |
| 88 | |
| 957 | 89 (defun make-obsolete-variable (var new) |
| 90 "Make the byte-compiler warn that VARIABLE is obsolete, | |
| 91 and NEW should be used instead. If NEW is a string, then that is the | |
| 92 `use instead' message." | |
| 93 (interactive | |
| 94 (list | |
| 95 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t))) | |
| 96 (if (equal str "") (error "")) | |
| 97 (intern str)) | |
| 98 (car (read-from-string (read-string "Obsoletion replacement: "))))) | |
| 99 (put var 'byte-obsolete-variable new) | |
| 100 var) | |
| 101 | |
| 757 | 102 (put 'dont-compile 'lisp-indent-hook 0) |
| 103 (defmacro dont-compile (&rest body) | |
| 957 | 104 "Like `progn', but the body always runs interpreted (not compiled). |
| 105 If you think you need this, you're probably making a mistake somewhere." | |
| 757 | 106 (list 'eval (list 'quote (if (cdr body) (cons 'progn body) (car body))))) |
| 107 | |
| 108 | |
| 109 ;;; interface to evaluating things at compile time and/or load time | |
| 110 ;;; these macro must come after any uses of them in this file, as their | |
| 111 ;;; definition in the file overrides the magic definitions on the | |
| 112 ;;; byte-compile-macro-environment. | |
| 113 | |
| 114 (put 'eval-when-compile 'lisp-indent-hook 0) | |
| 115 (defmacro eval-when-compile (&rest body) | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
116 "Like `progn', but evaluates the body at compile time. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
117 The result of the body appears to the compiler as a quoted constant." |
| 757 | 118 ;; Not necessary because we have it in b-c-initial-macro-environment |
| 119 ;; (list 'quote (eval (cons 'progn body))) | |
| 120 (cons 'progn body)) | |
| 121 | |
| 122 (put 'eval-and-compile 'lisp-indent-hook 0) | |
| 123 (defmacro eval-and-compile (&rest body) | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
124 "Like `progn', but evaluates the body at compile time and at load time." |
| 757 | 125 ;; Remember, it's magic. |
| 126 (cons 'progn body)) | |
| 127 | |
| 128 | |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
129 ;;; I nuked this because it's not a good idea for users to think of using it. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
130 ;;; These options are a matter of installation preference, and have nothing to |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
131 ;;; with particular source files; it's a mistake to suggest to users |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
132 ;;; they should associate these with particular source files. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
133 ;;; There is hardly any reason to change these parameters, anyway. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
134 ;;; --rms. |
| 757 | 135 |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
136 ;; (put 'byte-compiler-options 'lisp-indent-hook 0) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
137 ;; (defmacro byte-compiler-options (&rest args) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
138 ;; "Set some compilation-parameters for this file. This will affect only the |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
139 ;; file in which it appears; this does nothing when evaluated, and when loaded |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
140 ;; from a .el file. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
141 ;; |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
142 ;; Each argument to this macro must be a list of a key and a value. |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
143 ;; |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
144 ;; Keys: Values: Corresponding variable: |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
145 ;; |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
146 ;; verbose t, nil byte-compile-verbose |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
147 ;; optimize t, nil, source, byte byte-compile-optimize |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
148 ;; warnings list of warnings byte-compile-warnings |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
149 ;; Legal elements: (callargs redefine free-vars unresolved) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
150 ;; file-format emacs18, emacs19 byte-compile-compatibility |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
151 ;; |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
152 ;; For example, this might appear at the top of a source file: |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
153 ;; |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
154 ;; (byte-compiler-options |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
155 ;; (optimize t) |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
156 ;; (warnings (- free-vars)) ; Don't warn about free variables |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
157 ;; (file-format emacs19))" |
|
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
158 ;; nil) |
| 757 | 159 |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
757
diff
changeset
|
160 ;;; byte-run.el ends here |
