diff options
author | Karoly Lorentey <[email protected]> | 2004-10-03 13:08:55 +0000 |
---|---|---|
committer | Karoly Lorentey <[email protected]> | 2004-10-03 13:08:55 +0000 |
commit | 04ccca970d4a21222cd1f58c7c41983461f009fc (patch) | |
tree | ae6c3a37beb6a32881b80c42981b891138dd194f /src | |
parent | 181bb49001b52ee593c852377951f8f7b3cf4f38 (diff) | |
parent | 972a542d5b1101a143ef930f62090fa3feab49f1 (diff) |
Merged in changes from CVS trunk.
Patches applied:
* [email protected]/emacs--cvs-trunk--0--patch-581
Fix exec-shield autoconf test
* [email protected]/emacs--cvs-trunk--0--patch-582
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-583
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-584
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-585
Merge from gnus--rel--5.10
* [email protected]/emacs--cvs-trunk--0--patch-586
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-587
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-588
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-589
Merge from gnus--rel--5.10
* [email protected]/emacs--cvs-trunk--0--patch-590
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-591
Update from CVS
* [email protected]/emacs--cvs-trunk--0--patch-592
Update from CVS
* [email protected]/gnus--rel--5.10--patch-38
Update from CVS
* [email protected]/gnus--rel--5.10--patch-39
Merge from emacs--cvs-trunk--0
* [email protected]/gnus--rel--5.10--patch-40
Update from CVS
* [email protected]/gnus--rel--5.10--patch-41
Update from CVS
git-archimport-id: [email protected]/emacs--multi-tty--0--patch-252
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 50 | ||||
-rw-r--r-- | src/callproc.c | 2 | ||||
-rw-r--r-- | src/coding.c | 20 | ||||
-rw-r--r-- | src/dispextern.h | 28 | ||||
-rw-r--r-- | src/fileio.c | 3 | ||||
-rw-r--r-- | src/fringe.c | 157 | ||||
-rw-r--r-- | src/process.c | 1 | ||||
-rw-r--r-- | src/w32term.c | 17 | ||||
-rw-r--r-- | src/xdisp.c | 9 |
9 files changed, 185 insertions, 102 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b71bffc5bc..73fb09883e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,55 @@ +2004-09-30 Kenichi Handa <[email protected]> + + * process.c (send_process): Free composition data. + + * fileio.c (Finsert_file_contents): Free composition data. + + * coding.c (code_convert_region): Don't skip ASCIIs if there are + compositions to encode. + (encode_coding_string): Likewise. Free composition data. + +2004-09-30 Florian Weimer <[email protected]> (tiny change) + + * coding.c (code_convert_region): Free composition data. + 2004-09-29 Kim F. Storm <[email protected]> + * fringe.c: Remove limit on number of bitmaps. + (fringe_bitmaps, fringe_faces): Change to pointers. + (max_fringe_bitmaps): New var. + (Fdefine_fringe_bitmap): Expand fringe_bitmaps and fringe_faces. + (init_fringe): Allocate fringe_bitmaps and fringe_faces. + + * dispextern.h (FRINGE_ID_BITS): Increase to 16 bits (64K bitmaps). + (struct glyph_row): Reorder fringe_bitmap related fields. + (struct it): Likewise. + + * w32term.c (fringe_bmp): Change to pointer. + (max_fringe_bmp): New var. + (w32_define_fringe_bitmap): Expand fringe_bmp. + (w32_draw_fringe_bitmap): Check max_fringe_bmp. + (w32_destroy_fringe_bitmap): Likewise. + +2004-09-29 Kim F. Storm <[email protected]> + + * fringe.c: Simplify last change. + (lookup_fringe_bitmap): New function. + (valid_fringe_bitmap_p, resolve_fringe_bitmap): Remove. + (Fdestroy_fringe_bitmap): Use lookup_fringe_bitmap. + Keep standard bitmaps in Vfringe_bitmaps. + (Fdefine_fringe_bitmap): Use lookup_fringe_bitmap. + (Fset_fringe_bitmap_face): Likewise. + + * dispextern.h (lookup_fringe_bitmap): Add prototype. + (valid_fringe_bitmap_p): Remove prototype. + + * xdisp.c (handle_single_display_prop): Use lookup_fringe_bitmap. + +2004-09-29 Kim F. Storm <[email protected]> + + * fringe.c (destroy_fringe_bitmap, init_fringe_bitmap) + (w32_init_fringe, w32_reset_fringes): Fix bootstrap (NULL rif). + * dispextern.h (valid_fringe_bitmap_p): Fix prototype. * fringe.c (Vfringe_bitmaps): New variable. diff --git a/src/callproc.c b/src/callproc.c index c3345eb370..effd7ecbb1 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -807,6 +807,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) { detect_coding (&process_coding, bufptr, nread); if (process_coding.composing != COMPOSITION_DISABLED) + /* We have not yet allocated the composition + data because the coding type was undecided. */ coding_allocate_composition_data (&process_coding, PT); } if (process_coding.cmp_data) diff --git a/src/coding.c b/src/coding.c index 1257771d3e..58fc587570 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5646,8 +5646,11 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) coding_allocate_composition_data (coding, from); } - /* Try to skip the heading and tailing ASCIIs. */ - if (coding->type != coding_type_ccl) + /* Try to skip the heading and tailing ASCIIs. We can't skip them + if we must run CCL program or there are compositions to + encode. */ + if (coding->type != coding_type_ccl + && (! coding->cmp_data || coding->cmp_data->used == 0)) { int from_byte_orig = from_byte, to_byte_orig = to_byte; @@ -5663,6 +5666,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) if (!replace) /* We must record and adjust for this new text now. */ adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len); + coding_free_composition_data (coding); return 0; } @@ -6293,13 +6297,19 @@ encode_coding_string (str, coding, nocopy) if (coding->composing != COMPOSITION_DISABLED) coding_save_composition (coding, from, to, str); - /* Try to skip the heading and tailing ASCIIs. */ - if (coding->type != coding_type_ccl) + /* Try to skip the heading and tailing ASCIIs. We can't skip them + if we must run CCL program or there are compositions to + encode. */ + if (coding->type != coding_type_ccl + && (! coding->cmp_data || coding->cmp_data->used == 0)) { SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), 1); if (from == to_byte) - return (nocopy ? str : Fcopy_sequence (str)); + { + coding_free_composition_data (coding); + return (nocopy ? str : Fcopy_sequence (str)); + } shrinked_bytes = from + (SBYTES (str) - to_byte); } diff --git a/src/dispextern.h b/src/dispextern.h index 440c127508..7bf3149e1b 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -104,7 +104,7 @@ enum window_part }; /* Number of bits allocated to store fringe bitmap numbers. */ -#define FRINGE_ID_BITS 8 +#define FRINGE_ID_BITS 16 @@ -714,24 +714,24 @@ struct glyph_row /* Left fringe bitmap number (enum fringe_bitmap_type). */ unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; - /* Face of the left fringe glyph. */ - unsigned left_user_fringe_face_id : FACE_ID_BITS; - /* Right fringe bitmap number (enum fringe_bitmap_type). */ unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; - /* Face of the right fringe glyph. */ - unsigned right_user_fringe_face_id : FACE_ID_BITS; - /* Left fringe bitmap number (enum fringe_bitmap_type). */ unsigned left_fringe_bitmap : FRINGE_ID_BITS; - /* Face of the left fringe glyph. */ - unsigned left_fringe_face_id : FACE_ID_BITS; - /* Right fringe bitmap number (enum fringe_bitmap_type). */ unsigned right_fringe_bitmap : FRINGE_ID_BITS; + /* Face of the left fringe glyph. */ + unsigned left_user_fringe_face_id : FACE_ID_BITS; + + /* Face of the right fringe glyph. */ + unsigned right_user_fringe_face_id : FACE_ID_BITS; + + /* Face of the left fringe glyph. */ + unsigned left_fringe_face_id : FACE_ID_BITS; + /* Face of the right fringe glyph. */ unsigned right_fringe_face_id : FACE_ID_BITS; @@ -2043,12 +2043,12 @@ struct it /* Left fringe bitmap number (enum fringe_bitmap_type). */ unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; - /* Face of the left fringe glyph. */ - unsigned left_user_fringe_face_id : FACE_ID_BITS; - /* Right fringe bitmap number (enum fringe_bitmap_type). */ unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; + /* Face of the left fringe glyph. */ + unsigned left_user_fringe_face_id : FACE_ID_BITS; + /* Face of the right fringe glyph. */ unsigned right_user_fringe_face_id : FACE_ID_BITS; }; @@ -2630,7 +2630,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, /* Defined in fringe.c */ -int valid_fringe_bitmap_p (Lisp_Object); +int lookup_fringe_bitmap (Lisp_Object); void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); void draw_window_fringes P_ ((struct window *)); diff --git a/src/fileio.c b/src/fileio.c index 9e86b6a918..0cfea99b46 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4262,7 +4262,7 @@ actually used. */) if (how_much < 0) { xfree (conversion_buffer); - + coding_free_composition_data (&coding); if (how_much == -1) error ("IO error reading %s: %s", SDATA (orig_filename), emacs_strerror (errno)); @@ -4284,6 +4284,7 @@ actually used. */) if (bufpos == inserted) { xfree (conversion_buffer); + coding_free_composition_data (&coding); emacs_close (fd); specpdl_ptr--; /* Truncate the buffer to the size of the file. */ diff --git a/src/fringe.c b/src/fringe.c index 24a7bcb083..529004c7ed 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -446,27 +446,34 @@ struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] = { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 }, }; -static struct fringe_bitmap *fringe_bitmaps[MAX_FRINGE_BITMAPS]; -static unsigned fringe_faces[MAX_FRINGE_BITMAPS]; +static struct fringe_bitmap **fringe_bitmaps; +static unsigned *fringe_faces; +static int max_fringe_bitmaps; static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; -/* Return 1 if FRINGE_ID is a valid fringe bitmap id. */ + +/* Lookup bitmap number for symbol BITMAP. + Return 0 if not a bitmap. */ int -valid_fringe_bitmap_p (bitmap) +lookup_fringe_bitmap (bitmap) Lisp_Object bitmap; { int bn; + bitmap = Fget (bitmap, Qfringe); if (!INTEGERP (bitmap)) return 0; bn = XINT (bitmap); - return (bn >= NO_FRINGE_BITMAP - && bn < max_used_fringe_bitmap - && (bn < MAX_STANDARD_FRINGE_BITMAPS - || fringe_bitmaps[bn] != NULL)); + if (bn > NO_FRINGE_BITMAP + && bn < max_used_fringe_bitmap + && (bn < MAX_STANDARD_FRINGE_BITMAPS + || fringe_bitmaps[bn] != NULL)) + return bn; + + return 0; } /* Get fringe bitmap name for bitmap number BN. @@ -502,42 +509,6 @@ get_fringe_bitmap_name (bn) } -/* Resolve a BITMAP parameter. - - An INTEGER, corresponding to a bitmap number. - A STRING which is interned to a symbol. - A SYMBOL which has a fringe property which is a bitmap number. -*/ - -static int -resolve_fringe_bitmap (bitmap, namep) - Lisp_Object bitmap; - Lisp_Object *namep; -{ - if (namep) - *namep = Qnil; - - if (STRINGP (bitmap)) - bitmap = intern (SDATA (bitmap)); - - if (SYMBOLP (bitmap)) - { - if (namep) - *namep = bitmap; - bitmap = Fget (bitmap, Qfringe); - } - - if (valid_fringe_bitmap_p (bitmap)) - { - if (namep && NILP (*namep)) - *namep = get_fringe_bitmap_name (XINT (bitmap)); - return XINT (bitmap); - } - - return -1; -} - - /* Draw the bitmap WHICH in one of the left or right fringes of window W. ROW is the glyph row for which to display the bitmap; it determines the vertical position at which the bitmap has to be @@ -1069,7 +1040,9 @@ compute_fringe_widths (f, redraw) } -void +/* Free resources used by a user-defined bitmap. */ + +int destroy_fringe_bitmap (n) int n; { @@ -1081,8 +1054,9 @@ destroy_fringe_bitmap (n) if (*fbp && (*fbp)->dynamic) { /* XXX Is SELECTED_FRAME OK here? */ - if (FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap) - FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap (n); + struct redisplay_interface *rif = FRAME_RIF (SELECTED_FRAME ()); + if (rif && rif->destroy_fringe_bitmap) + rif->destroy_fringe_bitmap (n); xfree (*fbp); *fbp = NULL; } @@ -1101,20 +1075,21 @@ If BITMAP overrides a standard fringe bitmap, the original bitmap is restored. Lisp_Object bitmap; { int n; - Lisp_Object sym; - n = resolve_fringe_bitmap (bitmap, &sym); - if (n < 0) + CHECK_SYMBOL (bitmap); + n = lookup_fringe_bitmap (bitmap); + if (!n) return Qnil; destroy_fringe_bitmap (n); - if (SYMBOLP (sym)) + if (n >= MAX_STANDARD_FRINGE_BITMAPS) { - Vfringe_bitmaps = Fdelq (sym, Vfringe_bitmaps); + Vfringe_bitmaps = Fdelq (bitmap, Vfringe_bitmaps); /* It would be better to remove the fringe property. */ - Fput (sym, Qfringe, Qnil); + Fput (bitmap, Qfringe, Qnil); } + return Qnil; } @@ -1188,8 +1163,9 @@ init_fringe_bitmap (which, fb, once_p) destroy_fringe_bitmap (which); /* XXX Is SELECTED_FRAME OK here? */ - if (FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap) - FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap (which, fb->bits, fb->height, fb->width); + struct redisplay_interface *rif = FRAME_RIF (SELECTED_FRAME ()); + if (rif && rif->define_fringe_bitmap) + rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width); fringe_bitmaps[which] = fb; if (which >= max_used_fringe_bitmap) @@ -1219,12 +1195,8 @@ If BITMAP already exists, the existing definition is replaced. */) unsigned short *b; struct fringe_bitmap fb, *xfb; int fill1 = 0, fill2 = 0; - Lisp_Object sym; - - n = resolve_fringe_bitmap (bitmap, &sym); - if (NILP (sym) || INTEGERP (sym)) - sym = wrong_type_argument (Qsymbolp, bitmap); + CHECK_SYMBOL (bitmap); if (!STRINGP (bits) && !VECTORP (bits)) bits = wrong_type_argument (Qstringp, bits); @@ -1277,23 +1249,42 @@ If BITMAP already exists, the existing definition is replaced. */) else if (!NILP (align) && !EQ (align, Qcenter)) error ("Bad align argument"); - if (n < 0) + n = lookup_fringe_bitmap (bitmap); + if (!n) { - if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS) + if (max_used_fringe_bitmap < max_fringe_bitmaps) n = max_used_fringe_bitmap++; else { for (n = MAX_STANDARD_FRINGE_BITMAPS; - n < MAX_FRINGE_BITMAPS; + n < max_fringe_bitmaps; n++) if (fringe_bitmaps[n] == NULL) break; - if (n == MAX_FRINGE_BITMAPS) - error ("Cannot define more fringe bitmaps"); + + if (n == max_fringe_bitmaps) + { + if ((max_fringe_bitmaps + 20) > MAX_FRINGE_BITMAPS) + error ("No free fringe bitmap slots"); + + i = max_fringe_bitmaps; + max_fringe_bitmaps += 20; + fringe_bitmaps + = ((struct fringe_bitmap **) + xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *))); + fringe_faces + = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned)); + + for (; i < max_fringe_bitmaps; i++) + { + fringe_bitmaps[i] = NULL; + fringe_faces[i] = FRINGE_FACE_ID; + } + } } - Vfringe_bitmaps = Fcons (sym, Vfringe_bitmaps); - Fput (sym, Qfringe, make_number (n)); + Vfringe_bitmaps = Fcons (bitmap, Vfringe_bitmaps); + Fput (bitmap, Qfringe, make_number (n)); } fb.dynamic = 1; @@ -1321,7 +1312,7 @@ If BITMAP already exists, the existing definition is replaced. */) init_fringe_bitmap (n, xfb, 0); - return sym; + return bitmap; } DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face, @@ -1331,11 +1322,12 @@ If FACE is nil, reset face to default fringe face. */) (bitmap, face) Lisp_Object bitmap, face; { - int bn; + int n; int face_id; - bn = resolve_fringe_bitmap (bitmap, 0); - if (bn < 0) + CHECK_SYMBOL (bitmap); + n = lookup_fringe_bitmap (bitmap); + if (!n) error ("Undefined fringe bitmap"); if (!NILP (face)) @@ -1347,7 +1339,7 @@ If FACE is nil, reset face to default fringe face. */) else face_id = FRINGE_FACE_ID; - fringe_faces [bn] = face_id; + fringe_faces[n] = face_id; return Qnil; } @@ -1435,9 +1427,18 @@ init_fringe () { int i; - bzero (fringe_bitmaps, sizeof fringe_bitmaps); - for (i = 0; i < MAX_FRINGE_BITMAPS; i++) - fringe_faces[i] = FRINGE_FACE_ID; + max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20; + + fringe_bitmaps + = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); + fringe_faces + = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned)); + + for (i = 0; i < max_fringe_bitmaps; i++) + { + fringe_bitmaps[i] = NULL; + fringe_faces[i] = FRINGE_FACE_ID; + } } #ifdef HAVE_NTGUI @@ -1447,6 +1448,9 @@ w32_init_fringe () { enum fringe_bitmap_type bt; + if (!rif) + return; + for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++) { struct fringe_bitmap *fb = &standard_bitmaps[bt]; @@ -1460,6 +1464,9 @@ w32_reset_fringes () /* Destroy row bitmaps. */ int bt; + if (!rif) + return; + for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++) rif->destroy_fringe_bitmap (bt); } diff --git a/src/process.c b/src/process.c index dab7bdc319..9638c2875d 100644 --- a/src/process.c +++ b/src/process.c @@ -5203,6 +5203,7 @@ send_process (proc, buf, len, object) object = p->encoding_buf; encode_coding (coding, (char *) buf, SDATA (object), len, SBYTES (object)); + coding_free_composition_data (coding); len = coding->produced; buf = SDATA (object); } diff --git a/src/w32term.c b/src/w32term.c index 0614522a17..7e36845eaf 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -62,7 +62,8 @@ Boston, MA 02111-1307, USA. */ /* Fringe bitmaps. */ -static HBITMAP fringe_bmp[MAX_FRINGE_BITMAPS]; +static int max_fringe_bmp = 0; +static HBITMAP *fringe_bmp = 0; /* Non-nil means Emacs uses toolkit scroll bars. */ @@ -704,7 +705,7 @@ w32_draw_fringe_bitmap (w, row, p) p->bx, p->by, p->nx, p->ny); } - if (p->which) + if (p->which && p->which < max_fringe_bmp) { HBITMAP pixmap = fringe_bmp[p->which]; HDC compat_hdc; @@ -767,6 +768,15 @@ w32_define_fringe_bitmap (which, bits, h, wd) unsigned short *bits; int h, wd; { + if (which >= max_fringe_bmp) + { + int i = max_fringe_bmp; + max_fringe_bmp = which + 20; + fringe_bmp = (HBITMAP *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (HBITMAP)); + while (i < max_fringe_bmp) + fringe_bmp[i++] = 0; + } + fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits); } @@ -774,6 +784,9 @@ static void w32_destroy_fringe_bitmap (which) int which; { + if (which >= max_fringe_bmp) + return; + if (fringe_bmp[which]) DeleteObject (fringe_bmp[which]); fringe_bmp[which] = 0; diff --git a/src/xdisp.c b/src/xdisp.c index 2820bbb388..3d52e60c12 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -307,7 +307,6 @@ extern Lisp_Object Qheight; extern Lisp_Object QCwidth, QCheight, QCascent; extern Lisp_Object Qscroll_bar; extern Lisp_Object Qcursor; -extern Lisp_Object Qfringe; /* Non-nil means highlight trailing whitespace. */ @@ -3565,6 +3564,7 @@ handle_single_display_prop (it, prop, object, position, && CONSP (XCDR (prop))) { unsigned face_id = DEFAULT_FACE_ID; + int fringe_bitmap; /* Save current settings of IT so that we can restore them when we are finished with the glyph property value. */ @@ -3576,8 +3576,7 @@ handle_single_display_prop (it, prop, object, position, #ifdef HAVE_WINDOW_SYSTEM value = XCAR (XCDR (prop)); if (!SYMBOLP (value) - || (value = Fget (value, Qfringe), - !valid_fringe_bitmap_p (value))) + || !(fringe_bitmap = lookup_fringe_bitmap (value))) return 0; if (CONSP (XCDR (XCDR (prop)))) @@ -3606,12 +3605,12 @@ handle_single_display_prop (it, prop, object, position, if (EQ (XCAR (prop), Qleft_fringe)) { - it->left_user_fringe_bitmap = XINT (value); + it->left_user_fringe_bitmap = fringe_bitmap; it->left_user_fringe_face_id = face_id; } else { - it->right_user_fringe_bitmap = XINT (value); + it->right_user_fringe_bitmap = fringe_bitmap; it->right_user_fringe_face_id = face_id; } #endif /* HAVE_WINDOW_SYSTEM */ |