Mercurial > hg > xemacs-beta
comparison src/buffer.c @ 5140:e5380fdaf8f1
merge
| author | Ben Wing <ben@xemacs.org> |
|---|---|
| date | Sat, 13 Mar 2010 05:38:34 -0600 |
| parents | a9c41067dd88 |
| children | f965e31a35f0 |
comparison
equal
deleted
inserted
replaced
| 5139:a48ef26d87ee | 5140:e5380fdaf8f1 |
|---|---|
| 232 { XD_LISP_OBJECT, offsetof (struct buffer_text, line_number_cache) }, | 232 { XD_LISP_OBJECT, offsetof (struct buffer_text, line_number_cache) }, |
| 233 { XD_END } | 233 { XD_END } |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 #ifdef NEW_GC | 236 #ifdef NEW_GC |
| 237 DEFINE_LRECORD_IMPLEMENTATION ("buffer-text", buffer_text, | 237 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("buffer-text", buffer_text, |
| 238 1, /*dumpable-flag*/ | 238 0, buffer_text_description_1, |
| 239 0, 0, 0, 0, 0, | 239 Lisp_Buffer_Text); |
| 240 buffer_text_description_1, | |
| 241 Lisp_Buffer_Text); | |
| 242 #endif /* NEW_GC */ | 240 #endif /* NEW_GC */ |
| 243 | 241 |
| 244 static const struct sized_memory_description buffer_text_description = { | 242 static const struct sized_memory_description buffer_text_description = { |
| 245 sizeof (struct buffer_text), | 243 sizeof (struct buffer_text), |
| 246 buffer_text_description_1 | 244 buffer_text_description_1 |
| 331 } | 329 } |
| 332 | 330 |
| 333 /* We do not need a finalize method to handle a buffer's children list | 331 /* We do not need a finalize method to handle a buffer's children list |
| 334 because all buffers have `kill-buffer' applied to them before | 332 because all buffers have `kill-buffer' applied to them before |
| 335 they disappear, and the children removal happens then. */ | 333 they disappear, and the children removal happens then. */ |
| 336 DEFINE_LRECORD_IMPLEMENTATION ("buffer", buffer, | 334 DEFINE_NODUMP_LISP_OBJECT ("buffer", buffer, mark_buffer, |
| 337 0, /*dumpable-flag*/ | 335 print_buffer, 0, 0, 0, |
| 338 mark_buffer, print_buffer, 0, 0, 0, | 336 buffer_description, |
| 339 buffer_description, | 337 struct buffer); |
| 340 struct buffer); | |
| 341 | 338 |
| 342 DEFUN ("bufferp", Fbufferp, 1, 1, 0, /* | 339 DEFUN ("bufferp", Fbufferp, 1, 1, 0, /* |
| 343 Return t if OBJECT is an editor buffer. | 340 Return t if OBJECT is an editor buffer. |
| 344 */ | 341 */ |
| 345 (object)) | 342 (object)) |
| 601 } | 598 } |
| 602 | 599 |
| 603 static struct buffer * | 600 static struct buffer * |
| 604 allocate_buffer (void) | 601 allocate_buffer (void) |
| 605 { | 602 { |
| 606 struct buffer *b = ALLOC_LCRECORD_TYPE (struct buffer, &lrecord_buffer); | 603 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (buffer); |
| 607 | 604 |
| 608 COPY_LCRECORD (b, XBUFFER (Vbuffer_defaults)); | 605 copy_lisp_object (obj, Vbuffer_defaults); |
| 609 | 606 |
| 610 return b; | 607 return XBUFFER (obj); |
| 611 } | 608 } |
| 612 | 609 |
| 613 static Lisp_Object | 610 static Lisp_Object |
| 614 finish_init_buffer (struct buffer *b, Lisp_Object name) | 611 finish_init_buffer (struct buffer *b, Lisp_Object name) |
| 615 { | 612 { |
| 1777 static void | 1774 static void |
| 1778 compute_buffer_usage (struct buffer *b, struct buffer_stats *stats, | 1775 compute_buffer_usage (struct buffer *b, struct buffer_stats *stats, |
| 1779 struct overhead_stats *ovstats) | 1776 struct overhead_stats *ovstats) |
| 1780 { | 1777 { |
| 1781 xzero (*stats); | 1778 xzero (*stats); |
| 1782 stats->other += LISPOBJ_STORAGE_SIZE (b, sizeof (*b), ovstats); | 1779 stats->other += lisp_object_storage_size (wrap_buffer (b), ovstats); |
| 1783 stats->text += compute_buffer_text_usage (b, ovstats); | 1780 stats->text += compute_buffer_text_usage (b, ovstats); |
| 1784 stats->markers += compute_buffer_marker_usage (b, ovstats); | 1781 stats->markers += compute_buffer_marker_usage (b, ovstats); |
| 1785 stats->extents += compute_buffer_extent_usage (b, ovstats); | 1782 stats->extents += compute_buffer_extent_usage (b, ovstats); |
| 1786 } | 1783 } |
| 1787 | 1784 |
| 1908 | 1905 |
| 1909 | 1906 |
| 1910 void | 1907 void |
| 1911 syms_of_buffer (void) | 1908 syms_of_buffer (void) |
| 1912 { | 1909 { |
| 1913 INIT_LRECORD_IMPLEMENTATION (buffer); | 1910 INIT_LISP_OBJECT (buffer); |
| 1914 #ifdef NEW_GC | 1911 #ifdef NEW_GC |
| 1915 INIT_LRECORD_IMPLEMENTATION (buffer_text); | 1912 INIT_LISP_OBJECT (buffer_text); |
| 1916 #endif /* NEW_GC */ | 1913 #endif /* NEW_GC */ |
| 1917 | 1914 |
| 1918 DEFSYMBOL (Qbuffer_live_p); | 1915 DEFSYMBOL (Qbuffer_live_p); |
| 1919 DEFSYMBOL (Qbuffer_or_string_p); | 1916 DEFSYMBOL (Qbuffer_or_string_p); |
| 1920 DEFSYMBOL (Qmode_class); | 1917 DEFSYMBOL (Qmode_class); |
| 2141 #ifdef NEW_GC | 2138 #ifdef NEW_GC |
| 2142 #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magic_fun) \ | 2139 #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magic_fun) \ |
| 2143 do \ | 2140 do \ |
| 2144 { \ | 2141 { \ |
| 2145 struct symbol_value_forward *I_hate_C = \ | 2142 struct symbol_value_forward *I_hate_C = \ |
| 2146 alloc_lrecord_type (struct symbol_value_forward, \ | 2143 XSYMBOL_VALUE_FORWARD (ALLOC_NORMAL_LISP_OBJECT (symbol_value_forward)); \ |
| 2147 &lrecord_symbol_value_forward); \ | 2144 /*mcpro ((Lisp_Object) I_hate_C);*/ \ |
| 2148 /*mcpro ((Lisp_Object) I_hate_C);*/ \ | |
| 2149 \ | 2145 \ |
| 2150 I_hate_C->magic.value = &(buffer_local_flags.field_name); \ | 2146 I_hate_C->magic.value = &(buffer_local_flags.field_name); \ |
| 2151 I_hate_C->magic.type = forward_type; \ | 2147 I_hate_C->magic.type = forward_type; \ |
| 2152 I_hate_C->magicfun = magic_fun; \ | 2148 I_hate_C->magicfun = magic_fun; \ |
| 2153 \ | 2149 \ |
| 2217 DEFVAR_BUFFER_DEFAULTS_MAGIC (lname, field_name, 0) | 2213 DEFVAR_BUFFER_DEFAULTS_MAGIC (lname, field_name, 0) |
| 2218 | 2214 |
| 2219 static void | 2215 static void |
| 2220 nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap) | 2216 nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap) |
| 2221 { | 2217 { |
| 2222 ZERO_LCRECORD (b); | 2218 zero_nonsized_lisp_object (wrap_buffer (b)); |
| 2223 | 2219 |
| 2224 b->extent_info = Qnil; | 2220 b->extent_info = Qnil; |
| 2225 b->indirect_children = Qnil; | 2221 b->indirect_children = Qnil; |
| 2226 b->own_text.line_number_cache = Qnil; | 2222 b->own_text.line_number_cache = Qnil; |
| 2227 | 2223 |
| 2232 static void | 2228 static void |
| 2233 common_init_complex_vars_of_buffer (void) | 2229 common_init_complex_vars_of_buffer (void) |
| 2234 { | 2230 { |
| 2235 /* Make sure all markable slots in buffer_defaults | 2231 /* Make sure all markable slots in buffer_defaults |
| 2236 are initialized reasonably, so mark_buffer won't choke. */ | 2232 are initialized reasonably, so mark_buffer won't choke. */ |
| 2237 struct buffer *defs = ALLOC_LCRECORD_TYPE (struct buffer, &lrecord_buffer); | 2233 Lisp_Object defobj = ALLOC_NORMAL_LISP_OBJECT (buffer); |
| 2238 struct buffer *syms = ALLOC_LCRECORD_TYPE (struct buffer, &lrecord_buffer); | 2234 struct buffer *defs = XBUFFER (defobj); |
| 2235 Lisp_Object symobj = ALLOC_NORMAL_LISP_OBJECT (buffer); | |
| 2236 struct buffer *syms = XBUFFER (symobj); | |
| 2239 | 2237 |
| 2240 staticpro_nodump (&Vbuffer_defaults); | 2238 staticpro_nodump (&Vbuffer_defaults); |
| 2241 staticpro_nodump (&Vbuffer_local_symbols); | 2239 staticpro_nodump (&Vbuffer_local_symbols); |
| 2242 Vbuffer_defaults = wrap_buffer (defs); | 2240 Vbuffer_defaults = defobj; |
| 2243 Vbuffer_local_symbols = wrap_buffer (syms); | 2241 Vbuffer_local_symbols = symobj; |
| 2244 | 2242 |
| 2245 nuke_all_buffer_slots (syms, Qnil); | 2243 nuke_all_buffer_slots (syms, Qnil); |
| 2246 nuke_all_buffer_slots (defs, Qnil); | 2244 nuke_all_buffer_slots (defs, Qnil); |
| 2247 defs->text = &defs->own_text; | 2245 defs->text = &defs->own_text; |
| 2248 syms->text = &syms->own_text; | 2246 syms->text = &syms->own_text; |
| 2295 The local flag is a bit that is used in the buffer | 2293 The local flag is a bit that is used in the buffer |
| 2296 to say that it has its own local value for the slot. | 2294 to say that it has its own local value for the slot. |
| 2297 The local flag bits are in the local_var_flags slot of the | 2295 The local flag bits are in the local_var_flags slot of the |
| 2298 buffer. */ | 2296 buffer. */ |
| 2299 | 2297 |
| 2298 set_lheader_implementation ((struct lrecord_header *) | |
| 2299 &buffer_local_flags, &lrecord_buffer); | |
| 2300 nuke_all_buffer_slots (&buffer_local_flags, make_int (-2)); | 2300 nuke_all_buffer_slots (&buffer_local_flags, make_int (-2)); |
| 2301 buffer_local_flags.filename = always_local_no_default; | 2301 buffer_local_flags.filename = always_local_no_default; |
| 2302 buffer_local_flags.directory = always_local_no_default; | 2302 buffer_local_flags.directory = always_local_no_default; |
| 2303 buffer_local_flags.backed_up = always_local_no_default; | 2303 buffer_local_flags.backed_up = always_local_no_default; |
| 2304 buffer_local_flags.saved_size = always_local_no_default; | 2304 buffer_local_flags.saved_size = always_local_no_default; |
