annotate oldXMenu/XCrAssoc.c @ 55357:cec2c6c3bafb

(Qtotal): New var. (syms_of_xdisp): Intern and staticpro it. (calc_line_height_property): New arg total. Set it if line-spacing property has format (total . VALUE). (x_produce_glyphs): Ignore line-spacing if line-height is 0. Handle total line-spacing property.
author Kim F. Storm <storm@cua.dk>
date Tue, 04 May 2004 12:51:45 +0000
parents e8824c4f5f7e
children 3861ff8f4bf1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
1 /* Copyright Massachusetts Institute of Technology 1985 */
Dave Love <fx@gnu.org>
parents:
diff changeset
2
Dave Love <fx@gnu.org>
parents:
diff changeset
3 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
4 Permission to use, copy, modify, distribute, and sell this software and its
Dave Love <fx@gnu.org>
parents:
diff changeset
5 documentation for any purpose is hereby granted without fee, provided that
Dave Love <fx@gnu.org>
parents:
diff changeset
6 the above copyright notice appear in all copies and that both that
Dave Love <fx@gnu.org>
parents:
diff changeset
7 copyright notice and this permission notice appear in supporting
Dave Love <fx@gnu.org>
parents:
diff changeset
8 documentation, and that the name of M.I.T. not be used in advertising or
Dave Love <fx@gnu.org>
parents:
diff changeset
9 publicity pertaining to distribution of the software without specific,
Dave Love <fx@gnu.org>
parents:
diff changeset
10 written prior permission. M.I.T. makes no representations about the
Dave Love <fx@gnu.org>
parents:
diff changeset
11 suitability of this software for any purpose. It is provided "as is"
Dave Love <fx@gnu.org>
parents:
diff changeset
12 without express or implied warranty.
Dave Love <fx@gnu.org>
parents:
diff changeset
13 */
Dave Love <fx@gnu.org>
parents:
diff changeset
14
Dave Love <fx@gnu.org>
parents:
diff changeset
15 #include <config.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
16 #include <X11/Xlib.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
17 #include <errno.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
18 #include "X10.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
19
Dave Love <fx@gnu.org>
parents:
diff changeset
20 #ifndef NULL
Dave Love <fx@gnu.org>
parents:
diff changeset
21 #define NULL 0
Dave Love <fx@gnu.org>
parents:
diff changeset
22 #endif
Dave Love <fx@gnu.org>
parents:
diff changeset
23
Dave Love <fx@gnu.org>
parents:
diff changeset
24 extern int errno;
Dave Love <fx@gnu.org>
parents:
diff changeset
25
Dave Love <fx@gnu.org>
parents:
diff changeset
26 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
27 * XCreateAssocTable - Create an XAssocTable. The size argument should be
Dave Love <fx@gnu.org>
parents:
diff changeset
28 * a power of two for efficiency reasons. Some size suggestions: use 32
Dave Love <fx@gnu.org>
parents:
diff changeset
29 * buckets per 100 objects; a reasonable maximum number of object per
Dave Love <fx@gnu.org>
parents:
diff changeset
30 * buckets is 8. If there is an error creating the XAssocTable, a NULL
Dave Love <fx@gnu.org>
parents:
diff changeset
31 * pointer is returned.
Dave Love <fx@gnu.org>
parents:
diff changeset
32 */
Dave Love <fx@gnu.org>
parents:
diff changeset
33 XAssocTable *XCreateAssocTable(size)
Dave Love <fx@gnu.org>
parents:
diff changeset
34 register int size; /* Desired size of the table. */
Dave Love <fx@gnu.org>
parents:
diff changeset
35 {
Dave Love <fx@gnu.org>
parents:
diff changeset
36 register XAssocTable *table; /* XAssocTable to be initialized. */
Dave Love <fx@gnu.org>
parents:
diff changeset
37 register XAssoc *buckets; /* Pointer to the first bucket in */
Dave Love <fx@gnu.org>
parents:
diff changeset
38 /* the bucket array. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
39
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
40 /* Malloc the XAssocTable. */
Dave Love <fx@gnu.org>
parents:
diff changeset
41 if ((table = (XAssocTable *)malloc(sizeof(XAssocTable))) == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
42 /* malloc call failed! */
Dave Love <fx@gnu.org>
parents:
diff changeset
43 errno = ENOMEM;
Dave Love <fx@gnu.org>
parents:
diff changeset
44 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
45 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
46
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
47 /* calloc the buckets (actually just their headers). */
Dave Love <fx@gnu.org>
parents:
diff changeset
48 buckets = (XAssoc *)calloc((unsigned)size, (unsigned)sizeof(XAssoc));
Dave Love <fx@gnu.org>
parents:
diff changeset
49 if (buckets == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
50 /* calloc call failed! */
Dave Love <fx@gnu.org>
parents:
diff changeset
51 errno = ENOMEM;
Dave Love <fx@gnu.org>
parents:
diff changeset
52 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
53 }
Dave Love <fx@gnu.org>
parents:
diff changeset
54
Dave Love <fx@gnu.org>
parents:
diff changeset
55 /* Insert table data into the XAssocTable structure. */
Dave Love <fx@gnu.org>
parents:
diff changeset
56 table->buckets = buckets;
Dave Love <fx@gnu.org>
parents:
diff changeset
57 table->size = size;
Dave Love <fx@gnu.org>
parents:
diff changeset
58
Dave Love <fx@gnu.org>
parents:
diff changeset
59 while (--size >= 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
60 /* Initialize each bucket. */
Dave Love <fx@gnu.org>
parents:
diff changeset
61 buckets->prev = buckets;
Dave Love <fx@gnu.org>
parents:
diff changeset
62 buckets->next = buckets;
Dave Love <fx@gnu.org>
parents:
diff changeset
63 buckets++;
Dave Love <fx@gnu.org>
parents:
diff changeset
64 }
Dave Love <fx@gnu.org>
parents:
diff changeset
65
Dave Love <fx@gnu.org>
parents:
diff changeset
66 return(table);
Dave Love <fx@gnu.org>
parents:
diff changeset
67 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
68
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
69 /* arch-tag: 5df3237d-ada0-4345-a3ab-282cafb397aa
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
70 (do not change this comment) */