Mercurial > hg > xemacs-beta
comparison src/text.h @ 1333:1b0339b048ce
[xemacs-hg @ 2003-03-02 09:38:37 by ben]
To: xemacs-patches@xemacs.org
PROBLEMS: Include nt/PROBLEMS and update. Add note about incremental
linking badness.
cmdloop.el, custom.el, dumped-lisp.el, files.el, keydefs.el, keymap.el, lisp-mode.el, make-docfile.el, replace.el, simple.el, subr.el, view-less.el, wid-edit.el: Lots of syncing with FSF 21.2.
Use if-fboundp in wid-edit.el.
New file newcomment.el from FSF.
internals/internals.texi: Fix typo.
(Build-Time Dependencies): New node.
PROBLEMS: Delete.
config.inc.samp, xemacs.mak: Eliminate HAVE_VC6, use SUPPORT_EDIT_AND_CONTINUE in its place.
No incremental linking unless SUPPORT_EDIT_AND_CONTINUE, since it
can cause nasty crashes in pdump. Put warnings about this in
config.inc.samp. Report the full compile flags used for src
and lib-src in the Installation output.
alloc.c, lisp.h, ralloc.c, regex.c: Use ALLOCA() in regex.c to avoid excessive stack allocation.
Also fix subtle problem with REL_ALLOC() -- any call to malloc()
(direct or indirect) may relocate rel-alloced data, causing
buffer text to shift. After any such call, regex must update
all its pointers to such data. Add a system, when
ERROR_CHECK_MALLOC, whereby regex.c indicates all the places
it is prepared to handle malloc()/realloc()/free(), and any
calls anywhere in XEmacs outside of this will trigger an abort.
alloc.c, dialog-msw.c, eval.c, event-stream.c, general-slots.h, insdel.c, lisp.h, menubar-msw.c, menubar-x.c: Change *run_hook*_trapping_problems to take a warning class, not
a string. Factor out code to issue warnings, add flag to
call_trapping_problems() to postpone warning issue, and make
*run_hook*_trapping_problems issue their own warnings tailored
to the hook, postponed in the case of safe_run_hook_trapping_problems()
so that the appropriate message can be issued about resetting to
nil only when not `quit'. Make record_unwind_protect_restoring_int()
non-static.
dumper.c: Issue notes about incremental linking problems under Windows.
fileio.c: Mule-ize encrypt/decrypt-string code.
text.h: Spacing changes.
author | ben |
---|---|
date | Sun, 02 Mar 2003 09:38:54 +0000 |
parents | b531bf8658e9 |
children | e9929b7b37ad |
comparison
equal
deleted
inserted
replaced
1332:6aa23bb3da6b | 1333:1b0339b048ce |
---|---|
488 */ | 488 */ |
489 | 489 |
490 #ifdef ERROR_CHECK_TEXT | 490 #ifdef ERROR_CHECK_TEXT |
491 /* We use a separate definition to avoid warnings about unused dc_ptr1 */ | 491 /* We use a separate definition to avoid warnings about unused dc_ptr1 */ |
492 #define DEC_IBYTEPTR(ptr) do { \ | 492 #define DEC_IBYTEPTR(ptr) do { \ |
493 const Ibyte *dc_ptr1 = (ptr); \ | 493 const Ibyte *dc_ptr1 = (ptr); \ |
494 do { \ | 494 do { \ |
495 (ptr)--; \ | 495 (ptr)--; \ |
496 } while (!valid_ibyteptr_p (ptr)); \ | 496 } while (!valid_ibyteptr_p (ptr)); \ |
497 text_checking_assert (dc_ptr1 - (ptr) == rep_bytes_by_first_byte (*(ptr))); \ | 497 text_checking_assert (dc_ptr1 - (ptr) == rep_bytes_by_first_byte (*(ptr))); \ |
498 } while (0) | 498 } while (0) |
1878 } \ | 1878 } \ |
1879 if (ei1newsize != (ei)->max_size_allocated_) \ | 1879 if (ei1newsize != (ei)->max_size_allocated_) \ |
1880 { \ | 1880 { \ |
1881 if ((ei)->mallocp_) \ | 1881 if ((ei)->mallocp_) \ |
1882 /* xrealloc always preserves existing data as much as possible */ \ | 1882 /* xrealloc always preserves existing data as much as possible */ \ |
1883 (ei)->data_ = (Ibyte *) xrealloc ((ei)->data_, ei1newsize); \ | 1883 (ei)->data_ = (Ibyte *) xrealloc ((ei)->data_, ei1newsize); \ |
1884 else \ | 1884 else \ |
1885 { \ | 1885 { \ |
1886 /* We don't have realloc, so ALLOCA() more space and copy the \ | 1886 /* We don't have realloc, so ALLOCA() more space and copy the \ |
1887 data into it. */ \ | 1887 data into it. */ \ |
1888 Ibyte *ei1oldeidata = (ei)->data_; \ | 1888 Ibyte *ei1oldeidata = (ei)->data_; \ |
1934 | 1934 |
1935 #define eicpy_lstr(ei, lisp_string) \ | 1935 #define eicpy_lstr(ei, lisp_string) \ |
1936 do { \ | 1936 do { \ |
1937 Lisp_Object ei3 = (lisp_string); \ | 1937 Lisp_Object ei3 = (lisp_string); \ |
1938 EI_ALLOC_AND_COPY (ei, XSTRING_DATA (ei3), XSTRING_LENGTH (ei3), \ | 1938 EI_ALLOC_AND_COPY (ei, XSTRING_DATA (ei3), XSTRING_LENGTH (ei3), \ |
1939 string_char_length (ei3)); \ | 1939 string_char_length (ei3)); \ |
1940 } while (0) | 1940 } while (0) |
1941 | 1941 |
1942 #define eicpy_lstr_off(ei, lisp_string, off, charoff, len, charlen) \ | 1942 #define eicpy_lstr_off(ei, lisp_string, off, charoff, len, charlen) \ |
1943 do { \ | 1943 do { \ |
1944 Lisp_Object ei23lstr = (lisp_string); \ | 1944 Lisp_Object ei23lstr = (lisp_string); \ |
1956 EI_ALLOC_AND_COPY (ei, ei23data + ei23off, ei23len, ei23charlen); \ | 1956 EI_ALLOC_AND_COPY (ei, ei23data + ei23off, ei23len, ei23charlen); \ |
1957 } while (0) | 1957 } while (0) |
1958 | 1958 |
1959 #define eicpy_raw_fmt(ei, ptr, len, fmt, object) \ | 1959 #define eicpy_raw_fmt(ei, ptr, len, fmt, object) \ |
1960 do { \ | 1960 do { \ |
1961 const Ibyte *ei12ptr = (ptr); \ | 1961 const Ibyte *ei12ptr = (ptr); \ |
1962 Internal_Format ei12fmt = (fmt); \ | 1962 Internal_Format ei12fmt = (fmt); \ |
1963 int ei12len = (len); \ | 1963 int ei12len = (len); \ |
1964 assert (ei12fmt == FORMAT_DEFAULT); \ | 1964 assert (ei12fmt == FORMAT_DEFAULT); \ |
1965 EI_ALLOC_AND_COPY (ei, ei12ptr, ei12len, \ | 1965 EI_ALLOC_AND_COPY (ei, ei12ptr, ei12len, \ |
1966 bytecount_to_charcount (ei12ptr, ei12len)); \ | 1966 bytecount_to_charcount (ei12ptr, ei12len)); \ |
1977 eicpy_raw_fmt (ei, ei12p1ptr, qxestrlen (ei12p1ptr), fmt, object); \ | 1977 eicpy_raw_fmt (ei, ei12p1ptr, qxestrlen (ei12p1ptr), fmt, object); \ |
1978 } while (0) | 1978 } while (0) |
1979 | 1979 |
1980 #define eicpy_rawz(ei, ptr) eicpy_rawz_fmt (ei, ptr, FORMAT_DEFAULT, Qnil) | 1980 #define eicpy_rawz(ei, ptr) eicpy_rawz_fmt (ei, ptr, FORMAT_DEFAULT, Qnil) |
1981 | 1981 |
1982 #define eicpy_ch(ei, ch) \ | 1982 #define eicpy_ch(ei, ch) \ |
1983 do { \ | 1983 do { \ |
1984 Ibyte ei12p2[MAX_ICHAR_LEN]; \ | 1984 Ibyte ei12p2[MAX_ICHAR_LEN]; \ |
1985 Bytecount ei12p2len = set_itext_ichar (ei12p2, ch); \ | 1985 Bytecount ei12p2len = set_itext_ichar (ei12p2, ch); \ |
1986 EI_ALLOC_AND_COPY (ei, ei12p2, ei12p2len, 1); \ | 1986 EI_ALLOC_AND_COPY (ei, ei12p2, ei12p2len, 1); \ |
1987 } while (0) | 1987 } while (0) |
1988 | 1988 |
1989 #define eicpy_c(ei, c_string) \ | 1989 #define eicpy_c(ei, c_string) \ |
1990 do { \ | 1990 do { \ |
1991 const Char_ASCII *ei4 = (c_string); \ | 1991 const Char_ASCII *ei4 = (c_string); \ |
2242 string_char_length (ei17)); \ | 2242 string_char_length (ei17)); \ |
2243 } while (0) | 2243 } while (0) |
2244 | 2244 |
2245 #define eicat_ch(ei, ch) \ | 2245 #define eicat_ch(ei, ch) \ |
2246 do { \ | 2246 do { \ |
2247 Ibyte ei22ch[MAX_ICHAR_LEN]; \ | 2247 Ibyte ei22ch[MAX_ICHAR_LEN]; \ |
2248 Bytecount ei22len = set_itext_ichar (ei22ch, ch); \ | 2248 Bytecount ei22len = set_itext_ichar (ei22ch, ch); \ |
2249 eicat_1 (ei, ei22ch, ei22len, 1); \ | 2249 eicat_1 (ei, ei22ch, ei22len, 1); \ |
2250 } while (0) | 2250 } while (0) |
2251 | 2251 |
2252 | 2252 |
2283 memcpy ((ei)->data_ + ei18off, ei18src, ei18srclen); \ | 2283 memcpy ((ei)->data_ + ei18off, ei18src, ei18srclen); \ |
2284 } while (0) | 2284 } while (0) |
2285 | 2285 |
2286 #define eisub_ei(ei, off, charoff, len, charlen, ei2) \ | 2286 #define eisub_ei(ei, off, charoff, len, charlen, ei2) \ |
2287 do { \ | 2287 do { \ |
2288 const Eistring *ei19 = (ei2); \ | 2288 const Eistring *ei19 = (ei2); \ |
2289 eisub_1 (ei, off, charoff, len, charlen, ei19->data_, ei19->bytelen_, \ | 2289 eisub_1 (ei, off, charoff, len, charlen, ei19->data_, ei19->bytelen_, \ |
2290 ei19->charlen_); \ | 2290 ei19->charlen_); \ |
2291 } while (0) | 2291 } while (0) |
2292 | 2292 |
2293 #define eisub_c(ei, off, charoff, len, charlen, c_string) \ | 2293 #define eisub_c(ei, off, charoff, len, charlen, c_string) \ |
2298 eisub_1 (ei, off, charoff, len, charlen, ei20, ei20len, -1); \ | 2298 eisub_1 (ei, off, charoff, len, charlen, ei20, ei20len, -1); \ |
2299 } while (0) | 2299 } while (0) |
2300 | 2300 |
2301 #define eisub_ch(ei, off, charoff, len, charlen, ch) \ | 2301 #define eisub_ch(ei, off, charoff, len, charlen, ch) \ |
2302 do { \ | 2302 do { \ |
2303 Ibyte ei21ch[MAX_ICHAR_LEN]; \ | 2303 Ibyte ei21ch[MAX_ICHAR_LEN]; \ |
2304 Bytecount ei21len = set_itext_ichar (ei21ch, ch); \ | 2304 Bytecount ei21len = set_itext_ichar (ei21ch, ch); \ |
2305 eisub_1 (ei, off, charoff, len, charlen, ei21ch, ei21len, 1); \ | 2305 eisub_1 (ei, off, charoff, len, charlen, ei21ch, ei21len, 1); \ |
2306 } while (0) | 2306 } while (0) |
2307 | 2307 |
2308 #define eidel(ei, off, charoff, len, charlen) \ | 2308 #define eidel(ei, off, charoff, len, charlen) \ |
2309 eisub_1(ei, off, charoff, len, charlen, NULL, 0, 0) | 2309 eisub_1(ei, off, charoff, len, charlen, NULL, 0, 0) |
2310 | 2310 |
2311 | 2311 |
2312 /* ----- Converting to an external format ----- */ | 2312 /* ----- Converting to an external format ----- */ |
2313 | 2313 |
2314 #define eito_external(ei, codesys) \ | 2314 #define eito_external(ei, codesys) \ |
2315 do { \ | 2315 do { \ |
2316 if ((ei)->mallocp_) \ | 2316 if ((ei)->mallocp_) \ |
2317 { \ | 2317 { \ |
2318 if ((ei)->extdata_) \ | 2318 if ((ei)->extdata_) \ |
2319 { \ | 2319 { \ |
2320 xfree ((ei)->extdata_); \ | 2320 xfree ((ei)->extdata_); \ |
2321 (ei)->extdata_ = 0; \ | 2321 (ei)->extdata_ = 0; \ |
2322 } \ | 2322 } \ |
2323 TO_EXTERNAL_FORMAT (DATA, ((ei)->data_, (ei)->bytelen_), \ | 2323 TO_EXTERNAL_FORMAT (DATA, ((ei)->data_, (ei)->bytelen_), \ |
2324 MALLOC, ((ei)->extdata_, (ei)->extlen_), \ | 2324 MALLOC, ((ei)->extdata_, (ei)->extlen_), \ |
2325 codesys); \ | 2325 codesys); \ |
2326 } \ | 2326 } \ |
2327 else \ | 2327 else \ |
2328 TO_EXTERNAL_FORMAT (DATA, ((ei)->data_, (ei)->bytelen_), \ | 2328 TO_EXTERNAL_FORMAT (DATA, ((ei)->data_, (ei)->bytelen_), \ |
2329 ALLOCA, ((ei)->extdata_, (ei)->extlen_), \ | 2329 ALLOCA, ((ei)->extdata_, (ei)->extlen_), \ |
2330 codesys); \ | 2330 codesys); \ |
2430 int downp); | 2430 int downp); |
2431 | 2431 |
2432 #define EI_CASECHANGE(ei, downp) \ | 2432 #define EI_CASECHANGE(ei, downp) \ |
2433 do { \ | 2433 do { \ |
2434 int ei11new_allocmax = (ei)->charlen_ * MAX_ICHAR_LEN + 1; \ | 2434 int ei11new_allocmax = (ei)->charlen_ * MAX_ICHAR_LEN + 1; \ |
2435 Ibyte *ei11storage = \ | 2435 Ibyte *ei11storage = \ |
2436 (Ibyte *) alloca_array (Ibyte, ei11new_allocmax); \ | 2436 (Ibyte *) alloca_array (Ibyte, ei11new_allocmax); \ |
2437 int ei11newlen = eistr_casefiddle_1 ((ei)->data_, (ei)->bytelen_, \ | 2437 int ei11newlen = eistr_casefiddle_1 ((ei)->data_, (ei)->bytelen_, \ |
2438 ei11storage, downp); \ | 2438 ei11storage, downp); \ |
2439 \ | 2439 \ |
2440 if (ei11newlen) \ | 2440 if (ei11newlen) \ |
2441 { \ | 2441 { \ |
2442 (ei)->max_size_allocated_ = ei11new_allocmax; \ | 2442 (ei)->max_size_allocated_ = ei11new_allocmax; \ |
2443 (ei)->data_ = ei11storage; \ | 2443 (ei)->data_ = ei11storage; \ |
2444 (ei)->bytelen_ = ei11newlen; \ | 2444 (ei)->bytelen_ = ei11newlen; \ |
2445 /* charlen is the same. */ \ | 2445 /* charlen is the same. */ \ |
2446 } \ | 2446 } \ |
2447 } while (0) | 2447 } while (0) |
2448 | 2448 |