comparison src/composite.c @ 49136:6a4a30f1c2cb

(syms_of_composite): Make composition_hash_table weak.
author Dave Love <fx@gnu.org>
date Fri, 10 Jan 2003 12:49:26 +0000
parents 5c1be14cbcac
children 23a1cea22d13
comparison
equal deleted inserted replaced
49135:3752935a65db 49136:6a4a30f1c2cb
90 We use two tables to keep information about composition; 90 We use two tables to keep information about composition;
91 composition_hash_table and composition_table. 91 composition_hash_table and composition_table.
92 92
93 The former is a hash table in which keys are COMPONENTS-VECs and 93 The former is a hash table in which keys are COMPONENTS-VECs and
94 values are the corresponding COMPOSITION-IDs. This hash table is 94 values are the corresponding COMPOSITION-IDs. This hash table is
95 weak, but as each key (COMPONENTS-VEC) is also kept as a value of 95 weak, but as each key (COMPONENTS-VEC) is also kept as a value of the
96 `composition' property, it won't be collected as garbage until all 96 `composition' property, it won't be collected as garbage until all
97 text that have the same COMPONENTS-VEC are deleted. 97 bits of text that have the same COMPONENTS-VEC are deleted.
98 98
99 The latter is a table of pointers to `struct composition' indexed 99 The latter is a table of pointers to `struct composition' indexed
100 by COMPOSITION-ID. This structure keep the other information (see 100 by COMPOSITION-ID. This structure keeps the other information (see
101 composite.h). 101 composite.h).
102 102
103 In general, a text property holds information about individual 103 In general, a text property holds information about individual
104 characters. But, a `composition' property holds information about 104 characters. But, a `composition' property holds information about
105 a sequence of characters (in this sense, it is like `intangible' 105 a sequence of characters (in this sense, it is like the `intangible'
106 property). That means that we should not share the property value 106 property). That means that we should not share the property value
107 in adjacent compositions we can't distinguish them if they have the 107 in adjacent compositions -- we can't distinguish them if they have the
108 same property. So, after any changes, we call 108 same property. So, after any changes, we call
109 `update_compositions' and change a property of one of adjacent 109 `update_compositions' and change a property of one of adjacent
110 compositions to a copy of it. This function also runs a proper 110 compositions to a copy of it. This function also runs a proper
111 composition modification function to make a composition that gets 111 composition modification function to make a composition that gets
112 invalid by the change valid again. 112 invalid by the change valid again.
113 113
114 As a value of `composition' property holds information about a 114 As the value of the `composition' property holds information about a
115 specific range of text, the value gets invalid if we change the 115 specific range of text, the value gets invalid if we change the
116 text in the range. We treat `composition' property always 116 text in the range. We treat the `composition' property as always
117 rear-nonsticky (currently by setting default-text-properties to 117 rear-nonsticky (currently by setting default-text-properties to
118 (rear-nonsticky (composition))) and we never make properties of 118 (rear-nonsticky (composition))) and we never make properties of
119 adjacent compositions identical. Thus, any such changes make the 119 adjacent compositions identical. Thus, any such changes make the
120 range just shorter. So, we can check the validity of `composition' 120 range just shorter. So, we can check the validity of the `composition'
121 property by comparing LENGTH information with the actual length of 121 property by comparing LENGTH information with the actual length of
122 the composition. 122 the composition.
123 123
124 */ 124 */
125 125
841 extern Lisp_Object QCsize; 841 extern Lisp_Object QCsize;
842 842
843 args[0] = QCtest; 843 args[0] = QCtest;
844 args[1] = Qequal; 844 args[1] = Qequal;
845 args[2] = QCweakness; 845 args[2] = QCweakness;
846 args[3] = Qnil; 846 args[3] = Qt;
847 args[4] = QCsize; 847 args[4] = QCsize;
848 args[5] = make_number (311); 848 args[5] = make_number (311);
849 composition_hash_table = Fmake_hash_table (6, args); 849 composition_hash_table = Fmake_hash_table (6, args);
850 staticpro (&composition_hash_table); 850 staticpro (&composition_hash_table);
851 } 851 }