Mercurial > emacs
annotate oldXMenu/XCrAssoc.c @ 62089:e002770fe3ac
(ido-setup-hook): New hook.
(ido-define-mode-map-hook): Remove hook; use ido-setup-hook instead.
(ido-input-stack): New var.
(ido-define-mode-map): Bind M-b to ido-push-dir. Move old
ido-next-work-file binding to M-O.
Bind M-f to ido-wide-find-file-or-pop-dir.
(ido-define-mode-map): Don't run ido-define-mode-map-hook.
(ido-read-internal): Run ido-setup-hook.
Catch quit in read-file-name and read-string to cancel edit.
Handle new push, pop, and pop-all exit codes (for M-b/M-f).
Automatically pop-all when completing a directory name (RET).
(ido-file-internal): Add with-no-warnings around ffap and dired code.
(ido-exit-minibuffer): Use exit-minibuffer instead of throw.
(ido-wide-find-file, ido-wide-find-dir): Catch quit to cancel find.
(ido-push-dir, ido-pop-dir, ido-wide-find-file-or-pop-dir): New
functions for M-b/M-f to move among the directory components.
(ido-make-merged-file-list): Catch quit to cancel merge.
(ido-make-dir-list): Delete "." when ido-input-stack is non-empty.
(ido-completion-help): No warnings for ido-completion-buffer-full.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Thu, 05 May 2005 22:15:58 +0000 |
parents | e8824c4f5f7e |
children | 3861ff8f4bf1 |
rev | line source |
---|---|
25858 | 1 /* Copyright Massachusetts Institute of Technology 1985 */ |
2 | |
3 /* | |
4 Permission to use, copy, modify, distribute, and sell this software and its | |
5 documentation for any purpose is hereby granted without fee, provided that | |
6 the above copyright notice appear in all copies and that both that | |
7 copyright notice and this permission notice appear in supporting | |
8 documentation, and that the name of M.I.T. not be used in advertising or | |
9 publicity pertaining to distribution of the software without specific, | |
10 written prior permission. M.I.T. makes no representations about the | |
11 suitability of this software for any purpose. It is provided "as is" | |
12 without express or implied warranty. | |
13 */ | |
14 | |
15 #include <config.h> | |
16 #include <X11/Xlib.h> | |
17 #include <errno.h> | |
18 #include "X10.h" | |
19 | |
20 #ifndef NULL | |
21 #define NULL 0 | |
22 #endif | |
23 | |
24 extern int errno; | |
25 | |
26 /* | |
27 * XCreateAssocTable - Create an XAssocTable. The size argument should be | |
28 * a power of two for efficiency reasons. Some size suggestions: use 32 | |
29 * buckets per 100 objects; a reasonable maximum number of object per | |
30 * buckets is 8. If there is an error creating the XAssocTable, a NULL | |
31 * pointer is returned. | |
32 */ | |
33 XAssocTable *XCreateAssocTable(size) | |
34 register int size; /* Desired size of the table. */ | |
35 { | |
36 register XAssocTable *table; /* XAssocTable to be initialized. */ | |
37 register XAssoc *buckets; /* Pointer to the first bucket in */ | |
38 /* the bucket array. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
39 |
25858 | 40 /* Malloc the XAssocTable. */ |
41 if ((table = (XAssocTable *)malloc(sizeof(XAssocTable))) == NULL) { | |
42 /* malloc call failed! */ | |
43 errno = ENOMEM; | |
44 return(NULL); | |
45 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
46 |
25858 | 47 /* calloc the buckets (actually just their headers). */ |
48 buckets = (XAssoc *)calloc((unsigned)size, (unsigned)sizeof(XAssoc)); | |
49 if (buckets == NULL) { | |
50 /* calloc call failed! */ | |
51 errno = ENOMEM; | |
52 return(NULL); | |
53 } | |
54 | |
55 /* Insert table data into the XAssocTable structure. */ | |
56 table->buckets = buckets; | |
57 table->size = size; | |
58 | |
59 while (--size >= 0) { | |
60 /* Initialize each bucket. */ | |
61 buckets->prev = buckets; | |
62 buckets->next = buckets; | |
63 buckets++; | |
64 } | |
65 | |
66 return(table); | |
67 } | |
52401 | 68 |
69 /* arch-tag: 5df3237d-ada0-4345-a3ab-282cafb397aa | |
70 (do not change this comment) */ |