Mercurial > hg > xemacs-beta
comparison src/extents.c @ 424:11054d720c21 r21-2-20
Import from CVS: tag r21-2-20
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:26:11 +0200 |
parents | 41dbb7a9d5f2 |
children |
comparison
equal
deleted
inserted
replaced
423:28d9c139be4c | 424:11054d720c21 |
---|---|
258 int numels; | 258 int numels; |
259 int elsize; | 259 int elsize; |
260 Gap_Array_Marker *markers; | 260 Gap_Array_Marker *markers; |
261 } Gap_Array; | 261 } Gap_Array; |
262 | 262 |
263 Gap_Array_Marker *gap_array_marker_freelist; | 263 static Gap_Array_Marker *gap_array_marker_freelist; |
264 | 264 |
265 /* Convert a "memory position" (i.e. taking the gap into account) into | 265 /* Convert a "memory position" (i.e. taking the gap into account) into |
266 the address of the element at (i.e. after) that position. "Memory | 266 the address of the element at (i.e. after) that position. "Memory |
267 positions" are only used internally and are of type Memind. | 267 positions" are only used internally and are of type Memind. |
268 "Array positions" are used externally and are of type int. */ | 268 "Array positions" are used externally and are of type int. */ |
299 Gap_Array *start; | 299 Gap_Array *start; |
300 Gap_Array *end; | 300 Gap_Array *end; |
301 Extent_List_Marker *markers; | 301 Extent_List_Marker *markers; |
302 } Extent_List; | 302 } Extent_List; |
303 | 303 |
304 Extent_List_Marker *extent_list_marker_freelist; | 304 static Extent_List_Marker *extent_list_marker_freelist; |
305 | 305 |
306 #define EXTENT_LESS_VALS(e,st,nd) ((extent_start (e) < (st)) || \ | 306 #define EXTENT_LESS_VALS(e,st,nd) ((extent_start (e) < (st)) || \ |
307 ((extent_start (e) == (st)) && \ | 307 ((extent_start (e) == (st)) && \ |
308 (extent_end (e) > (nd)))) | 308 (extent_end (e) > (nd)))) |
309 | 309 |
442 Lisp_Object Qoutside_margin; | 442 Lisp_Object Qoutside_margin; |
443 Lisp_Object Qinside_margin; | 443 Lisp_Object Qinside_margin; |
444 Lisp_Object Qwhitespace; | 444 Lisp_Object Qwhitespace; |
445 /* Qtext defined in general.c */ | 445 /* Qtext defined in general.c */ |
446 | 446 |
447 /* partially used in redisplay */ | |
448 Lisp_Object Qglyph_invisible; | |
449 | |
450 Lisp_Object Qcopy_function; | 447 Lisp_Object Qcopy_function; |
451 Lisp_Object Qpaste_function; | 448 Lisp_Object Qpaste_function; |
452 | 449 |
453 /* The idea here is that if we're given a list of faces, we | 450 /* The idea here is that if we're given a list of faces, we |
454 need to "memoize" this so that two lists of faces that are `equal' | 451 need to "memoize" this so that two lists of faces that are `equal' |
908 /************************************************************************/ | 905 /************************************************************************/ |
909 /* Auxiliary extent structure */ | 906 /* Auxiliary extent structure */ |
910 /************************************************************************/ | 907 /************************************************************************/ |
911 | 908 |
912 static Lisp_Object | 909 static Lisp_Object |
913 mark_extent_auxiliary (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 910 mark_extent_auxiliary (Lisp_Object obj) |
914 { | 911 { |
915 struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); | 912 struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); |
916 markobj (data->begin_glyph); | 913 mark_object (data->begin_glyph); |
917 markobj (data->end_glyph); | 914 mark_object (data->end_glyph); |
918 markobj (data->invisible); | 915 mark_object (data->invisible); |
919 markobj (data->children); | 916 mark_object (data->children); |
920 markobj (data->read_only); | 917 mark_object (data->read_only); |
921 markobj (data->mouse_face); | 918 mark_object (data->mouse_face); |
922 markobj (data->initial_redisplay_function); | 919 mark_object (data->initial_redisplay_function); |
923 markobj (data->before_change_functions); | 920 mark_object (data->before_change_functions); |
924 markobj (data->after_change_functions); | 921 mark_object (data->after_change_functions); |
925 return data->parent; | 922 return data->parent; |
926 } | 923 } |
927 | 924 |
928 DEFINE_LRECORD_IMPLEMENTATION ("extent-auxiliary", extent_auxiliary, | 925 DEFINE_LRECORD_IMPLEMENTATION ("extent-auxiliary", extent_auxiliary, |
929 mark_extent_auxiliary, internal_object_printer, | 926 mark_extent_auxiliary, internal_object_printer, |
971 static struct stack_of_extents *allocate_soe (void); | 968 static struct stack_of_extents *allocate_soe (void); |
972 static void free_soe (struct stack_of_extents *soe); | 969 static void free_soe (struct stack_of_extents *soe); |
973 static void soe_invalidate (Lisp_Object obj); | 970 static void soe_invalidate (Lisp_Object obj); |
974 | 971 |
975 static Lisp_Object | 972 static Lisp_Object |
976 mark_extent_info (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 973 mark_extent_info (Lisp_Object obj) |
977 { | 974 { |
978 struct extent_info *data = (struct extent_info *) XEXTENT_INFO (obj); | 975 struct extent_info *data = (struct extent_info *) XEXTENT_INFO (obj); |
979 int i; | 976 int i; |
980 Extent_List *list = data->extents; | 977 Extent_List *list = data->extents; |
981 | 978 |
994 { | 991 { |
995 struct extent *extent = extent_list_at (list, i, 0); | 992 struct extent *extent = extent_list_at (list, i, 0); |
996 Lisp_Object exobj; | 993 Lisp_Object exobj; |
997 | 994 |
998 XSETEXTENT (exobj, extent); | 995 XSETEXTENT (exobj, extent); |
999 markobj (exobj); | 996 mark_object (exobj); |
1000 } | 997 } |
1001 } | 998 } |
1002 | 999 |
1003 return Qnil; | 1000 return Qnil; |
1004 } | 1001 } |
2911 | 2908 |
2912 /* These are the basic helper functions for handling the allocation of | 2909 /* These are the basic helper functions for handling the allocation of |
2913 extent objects. They are similar to the functions for other | 2910 extent objects. They are similar to the functions for other |
2914 lrecord objects. allocate_extent() is in alloc.c, not here. */ | 2911 lrecord objects. allocate_extent() is in alloc.c, not here. */ |
2915 | 2912 |
2916 static Lisp_Object mark_extent (Lisp_Object, void (*) (Lisp_Object)); | 2913 static Lisp_Object mark_extent (Lisp_Object); |
2917 static int extent_equal (Lisp_Object, Lisp_Object, int depth); | 2914 static int extent_equal (Lisp_Object, Lisp_Object, int depth); |
2918 static unsigned long extent_hash (Lisp_Object obj, int depth); | 2915 static unsigned long extent_hash (Lisp_Object obj, int depth); |
2919 static void print_extent (Lisp_Object obj, Lisp_Object printcharfun, | 2916 static void print_extent (Lisp_Object obj, Lisp_Object printcharfun, |
2920 int escapeflag); | 2917 int escapeflag); |
2921 static Lisp_Object extent_getprop (Lisp_Object obj, Lisp_Object prop); | 2918 static Lisp_Object extent_getprop (Lisp_Object obj, Lisp_Object prop); |
2943 extent_getprop, extent_putprop, | 2940 extent_getprop, extent_putprop, |
2944 extent_remprop, extent_plist, | 2941 extent_remprop, extent_plist, |
2945 struct extent); | 2942 struct extent); |
2946 | 2943 |
2947 static Lisp_Object | 2944 static Lisp_Object |
2948 mark_extent (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 2945 mark_extent (Lisp_Object obj) |
2949 { | 2946 { |
2950 struct extent *extent = XEXTENT (obj); | 2947 struct extent *extent = XEXTENT (obj); |
2951 | 2948 |
2952 markobj (extent_object (extent)); | 2949 mark_object (extent_object (extent)); |
2953 markobj (extent_no_chase_normal_field (extent, face)); | 2950 mark_object (extent_no_chase_normal_field (extent, face)); |
2954 return extent->plist; | 2951 return extent->plist; |
2955 } | 2952 } |
2956 | 2953 |
2957 static void | 2954 static void |
2958 print_extent_1 (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | 2955 print_extent_1 (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) |
2967 if (!NILP (extent_begin_glyph (anc))) *bp++ = '*'; | 2964 if (!NILP (extent_begin_glyph (anc))) *bp++ = '*'; |
2968 *bp++ = (extent_start_open_p (anc) ? '(': '['); | 2965 *bp++ = (extent_start_open_p (anc) ? '(': '['); |
2969 if (extent_detached_p (ext)) | 2966 if (extent_detached_p (ext)) |
2970 strcpy (bp, "detached"); | 2967 strcpy (bp, "detached"); |
2971 else | 2968 else |
2972 { | 2969 sprintf (bp, "%ld, %ld", |
2973 Bufpos from = XINT (Fextent_start_position (obj)); | 2970 (long) XINT (Fextent_start_position (obj)), |
2974 Bufpos to = XINT (Fextent_end_position (obj)); | 2971 (long) XINT (Fextent_end_position (obj))); |
2975 sprintf (bp, "%d, %d", from, to); | |
2976 } | |
2977 bp += strlen (bp); | 2972 bp += strlen (bp); |
2978 *bp++ = (extent_end_open_p (anc) ? ')': ']'); | 2973 *bp++ = (extent_end_open_p (anc) ? ')': ']'); |
2979 if (!NILP (extent_end_glyph (anc))) *bp++ = '*'; | 2974 if (!NILP (extent_end_glyph (anc))) *bp++ = '*'; |
2980 *bp++ = ' '; | 2975 *bp++ = ' '; |
2981 | 2976 |
3182 { | 3177 { |
3183 /* #### Is this correct, anyway? */ | 3178 /* #### Is this correct, anyway? */ |
3184 return -1; | 3179 return -1; |
3185 } | 3180 } |
3186 | 3181 |
3187 return external_remprop (&ext->plist, prop, 0, ERROR_ME); | 3182 return external_remprop (extent_plist_addr (ext), prop, 0, ERROR_ME); |
3188 } | 3183 } |
3189 | 3184 |
3190 static Lisp_Object | 3185 static Lisp_Object |
3191 extent_plist (Lisp_Object obj) | 3186 extent_plist (Lisp_Object obj) |
3192 { | 3187 { |
6720 defsymbol (&Qoutside_margin, "outside-margin"); | 6715 defsymbol (&Qoutside_margin, "outside-margin"); |
6721 defsymbol (&Qinside_margin, "inside-margin"); | 6716 defsymbol (&Qinside_margin, "inside-margin"); |
6722 defsymbol (&Qwhitespace, "whitespace"); | 6717 defsymbol (&Qwhitespace, "whitespace"); |
6723 /* Qtext defined in general.c */ | 6718 /* Qtext defined in general.c */ |
6724 | 6719 |
6725 defsymbol (&Qglyph_invisible, "glyph-invisible"); | |
6726 | |
6727 defsymbol (&Qpaste_function, "paste-function"); | 6720 defsymbol (&Qpaste_function, "paste-function"); |
6728 defsymbol (&Qcopy_function, "copy-function"); | 6721 defsymbol (&Qcopy_function, "copy-function"); |
6729 | 6722 |
6730 defsymbol (&Qtext_prop, "text-prop"); | 6723 defsymbol (&Qtext_prop, "text-prop"); |
6731 defsymbol (&Qtext_prop_extent_paste_function, | 6724 defsymbol (&Qtext_prop_extent_paste_function, |
6798 DEFSUBR (Fnext_single_property_change); | 6791 DEFSUBR (Fnext_single_property_change); |
6799 DEFSUBR (Fprevious_single_property_change); | 6792 DEFSUBR (Fprevious_single_property_change); |
6800 } | 6793 } |
6801 | 6794 |
6802 void | 6795 void |
6796 reinit_vars_of_extents (void) | |
6797 { | |
6798 extent_auxiliary_defaults.begin_glyph = Qnil; | |
6799 extent_auxiliary_defaults.end_glyph = Qnil; | |
6800 extent_auxiliary_defaults.parent = Qnil; | |
6801 extent_auxiliary_defaults.children = Qnil; | |
6802 extent_auxiliary_defaults.priority = 0; | |
6803 extent_auxiliary_defaults.invisible = Qnil; | |
6804 extent_auxiliary_defaults.read_only = Qnil; | |
6805 extent_auxiliary_defaults.mouse_face = Qnil; | |
6806 extent_auxiliary_defaults.initial_redisplay_function = Qnil; | |
6807 extent_auxiliary_defaults.before_change_functions = Qnil; | |
6808 extent_auxiliary_defaults.after_change_functions = Qnil; | |
6809 } | |
6810 | |
6811 void | |
6803 vars_of_extents (void) | 6812 vars_of_extents (void) |
6804 { | 6813 { |
6814 reinit_vars_of_extents (); | |
6815 | |
6805 DEFVAR_INT ("mouse-highlight-priority", &mouse_highlight_priority /* | 6816 DEFVAR_INT ("mouse-highlight-priority", &mouse_highlight_priority /* |
6806 The priority to use for the mouse-highlighting pseudo-extent | 6817 The priority to use for the mouse-highlighting pseudo-extent |
6807 that is used to highlight extents with the `mouse-face' attribute set. | 6818 that is used to highlight extents with the `mouse-face' attribute set. |
6808 See `set-extent-priority'. | 6819 See `set-extent-priority'. |
6809 */ ); | 6820 */ ); |
6826 staticpro (&Vlast_highlighted_extent); | 6837 staticpro (&Vlast_highlighted_extent); |
6827 Vlast_highlighted_extent = Qnil; | 6838 Vlast_highlighted_extent = Qnil; |
6828 | 6839 |
6829 Vextent_face_reusable_list = Fcons (Qnil, Qnil); | 6840 Vextent_face_reusable_list = Fcons (Qnil, Qnil); |
6830 staticpro (&Vextent_face_reusable_list); | 6841 staticpro (&Vextent_face_reusable_list); |
6831 | |
6832 extent_auxiliary_defaults.begin_glyph = Qnil; | |
6833 extent_auxiliary_defaults.end_glyph = Qnil; | |
6834 extent_auxiliary_defaults.parent = Qnil; | |
6835 extent_auxiliary_defaults.children = Qnil; | |
6836 extent_auxiliary_defaults.priority = 0; | |
6837 extent_auxiliary_defaults.invisible = Qnil; | |
6838 extent_auxiliary_defaults.read_only = Qnil; | |
6839 extent_auxiliary_defaults.mouse_face = Qnil; | |
6840 extent_auxiliary_defaults.initial_redisplay_function = Qnil; | |
6841 extent_auxiliary_defaults.before_change_functions = Qnil; | |
6842 extent_auxiliary_defaults.after_change_functions = Qnil; | |
6843 } | 6842 } |
6844 | 6843 |
6845 void | 6844 void |
6846 complex_vars_of_extents (void) | 6845 complex_vars_of_extents (void) |
6847 { | 6846 { |