Mercurial > emacs
annotate oldXMenu/XMakeAssoc.c @ 82988:f82e3a6f5ccb
A few more bugfixes and new features.
(Sigh.) I obviously need to remember to separate individual changes
to multiple commits.
src/emacsclient.c: Improved error handling.
(decode_options): Changed frame option (again) from -f to -t.
(print_help_and_exit): Ditto.
(copy_from_to): Check EINTR after write, not EAGAIN. Removed SIGIO hack.
(pty_conversation): Handle errors transmitted through the socket.
Handle pty errors by not reading from it anymore.
(main): Restore correct errno after socket_status failed. Send -tty
on -t, not -pty.
lisp/server.el (server-process-filter): Watch -tty, not -pty.
Use make-frame-on-tty instead of make-terminal-frame.
Don't set newframe to t if make-frame-on-tty failed.
Don't delete frames here. Print correct message when there are no
files to edit, but a new frame was requested.
(server-sentinel): Delete the frame after the process.
(server-handle-delete-frame): New function for delete-frame-functions.
(server-start): Add server-handle-delete-frame to delete-frame-functions.
(server-buffer-done): Don't delete frames here.
src/alloc.c (mark_ttys): Add prototype.
(Fgarbage_collect): Call mark_ttys.
src/emacs.c: (shut_down_emacs): Don't flush stdout before
reset_sys_modes().
src/process.c (add_keyboard_wait_descriptor_called_flag): Removed.
(add_keyboard_wait_descriptor): Removed stdin hack.
src/sysdep.c: Unconditionally include sysselect.h.
(old_fcntl_flags): Changed to an array.
(init_sigio, reset_sigio): Use it.
(narrow_foreground_group, widen_foreground_group): Use setpgid, not
setpgrp.
(old_fcntl_owner): Changed to an array.
(init_sys_modes, reset_sys_modes): Use it. Fix fsync() and reset_sigio() calls.
src/term.c (Qframe_tty_name, Qframe_tty_type): New variables.
(syms_of_term): Initialize them.
(Fframe_tty_name, Fframe_tty_type): New functions.
(term_init): Call add_keyboard_wait_descriptor().
(Fdelete_tty): New function.
(delete_tty): Call delete_keyboard_wait_descriptor().
(get_current_tty): Removed.
(mark_ttys): New function.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-28
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 31 Dec 2003 05:09:29 +0000 |
parents | 695cf19ef79e |
children | e8824c4f5f7e 375f2633d815 |
rev | line source |
---|---|
25858 | 1 /* $XConsortium: XMakeAssoc.c,v 10.18 91/01/06 12:09:28 rws Exp $ */ |
2 /* Copyright Massachusetts Institute of Technology 1985 */ | |
3 | |
4 /* | |
5 Permission to use, copy, modify, distribute, and sell this software and its | |
6 documentation for any purpose is hereby granted without fee, provided that | |
7 the above copyright notice appear in all copies and that both that | |
8 copyright notice and this permission notice appear in supporting | |
9 documentation, and that the name of M.I.T. not be used in advertising or | |
10 publicity pertaining to distribution of the software without specific, | |
11 written prior permission. M.I.T. makes no representations about the | |
12 suitability of this software for any purpose. It is provided "as is" | |
13 without express or implied warranty. | |
14 */ | |
15 | |
16 #include <config.h> | |
17 #include <X11/Xlib.h> | |
18 #include <X11/Xresource.h> | |
19 #include "X10.h" | |
20 #include <errno.h> | |
21 | |
22 #ifndef NULL | |
23 #define NULL 0 | |
24 #endif | |
25 | |
26 extern int errno; | |
27 | |
28 void emacs_insque(); | |
29 struct qelem { | |
30 struct qelem *q_forw; | |
31 struct qelem *q_back; | |
32 char q_data[1]; | |
33 }; | |
34 /* | |
35 * XMakeAssoc - Insert data into an XAssocTable keyed on an XId. | |
36 * Data is inserted into the table only once. Redundant inserts are | |
37 * meaningless (but cause no problems). The queue in each association | |
38 * bucket is sorted (lowest XId to highest XId). | |
39 */ | |
40 XMakeAssoc(dpy, table, x_id, data) | |
41 register Display *dpy; | |
42 register XAssocTable *table; | |
43 register XID x_id; | |
44 register caddr_t data; | |
45 { | |
46 int hash; | |
47 register XAssoc *bucket; | |
48 register XAssoc *Entry; | |
49 register XAssoc *new_entry; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
50 |
25858 | 51 /* Hash the XId to get the bucket number. */ |
52 hash = x_id & (table->size - 1); | |
53 /* Look up the bucket to get the entries in that bucket. */ | |
54 bucket = &table->buckets[hash]; | |
55 /* Get the first entry in the bucket. */ | |
56 Entry = bucket->next; | |
57 | |
58 /* If (Entry != bucket), the bucket is empty so make */ | |
59 /* the new entry the first entry in the bucket. */ | |
60 /* if (Entry == bucket), the we have to search the */ | |
61 /* bucket. */ | |
62 if (Entry != bucket) { | |
63 /* The bucket isn't empty, begin searching. */ | |
64 /* If we leave the for loop then we have either passed */ | |
65 /* where the entry should be or hit the end of the bucket. */ | |
66 /* In either case we should then insert the new entry */ | |
67 /* before the current value of "Entry". */ | |
68 for (; Entry != bucket; Entry = Entry->next) { | |
69 if (Entry->x_id == x_id) { | |
70 /* Entry has the same XId... */ | |
71 if (Entry->display == dpy) { | |
72 /* Entry has the same Display... */ | |
73 /* Therefore there is already an */ | |
74 /* entry with this XId and Display, */ | |
75 /* reset its data value and return. */ | |
76 Entry->data = data; | |
77 return; | |
78 } | |
79 /* We found an association with the right */ | |
80 /* id but the wrong display! */ | |
81 continue; | |
82 } | |
83 /* If the current entry's XId is greater than the */ | |
84 /* XId of the entry to be inserted then we have */ | |
85 /* passed the location where the new XId should */ | |
86 /* be inserted. */ | |
87 if (Entry->x_id > x_id) break; | |
88 } | |
89 } | |
90 | |
91 /* If we are here then the new entry should be inserted just */ | |
92 /* before the current value of "Entry". */ | |
93 /* Create a new XAssoc and load it with new provided data. */ | |
94 new_entry = (XAssoc *) xmalloc(sizeof(XAssoc)); | |
95 new_entry->display = dpy; | |
96 new_entry->x_id = x_id; | |
97 new_entry->data = data; | |
98 | |
99 /* Insert the new entry. */ | |
100 emacs_insque((struct qelem *)new_entry, (struct qelem *)Entry->prev); | |
101 } | |
102 | |
52401 | 103 /* arch-tag: d7e3fb8a-f3b3-4c5d-a307-75ca67ec1b49 |
104 (do not change this comment) */ |