Mercurial > hg > xemacs-beta
comparison src/extents.c @ 5127:a9c41067dd88 ben-lisp-object
more cleanups, terminology clarification, lots of doc work
-------------------- ChangeLog entries follow: --------------------
man/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* internals/internals.texi (Introduction to Allocation):
* internals/internals.texi (Integers and Characters):
* internals/internals.texi (Allocation from Frob Blocks):
* internals/internals.texi (lrecords):
* internals/internals.texi (Low-level allocation):
Rewrite section on allocation of Lisp objects to reflect the new
reality. Remove references to nonexistent XSETINT and XSETCHAR.
modules/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c (allocate_pgconn):
* postgresql/postgresql.c (allocate_pgresult):
* postgresql/postgresql.h (struct Lisp_PGconn):
* postgresql/postgresql.h (struct Lisp_PGresult):
* ldap/eldap.c (allocate_ldap):
* ldap/eldap.h (struct Lisp_LDAP):
Same changes as in src/ dir. See large log there in ChangeLog,
but basically:
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
../hlo/src/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (old_alloc_sized_lcrecord):
* alloc.c (very_old_free_lcrecord):
* alloc.c (copy_lisp_object):
* alloc.c (zero_sized_lisp_object):
* alloc.c (zero_nonsized_lisp_object):
* alloc.c (lisp_object_storage_size):
* alloc.c (free_normal_lisp_object):
* alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC):
* alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT):
* alloc.c (Fcons):
* alloc.c (noseeum_cons):
* alloc.c (make_float):
* alloc.c (make_bignum):
* alloc.c (make_bignum_bg):
* alloc.c (make_ratio):
* alloc.c (make_ratio_bg):
* alloc.c (make_ratio_rt):
* alloc.c (make_bigfloat):
* alloc.c (make_bigfloat_bf):
* alloc.c (size_vector):
* alloc.c (make_compiled_function):
* alloc.c (Fmake_symbol):
* alloc.c (allocate_extent):
* alloc.c (allocate_event):
* alloc.c (make_key_data):
* alloc.c (make_button_data):
* alloc.c (make_motion_data):
* alloc.c (make_process_data):
* alloc.c (make_timeout_data):
* alloc.c (make_magic_data):
* alloc.c (make_magic_eval_data):
* alloc.c (make_eval_data):
* alloc.c (make_misc_user_data):
* alloc.c (Fmake_marker):
* alloc.c (noseeum_make_marker):
* alloc.c (size_string_direct_data):
* alloc.c (make_uninit_string):
* alloc.c (make_string_nocopy):
* alloc.c (mark_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (sweep_lcrecords_1):
* alloc.c (malloced_storage_size):
* buffer.c (allocate_buffer):
* buffer.c (compute_buffer_usage):
* buffer.c (DEFVAR_BUFFER_LOCAL_1):
* buffer.c (nuke_all_buffer_slots):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.h (struct buffer_text):
* buffer.h (struct buffer):
* bytecode.c:
* bytecode.c (make_compiled_function_args):
* bytecode.c (size_compiled_function_args):
* bytecode.h (struct compiled_function_args):
* casetab.c (allocate_case_table):
* casetab.h (struct Lisp_Case_Table):
* charset.h (struct Lisp_Charset):
* chartab.c (fill_char_table):
* chartab.c (Fmake_char_table):
* chartab.c (make_char_table_entry):
* chartab.c (copy_char_table_entry):
* chartab.c (Fcopy_char_table):
* chartab.c (put_char_table):
* chartab.h (struct Lisp_Char_Table_Entry):
* chartab.h (struct Lisp_Char_Table):
* console-gtk-impl.h (struct gtk_device):
* console-gtk-impl.h (struct gtk_frame):
* console-impl.h (struct console):
* console-msw-impl.h (struct Lisp_Devmode):
* console-msw-impl.h (struct mswindows_device):
* console-msw-impl.h (struct msprinter_device):
* console-msw-impl.h (struct mswindows_frame):
* console-msw-impl.h (struct mswindows_dialog_id):
* console-stream-impl.h (struct stream_console):
* console-stream.c (stream_init_console):
* console-tty-impl.h (struct tty_console):
* console-tty-impl.h (struct tty_device):
* console-tty.c (allocate_tty_console_struct):
* console-x-impl.h (struct x_device):
* console-x-impl.h (struct x_frame):
* console.c (allocate_console):
* console.c (nuke_all_console_slots):
* console.c (DEFVAR_CONSOLE_LOCAL_1):
* console.c (common_init_complex_vars_of_console):
* data.c (make_weak_list):
* data.c (make_weak_box):
* data.c (make_ephemeron):
* database.c:
* database.c (struct Lisp_Database):
* database.c (allocate_database):
* database.c (finalize_database):
* device-gtk.c (allocate_gtk_device_struct):
* device-impl.h (struct device):
* device-msw.c:
* device-msw.c (mswindows_init_device):
* device-msw.c (msprinter_init_device):
* device-msw.c (finalize_devmode):
* device-msw.c (allocate_devmode):
* device-tty.c (allocate_tty_device_struct):
* device-x.c (allocate_x_device_struct):
* device.c:
* device.c (nuke_all_device_slots):
* device.c (allocate_device):
* dialog-msw.c (handle_question_dialog_box):
* elhash.c:
* elhash.c (struct Lisp_Hash_Table):
* elhash.c (finalize_hash_table):
* elhash.c (make_general_lisp_hash_table):
* elhash.c (Fcopy_hash_table):
* elhash.h (htentry):
* emacs.c (main_1):
* eval.c:
* eval.c (size_multiple_value):
* event-stream.c (finalize_command_builder):
* event-stream.c (allocate_command_builder):
* event-stream.c (free_command_builder):
* event-stream.c (event_stream_generate_wakeup):
* event-stream.c (event_stream_resignal_wakeup):
* event-stream.c (event_stream_disable_wakeup):
* event-stream.c (event_stream_wakeup_pending_p):
* events.h (struct Lisp_Timeout):
* events.h (struct command_builder):
* extents-impl.h:
* extents-impl.h (struct extent_auxiliary):
* extents-impl.h (struct extent_info):
* extents-impl.h (set_extent_no_chase_aux_field):
* extents-impl.h (set_extent_no_chase_normal_field):
* extents.c:
* extents.c (gap_array_marker):
* extents.c (gap_array):
* extents.c (extent_list_marker):
* extents.c (extent_list):
* extents.c (stack_of_extents):
* extents.c (gap_array_make_marker):
* extents.c (extent_list_make_marker):
* extents.c (allocate_extent_list):
* extents.c (SLOT):
* extents.c (mark_extent_auxiliary):
* extents.c (allocate_extent_auxiliary):
* extents.c (attach_extent_auxiliary):
* extents.c (size_gap_array):
* extents.c (finalize_extent_info):
* extents.c (allocate_extent_info):
* extents.c (uninit_buffer_extents):
* extents.c (allocate_soe):
* extents.c (copy_extent):
* extents.c (vars_of_extents):
* extents.h:
* faces.c (allocate_face):
* faces.h (struct Lisp_Face):
* faces.h (struct face_cachel):
* file-coding.c:
* file-coding.c (finalize_coding_system):
* file-coding.c (sizeof_coding_system):
* file-coding.c (Fcopy_coding_system):
* file-coding.h (struct Lisp_Coding_System):
* file-coding.h (MARKED_SLOT):
* fns.c (size_bit_vector):
* font-mgr.c:
* font-mgr.c (finalize_fc_pattern):
* font-mgr.c (print_fc_pattern):
* font-mgr.c (Ffc_pattern_p):
* font-mgr.c (Ffc_pattern_create):
* font-mgr.c (Ffc_name_parse):
* font-mgr.c (Ffc_name_unparse):
* font-mgr.c (Ffc_pattern_duplicate):
* font-mgr.c (Ffc_pattern_add):
* font-mgr.c (Ffc_pattern_del):
* font-mgr.c (Ffc_pattern_get):
* font-mgr.c (fc_config_create_using):
* font-mgr.c (fc_strlist_to_lisp_using):
* font-mgr.c (fontset_to_list):
* font-mgr.c (Ffc_config_p):
* font-mgr.c (Ffc_config_up_to_date):
* font-mgr.c (Ffc_config_build_fonts):
* font-mgr.c (Ffc_config_get_cache):
* font-mgr.c (Ffc_config_get_fonts):
* font-mgr.c (Ffc_config_set_current):
* font-mgr.c (Ffc_config_get_blanks):
* font-mgr.c (Ffc_config_get_rescan_interval):
* font-mgr.c (Ffc_config_set_rescan_interval):
* font-mgr.c (Ffc_config_app_font_add_file):
* font-mgr.c (Ffc_config_app_font_add_dir):
* font-mgr.c (Ffc_config_app_font_clear):
* font-mgr.c (size):
* font-mgr.c (Ffc_config_substitute):
* font-mgr.c (Ffc_font_render_prepare):
* font-mgr.c (Ffc_font_match):
* font-mgr.c (Ffc_font_sort):
* font-mgr.c (finalize_fc_config):
* font-mgr.c (print_fc_config):
* font-mgr.h:
* font-mgr.h (struct fc_pattern):
* font-mgr.h (XFC_PATTERN):
* font-mgr.h (struct fc_config):
* font-mgr.h (XFC_CONFIG):
* frame-gtk.c (allocate_gtk_frame_struct):
* frame-impl.h (struct frame):
* frame-msw.c (mswindows_init_frame_1):
* frame-x.c (allocate_x_frame_struct):
* frame.c (nuke_all_frame_slots):
* frame.c (allocate_frame_core):
* gc.c:
* gc.c (GC_CHECK_NOT_FREE):
* glyphs.c (finalize_image_instance):
* glyphs.c (allocate_image_instance):
* glyphs.c (Fcolorize_image_instance):
* glyphs.c (allocate_glyph):
* glyphs.c (unmap_subwindow_instance_cache_mapper):
* glyphs.c (register_ignored_expose):
* glyphs.h (struct Lisp_Image_Instance):
* glyphs.h (struct Lisp_Glyph):
* glyphs.h (struct glyph_cachel):
* glyphs.h (struct expose_ignore):
* gui.c (allocate_gui_item):
* gui.h (struct Lisp_Gui_Item):
* keymap.c (struct Lisp_Keymap):
* keymap.c (make_keymap):
* lisp.h:
* lisp.h (struct Lisp_String_Direct_Data):
* lisp.h (struct Lisp_String_Indirect_Data):
* lisp.h (struct Lisp_Vector):
* lisp.h (struct Lisp_Bit_Vector):
* lisp.h (DECLARE_INLINE_LISP_BIT_VECTOR):
* lisp.h (struct weak_box):
* lisp.h (struct ephemeron):
* lisp.h (struct weak_list):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER):
* lrecord.h (struct lcrecord_list):
* lstream.c (finalize_lstream):
* lstream.c (sizeof_lstream):
* lstream.c (Lstream_new):
* lstream.c (Lstream_delete):
* lstream.h (struct lstream):
* marker.c:
* marker.c (finalize_marker):
* marker.c (compute_buffer_marker_usage):
* mule-charset.c:
* mule-charset.c (make_charset):
* mule-charset.c (compute_charset_usage):
* objects-impl.h (struct Lisp_Color_Instance):
* objects-impl.h (struct Lisp_Font_Instance):
* objects-tty-impl.h (struct tty_color_instance_data):
* objects-tty-impl.h (struct tty_font_instance_data):
* objects-tty.c (tty_initialize_color_instance):
* objects-tty.c (tty_initialize_font_instance):
* objects.c (finalize_color_instance):
* objects.c (Fmake_color_instance):
* objects.c (finalize_font_instance):
* objects.c (Fmake_font_instance):
* objects.c (reinit_vars_of_objects):
* opaque.c:
* opaque.c (sizeof_opaque):
* opaque.c (make_opaque_ptr):
* opaque.c (free_opaque_ptr):
* opaque.h:
* opaque.h (Lisp_Opaque):
* opaque.h (Lisp_Opaque_Ptr):
* print.c (printing_unreadable_lcrecord):
* print.c (external_object_printer):
* print.c (debug_p4):
* process.c (finalize_process):
* process.c (make_process_internal):
* procimpl.h (struct Lisp_Process):
* rangetab.c (Fmake_range_table):
* rangetab.c (Fcopy_range_table):
* rangetab.h (struct Lisp_Range_Table):
* scrollbar.c:
* scrollbar.c (create_scrollbar_instance):
* scrollbar.c (compute_scrollbar_instance_usage):
* scrollbar.h (struct scrollbar_instance):
* specifier.c (finalize_specifier):
* specifier.c (sizeof_specifier):
* specifier.c (set_specifier_caching):
* specifier.h (struct Lisp_Specifier):
* specifier.h (struct specifier_caching):
* symeval.h:
* symeval.h (SYMBOL_VALUE_MAGIC_P):
* symeval.h (DEFVAR_SYMVAL_FWD):
* symsinit.h:
* syntax.c (init_buffer_syntax_cache):
* syntax.h (struct syntax_cache):
* toolbar.c:
* toolbar.c (allocate_toolbar_button):
* toolbar.c (update_toolbar_button):
* toolbar.h (struct toolbar_button):
* tooltalk.c (struct Lisp_Tooltalk_Message):
* tooltalk.c (make_tooltalk_message):
* tooltalk.c (struct Lisp_Tooltalk_Pattern):
* tooltalk.c (make_tooltalk_pattern):
* ui-gtk.c:
* ui-gtk.c (allocate_ffi_data):
* ui-gtk.c (emacs_gtk_object_finalizer):
* ui-gtk.c (allocate_emacs_gtk_object_data):
* ui-gtk.c (allocate_emacs_gtk_boxed_data):
* ui-gtk.h:
* window-impl.h (struct window):
* window-impl.h (struct window_mirror):
* window.c (finalize_window):
* window.c (allocate_window):
* window.c (new_window_mirror):
* window.c (mark_window_as_deleted):
* window.c (make_dummy_parent):
* window.c (compute_window_mirror_usage):
* window.c (compute_window_usage):
Overall point of this change and previous ones in this repository:
(1) Introduce new, clearer terminology: everything other than int
or char is a "record" object, which comes in two types: "normal
objects" and "frob-block objects". Fix up all places that
referred to frob-block objects as "simple", "basic", etc.
(2) Provide an advertised interface for doing operations on Lisp
objects, including creating new types, that is clean and
consistent in its naming, uses the above-referenced terms and
avoids referencing "lrecords", "old lcrecords", etc., which should
hide under the surface.
(3) Make the size_in_bytes and finalizer methods take a
Lisp_Object rather than a void * for consistency with other methods.
(4) Separate finalizer method into finalizer and disksaver, so
that normal finalize methods don't have to worry about disksaving.
Other specifics:
(1) Renaming:
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
implementation->basic_p -> implementation->frob_block_p
ALLOCATE_FIXED_TYPE_AND_SET_IMPL -> ALLOC_FROB_BLOCK_LISP_OBJECT
*FCCONFIG*, wrap_fcconfig -> *FC_CONFIG*, wrap_fc_config
*FCPATTERN*, wrap_fcpattern -> *FC_PATTERN*, wrap_fc_pattern
(the last two changes make the naming of these macros consistent
with the naming of all other macros, since the objects are named
fc-config and fc-pattern with a hyphen)
(2) Lots of documentation fixes in lrecord.h.
(3) Eliminate macros for copying, freeing, zeroing objects, getting
their storage size. Instead, new functions:
zero_sized_lisp_object()
zero_nonsized_lisp_object()
lisp_object_storage_size()
free_normal_lisp_object()
(copy_lisp_object() already exists)
LISP_OBJECT_FROB_BLOCK_P() (actually a macro)
Eliminated:
free_lrecord()
zero_lrecord()
copy_lrecord()
copy_sized_lrecord()
old_copy_lcrecord()
old_copy_sized_lcrecord()
old_zero_lcrecord()
old_zero_sized_lcrecord()
LISP_OBJECT_STORAGE_SIZE()
COPY_SIZED_LISP_OBJECT()
COPY_SIZED_LCRECORD()
COPY_LISP_OBJECT()
ZERO_LISP_OBJECT()
FREE_LISP_OBJECT()
(4) Catch the remaining places where lrecord stuff was used directly
and use the advertised interface, e.g. alloc_sized_lrecord() ->
ALLOC_SIZED_LISP_OBJECT().
(5) Make certain statically-declared pseudo-objects
(buffer_local_flags, console_local_flags) have their lheader
initialized correctly, so things like copy_lisp_object() can work
on them. Make extent_auxiliary_defaults a proper heap object
Vextent_auxiliary_defaults, and make extent auxiliaries dumpable
so that this object can be dumped. allocate_extent_auxiliary()
now just creates the object, and attach_extent_auxiliary()
creates an extent auxiliary and attaches to an extent, like the
old allocate_extent_auxiliary().
(6) Create EXTENT_AUXILIARY_SLOTS macro, similar to the foo-slots.h
files but in a macro instead of a file. The purpose is to avoid
duplication when iterating over all the slots in an extent auxiliary.
Use it.
(7) In lstream.c, don't zero out object after allocation because
allocation routines take care of this.
(8) In marker.c, fix a mistake in computing marker overhead.
(9) In print.c, clean up printing_unreadable_lcrecord(),
external_object_printer() to avoid lots of ifdef NEW_GC's.
(10) Separate toolbar-button allocation into a separate
allocate_toolbar_button() function for use in the example code
in lrecord.h.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Fri, 05 Mar 2010 04:08:17 -0600 |
parents | 2a462149bd6a |
children | f965e31a35f0 |
comparison
equal
deleted
inserted
replaced
5126:2a462149bd6a | 5127:a9c41067dd88 |
---|---|
241 deleted, similar to standard markers. */ | 241 deleted, similar to standard markers. */ |
242 | 242 |
243 typedef struct gap_array_marker | 243 typedef struct gap_array_marker |
244 { | 244 { |
245 #ifdef NEW_GC | 245 #ifdef NEW_GC |
246 LISP_OBJECT_HEADER header; | 246 NORMAL_LISP_OBJECT_HEADER header; |
247 #endif /* NEW_GC */ | 247 #endif /* NEW_GC */ |
248 int pos; | 248 int pos; |
249 struct gap_array_marker *next; | 249 struct gap_array_marker *next; |
250 } Gap_Array_Marker; | 250 } Gap_Array_Marker; |
251 | 251 |
271 | 271 |
272 | 272 |
273 typedef struct gap_array | 273 typedef struct gap_array |
274 { | 274 { |
275 #ifdef NEW_GC | 275 #ifdef NEW_GC |
276 LISP_OBJECT_HEADER header; | 276 NORMAL_LISP_OBJECT_HEADER header; |
277 #endif /* NEW_GC */ | 277 #endif /* NEW_GC */ |
278 Elemcount gap; | 278 Elemcount gap; |
279 Elemcount gapsize; | 279 Elemcount gapsize; |
280 Elemcount numels; | 280 Elemcount numels; |
281 Bytecount elsize; | 281 Bytecount elsize; |
317 /* ------------------------------- */ | 317 /* ------------------------------- */ |
318 | 318 |
319 typedef struct extent_list_marker | 319 typedef struct extent_list_marker |
320 { | 320 { |
321 #ifdef NEW_GC | 321 #ifdef NEW_GC |
322 LISP_OBJECT_HEADER header; | 322 NORMAL_LISP_OBJECT_HEADER header; |
323 #endif /* NEW_GC */ | 323 #endif /* NEW_GC */ |
324 Gap_Array_Marker *m; | 324 Gap_Array_Marker *m; |
325 int endp; | 325 int endp; |
326 struct extent_list_marker *next; | 326 struct extent_list_marker *next; |
327 } Extent_List_Marker; | 327 } Extent_List_Marker; |
328 | 328 |
329 typedef struct extent_list | 329 typedef struct extent_list |
330 { | 330 { |
331 #ifdef NEW_GC | 331 #ifdef NEW_GC |
332 LISP_OBJECT_HEADER header; | 332 NORMAL_LISP_OBJECT_HEADER header; |
333 #endif /* NEW_GC */ | 333 #endif /* NEW_GC */ |
334 Gap_Array *start; | 334 Gap_Array *start; |
335 Gap_Array *end; | 335 Gap_Array *end; |
336 Extent_List_Marker *markers; | 336 Extent_List_Marker *markers; |
337 } Extent_List; | 337 } Extent_List; |
380 EXTENT_E_LESS_EQUAL_VALS (e1, extent_start (e2), extent_end (e2)) | 380 EXTENT_E_LESS_EQUAL_VALS (e1, extent_start (e2), extent_end (e2)) |
381 | 381 |
382 #define EXTENT_GAP_ARRAY_AT(ga, pos) (* (EXTENT *) GAP_ARRAY_EL_ADDR(ga, pos)) | 382 #define EXTENT_GAP_ARRAY_AT(ga, pos) (* (EXTENT *) GAP_ARRAY_EL_ADDR(ga, pos)) |
383 | 383 |
384 /* ------------------------------- */ | 384 /* ------------------------------- */ |
385 /* auxiliary extent structure */ | |
386 /* ------------------------------- */ | |
387 | |
388 struct extent_auxiliary extent_auxiliary_defaults; | |
389 | |
390 /* ------------------------------- */ | |
391 /* buffer-extent primitives */ | 385 /* buffer-extent primitives */ |
392 /* ------------------------------- */ | 386 /* ------------------------------- */ |
393 | 387 |
394 typedef struct stack_of_extents | 388 typedef struct stack_of_extents |
395 { | 389 { |
396 #ifdef NEW_GC | 390 #ifdef NEW_GC |
397 LISP_OBJECT_HEADER header; | 391 NORMAL_LISP_OBJECT_HEADER header; |
398 #endif /* NEW_GC */ | 392 #endif /* NEW_GC */ |
399 Extent_List *extents; | 393 Extent_List *extents; |
400 Memxpos pos; /* Position of stack of extents. EXTENTS is the list of | 394 Memxpos pos; /* Position of stack of extents. EXTENTS is the list of |
401 all extents that overlap this position. This position | 395 all extents that overlap this position. This position |
402 can be -1 if the stack of extents is invalid (this | 396 can be -1 if the stack of extents is invalid (this |
439 /* flags for decode_extent() */ | 433 /* flags for decode_extent() */ |
440 #define DE_MUST_HAVE_BUFFER 1 | 434 #define DE_MUST_HAVE_BUFFER 1 |
441 #define DE_MUST_BE_ATTACHED 2 | 435 #define DE_MUST_BE_ATTACHED 2 |
442 | 436 |
443 Lisp_Object Vlast_highlighted_extent; | 437 Lisp_Object Vlast_highlighted_extent; |
438 | |
439 Lisp_Object Vextent_auxiliary_defaults; | |
444 | 440 |
445 Lisp_Object QSin_map_extents_internal; | 441 Lisp_Object QSin_map_extents_internal; |
446 | 442 |
447 Fixnum mouse_highlight_priority; | 443 Fixnum mouse_highlight_priority; |
448 | 444 |
689 { | 685 { |
690 Gap_Array_Marker *m; | 686 Gap_Array_Marker *m; |
691 | 687 |
692 assert (pos >= 0 && pos <= ga->numels); | 688 assert (pos >= 0 && pos <= ga->numels); |
693 #ifdef NEW_GC | 689 #ifdef NEW_GC |
694 m = XGAP_ARRAY_MARKER (ALLOC_LISP_OBJECT (gap_array_marker)); | 690 m = XGAP_ARRAY_MARKER (ALLOC_NORMAL_LISP_OBJECT (gap_array_marker)); |
695 #else /* not NEW_GC */ | 691 #else /* not NEW_GC */ |
696 if (gap_array_marker_freelist) | 692 if (gap_array_marker_freelist) |
697 { | 693 { |
698 m = gap_array_marker_freelist; | 694 m = gap_array_marker_freelist; |
699 gap_array_marker_freelist = gap_array_marker_freelist->next; | 695 gap_array_marker_freelist = gap_array_marker_freelist->next; |
927 extent_list_make_marker (Extent_List *el, int pos, int endp) | 923 extent_list_make_marker (Extent_List *el, int pos, int endp) |
928 { | 924 { |
929 Extent_List_Marker *m; | 925 Extent_List_Marker *m; |
930 | 926 |
931 #ifdef NEW_GC | 927 #ifdef NEW_GC |
932 m = XEXTENT_LIST_MARKER (ALLOC_LISP_OBJECT (extent_list_marker)); | 928 m = XEXTENT_LIST_MARKER (ALLOC_NORMAL_LISP_OBJECT (extent_list_marker)); |
933 #else /* not NEW_GC */ | 929 #else /* not NEW_GC */ |
934 if (extent_list_marker_freelist) | 930 if (extent_list_marker_freelist) |
935 { | 931 { |
936 m = extent_list_marker_freelist; | 932 m = extent_list_marker_freelist; |
937 extent_list_marker_freelist = extent_list_marker_freelist->next; | 933 extent_list_marker_freelist = extent_list_marker_freelist->next; |
976 | 972 |
977 static Extent_List * | 973 static Extent_List * |
978 allocate_extent_list (void) | 974 allocate_extent_list (void) |
979 { | 975 { |
980 #ifdef NEW_GC | 976 #ifdef NEW_GC |
981 Extent_List *el = XEXTENT_LIST (ALLOC_LISP_OBJECT (extent_list)); | 977 Extent_List *el = XEXTENT_LIST (ALLOC_NORMAL_LISP_OBJECT (extent_list)); |
982 #else /* not NEW_GC */ | 978 #else /* not NEW_GC */ |
983 Extent_List *el = xnew (Extent_List); | 979 Extent_List *el = xnew (Extent_List); |
984 #endif /* not NEW_GC */ | 980 #endif /* not NEW_GC */ |
985 el->start = make_gap_array (sizeof (EXTENT)); | 981 el->start = make_gap_array (sizeof (EXTENT)); |
986 el->end = make_gap_array (sizeof (EXTENT)); | 982 el->end = make_gap_array (sizeof (EXTENT)); |
1002 /************************************************************************/ | 998 /************************************************************************/ |
1003 /* Auxiliary extent structure */ | 999 /* Auxiliary extent structure */ |
1004 /************************************************************************/ | 1000 /************************************************************************/ |
1005 | 1001 |
1006 static const struct memory_description extent_auxiliary_description[] ={ | 1002 static const struct memory_description extent_auxiliary_description[] ={ |
1007 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, begin_glyph) }, | 1003 #define SLOT(x) \ |
1008 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, end_glyph) }, | 1004 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, x) }, |
1009 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, parent) }, | 1005 EXTENT_AUXILIARY_SLOTS |
1010 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, children) }, | 1006 #undef SLOT |
1011 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, invisible) }, | |
1012 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, read_only) }, | |
1013 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, mouse_face) }, | |
1014 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, initial_redisplay_function) }, | |
1015 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, before_change_functions) }, | |
1016 { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, after_change_functions) }, | |
1017 { XD_END } | 1007 { XD_END } |
1018 }; | 1008 }; |
1019 static Lisp_Object | 1009 static Lisp_Object |
1020 mark_extent_auxiliary (Lisp_Object obj) | 1010 mark_extent_auxiliary (Lisp_Object obj) |
1021 { | 1011 { |
1022 struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); | 1012 struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); |
1023 mark_object (data->begin_glyph); | 1013 #define SLOT(x) mark_object (data->x); |
1024 mark_object (data->end_glyph); | 1014 EXTENT_AUXILIARY_SLOTS |
1025 mark_object (data->invisible); | 1015 #undef SLOT |
1026 mark_object (data->children); | 1016 |
1027 mark_object (data->read_only); | 1017 return Qnil; |
1028 mark_object (data->mouse_face); | 1018 } |
1029 mark_object (data->initial_redisplay_function); | 1019 |
1030 mark_object (data->before_change_functions); | 1020 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("extent-auxiliary", |
1031 mark_object (data->after_change_functions); | 1021 extent_auxiliary, |
1032 return data->parent; | 1022 mark_extent_auxiliary, |
1033 } | 1023 extent_auxiliary_description, |
1034 | 1024 struct extent_auxiliary); |
1035 DEFINE_NODUMP_INTERNAL_LISP_OBJECT ("extent-auxiliary", | 1025 |
1036 extent_auxiliary, | 1026 |
1037 mark_extent_auxiliary, | 1027 static Lisp_Object |
1038 extent_auxiliary_description, | 1028 allocate_extent_auxiliary (void) |
1039 struct extent_auxiliary); | 1029 { |
1030 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (extent_auxiliary); | |
1031 struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); | |
1032 | |
1033 #define SLOT(x) data->x = Qnil; | |
1034 EXTENT_AUXILIARY_SLOTS | |
1035 #undef SLOT | |
1036 | |
1037 return obj; | |
1038 } | |
1039 | |
1040 void | 1040 void |
1041 allocate_extent_auxiliary (EXTENT ext) | 1041 attach_extent_auxiliary (EXTENT ext) |
1042 { | 1042 { |
1043 Lisp_Object obj = ALLOC_LISP_OBJECT (extent_auxiliary); | 1043 Lisp_Object obj = allocate_extent_auxiliary (); |
1044 struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); | 1044 |
1045 | |
1046 COPY_LISP_OBJECT (data, &extent_auxiliary_defaults); | |
1047 ext->plist = Fcons (obj, ext->plist); | 1045 ext->plist = Fcons (obj, ext->plist); |
1048 ext->flags.has_aux = 1; | 1046 ext->flags.has_aux = 1; |
1049 } | 1047 } |
1050 | 1048 |
1051 | 1049 |
1121 }; | 1119 }; |
1122 | 1120 |
1123 #ifdef NEW_GC | 1121 #ifdef NEW_GC |
1124 | 1122 |
1125 static Bytecount | 1123 static Bytecount |
1126 size_gap_array (const void *lheader) | 1124 size_gap_array (Lisp_Object obj) |
1127 { | 1125 { |
1128 Gap_Array *ga = (Gap_Array *) lheader; | 1126 Gap_Array *ga = XGAP_ARRAY (obj); |
1129 return offsetof (Gap_Array, array) + (ga->numels + ga->gapsize) * ga->elsize; | 1127 return offsetof (Gap_Array, array) + (ga->numels + ga->gapsize) * ga->elsize; |
1130 } | 1128 } |
1131 | 1129 |
1132 DEFINE_NODUMP_SIZABLE_INTERNAL_LISP_OBJECT ("gap-array", gap_array, | 1130 DEFINE_NODUMP_SIZABLE_INTERNAL_LISP_OBJECT ("gap-array", gap_array, |
1133 0, | 1131 0, |
1264 mark_extent_info, | 1262 mark_extent_info, |
1265 extent_info_description, | 1263 extent_info_description, |
1266 struct extent_info); | 1264 struct extent_info); |
1267 #else /* not NEW_GC */ | 1265 #else /* not NEW_GC */ |
1268 static void | 1266 static void |
1269 finalize_extent_info (void *header) | 1267 finalize_extent_info (Lisp_Object obj) |
1270 { | 1268 { |
1271 struct extent_info *data = (struct extent_info *) header; | 1269 struct extent_info *data = XEXTENT_INFO (obj); |
1272 | 1270 |
1273 data->soe = 0; | 1271 data->soe = 0; |
1274 data->extents = 0; | 1272 data->extents = 0; |
1275 if (data->soe) | 1273 if (data->soe) |
1276 { | 1274 { |
1292 #endif /* not NEW_GC */ | 1290 #endif /* not NEW_GC */ |
1293 | 1291 |
1294 static Lisp_Object | 1292 static Lisp_Object |
1295 allocate_extent_info (void) | 1293 allocate_extent_info (void) |
1296 { | 1294 { |
1297 Lisp_Object obj = ALLOC_LISP_OBJECT (extent_info); | 1295 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (extent_info); |
1298 struct extent_info *data = XEXTENT_INFO (obj); | 1296 struct extent_info *data = XEXTENT_INFO (obj); |
1299 | 1297 |
1300 data->extents = allocate_extent_list (); | 1298 data->extents = allocate_extent_list (); |
1301 data->soe = 0; | 1299 data->soe = 0; |
1302 return obj; | 1300 return obj; |
1454 } | 1452 } |
1455 | 1453 |
1456 void | 1454 void |
1457 uninit_buffer_extents (struct buffer *b) | 1455 uninit_buffer_extents (struct buffer *b) |
1458 { | 1456 { |
1459 #ifndef NEW_GC | |
1460 struct extent_info *data = XEXTENT_INFO (b->extent_info); | |
1461 #endif /* not NEW_GC */ | |
1462 | |
1463 /* Don't destroy the extents here -- there may still be children | 1457 /* Don't destroy the extents here -- there may still be children |
1464 extents pointing to the extents. */ | 1458 extents pointing to the extents. */ |
1465 detach_all_extents (wrap_buffer (b)); | 1459 detach_all_extents (wrap_buffer (b)); |
1466 #ifndef NEW_GC | 1460 #ifndef NEW_GC |
1467 finalize_extent_info (data); | 1461 finalize_extent_info (b->extent_info); |
1468 #endif /* not NEW_GC */ | 1462 #endif /* not NEW_GC */ |
1469 } | 1463 } |
1470 | 1464 |
1471 /* Retrieve the extent list that an extent is a member of; the | 1465 /* Retrieve the extent list that an extent is a member of; the |
1472 return value will never be 0 except in destroyed buffers (in which | 1466 return value will never be 0 except in destroyed buffers (in which |
1783 static struct stack_of_extents * | 1777 static struct stack_of_extents * |
1784 allocate_soe (void) | 1778 allocate_soe (void) |
1785 { | 1779 { |
1786 #ifdef NEW_GC | 1780 #ifdef NEW_GC |
1787 struct stack_of_extents *soe = | 1781 struct stack_of_extents *soe = |
1788 XSTACK_OF_EXTENTS (ALLOC_LISP_OBJECT (stack_of_extents)); | 1782 XSTACK_OF_EXTENTS (ALLOC_NORMAL_LISP_OBJECT (stack_of_extents)); |
1789 #else /* not NEW_GC */ | 1783 #else /* not NEW_GC */ |
1790 struct stack_of_extents *soe = xnew_and_zero (struct stack_of_extents); | 1784 struct stack_of_extents *soe = xnew_and_zero (struct stack_of_extents); |
1791 #endif /* not NEW_GC */ | 1785 #endif /* not NEW_GC */ |
1792 soe->extents = allocate_extent_list (); | 1786 soe->extents = allocate_extent_list (); |
1793 soe->pos = -1; | 1787 soe->pos = -1; |
4041 if (e->flags.has_aux) | 4035 if (e->flags.has_aux) |
4042 { | 4036 { |
4043 /* also need to copy the aux struct. It won't work for | 4037 /* also need to copy the aux struct. It won't work for |
4044 this extent to share the same aux struct as the original | 4038 this extent to share the same aux struct as the original |
4045 one. */ | 4039 one. */ |
4046 Lisp_Object ea = ALLOC_LISP_OBJECT (extent_auxiliary); | 4040 Lisp_Object ea = ALLOC_NORMAL_LISP_OBJECT (extent_auxiliary); |
4047 struct extent_auxiliary *data = XEXTENT_AUXILIARY (ea); | 4041 |
4048 | 4042 copy_lisp_object (ea, XCAR (original->plist)); |
4049 COPY_LISP_OBJECT (data, XEXTENT_AUXILIARY (XCAR (original->plist))); | |
4050 XCAR (e->plist) = ea; | 4043 XCAR (e->plist) = ea; |
4051 } | 4044 } |
4052 | 4045 |
4053 { | 4046 { |
4054 /* we may have just added another child to the parent extent. */ | 4047 /* we may have just added another child to the parent extent. */ |
7563 DEFSUBR (Fnext_single_char_property_change); | 7556 DEFSUBR (Fnext_single_char_property_change); |
7564 DEFSUBR (Fprevious_single_char_property_change); | 7557 DEFSUBR (Fprevious_single_char_property_change); |
7565 } | 7558 } |
7566 | 7559 |
7567 void | 7560 void |
7568 reinit_vars_of_extents (void) | |
7569 { | |
7570 extent_auxiliary_defaults.begin_glyph = Qnil; | |
7571 extent_auxiliary_defaults.end_glyph = Qnil; | |
7572 extent_auxiliary_defaults.parent = Qnil; | |
7573 extent_auxiliary_defaults.children = Qnil; | |
7574 extent_auxiliary_defaults.priority = 0; | |
7575 extent_auxiliary_defaults.invisible = Qnil; | |
7576 extent_auxiliary_defaults.read_only = Qnil; | |
7577 extent_auxiliary_defaults.mouse_face = Qnil; | |
7578 extent_auxiliary_defaults.initial_redisplay_function = Qnil; | |
7579 extent_auxiliary_defaults.before_change_functions = Qnil; | |
7580 extent_auxiliary_defaults.after_change_functions = Qnil; | |
7581 } | |
7582 | |
7583 void | |
7584 vars_of_extents (void) | 7561 vars_of_extents (void) |
7585 { | 7562 { |
7586 DEFVAR_INT ("mouse-highlight-priority", &mouse_highlight_priority /* | 7563 DEFVAR_INT ("mouse-highlight-priority", &mouse_highlight_priority /* |
7587 The priority to use for the mouse-highlighting pseudo-extent | 7564 The priority to use for the mouse-highlighting pseudo-extent |
7588 that is used to highlight extents with the `mouse-face' attribute set. | 7565 that is used to highlight extents with the `mouse-face' attribute set. |
7622 Vextent_face_reverse_memoize_hash_table = | 7599 Vextent_face_reverse_memoize_hash_table = |
7623 make_lisp_hash_table (100, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); | 7600 make_lisp_hash_table (100, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); |
7624 | 7601 |
7625 QSin_map_extents_internal = build_defer_string ("(in map-extents-internal)"); | 7602 QSin_map_extents_internal = build_defer_string ("(in map-extents-internal)"); |
7626 staticpro (&QSin_map_extents_internal); | 7603 staticpro (&QSin_map_extents_internal); |
7627 } | 7604 |
7605 Vextent_auxiliary_defaults = | |
7606 allocate_extent_auxiliary (); | |
7607 staticpro (&Vextent_auxiliary_defaults); | |
7608 } |