Mercurial > hg > xemacs-beta
comparison src/redisplay.c @ 5038:9410323e4b0d
major dynarr fixes
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-20 Ben Wing <ben@xemacs.org>
* device-x.c (Fx_get_resource):
* dynarr.c:
* dynarr.c (Dynarr_realloc):
* dynarr.c (Dynarr_newf):
* dynarr.c (Dynarr_lisp_realloc):
* dynarr.c (Dynarr_lisp_newf):
* dynarr.c (Dynarr_resize):
* dynarr.c (Dynarr_insert_many):
* dynarr.c (Dynarr_delete_many):
* dynarr.c (Dynarr_memory_usage):
* dynarr.c (stack_like_free):
* file-coding.c (coding_reader):
* file-coding.c (gzip_convert):
* gutter.c (output_gutter):
* lisp.h:
* lisp.h (Dynarr_declare):
* lisp.h (DYNARR_SET_LISP_IMP):
* lisp.h (CHECK_NATNUM):
* profile.c (create_timing_profile_table):
* redisplay-output.c (sync_rune_structs):
* redisplay-output.c (sync_display_line_structs):
* redisplay-output.c (redisplay_output_window):
* redisplay.c:
* redisplay.c (get_display_block_from_line):
* redisplay.c (add_ichar_rune_1):
* redisplay.c (ensure_modeline_generated):
* redisplay.c (generate_displayable_area):
* redisplay.c (regenerate_window):
* redisplay.c (update_line_start_cache):
* signal.c:
* signal.c (check_quit):
Lots of rewriting of dynarr code.
(1) Lots of documentation added. Also fix places that
referenced a now-bogus internals node concerning redisplay
critical sections.
(2) Rename:
Dynarr_add_lisp_string -> Dynarr_add_ext_lisp_string
Dynarr_set_length -> Dynarr_set_lengthr ("restricted")
Dynarr_increment -> Dynarr_incrementr
Dynarr_resize_if -> Dynarr_resize_to_add
(3) New functions:
Dynarr_elsize = dy->elsize_
Dynarr_set_length(): Set length, resizing as necessary
Dynarr_set_length_and_zero(): Set length, resizing as necessary,
zeroing out new elements
Dynarr_increase_length(), Dynarr_increase_length_and_zero():
Optimization of Dynarr_set_length(), Dynarr_set_length_and_zero()
when size is known to increase
Dynarr_resize_to_fit(): Resize as necessary to fit a given length.
Dynarr_set(): Set element at a given position, increasing length
as necessary and setting any newly created positions to 0
(4) Use Elemcount, Bytecount.
(5) Rewrite many macros as inline functions.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 20 Feb 2010 03:46:22 -0600 |
parents | 16112448d484 |
children | 548f1f47eb82 |
comparison
equal
deleted
inserted
replaced
5037:e70a73f9243d | 5038:9410323e4b0d |
---|---|
726 if (elt < Dynarr_largest (dl->display_blocks)) | 726 if (elt < Dynarr_largest (dl->display_blocks)) |
727 { | 727 { |
728 struct display_block *dbp = Dynarr_atp (dl->display_blocks, elt); | 728 struct display_block *dbp = Dynarr_atp (dl->display_blocks, elt); |
729 | 729 |
730 /* "add" the block to the list */ | 730 /* "add" the block to the list */ |
731 Dynarr_increment (dl->display_blocks); | 731 Dynarr_incrementr (dl->display_blocks); |
732 | 732 |
733 /* initialize and return */ | 733 /* initialize and return */ |
734 dbp->type = type; | 734 dbp->type = type; |
735 return dbp; | 735 return dbp; |
736 } | 736 } |
1219 crb->cursor_type = CURSOR_OFF; | 1219 crb->cursor_type = CURSOR_OFF; |
1220 | 1220 |
1221 if (local) | 1221 if (local) |
1222 Dynarr_add (data->db->runes, *crb); | 1222 Dynarr_add (data->db->runes, *crb); |
1223 else | 1223 else |
1224 Dynarr_increment (data->db->runes); | 1224 Dynarr_incrementr (data->db->runes); |
1225 | 1225 |
1226 data->pixpos += width; | 1226 data->pixpos += width; |
1227 | 1227 |
1228 return NULL; | 1228 return NULL; |
1229 } | 1229 } |
4530 currently a modeline because it is definitely going to become | 4530 currently a modeline because it is definitely going to become |
4531 one if we have gotten to this point. */ | 4531 one if we have gotten to this point. */ |
4532 if (Dynarr_length (dla) == 0) | 4532 if (Dynarr_length (dla) == 0) |
4533 { | 4533 { |
4534 if (Dynarr_largest (dla) > 0) | 4534 if (Dynarr_largest (dla) > 0) |
4535 Dynarr_increment (dla); | 4535 Dynarr_incrementr (dla); |
4536 else | 4536 else |
4537 { | 4537 { |
4538 struct display_line modeline; | 4538 struct display_line modeline; |
4539 | 4539 |
4540 DISPLAY_LINE_INIT (modeline); | 4540 DISPLAY_LINE_INIT (modeline); |
5299 return ret_charcount; | 5299 return ret_charcount; |
5300 } | 5300 } |
5301 | 5301 |
5302 /* | 5302 /* |
5303 | 5303 |
5304 Info on Re-entrancy crashes, with backtraces given: | 5304 Info on reentrancy crashes, with backtraces given: |
5305 | 5305 |
5306 (Info-goto-node "(internals)Nasty Bugs due to Reentrancy in Redisplay Structures handling QUIT") | 5306 (Info-goto-node "(internals)Critical Redisplay Sections") |
5307 | |
5307 */ | 5308 */ |
5308 | 5309 |
5309 | 5310 |
5310 /* This is ripped off from regenerate_window. All we want to do is | 5311 /* This is ripped off from regenerate_window. All we want to do is |
5311 loop through elements in the string creating display lines until we | 5312 loop through elements in the string creating display lines until we |
5403 dlp->clip = 0; | 5404 dlp->clip = 0; |
5404 | 5405 |
5405 if (pos_of_dlp < 0) | 5406 if (pos_of_dlp < 0) |
5406 Dynarr_add (dla, *dlp); | 5407 Dynarr_add (dla, *dlp); |
5407 else if (pos_of_dlp == Dynarr_length (dla)) | 5408 else if (pos_of_dlp == Dynarr_length (dla)) |
5408 Dynarr_increment (dla); | 5409 Dynarr_incrementr (dla); |
5409 else | 5410 else |
5410 ABORT (); | 5411 ABORT (); |
5411 | 5412 |
5412 /* #### This type of check needs to be done down in the | 5413 /* #### This type of check needs to be done down in the |
5413 generate_display_line call. */ | 5414 generate_display_line call. */ |
5457 ABORT (); | 5458 ABORT (); |
5458 | 5459 |
5459 if (!in_display) | 5460 if (!in_display) |
5460 depth = enter_redisplay_critical_section (); | 5461 depth = enter_redisplay_critical_section (); |
5461 | 5462 |
5462 /* This is one spot where a re-entrancy crash will occur, due to a check | 5463 /* This is one spot where a reentrancy crash will occur, due to a check |
5463 in the dynarr to make sure it isn't "locked" */ | 5464 in the dynarr to make sure it isn't "locked" */ |
5464 /* | 5465 /* |
5465 | 5466 |
5466 Info on Re-entrancy crashes, with backtraces given: | 5467 Info on reentrancy crashes, with backtraces given: |
5467 | 5468 |
5468 (Info-goto-node "(internals)Nasty Bugs due to Reentrancy in Redisplay Structures handling QUIT") | 5469 (Info-goto-node "(internals)Critical Redisplay Sections") |
5469 */ | 5470 */ |
5470 | 5471 |
5471 Dynarr_reset (dla); | 5472 Dynarr_reset (dla); |
5472 w->max_line_len = 0; | 5473 w->max_line_len = 0; |
5473 | 5474 |
5626 w->max_line_len = dlp->num_chars; | 5627 w->max_line_len = dlp->num_chars; |
5627 | 5628 |
5628 if (pos_of_dlp < 0) | 5629 if (pos_of_dlp < 0) |
5629 Dynarr_add (dla, *dlp); | 5630 Dynarr_add (dla, *dlp); |
5630 else if (pos_of_dlp == Dynarr_length (dla)) | 5631 else if (pos_of_dlp == Dynarr_length (dla)) |
5631 Dynarr_increment (dla); | 5632 Dynarr_incrementr (dla); |
5632 else | 5633 else |
5633 ABORT (); | 5634 ABORT (); |
5634 | 5635 |
5635 /* #### This isn't right, but it is close enough for now. */ | 5636 /* #### This isn't right, but it is close enough for now. */ |
5636 w->window_end_pos[type] = start_pos; | 5637 w->window_end_pos[type] = start_pos; |
8467 Dynarr_length (internal_cache)); | 8468 Dynarr_length (internal_cache)); |
8468 w->line_cache_validation_override--; | 8469 w->line_cache_validation_override--; |
8469 return; | 8470 return; |
8470 } | 8471 } |
8471 | 8472 |
8472 Dynarr_insert_many_at_start (cache, Dynarr_begin (internal_cache), | 8473 Dynarr_prepend_many (cache, Dynarr_begin (internal_cache), |
8473 ic_elt + 1); | 8474 ic_elt + 1); |
8474 } | 8475 } |
8475 | 8476 |
8476 if (end > high_bound) | 8477 if (end > high_bound) |
8477 { | 8478 { |