comparison src/text.c @ 800:a5954632b187

[xemacs-hg @ 2002-03-31 08:27:14 by ben] more fixes, first crack at finishing behavior implementation TODO.ben-mule-21-5: Update. configure.in: Fix for new error-checking types. make-mswin-unicode.pl: Don't be fucked up by CRLF. Output code to force errors when nonintercepted Windows calls issued. behavior.el, dumped-lisp.el, menubar-items.el: Add support for saving using custom. Load into a dumped XEmacs. Correct :title to :short-doc in accordance with behavior-defs.el. Add a submenu under Options for turning on/off behaviors. cl-macs.el: Properly document `loop'. Fix a minor bug in keymap iteration and add support for bit-vector iteration. lisp-mode.el: Rearrange and add items for macro expanding. menubar-items.el: Document connection between these two functions. window.el: Port stuff from GNU 21.1. config.inc.samp, xemacs.mak: Separate out and add new variable for controlling error-checking. s/windowsnt.h: Use new ERROR_CHECK_ALL; not related to DEBUG_XEMACS. alloc.c, backtrace.h, buffer.c, buffer.h, bytecode.c, callproc.c, casetab.c, charset.h, chartab.c, cmdloop.c, config.h.in, console-msw.c, console-stream.c, console-tty.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dired-msw.c, dired.c, dumper.c, editfns.c, eldap.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, file-coding.h, fileio.c, frame-msw.c, frame.c, frame.h, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, insdel.c, intl-auto-encap-win32.c, intl-auto-encap-win32.h, intl-encap-win32.c, intl-win32.c, keymap.c, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-x.c, menubar.c, mule-coding.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, opaque.c, print.c, process-nt.c, process-unix.c, process.c, rangetab.c, redisplay-msw.c, redisplay-output.c, redisplay.c, regex.c, scrollbar-msw.c, select-msw.c, signal.c, specifier.c, specifier.h, symbols.c, sysdep.c, syswindows.h, text.c, text.h, toolbar-msw.c, tooltalk.c, ui-gtk.c, unicode.c, window.c: Redo error-checking macros: ERROR_CHECK_TYPECHECK -> ERROR_CHECK_TYPES, ERROR_CHECK_CHARBPOS -> ERROR_CHECK_TEXT, add ERROR_CHECK_DISPLAY, ERROR_CHECK_STRUCTURES. Document these in config.h.in. Fix code to follow docs. Fix *_checking_assert() in accordance with new names. Attempt to fix periodic redisplay crash freeing display line structures. Add first implementation of sledgehammer redisplay check. Redo print_*() to use write_fmt_string(), write_fmt_string_lisp(). Fix bug in md5 handling. Rename character-to-unicode to char-to-unicode; same for unicode-to-char{acter}. Move chartab documentation to `make-char-table'. Some header cleanup. Clean up remaining places where nonintercepted Windows calls are being used. automated/mule-tests.el: Fix for new Unicode support.
author ben
date Sun, 31 Mar 2002 08:30:17 +0000
parents e38acbeb1cae
children 2b676dc88c66
comparison
equal deleted inserted replaced
799:03d9f9084848 800:a5954632b187
1272 of a character. Note that we might have already gotten 1272 of a character. Note that we might have already gotten
1273 a core dump above from an invalid reference, but at least 1273 a core dump above from an invalid reference, but at least
1274 we will get no farther than here. 1274 we will get no farther than here.
1275 1275
1276 This also catches len < 0. */ 1276 This also catches len < 0. */
1277 charbpos_checking_assert (ptr == end); 1277 text_checking_assert (ptr == end);
1278 1278
1279 return count; 1279 return count;
1280 } 1280 }
1281 1281
1282 /* Given a pointer to a text string and a length in characters, return 1282 /* Given a pointer to a text string and a length in characters, return
1285 Bytecount 1285 Bytecount
1286 charcount_to_bytecount (const Intbyte *ptr, Charcount len) 1286 charcount_to_bytecount (const Intbyte *ptr, Charcount len)
1287 { 1287 {
1288 const Intbyte *newptr = ptr; 1288 const Intbyte *newptr = ptr;
1289 1289
1290 charbpos_checking_assert (len >= 0); 1290 text_checking_assert (len >= 0);
1291 while (len > 0) 1291 while (len > 0)
1292 { 1292 {
1293 INC_CHARPTR (newptr); 1293 INC_CHARPTR (newptr);
1294 len--; 1294 len--;
1295 } 1295 }
1403 bufmax = bufmin = BUF_ZV (buf); 1403 bufmax = bufmin = BUF_ZV (buf);
1404 bytmax = bytmin = BI_BUF_ZV (buf); 1404 bytmax = bytmin = BI_BUF_ZV (buf);
1405 size = 1; 1405 size = 1;
1406 } 1406 }
1407 } 1407 }
1408 #ifdef ERROR_CHECK_CHARBPOS 1408 #ifdef ERROR_CHECK_TEXT
1409 else if (x >= bufmin) 1409 else if (x >= bufmin)
1410 abort (); 1410 abort ();
1411 #endif 1411 #endif
1412 else 1412 else
1413 { 1413 {
1681 bufmax = bufmin = BUF_ZV (buf); 1681 bufmax = bufmin = BUF_ZV (buf);
1682 bytmax = bytmin = BI_BUF_ZV (buf); 1682 bytmax = bytmin = BI_BUF_ZV (buf);
1683 size = 1; 1683 size = 1;
1684 } 1684 }
1685 } 1685 }
1686 #ifdef ERROR_CHECK_CHARBPOS 1686 #ifdef ERROR_CHECK_TEXT
1687 else if (x >= bytmin) 1687 else if (x >= bytmin)
1688 abort (); 1688 abort ();
1689 #endif 1689 #endif
1690 else 1690 else
1691 { 1691 {
2029 update_entirely_ascii_p_flag (buf); 2029 update_entirely_ascii_p_flag (buf);
2030 } 2030 }
2031 2031
2032 #endif /* MULE */ 2032 #endif /* MULE */
2033 2033
2034 #ifdef ERROR_CHECK_CHARBPOS 2034 #ifdef ERROR_CHECK_TEXT
2035 2035
2036 Bytebpos 2036 Bytebpos
2037 charbpos_to_bytebpos (struct buffer *buf, Charbpos x) 2037 charbpos_to_bytebpos (struct buffer *buf, Charbpos x)
2038 { 2038 {
2039 Bytebpos retval = real_charbpos_to_bytebpos (buf, x); 2039 Bytebpos retval = real_charbpos_to_bytebpos (buf, x);
2046 { 2046 {
2047 ASSERT_VALID_BYTEBPOS_UNSAFE (buf, x); 2047 ASSERT_VALID_BYTEBPOS_UNSAFE (buf, x);
2048 return real_bytebpos_to_charbpos (buf, x); 2048 return real_bytebpos_to_charbpos (buf, x);
2049 } 2049 }
2050 2050
2051 #endif /* ERROR_CHECK_CHARBPOS */ 2051 #endif /* ERROR_CHECK_TEXT */
2052 2052
2053 2053
2054 /************************************************************************/ 2054 /************************************************************************/
2055 /* verifying buffer and string positions */ 2055 /* verifying buffer and string positions */
2056 /************************************************************************/ 2056 /************************************************************************/
2520 '~'; 2520 '~';
2521 2521
2522 Dynarr_add (conversion_out_dynarr, (Extbyte) c); 2522 Dynarr_add (conversion_out_dynarr, (Extbyte) c);
2523 INC_CHARPTR (ptr); 2523 INC_CHARPTR (ptr);
2524 } 2524 }
2525 charbpos_checking_assert (ptr == end); 2525 text_checking_assert (ptr == end);
2526 } 2526 }
2527 #else 2527 #else
2528 Dynarr_add_many (conversion_out_dynarr, ptr, len); 2528 Dynarr_add_many (conversion_out_dynarr, ptr, len);
2529 #endif 2529 #endif
2530 2530
2598 make_dynarr_output_stream 2598 make_dynarr_output_stream
2599 ((unsigned_char_dynarr *) conversion_out_dynarr); 2599 ((unsigned_char_dynarr *) conversion_out_dynarr);
2600 } 2600 }
2601 2601
2602 streams_to_delete[delete_count++] = outstream = 2602 streams_to_delete[delete_count++] = outstream =
2603 make_coding_output_stream (XLSTREAM (outstream), coding_system, CODING_ENCODE); 2603 make_coding_output_stream (XLSTREAM (outstream), coding_system,
2604 CODING_ENCODE, 0);
2604 2605
2605 reader = XLSTREAM (instream); 2606 reader = XLSTREAM (instream);
2606 writer = XLSTREAM (outstream); 2607 writer = XLSTREAM (outstream);
2607 /* decoding_stream will gc-protect outstream */ 2608 /* decoding_stream will gc-protect outstream */
2608 GCPRO2 (instream, outstream); 2609 GCPRO2 (instream, outstream);
2782 make_dynarr_output_stream 2783 make_dynarr_output_stream
2783 ((unsigned_char_dynarr *) conversion_in_dynarr); 2784 ((unsigned_char_dynarr *) conversion_in_dynarr);
2784 } 2785 }
2785 2786
2786 streams_to_delete[delete_count++] = outstream = 2787 streams_to_delete[delete_count++] = outstream =
2787 make_coding_output_stream (XLSTREAM (outstream), coding_system, CODING_DECODE); 2788 make_coding_output_stream (XLSTREAM (outstream), coding_system,
2789 CODING_DECODE, 0);
2788 2790
2789 reader = XLSTREAM (instream); 2791 reader = XLSTREAM (instream);
2790 writer = XLSTREAM (outstream); 2792 writer = XLSTREAM (outstream);
2791 /* outstream will gc-protect its sink stream, if necessary */ 2793 /* outstream will gc-protect its sink stream, if necessary */
2792 GCPRO2 (instream, outstream); 2794 GCPRO2 (instream, outstream);
3013 str[0] = (Intbyte) ch; 3015 str[0] = (Intbyte) ch;
3014 3016
3015 for (bytes = REP_BYTES_BY_FIRST_BYTE (ch) - 1; bytes; bytes--) 3017 for (bytes = REP_BYTES_BY_FIRST_BYTE (ch) - 1; bytes; bytes--)
3016 { 3018 {
3017 int c = Lstream_getc (stream); 3019 int c = Lstream_getc (stream);
3018 charbpos_checking_assert (c >= 0); 3020 text_checking_assert (c >= 0);
3019 *++strptr = (Intbyte) c; 3021 *++strptr = (Intbyte) c;
3020 } 3022 }
3021 return charptr_emchar (str); 3023 return charptr_emchar (str);
3022 } 3024 }
3023 3025