comparison src/fns.c @ 793:e38acbeb1cae

[xemacs-hg @ 2002-03-29 04:46:17 by ben] lots o' fixes etc/ChangeLog: New file. Separated out all entries for etc/ into their own ChangeLog. Includes entries for the following files: etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad, etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL, etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS, etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL, etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se, etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh, etc/custom/example-themes/europe-theme.el, etc/custom/example-themes/ex-custom-file, etc/custom/example-themes/example-theme.el, etc/e/eterm.ti, etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1, etc/gnuserv.README, etc/package-index.LATEST.gpg, etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm, etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs, etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E, etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm, etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm, etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar, etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1, etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL, etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el, etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\* unicode/unicode-consortium/8859-16.TXT: New file. mule/english.el: Define this charset now, since a bug was fixed that formerly prevented it. mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be integers. Makefile.in.in: Always include gui.c, to fix compile error when TTY-only. EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo(). Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate nearly all uses of Lisp_String * in favor of Lisp_Object, and correct macros so most of them favor Lisp_Object. Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings, but at level `debug' (usually ignored). Use it when instantiating specifiers, so problems can be debugged. Move log-warning-minimum-level into C so that we can optimize ERROR_ME_DEBUG_WARN. Fix warning levels consistent with new definitions. Add default_ and parent fields to char table; not yet implemented. New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as Courier New but less interline spacing, so more lines fit). Increase default frame size on Windows to 50 lines. (If that's too big for the workspace, the frame will be shrunk as necessary.) Fix problem with text files with no newlines (). (Change `convert-eol' coding system to use `nil' for autodetect, consistent with make-coding-system.) Correct compile warnings in vm-limit.c. Fix handling of reverse-direction charsets to avoid errors when opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el. Recode some object printing methods to use write_fmt_string() instead of a fixed buffer and sprintf. Turn on display of png comments as warnings (level `info'), now that they're unobtrusive. Revamped the sound documentation. Fixed bug in redisplay w.r.t. hscroll/truncation/continuation glyphs causing jumping up and down of the lines, since they're bigger than the line size. (It was seen most obviously when there's a horizontal scroll bar, e.g. do C-h a glyph or something like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now.
author ben
date Fri, 29 Mar 2002 04:49:13 +0000
parents 578cb2932d72
children 2b676dc88c66
comparison
equal deleted inserted replaced
792:4e83fdb13eb9 793:e38acbeb1cae
276 Symbols are also allowed; their print names are used instead. 276 Symbols are also allowed; their print names are used instead.
277 */ 277 */
278 (string1, string2)) 278 (string1, string2))
279 { 279 {
280 Bytecount len; 280 Bytecount len;
281 Lisp_String *p1, *p2; 281 Lisp_Object p1, p2;
282 282
283 if (SYMBOLP (string1)) 283 if (SYMBOLP (string1))
284 p1 = XSYMBOL (string1)->name; 284 p1 = XSYMBOL (string1)->name;
285 else 285 else
286 { 286 {
287 CHECK_STRING (string1); 287 CHECK_STRING (string1);
288 p1 = XSTRING (string1); 288 p1 = string1;
289 } 289 }
290 290
291 if (SYMBOLP (string2)) 291 if (SYMBOLP (string2))
292 p2 = XSYMBOL (string2)->name; 292 p2 = XSYMBOL (string2)->name;
293 else 293 else
294 { 294 {
295 CHECK_STRING (string2); 295 CHECK_STRING (string2);
296 p2 = XSTRING (string2); 296 p2 = string2;
297 } 297 }
298 298
299 return (((len = string_length (p1)) == string_length (p2)) && 299 return (((len = XSTRING_LENGTH (p1)) == XSTRING_LENGTH (p2)) &&
300 !memcmp (string_data (p1), string_data (p2), len)) ? Qt : Qnil; 300 !memcmp (XSTRING_DATA (p1), XSTRING_DATA (p2), len)) ? Qt : Qnil;
301 } 301 }
302 302
303 DEFUN ("string-lessp", Fstring_lessp, 2, 2, 0, /* 303 DEFUN ("string-lessp", Fstring_lessp, 2, 2, 0, /*
304 Return t if first arg string is less than second in lexicographic order. 304 Return t if first arg string is less than second in lexicographic order.
305 Comparison is simply done on a character-by-character basis using the 305 Comparison is simply done on a character-by-character basis using the
313 multiple character sets. This may be changed when Unicode support 313 multiple character sets. This may be changed when Unicode support
314 is implemented. 314 is implemented.
315 */ 315 */
316 (string1, string2)) 316 (string1, string2))
317 { 317 {
318 Lisp_String *p1, *p2; 318 Lisp_Object p1, p2;
319 Charcount end, len2; 319 Charcount end, len2;
320 int i; 320 int i;
321 321
322 if (SYMBOLP (string1)) 322 if (SYMBOLP (string1))
323 p1 = XSYMBOL (string1)->name; 323 p1 = XSYMBOL (string1)->name;
324 else 324 else
325 { 325 {
326 CHECK_STRING (string1); 326 CHECK_STRING (string1);
327 p1 = XSTRING (string1); 327 p1 = string1;
328 } 328 }
329 329
330 if (SYMBOLP (string2)) 330 if (SYMBOLP (string2))
331 p2 = XSYMBOL (string2)->name; 331 p2 = XSYMBOL (string2)->name;
332 else 332 else
333 { 333 {
334 CHECK_STRING (string2); 334 CHECK_STRING (string2);
335 p2 = XSTRING (string2); 335 p2 = string2;
336 } 336 }
337 337
338 end = string_char_length (p1); 338 end = XSTRING_CHAR_LENGTH (p1);
339 len2 = string_char_length (p2); 339 len2 = XSTRING_CHAR_LENGTH (p2);
340 if (end > len2) 340 if (end > len2)
341 end = len2; 341 end = len2;
342 342
343 { 343 {
344 Intbyte *ptr1 = string_data (p1); 344 Intbyte *ptr1 = XSTRING_DATA (p1);
345 Intbyte *ptr2 = string_data (p2); 345 Intbyte *ptr2 = XSTRING_DATA (p2);
346 346
347 /* #### It is not really necessary to do this: We could compare 347 /* #### It is not really necessary to do this: We could compare
348 byte-by-byte and still get a reasonable comparison, since this 348 byte-by-byte and still get a reasonable comparison, since this
349 would compare characters with a charset in the same way. With 349 would compare characters with a charset in the same way. With
350 a little rearrangement of the leading bytes, we could make most 350 a little rearrangement of the leading bytes, we could make most
369 Each string has a tick counter which is incremented each time the contents 369 Each string has a tick counter which is incremented each time the contents
370 of the string are changed (e.g. with `aset'). It wraps around occasionally. 370 of the string are changed (e.g. with `aset'). It wraps around occasionally.
371 */ 371 */
372 (string)) 372 (string))
373 { 373 {
374 Lisp_String *s;
375
376 CHECK_STRING (string); 374 CHECK_STRING (string);
377 s = XSTRING (string); 375 if (CONSP (XSTRING_PLIST (string)) && INTP (XCAR (XSTRING_PLIST (string))))
378 if (CONSP (s->plist) && INTP (XCAR (s->plist))) 376 return XCAR (XSTRING_PLIST (string));
379 return XCAR (s->plist);
380 else 377 else
381 return Qzero; 378 return Qzero;
382 } 379 }
383 380
384 void 381 void
385 bump_string_modiff (Lisp_Object str) 382 bump_string_modiff (Lisp_Object str)
386 { 383 {
387 Lisp_String *s = XSTRING (str); 384 Lisp_Object *ptr = &XSTRING_PLIST (str);
388 Lisp_Object *ptr = &s->plist;
389 385
390 #ifdef I18N3 386 #ifdef I18N3
391 /* #### remove the `string-translatable' property from the string, 387 /* #### remove the `string-translatable' property from the string,
392 if there is one. */ 388 if there is one. */
393 #endif 389 #endif
394 /* skip over extent info if it's there */ 390 /* skip over extent info if it's there */
395 if (CONSP (*ptr) && EXTENT_INFOP (XCAR (*ptr))) 391 if (CONSP (*ptr) && EXTENT_INFOP (XCAR (*ptr)))
396 ptr = &XCDR (*ptr); 392 ptr = &XCDR (*ptr);
397 if (CONSP (*ptr) && INTP (XCAR (*ptr))) 393 if (CONSP (*ptr) && INTP (XCAR (*ptr)))
398 XSETINT (XCAR (*ptr), 1+XINT (XCAR (*ptr))); 394 XCAR (*ptr) = make_int (1+XINT (XCAR (*ptr)));
399 else 395 else
400 *ptr = Fcons (make_int (1), *ptr); 396 *ptr = Fcons (make_int (1), *ptr);
401 } 397 }
402 398
403 399
889 885
890 CHECK_STRING (string); 886 CHECK_STRING (string);
891 CHECK_INT (start); 887 CHECK_INT (start);
892 get_string_range_char (string, start, end, &ccstart, &ccend, 888 get_string_range_char (string, start, end, &ccstart, &ccend,
893 GB_HISTORICAL_STRING_BEHAVIOR); 889 GB_HISTORICAL_STRING_BEHAVIOR);
894 bstart = XSTRING_INDEX_CHAR_TO_BYTE (string, ccstart); 890 bstart = string_index_char_to_byte (string, ccstart);
895 blen = XSTRING_OFFSET_CHAR_TO_BYTE_LEN (string, bstart, ccend - ccstart); 891 blen = string_offset_char_to_byte_len (string, bstart, ccend - ccstart);
896 val = make_string (XSTRING_DATA (string) + bstart, blen); 892 val = make_string (XSTRING_DATA (string) + bstart, blen);
897 /* Copy any applicable extent information into the new string. */ 893 /* Copy any applicable extent information into the new string. */
898 copy_string_extents (val, string, 0, bstart, blen); 894 copy_string_extents (val, string, 0, bstart, blen);
899 return val; 895 return val;
900 } 896 }
2131 warn_when_safe_lispobj 2127 warn_when_safe_lispobj
2132 (Qlist, Qwarning, 2128 (Qlist, Qwarning,
2133 list2 (build_msg_string 2129 list2 (build_msg_string
2134 ("Malformed property list -- list has been truncated"), 2130 ("Malformed property list -- list has been truncated"),
2135 *plist)); 2131 *plist));
2132 /* #### WARNING: This is more dangerous than it seems; perhaps
2133 not a good idea. It also violates the principle of least
2134 surprise -- passing in ERROR_ME_WARN causes truncation, but
2135 ERROR_ME and ERROR_ME_NOT don't. */
2136 *badplace = Qnil; 2136 *badplace = Qnil;
2137 } 2137 }
2138 return Qunbound; 2138 return Qunbound;
2139 } 2139 }
2140 } 2140 }
2158 warn_when_safe_lispobj 2158 warn_when_safe_lispobj
2159 (Qlist, Qwarning, 2159 (Qlist, Qwarning,
2160 list2 (build_msg_string 2160 list2 (build_msg_string
2161 ("Circular property list -- list has been truncated"), 2161 ("Circular property list -- list has been truncated"),
2162 *plist)); 2162 *plist));
2163 /* #### WARNING: This is more dangerous than it seems; perhaps
2164 not a good idea. It also violates the principle of least
2165 surprise -- passing in ERROR_ME_WARN causes truncation, but
2166 ERROR_ME and ERROR_ME_NOT don't. */
2163 *badplace = Qnil; 2167 *badplace = Qnil;
2164 } 2168 }
2165 return Qunbound; 2169 return Qunbound;
2166 } 2170 }
2167 } 2171 }
2793 (array, item)) 2797 (array, item))
2794 { 2798 {
2795 retry: 2799 retry:
2796 if (STRINGP (array)) 2800 if (STRINGP (array))
2797 { 2801 {
2798 Lisp_String *s = XSTRING (array); 2802 Bytecount old_bytecount = XSTRING_LENGTH (array);
2799 Bytecount old_bytecount = string_length (s);
2800 Bytecount new_bytecount; 2803 Bytecount new_bytecount;
2801 Bytecount item_bytecount; 2804 Bytecount item_bytecount;
2802 Intbyte item_buf[MAX_EMCHAR_LEN]; 2805 Intbyte item_buf[MAX_EMCHAR_LEN];
2803 Intbyte *p; 2806 Intbyte *p;
2804 Intbyte *end; 2807 Intbyte *end;
2806 CHECK_CHAR_COERCE_INT (item); 2809 CHECK_CHAR_COERCE_INT (item);
2807 CHECK_LISP_WRITEABLE (array); 2810 CHECK_LISP_WRITEABLE (array);
2808 2811
2809 sledgehammer_check_ascii_begin (array); 2812 sledgehammer_check_ascii_begin (array);
2810 item_bytecount = set_charptr_emchar (item_buf, XCHAR (item)); 2813 item_bytecount = set_charptr_emchar (item_buf, XCHAR (item));
2811 new_bytecount = item_bytecount * string_char_length (s); 2814 new_bytecount = item_bytecount * XSTRING_CHAR_LENGTH (array);
2812 2815
2813 resize_string (s, -1, new_bytecount - old_bytecount); 2816 resize_string (array, -1, new_bytecount - old_bytecount);
2814 2817
2815 for (p = string_data (s), end = p + new_bytecount; 2818 for (p = XSTRING_DATA (array), end = p + new_bytecount;
2816 p < end; 2819 p < end;
2817 p += item_bytecount) 2820 p += item_bytecount)
2818 memcpy (p, item_buf, item_bytecount); 2821 memcpy (p, item_buf, item_bytecount);
2819 *p = '\0'; 2822 *p = '\0';
2820 2823
2821 set_string_ascii_begin (s, 2824 XSET_STRING_ASCII_BEGIN (array,
2822 item_bytecount == 1 ? 2825 item_bytecount == 1 ?
2823 min (new_bytecount, MAX_STRING_ASCII_BEGIN) : 2826 min (new_bytecount, MAX_STRING_ASCII_BEGIN) :
2824 0); 2827 0);
2825 bump_string_modiff (array); 2828 bump_string_modiff (array);
2826 sledgehammer_check_ascii_begin (array); 2829 sledgehammer_check_ascii_begin (array);
2827 } 2830 }
2828 else if (VECTORP (array)) 2831 else if (VECTORP (array))
2829 { 2832 {