Mercurial > hg > xemacs-beta
annotate src/console-stream.c @ 5353:38e24b8be4ea
Improve the lexical scoping in #'block, #'return-from.
lisp/ChangeLog addition:
2011-02-07 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el:
* bytecomp.el (byte-compile-initial-macro-environment):
Shadow `block', `return-from' here, we implement them differently
when byte-compiling.
* bytecomp.el (byte-compile-active-blocks): New.
* bytecomp.el (byte-compile-block-1): New.
* bytecomp.el (byte-compile-return-from-1): New.
* bytecomp.el (return-from-1): New.
* bytecomp.el (block-1): New.
These are two aliases that exist to have their own associated
byte-compile functions, which functions implement `block' and
`return-from'.
* cl-extra.el (cl-macroexpand-all):
Fix a bug here when macros in the environment have been compiled.
* cl-macs.el (block):
* cl-macs.el (return):
* cl-macs.el (return-from):
Be more careful about lexical scope in these macros.
* cl.el:
* cl.el ('cl-block-wrapper): Removed.
* cl.el ('cl-block-throw): Removed.
These aren't needed in code generated by this XEmacs. They
shouldn't be needed in code generated by XEmacs 21.4, but if it
turns out the packages do need them, we can put them back.
2011-01-30 Mike Sperber <mike@xemacs.org>
* font-lock.el (font-lock-fontify-pending-extents): Don't fail if
`font-lock-mode' is unset, which can happen in the middle of
`revert-buffer'.
2011-01-23 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (delete):
* cl-macs.el (delq):
* cl-macs.el (remove):
* cl-macs.el (remq):
Don't use the compiler macro if these functions were given the
wrong number of arguments, as happens in lisp-tests.el.
* cl-seq.el (remove, remq): Removed.
I added these to subr.el, and forgot to remove them from here.
2011-01-22 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-setq, byte-compile-set):
Remove kludge allowing keywords' values to be set, all the code
that does that is gone.
* cl-compat.el (elt-satisfies-test-p):
* faces.el (set-face-parent):
* faces.el (face-doc-string):
* gtk-font-menu.el:
* gtk-font-menu.el (gtk-reset-device-font-menus):
* msw-font-menu.el:
* msw-font-menu.el (mswindows-reset-device-font-menus):
* package-get.el (package-get-installedp):
* select.el (select-convert-from-image-data):
* sound.el:
* sound.el (load-sound-file):
* x-font-menu.el (x-reset-device-font-menus-core):
Don't quote keywords, they're self-quoting, and the
win from backward-compatibility is sufficiently small now that the
style problem overrides it.
2011-01-22 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (block, return-from): Require that NAME be a symbol
in these macros, as always documented in the #'block docstring and
as required by Common Lisp.
* descr-text.el (unidata-initialize-unihan-database):
Correct the use of non-symbols in #'block and #'return-from in
this function.
2011-01-15 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (concatenate): Accept more complicated TYPEs in this
function, handing the sequences over to #'coerce if we don't
understand them here.
* cl-macs.el (inline): Don't proclaim #'concatenate as inline, its
compiler macro is more useful than doing that.
2011-01-11 Aidan Kehoe <kehoea@parhasard.net>
* subr.el (delete, delq, remove, remq): Move #'remove, #'remq
here, they don't belong in cl-seq.el; move #'delete, #'delq here
from fns.c, implement them in terms of #'delete*, allowing support
for sequences generally.
* update-elc.el (do-autoload-commands): Use #'delete*, not #'delq
here, now the latter's no longer dumped.
* cl-macs.el (delete, delq): Add compiler macros transforming
#'delete and #'delq to #'delete* calls.
2011-01-10 Aidan Kehoe <kehoea@parhasard.net>
* dialog.el (make-dialog-box): Correct a misplaced parenthesis
here, thank you Mats Lidell in 87zkr9gqrh.fsf@mail.contactor.se !
2011-01-02 Aidan Kehoe <kehoea@parhasard.net>
* dialog.el (make-dialog-box):
* list-mode.el (display-completion-list):
These functions used to use cl-parsing-keywords; change them to
use defun* instead, fixing the build. (Not sure what led to me
not including this change in d1b17a33450b!)
2011-01-02 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (define-star-compiler-macros):
Make sure the form has ITEM and LIST specified before attempting
to change to calls with explicit tests; necessary for some tests
in lisp-tests.el to compile correctly.
(stable-union, stable-intersection): Add compiler macros for these
functions, in the same way we do for most of the other functions
in cl-seq.el.
2011-01-01 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (dolist, dotimes, do-symbols, macrolet)
(symbol-macrolet):
Define these macros with defmacro* instead of parsing the argument
list by hand, for the sake of style and readability; use backquote
where appropriate, instead of calling #'list and and friends, for
the same reason.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* x-misc.el (device-x-display):
Provide this function, documented in the Lispref for years, but
not existing previously. Thank you Julian Bradfield, thank you
Jeff Mincy.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* cl-seq.el:
Move the heavy lifting from this file to C. Dump the
cl-parsing-keywords macro, but don't use defun* for the functions
we define that do take keywords, dynamic scope lossage makes that
not practical.
* subr.el (sort, fillarray): Move these aliases here.
(map-plist): #'nsublis is now built-in, but at this point #'eql
isn't necessarily available as a test; use #'eq.
* obsolete.el (cl-delete-duplicates): Make this available for old
compiler macros and old code.
(memql): Document that this is equivalent to #'member*, and worse.
* cl.el (adjoin, subst): Removed. These are in C.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* simple.el (assoc-ignore-case): Remove a duplicate definition of
this function (it's already in subr.el).
* iso8859-1.el (char-width):
On non-Mule, make this function equivalent to that produced by
(constantly 1), but preserve its docstring.
* subr.el (subst-char-in-string): Define this in terms of
#'substitute, #'nsubstitute.
(string-width): Define this using #'reduce and #'char-width.
(char-width): Give this a simpler definition, it makes far more
sense to check for mule at load time and redefine, as we do in
iso8859-1.el.
(store-substring): Implement this in terms of #'replace, now
#'replace is cheap.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* update-elc.el (lisp-files-needed-for-byte-compilation)
(lisp-files-needing-early-byte-compilation):
cl-macs belongs in the former, not the latter, it is as
fundamental as bytecomp.el.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* cl.el:
Provde the Common Lisp program-error, type-error as error
symbols. This doesn't nearly go far enough for anyone using the
Common Lisp errors.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (delete-duplicates):
If the form has an incorrect number of arguments, don't attempt a
compiler macroexpansion.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (cl-safe-expr-p):
Forms that start with the symbol lambda are also safe.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (= < > <= >=):
For these functions' compiler macros, the optimisation is safe
even if the first and the last arguments have side effects, since
they're only used the once.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (inline-side-effect-free-compiler-macros):
Unroll a loop here at macro-expansion time, so these compiler
macros are compiled. Use #'eql instead of #'eq in a couple of
places for better style.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (notany, notevery): Avoid some dynamic scope
stupidity with local variable names in these functions, when they
weren't prefixed with cl-; go into some more detail in the doc
strings.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (side-effect-free-fns): #'remove, #'remq are
free of side-effects.
(side-effect-and-error-free-fns):
Drop dot, dot-marker from the list.
2010-11-17 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (coerce):
In the argument list, name the first argument OBJECT, not X; the
former name was always used in the doc string and is clearer.
Handle vector type specifications which include the length of the
target sequence, error if there's a mismatch.
* cl-macs.el (cl-make-type-test): Handle type specifications
starting with the symbol 'eql.
2010-11-14 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (eql): Don't remove the byte-compile property of this
symbol. That was necessary to override a bug in bytecomp.el where
#'eql was confused with #'eq, which bug we no longer have.
If neither expression is constant, don't attempt to handle the
expression in this compiler macro, leave it to byte-compile-eql,
which produces better code anyway.
* bytecomp.el (eq): #'eql is not the function associated with the
byte-eq byte code.
(byte-compile-eql): Add an explicit compile method for this
function, for cases where the cl-macs compiler macro hasn't
reduced it to #'eq or #'equal.
2010-10-25 Aidan Kehoe <kehoea@parhasard.net>
Add compiler macros and compilation sanity-checking for various
functions that take keywords.
* byte-optimize.el (side-effect-free-fns): #'symbol-value is
side-effect free and not error free.
* bytecomp.el (byte-compile-normal-call): Check keyword argument
lists for sanity; store information about the positions where
keyword arguments start using the new byte-compile-keyword-start
property.
* cl-macs.el (cl-const-expr-val): Take a new optional argument,
cl-not-constant, defaulting to nil, in this function; return it if
the expression is not constant.
(cl-non-fixnum-number-p): Make this into a separate function, we
want to pass it to #'every.
(eql): Use it.
(define-star-compiler-macros): Use the same code to generate the
member*, assoc* and rassoc* compiler macros; special-case some
code in #'add-to-list in subr.el.
(remove, remq): Add compiler macros for these two functions, in
preparation for #'remove being in C.
(define-foo-if-compiler-macros): Transform (remove-if-not ...) calls to
(remove ... :if-not) at compile time, which will be a real win
once the latter is in C.
(define-substitute-if-compiler-macros)
(define-subst-if-compiler-macros): Similarly for these functions.
(delete-duplicates): Change this compiler macro to use
#'plists-equal; if we don't have information about the type of
SEQUENCE at compile time, don't bother attempting to inline the
call, the function will be in C soon enough.
(equalp): Remove an old commented-out compiler macro for this, if
we want to see it it's in version control.
(subst-char-in-string): Transform this to a call to nsubstitute or
nsubstitute, if that is appropriate.
* cl.el (ldiff): Don't call setf here, this makes for a load-time
dependency problem in cl-macs.el
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* term/vt100.el:
Refer to XEmacs, not GNU Emacs, in permissions.
* term/bg-mouse.el:
* term/sup-mouse.el:
Put copyright notice in canonical "Copyright DATE AUTHOR" form.
Refer to XEmacs, not GNU Emacs, in permissions.
* site-load.el:
Add permission boilerplate.
* mule/canna-leim.el:
* alist.el:
Refer to XEmacs, not APEL/this program, in permissions.
* mule/canna-leim.el:
Remove my copyright, I've assigned it to the FSF.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* gtk.el:
* gtk-widget-accessors.el:
* gtk-package.el:
* gtk-marshal.el:
* gtk-compose.el:
* gnome.el:
Add copyright notice based on internal evidence.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* easymenu.el: Add reference to COPYING to permission notice.
* gutter.el:
* gutter-items.el:
* menubar-items.el:
Fix typo "Xmacs" in permissions notice.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* auto-save.el:
* font.el:
* fontconfig.el:
* mule/kinsoku.el:
Add "part of XEmacs" text to permission notice.
2010-10-14 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (side-effect-free-fns):
* cl-macs.el (remf, getf):
* cl-extra.el (tailp, cl-set-getf, cl-do-remf):
* cl.el (ldiff, endp):
Tighten up Common Lisp compatibility for #'ldiff, #'endp, #'tailp;
add circularity checking for the first two.
#'cl-set-getf and #'cl-do-remf were Lisp implementations of
#'plist-put and #'plist-remprop; change the names to aliases,
changes the macros that use them to using #'plist-put and
#'plist-remprop directly.
2010-10-12 Aidan Kehoe <kehoea@parhasard.net>
* abbrev.el (fundamental-mode-abbrev-table, global-abbrev-table):
Create both these abbrev tables using the usual
#'define-abbrev-table calls, rather than attempting to
special-case them.
* cl-extra.el: Force cl-macs to be loaded here, if cl-extra.el is
being loaded interpreted. Previously other, later files would
redundantly call (load "cl-macs") when interpreted, it's more
reasonable to do it here, once.
* cmdloop.el (read-quoted-char-radix): Use defcustom here, we
don't have any dump-order dependencies that would prevent that.
* custom.el (eval-when-compile): Don't load cl-macs when
interpreted or when byte-compiling, rely on cl-extra.el in the
former case and the appropriate entry in bytecomp-load-hook in the
latter. Get rid of custom-declare-variable-list, we have no
dump-time dependencies that would require it.
* faces.el (eval-when-compile): Don't load cl-macs when
interpreted or when byte-compiling.
* packages.el: Remove some inaccurate comments.
* post-gc.el (cleanup-simple-finalizers): Use #'delete-if-not
here, now the order of preloaded-file-list has been changed to
make it available.
* subr.el (custom-declare-variable-list): Remove. No need for it.
Also remove a stub define-abbrev-table from this file, given the
current order of preloaded-file-list there's no need for it.
2010-10-10 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are
also constant.
(byte-compile-initial-macro-environment): In #'the, if FORM is
constant and does not match TYPE, warn at byte-compile time.
2010-10-10 Aidan Kehoe <kehoea@parhasard.net>
* backquote.el (bq-vector-contents, bq-list*): Remove; the former
is equivalent to (append VECTOR nil), the latter to (list* ...).
(bq-process-2): Use (append VECTOR nil) instead of using
#'bq-vector-contents to convert to a list.
(bq-process-1): Now we use list* instead of bq-list
* subr.el (list*): Moved from cl.el, since it is now required to
be available the first time a backquoted form is encountered.
* cl.el (list*): Move to subr.el.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* test-harness.el (Check-Message):
Add an omitted comma here, thank you the buildbot.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* hash-table.el (hash-table-key-list, hash-table-value-list)
(hash-table-key-value-alist, hash-table-key-value-plist):
Remove some useless #'nreverse calls in these files; our hash
tables have no order, it's not helpful to pretend they do.
* behavior.el (read-behavior):
Do the same in this file, in some code evidently copied from
hash-table.el.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* info.el (Info-insert-dir):
* format.el (format-deannotate-region):
* files.el (cd, save-buffers-kill-emacs):
Use #'some, #'every and related functions for applying boolean
operations to lists, instead of rolling our own ones that cons and
don't short-circuit.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-initial-macro-environment):
* cl-macs.el (the):
Rephrase the docstring, make its implementation when compiling
files a little nicer.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* descr-text.el (unidata-initialize-unicodedata-database)
(unidata-initialize-unihan-database, describe-char-unicode-data)
(describe-char-unicode-data):
Wrap calls to the database functions with (with-fboundp ...),
avoiding byte compile warnings on builds without support for the
database functions.
(describe-char): (reduce #'max ...), not (apply #'max ...), no
need to cons needlessly.
(describe-char): Remove a redundant lambda wrapping
#'extent-properties.
(describe-char-unicode-data): Call #'nsubst when replacing "" with
nil in the result of #'split-string, instead of consing inside
mapcar.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* x-faces.el (x-available-font-sizes):
* specifier.el (let-specifier):
* package-ui.el (pui-add-required-packages):
* msw-faces.el (mswindows-available-font-sizes):
* modeline.el (modeline-minor-mode-menu):
* minibuf.el (minibuf-directory-files):
Replace the O2N (delq nil (mapcar (lambda (W) (and X Y)) Z)) with
the ON (mapcan (lambda (W) (and X (list Y))) Z) in these files.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (= < > <= >=):
When these functions are handed more than two arguments, and those
arguments have no side effects, transform to a series of two
argument calls, avoiding funcall in the byte-compiled code.
* mule/mule-cmds.el (finish-set-language-environment):
Take advantage of this change in a function called 256 times at
startup.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-function-form, byte-compile-quote)
(byte-compile-quote-form):
Warn at compile time, and error at runtime, if a (quote ...) or a
(function ...) form attempts to quote more than one object.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (byte-optimize-apply): Transform (apply 'nconc
(mapcar ...)) to (mapcan ...); warn about use of the first idiom.
* update-elc.el (do-autoload-commands):
* packages.el (packages-find-package-library-path):
* frame.el (frame-list):
* extents.el (extent-descendants):
* etags.el (buffer-tag-table-files):
* dumped-lisp.el (preloaded-file-list):
* device.el (device-list):
* bytecomp-runtime.el (proclaim-inline, proclaim-notinline)
Use #'mapcan, not (apply #'nconc (mapcar ...) in all these files.
* bytecomp-runtime.el (eval-when-compile, eval-and-compile):
In passing, mention that these macros also evaluate the body when
interpreted.
tests/ChangeLog addition:
2011-02-07 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Test lexical scope for `block', `return-from'; add a
Known-Bug-Expect-Failure for a contorted example that fails when
byte-compiled.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 07 Feb 2011 12:01:24 +0000 |
parents | 7be849cb8828 |
children | 308d34e9f07d |
rev | line source |
---|---|
428 | 1 /* Stream device functions. |
2 Copyright (C) 1995 Free Software Foundation, Inc. | |
1279 | 3 Copyright (C) 1996, 2001, 2002, 2003 Ben Wing. |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
7 XEmacs is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2, or (at your option) any | |
10 later version. | |
11 | |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with XEmacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
21 | |
22 /* Synched up with: Not in FSF. */ | |
23 | |
24 /* This file has been Mule-ized. */ | |
25 | |
26 /* Written by Ben Wing. */ | |
27 | |
28 #include <config.h> | |
29 #include "lisp.h" | |
30 | |
872 | 31 #include "device-impl.h" |
428 | 32 #include "events.h" |
872 | 33 #include "frame-impl.h" |
428 | 34 #include "redisplay.h" |
35 #include "sysdep.h" | |
800 | 36 #include "window.h" |
37 | |
872 | 38 #include "console-stream-impl.h" |
800 | 39 #include "console-tty.h" |
40 | |
428 | 41 #include "sysfile.h" |
42 | |
43 DEFINE_CONSOLE_TYPE (stream); | |
44 | |
45 Lisp_Object Vterminal_console; | |
46 Lisp_Object Vterminal_device; | |
47 Lisp_Object Vterminal_frame; | |
48 | |
49 Lisp_Object Vstdio_str; | |
50 | |
1204 | 51 static const struct memory_description stream_console_data_description_1 [] = { |
52 { XD_LISP_OBJECT, offsetof (struct stream_console, instream) }, | |
53 { XD_END } | |
54 }; | |
55 | |
3092 | 56 #ifdef NEW_GC |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
57 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("stream-console", stream_console, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
58 0, stream_console_data_description_1, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
59 Lisp_Stream_Console); |
3092 | 60 #else /* not NEW_GC */ |
1204 | 61 const struct sized_memory_description stream_console_data_description = { |
62 sizeof (struct stream_console), stream_console_data_description_1 | |
63 }; | |
3092 | 64 #endif /* not NEW_GC */ |
1204 | 65 |
428 | 66 static void |
2286 | 67 stream_init_console (struct console *con, Lisp_Object UNUSED (params)) |
428 | 68 { |
69 Lisp_Object tty = CONSOLE_CONNECTION (con); | |
70 struct stream_console *stream_con; | |
71 | |
3092 | 72 #ifdef NEW_GC |
73 if (CONSOLE_STREAM_DATA (con) == NULL) | |
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
74 CONSOLE_STREAM_DATA (con) = |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
75 XSTREAM_CONSOLE (ALLOC_NORMAL_LISP_OBJECT (stream_console)); |
3092 | 76 #else /* not NEW_GC */ |
428 | 77 if (CONSOLE_STREAM_DATA (con) == NULL) |
1204 | 78 CONSOLE_STREAM_DATA (con) = xnew_and_zero (struct stream_console); |
3092 | 79 #endif /* not NEW_GC */ |
428 | 80 |
81 stream_con = CONSOLE_STREAM_DATA (con); | |
82 | |
1204 | 83 stream_con->instream = Qnil; |
428 | 84 |
85 /* Open the specified console */ | |
86 if (NILP (tty) || internal_equal (tty, Vstdio_str, 0)) | |
87 { | |
88 stream_con->in = stdin; | |
89 stream_con->out = stdout; | |
90 stream_con->err = stderr; | |
91 } | |
92 else | |
93 { | |
94 CHECK_STRING (tty); | |
95 stream_con->in = stream_con->out = stream_con->err = | |
442 | 96 /* #### We don't currently do coding-system translation on |
97 this descriptor. */ | |
771 | 98 qxe_fopen (XSTRING_DATA (tty), READ_PLUS_TEXT); |
428 | 99 if (!stream_con->in) |
563 | 100 signal_error (Qio_error, "Unable to open tty", tty); |
428 | 101 } |
102 } | |
103 | |
104 static void | |
2286 | 105 stream_init_device (struct device *d, Lisp_Object UNUSED (params)) |
428 | 106 { |
107 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); | |
108 | |
109 DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->in); | |
110 DEVICE_OUTFD (d) = fileno (CONSOLE_STREAM_DATA (con)->out); | |
111 init_baud_rate (d); | |
112 init_one_device (d); | |
113 } | |
114 | |
115 static int | |
2286 | 116 stream_initially_selected_for_input (struct console *UNUSED (con)) |
428 | 117 { |
118 return noninteractive && initialized; | |
119 } | |
120 | |
121 extern int stdout_needs_newline; | |
122 | |
123 static void | |
124 stream_delete_console (struct console *con) | |
125 { | |
126 struct stream_console *stream_con = CONSOLE_STREAM_DATA (con); | |
127 if (stream_con) | |
128 { | |
129 if (/* stream_con->needs_newline */ | |
130 stdout_needs_newline) /* #### clean this up */ | |
131 { | |
132 fputc ('\n', stream_con->out); | |
133 fflush (stream_con->out); | |
134 } | |
135 if (stream_con->in != stdin) | |
771 | 136 retry_fclose (stream_con->in); |
428 | 137 |
3263 | 138 #ifndef NEW_GC |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
139 xfree (stream_con); |
3092 | 140 #endif /* not NEW_GC */ |
428 | 141 CONSOLE_STREAM_DATA (con) = NULL; |
142 } | |
143 } | |
144 | |
145 Lisp_Object | |
146 stream_semi_canonicalize_console_connection (Lisp_Object connection, | |
2286 | 147 Error_Behavior UNUSED (errb)) |
428 | 148 { |
149 return NILP (connection) ? Vstdio_str : connection; | |
150 } | |
151 | |
152 Lisp_Object | |
153 stream_canonicalize_console_connection (Lisp_Object connection, | |
578 | 154 Error_Behavior errb) |
428 | 155 { |
156 if (NILP (connection) || internal_equal (connection, Vstdio_str, 0)) | |
157 return Vstdio_str; | |
158 | |
159 if (!ERRB_EQ (errb, ERROR_ME)) | |
160 { | |
161 if (!STRINGP (connection)) | |
162 return Qunbound; | |
163 } | |
164 else | |
165 CHECK_STRING (connection); | |
166 | |
167 return Ffile_truename (connection, Qnil); | |
168 } | |
169 | |
170 Lisp_Object | |
171 stream_semi_canonicalize_device_connection (Lisp_Object connection, | |
578 | 172 Error_Behavior errb) |
428 | 173 { |
174 return stream_semi_canonicalize_console_connection (connection, errb); | |
175 } | |
176 | |
177 Lisp_Object | |
178 stream_canonicalize_device_connection (Lisp_Object connection, | |
578 | 179 Error_Behavior errb) |
428 | 180 { |
181 return stream_canonicalize_console_connection (connection, errb); | |
182 } | |
183 | |
184 | |
185 static void | |
2286 | 186 stream_init_frame_1 (struct frame *f, Lisp_Object UNUSED (props), |
771 | 187 int frame_name_is_defaulted) |
428 | 188 { |
189 #if 0 | |
190 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
191 if (!NILP (DEVICE_FRAME_LIST (d))) | |
563 | 192 invalid_operation ("Only one frame allowed on stream devices", Qunbound); |
428 | 193 #endif |
771 | 194 if (frame_name_is_defaulted) |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4928
diff
changeset
|
195 f->name = build_ascstring ("stream"); |
428 | 196 f->height = 80; |
197 f->width = 24; | |
198 f->visible = 0; /* so redisplay doesn't try to do anything */ | |
199 } | |
200 | |
201 | |
202 static int | |
4928
ea701c23ed84
change text_width method to take a window, in preparation for unicode-internal changes
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
203 stream_text_width (struct window *UNUSED (w), |
2286 | 204 struct face_cachel *UNUSED (cachel), |
205 const Ichar *UNUSED (str), Charcount len) | |
428 | 206 { |
207 return len; | |
208 } | |
209 | |
210 static int | |
2286 | 211 stream_left_margin_width (struct window *UNUSED (w)) |
428 | 212 { |
213 return 0; | |
214 } | |
215 | |
216 static int | |
2286 | 217 stream_right_margin_width (struct window *UNUSED (w)) |
428 | 218 { |
219 return 0; | |
220 } | |
221 | |
222 static int | |
223 stream_divider_height (void) | |
224 { | |
225 return 1; | |
226 } | |
227 | |
228 static int | |
229 stream_eol_cursor_width (void) | |
230 { | |
231 return 1; | |
232 } | |
233 | |
1279 | 234 /* We used to try and check for redisplaying on stream devices (e.g. in |
235 redisplay_device(), and beg out if so. However, we didn't always manage | |
236 completely. Now we do manage completely, and to verify this we abort if | |
237 we try to display a stream device. This might fix some crashes I've | |
238 been getting in pdump -- the only difference between crash and non-crash | |
239 is a few changes to the redisplay critical-section handling. */ | |
240 | |
241 static void | |
2286 | 242 stream_window_output_begin (struct window *UNUSED (w)) |
1279 | 243 { |
2500 | 244 ABORT (); |
1279 | 245 } |
246 | |
247 static void | |
2286 | 248 stream_window_output_end (struct window *UNUSED (w)) |
1279 | 249 { |
2500 | 250 ABORT (); |
1279 | 251 } |
252 | |
253 static void | |
2286 | 254 stream_frame_output_begin (struct frame *UNUSED (f)) |
1279 | 255 { |
2500 | 256 ABORT (); |
1279 | 257 } |
258 | |
259 static void | |
2286 | 260 stream_frame_output_end (struct frame *UNUSED (f)) |
1279 | 261 { |
2500 | 262 ABORT (); |
1279 | 263 } |
264 | |
428 | 265 static void |
2286 | 266 stream_output_display_block (struct window *UNUSED (w), |
267 struct display_line *UNUSED (dl), | |
268 int UNUSED (block), int UNUSED (start), | |
269 int UNUSED (end), int UNUSED (start_pixpos), | |
270 int UNUSED (cursor_start), | |
271 int UNUSED (cursor_width), | |
272 int UNUSED (cursor_height)) | |
428 | 273 { |
2500 | 274 ABORT (); |
428 | 275 } |
276 | |
277 static void | |
2286 | 278 stream_clear_region (Lisp_Object UNUSED (window), struct device* UNUSED (d), |
279 struct frame *UNUSED (f), face_index UNUSED (findex), | |
280 int UNUSED (x), int UNUSED (y), int UNUSED (width), | |
281 int UNUSED (height), Lisp_Object UNUSED (fcolor), | |
282 Lisp_Object UNUSED (bcolor), | |
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
4976
diff
changeset
|
283 Lisp_Object UNUSED (background_pixmap), |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
4976
diff
changeset
|
284 Lisp_Object UNUSED (background_placement)) |
428 | 285 { |
2500 | 286 ABORT (); |
428 | 287 } |
288 | |
289 static int | |
2286 | 290 stream_flash (struct device *UNUSED (d)) |
428 | 291 { |
292 return 0; /* sorry can't do it */ | |
293 } | |
294 | |
295 static void | |
2286 | 296 stream_ring_bell (struct device *d, int UNUSED (volume), int UNUSED (pitch), |
297 int UNUSED (duration)) | |
428 | 298 { |
299 struct console *c = XCONSOLE (DEVICE_CONSOLE (d)); | |
826 | 300 /* Don't output ^G when not a TTY -- in particular, under MS Windows, ^G |
301 is interpreted as bell by the console, but not when running under | |
302 VC++. Probably this would be the same under Unix. */ | |
303 if (isatty (fileno (CONSOLE_STREAM_DATA (c)->out))) | |
304 { | |
305 fputc (07, CONSOLE_STREAM_DATA (c)->out); | |
306 fflush (CONSOLE_STREAM_DATA (c)->out); | |
307 } | |
428 | 308 } |
309 | |
310 | |
311 /************************************************************************/ | |
312 /* initialization */ | |
313 /************************************************************************/ | |
314 | |
315 void | |
316 console_type_create_stream (void) | |
317 { | |
318 INITIALIZE_CONSOLE_TYPE (stream, "stream", "console-stream-p"); | |
319 | |
320 /* console methods */ | |
321 CONSOLE_HAS_METHOD (stream, init_console); | |
322 CONSOLE_HAS_METHOD (stream, initially_selected_for_input); | |
323 CONSOLE_HAS_METHOD (stream, delete_console); | |
324 CONSOLE_HAS_METHOD (stream, canonicalize_console_connection); | |
325 CONSOLE_HAS_METHOD (stream, canonicalize_device_connection); | |
326 CONSOLE_HAS_METHOD (stream, semi_canonicalize_console_connection); | |
327 CONSOLE_HAS_METHOD (stream, semi_canonicalize_device_connection); | |
328 | |
329 /* device methods */ | |
330 CONSOLE_HAS_METHOD (stream, init_device); | |
331 | |
332 /* frame methods */ | |
333 CONSOLE_HAS_METHOD (stream, init_frame_1); | |
334 | |
335 /* redisplay methods */ | |
1279 | 336 CONSOLE_HAS_METHOD (stream, text_width); |
428 | 337 CONSOLE_HAS_METHOD (stream, left_margin_width); |
338 CONSOLE_HAS_METHOD (stream, right_margin_width); | |
339 CONSOLE_HAS_METHOD (stream, divider_height); | |
340 CONSOLE_HAS_METHOD (stream, eol_cursor_width); | |
1279 | 341 CONSOLE_HAS_METHOD (stream, window_output_begin); |
342 CONSOLE_HAS_METHOD (stream, window_output_end); | |
343 CONSOLE_HAS_METHOD (stream, frame_output_begin); | |
344 CONSOLE_HAS_METHOD (stream, frame_output_end); | |
345 CONSOLE_HAS_METHOD (stream, output_display_block); | |
428 | 346 CONSOLE_HAS_METHOD (stream, clear_region); |
347 CONSOLE_HAS_METHOD (stream, flash); | |
348 CONSOLE_HAS_METHOD (stream, ring_bell); | |
349 } | |
350 | |
351 void | |
352 reinit_console_type_create_stream (void) | |
353 { | |
354 REINITIALIZE_CONSOLE_TYPE (stream); | |
355 } | |
356 | |
357 void | |
358 vars_of_console_stream (void) | |
359 { | |
360 DEFVAR_LISP ("terminal-console", &Vterminal_console /* | |
444 | 361 The initial console object, which represents XEmacs' stdout. |
428 | 362 */ ); |
363 Vterminal_console = Qnil; | |
364 | |
365 DEFVAR_LISP ("terminal-device", &Vterminal_device /* | |
444 | 366 The initial device object, which represents XEmacs' stdout. |
428 | 367 */ ); |
368 Vterminal_device = Qnil; | |
369 | |
370 DEFVAR_LISP ("terminal-frame", &Vterminal_frame /* | |
444 | 371 The initial frame object, which represents XEmacs' stdout. |
428 | 372 */ ); |
373 Vterminal_frame = Qnil; | |
374 | |
375 /* Moved from console-tty.c */ | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4928
diff
changeset
|
376 Vstdio_str = build_ascstring ("stdio"); |
428 | 377 staticpro (&Vstdio_str); |
378 } | |
379 | |
380 #ifndef PDUMP | |
381 void | |
2342 | 382 init_console_stream (int UNUSED (reinit)) |
428 | 383 { |
384 /* This function can GC */ | |
385 if (!initialized) | |
386 { | |
387 Vterminal_device = Fmake_device (Qstream, Qnil, Qnil); | |
388 Vterminal_console = Fdevice_console (Vterminal_device); | |
389 Vterminal_frame = Fmake_frame (Qnil, Vterminal_device); | |
390 minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window; | |
391 } | |
392 else | |
393 { | |
394 /* Re-initialize the FILE fields of the console. */ | |
395 stream_init_console (XCONSOLE (Vterminal_console), Qnil); | |
396 if (noninteractive) | |
397 event_stream_select_console (XCONSOLE (Vterminal_console)); | |
398 } | |
399 } | |
400 | |
401 #else | |
402 | |
403 void | |
442 | 404 init_console_stream (int reinit) |
428 | 405 { |
406 /* This function can GC */ | |
442 | 407 if (!reinit) |
408 { | |
409 Vterminal_device = Fmake_device (Qstream, Qnil, Qnil); | |
410 Vterminal_console = Fdevice_console (Vterminal_device); | |
411 Vterminal_frame = Fmake_frame (Qnil, Vterminal_device); | |
412 minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window; | |
413 } | |
428 | 414 if (initialized) |
415 { | |
416 stream_init_console (XCONSOLE (Vterminal_console), Qnil); | |
417 if (noninteractive) | |
418 event_stream_select_console (XCONSOLE (Vterminal_console)); | |
419 } | |
420 } | |
421 #endif |