Mercurial > hg > xemacs-beta
comparison src/fns.c @ 867:804517e16990
[xemacs-hg @ 2002-06-05 09:54:39 by ben]
Textual renaming: text/char names
abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization.
[a] distinguish between "charptr" when it refers to operations on
the pointer itself and when it refers to operations on text; and
[b] use consistent naming for everything referring to internal
format, i.e.
Itext == text in internal format
Ibyte == a byte in such text
Ichar == a char as represented in internal character format
thus e.g.
set_charptr_emchar -> set_itext_ichar
The pre and post tags on either side of this change are:
pre-internal-format-textual-renaming
post-internal-format-textual-renaming
See the Internals Manual for details of exactly how this was done,
how to handle the change in your workspace, etc.
author | ben |
---|---|
date | Wed, 05 Jun 2002 09:58:45 +0000 |
parents | 2b6fa2618f76 |
children | 79c6ff3eef26 |
comparison
equal
deleted
inserted
replaced
866:613552a02607 | 867:804517e16990 |
---|---|
385 len2 = string_char_length (p2); | 385 len2 = string_char_length (p2); |
386 if (end > len2) | 386 if (end > len2) |
387 end = len2; | 387 end = len2; |
388 | 388 |
389 { | 389 { |
390 Intbyte *ptr1 = XSTRING_DATA (p1); | 390 Ibyte *ptr1 = XSTRING_DATA (p1); |
391 Intbyte *ptr2 = XSTRING_DATA (p2); | 391 Ibyte *ptr2 = XSTRING_DATA (p2); |
392 | 392 |
393 /* #### It is not really necessary to do this: We could compare | 393 /* #### It is not really necessary to do this: We could compare |
394 byte-by-byte and still get a reasonable comparison, since this | 394 byte-by-byte and still get a reasonable comparison, since this |
395 would compare characters with a charset in the same way. With | 395 would compare characters with a charset in the same way. With |
396 a little rearrangement of the leading bytes, we could make most | 396 a little rearrangement of the leading bytes, we could make most |
397 inter-charset comparisons work out the same, too; even if some | 397 inter-charset comparisons work out the same, too; even if some |
398 don't, this is not a big deal because inter-charset comparisons | 398 don't, this is not a big deal because inter-charset comparisons |
399 aren't really well-defined anyway. */ | 399 aren't really well-defined anyway. */ |
400 for (i = 0; i < end; i++) | 400 for (i = 0; i < end; i++) |
401 { | 401 { |
402 if (charptr_emchar (ptr1) != charptr_emchar (ptr2)) | 402 if (itext_ichar (ptr1) != itext_ichar (ptr2)) |
403 return charptr_emchar (ptr1) < charptr_emchar (ptr2) ? Qt : Qnil; | 403 return itext_ichar (ptr1) < itext_ichar (ptr2) ? Qt : Qnil; |
404 INC_CHARPTR (ptr1); | 404 INC_IBYTEPTR (ptr1); |
405 INC_CHARPTR (ptr2); | 405 INC_IBYTEPTR (ptr2); |
406 } | 406 } |
407 } | 407 } |
408 /* Can't do i < len2 because then comparison between "foo" and "foo^@" | 408 /* Can't do i < len2 because then comparison between "foo" and "foo^@" |
409 won't work right in I18N2 case */ | 409 won't work right in I18N2 case */ |
410 return end < len2 ? Qt : Qnil; | 410 return end < len2 ? Qt : Qnil; |
612 int toindex; | 612 int toindex; |
613 int argnum; | 613 int argnum; |
614 Lisp_Object last_tail; | 614 Lisp_Object last_tail; |
615 Lisp_Object prev; | 615 Lisp_Object prev; |
616 struct merge_string_extents_struct *args_mse = 0; | 616 struct merge_string_extents_struct *args_mse = 0; |
617 Intbyte *string_result = 0; | 617 Ibyte *string_result = 0; |
618 Intbyte *string_result_ptr = 0; | 618 Ibyte *string_result_ptr = 0; |
619 struct gcpro gcpro1; | 619 struct gcpro gcpro1; |
620 int sdep = specpdl_depth (); | 620 int sdep = specpdl_depth (); |
621 | 621 |
622 /* The modus operandi in Emacs is "caller gc-protects args". | 622 /* The modus operandi in Emacs is "caller gc-protects args". |
623 However, concat is called many times in Emacs on freshly | 623 However, concat is called many times in Emacs on freshly |
723 to find the place to change, and may have to do some | 723 to find the place to change, and may have to do some |
724 realloc()ing in order to make the char fit properly. | 724 realloc()ing in order to make the char fit properly. |
725 O(N^2) yuckage. */ | 725 O(N^2) yuckage. */ |
726 val = Qnil; | 726 val = Qnil; |
727 string_result = | 727 string_result = |
728 (Intbyte *) MALLOC_OR_ALLOCA (total_length * MAX_EMCHAR_LEN); | 728 (Ibyte *) MALLOC_OR_ALLOCA (total_length * MAX_ICHAR_LEN); |
729 string_result_ptr = string_result; | 729 string_result_ptr = string_result; |
730 break; | 730 break; |
731 default: | 731 default: |
732 val = Qnil; | 732 val = Qnil; |
733 abort (); | 733 abort (); |
746 for (argnum = 0; argnum < nargs; argnum++) | 746 for (argnum = 0; argnum < nargs; argnum++) |
747 { | 747 { |
748 Charcount thisleni = 0; | 748 Charcount thisleni = 0; |
749 Charcount thisindex = 0; | 749 Charcount thisindex = 0; |
750 Lisp_Object seq = args[argnum]; | 750 Lisp_Object seq = args[argnum]; |
751 Intbyte *string_source_ptr = 0; | 751 Ibyte *string_source_ptr = 0; |
752 Intbyte *string_prev_result_ptr = string_result_ptr; | 752 Ibyte *string_prev_result_ptr = string_result_ptr; |
753 | 753 |
754 if (!CONSP (seq)) | 754 if (!CONSP (seq)) |
755 { | 755 { |
756 #ifdef LOSING_BYTECODE | 756 #ifdef LOSING_BYTECODE |
757 thisleni = length_with_bytecode_hack (seq); | 757 thisleni = length_with_bytecode_hack (seq); |
781 if (thisindex >= thisleni) | 781 if (thisindex >= thisleni) |
782 break; | 782 break; |
783 | 783 |
784 if (STRINGP (seq)) | 784 if (STRINGP (seq)) |
785 { | 785 { |
786 elt = make_char (charptr_emchar (string_source_ptr)); | 786 elt = make_char (itext_ichar (string_source_ptr)); |
787 INC_CHARPTR (string_source_ptr); | 787 INC_IBYTEPTR (string_source_ptr); |
788 } | 788 } |
789 else if (VECTORP (seq)) | 789 else if (VECTORP (seq)) |
790 elt = XVECTOR_DATA (seq)[thisindex]; | 790 elt = XVECTOR_DATA (seq)[thisindex]; |
791 else if (BIT_VECTORP (seq)) | 791 else if (BIT_VECTORP (seq)) |
792 elt = make_int (bit_vector_bit (XBIT_VECTOR (seq), | 792 elt = make_int (bit_vector_bit (XBIT_VECTOR (seq), |
812 set_bit_vector_bit (XBIT_VECTOR (val), toindex++, XINT (elt)); | 812 set_bit_vector_bit (XBIT_VECTOR (val), toindex++, XINT (elt)); |
813 } | 813 } |
814 else | 814 else |
815 { | 815 { |
816 CHECK_CHAR_COERCE_INT (elt); | 816 CHECK_CHAR_COERCE_INT (elt); |
817 string_result_ptr += set_charptr_emchar (string_result_ptr, | 817 string_result_ptr += set_itext_ichar (string_result_ptr, |
818 XCHAR (elt)); | 818 XCHAR (elt)); |
819 } | 819 } |
820 } | 820 } |
821 if (args_mse) | 821 if (args_mse) |
822 { | 822 { |
1027 } | 1027 } |
1028 | 1028 |
1029 /* Split STRING into a list of substrings. The substrings are the | 1029 /* Split STRING into a list of substrings. The substrings are the |
1030 parts of original STRING separated by SEPCHAR. */ | 1030 parts of original STRING separated by SEPCHAR. */ |
1031 static Lisp_Object | 1031 static Lisp_Object |
1032 split_string_by_emchar_1 (const Intbyte *string, Bytecount size, | 1032 split_string_by_ichar_1 (const Ibyte *string, Bytecount size, |
1033 Emchar sepchar) | 1033 Ichar sepchar) |
1034 { | 1034 { |
1035 Lisp_Object result = Qnil; | 1035 Lisp_Object result = Qnil; |
1036 const Intbyte *end = string + size; | 1036 const Ibyte *end = string + size; |
1037 | 1037 |
1038 while (1) | 1038 while (1) |
1039 { | 1039 { |
1040 const Intbyte *p = string; | 1040 const Ibyte *p = string; |
1041 while (p < end) | 1041 while (p < end) |
1042 { | 1042 { |
1043 if (charptr_emchar (p) == sepchar) | 1043 if (itext_ichar (p) == sepchar) |
1044 break; | 1044 break; |
1045 INC_CHARPTR (p); | 1045 INC_IBYTEPTR (p); |
1046 } | 1046 } |
1047 result = Fcons (make_string (string, p - string), result); | 1047 result = Fcons (make_string (string, p - string), result); |
1048 if (p < end) | 1048 if (p < end) |
1049 { | 1049 { |
1050 string = p; | 1050 string = p; |
1051 INC_CHARPTR (string); /* skip sepchar */ | 1051 INC_IBYTEPTR (string); /* skip sepchar */ |
1052 } | 1052 } |
1053 else | 1053 else |
1054 break; | 1054 break; |
1055 } | 1055 } |
1056 return Fnreverse (result); | 1056 return Fnreverse (result); |
1061 (':' or whatever). */ | 1061 (':' or whatever). */ |
1062 Lisp_Object | 1062 Lisp_Object |
1063 split_external_path (const Extbyte *path) | 1063 split_external_path (const Extbyte *path) |
1064 { | 1064 { |
1065 Bytecount newlen; | 1065 Bytecount newlen; |
1066 Intbyte *newpath; | 1066 Ibyte *newpath; |
1067 if (!path) | 1067 if (!path) |
1068 return Qnil; | 1068 return Qnil; |
1069 | 1069 |
1070 TO_INTERNAL_FORMAT (C_STRING, path, ALLOCA, (newpath, newlen), Qfile_name); | 1070 TO_INTERNAL_FORMAT (C_STRING, path, ALLOCA, (newpath, newlen), Qfile_name); |
1071 | 1071 |
1074 depend on split_external_path("") returning nil instead of an empty | 1074 depend on split_external_path("") returning nil instead of an empty |
1075 string? */ | 1075 string? */ |
1076 if (!newlen) | 1076 if (!newlen) |
1077 return Qnil; | 1077 return Qnil; |
1078 | 1078 |
1079 return split_string_by_emchar_1 (newpath, newlen, SEPCHAR); | 1079 return split_string_by_ichar_1 (newpath, newlen, SEPCHAR); |
1080 } | 1080 } |
1081 | 1081 |
1082 Lisp_Object | 1082 Lisp_Object |
1083 split_env_path (const CIntbyte *evarname, const Intbyte *default_) | 1083 split_env_path (const CIbyte *evarname, const Ibyte *default_) |
1084 { | 1084 { |
1085 const Intbyte *path = 0; | 1085 const Ibyte *path = 0; |
1086 if (evarname) | 1086 if (evarname) |
1087 path = egetenv (evarname); | 1087 path = egetenv (evarname); |
1088 if (!path) | 1088 if (!path) |
1089 path = default_; | 1089 path = default_; |
1090 if (!path) | 1090 if (!path) |
1091 return Qnil; | 1091 return Qnil; |
1092 return split_string_by_emchar_1 (path, qxestrlen (path), SEPCHAR); | 1092 return split_string_by_ichar_1 (path, qxestrlen (path), SEPCHAR); |
1093 } | 1093 } |
1094 | 1094 |
1095 /* Ben thinks this function should not exist or be exported to Lisp. | 1095 /* Ben thinks this function should not exist or be exported to Lisp. |
1096 We use it to define split-path-string in subr.el (not!). */ | 1096 We use it to define split-path-string in subr.el (not!). */ |
1097 | 1097 |
1100 */ | 1100 */ |
1101 (string, sepchar)) | 1101 (string, sepchar)) |
1102 { | 1102 { |
1103 CHECK_STRING (string); | 1103 CHECK_STRING (string); |
1104 CHECK_CHAR (sepchar); | 1104 CHECK_CHAR (sepchar); |
1105 return split_string_by_emchar_1 (XSTRING_DATA (string), | 1105 return split_string_by_ichar_1 (XSTRING_DATA (string), |
1106 XSTRING_LENGTH (string), | 1106 XSTRING_LENGTH (string), |
1107 XCHAR (sepchar)); | 1107 XCHAR (sepchar)); |
1108 } | 1108 } |
1109 | 1109 |
1110 /* #### This was supposed to be in subr.el, but is used VERY early in | 1110 /* #### This was supposed to be in subr.el, but is used VERY early in |
1124 Vpath_separator = signal_continuable_error | 1124 Vpath_separator = signal_continuable_error |
1125 (Qinvalid_state, | 1125 (Qinvalid_state, |
1126 "`path-separator' should be set to a single-character string", | 1126 "`path-separator' should be set to a single-character string", |
1127 Vpath_separator); | 1127 Vpath_separator); |
1128 | 1128 |
1129 return (split_string_by_emchar_1 | 1129 return (split_string_by_ichar_1 |
1130 (XSTRING_DATA (path), XSTRING_LENGTH (path), | 1130 (XSTRING_DATA (path), XSTRING_LENGTH (path), |
1131 charptr_emchar (XSTRING_DATA (Vpath_separator)))); | 1131 itext_ichar (XSTRING_DATA (Vpath_separator)))); |
1132 } | 1132 } |
1133 | 1133 |
1134 | 1134 |
1135 DEFUN ("nthcdr", Fnthcdr, 2, 2, 0, /* | 1135 DEFUN ("nthcdr", Fnthcdr, 2, 2, 0, /* |
1136 Take cdr N times on LIST, and return the result. | 1136 Take cdr N times on LIST, and return the result. |
2909 if (STRINGP (array)) | 2909 if (STRINGP (array)) |
2910 { | 2910 { |
2911 Bytecount old_bytecount = XSTRING_LENGTH (array); | 2911 Bytecount old_bytecount = XSTRING_LENGTH (array); |
2912 Bytecount new_bytecount; | 2912 Bytecount new_bytecount; |
2913 Bytecount item_bytecount; | 2913 Bytecount item_bytecount; |
2914 Intbyte item_buf[MAX_EMCHAR_LEN]; | 2914 Ibyte item_buf[MAX_ICHAR_LEN]; |
2915 Intbyte *p; | 2915 Ibyte *p; |
2916 Intbyte *end; | 2916 Ibyte *end; |
2917 | 2917 |
2918 CHECK_CHAR_COERCE_INT (item); | 2918 CHECK_CHAR_COERCE_INT (item); |
2919 CHECK_LISP_WRITEABLE (array); | 2919 CHECK_LISP_WRITEABLE (array); |
2920 | 2920 |
2921 sledgehammer_check_ascii_begin (array); | 2921 sledgehammer_check_ascii_begin (array); |
2922 item_bytecount = set_charptr_emchar (item_buf, XCHAR (item)); | 2922 item_bytecount = set_itext_ichar (item_buf, XCHAR (item)); |
2923 new_bytecount = item_bytecount * (Bytecount) string_char_length (array); | 2923 new_bytecount = item_bytecount * (Bytecount) string_char_length (array); |
2924 | 2924 |
2925 resize_string (array, -1, new_bytecount - old_bytecount); | 2925 resize_string (array, -1, new_bytecount - old_bytecount); |
2926 | 2926 |
2927 for (p = XSTRING_DATA (array), end = p + new_bytecount; | 2927 for (p = XSTRING_DATA (array), end = p + new_bytecount; |
3184 } | 3184 } |
3185 else if (STRINGP (sequence)) | 3185 else if (STRINGP (sequence)) |
3186 { | 3186 { |
3187 /* The string data of `sequence' might be relocated during GC. */ | 3187 /* The string data of `sequence' might be relocated during GC. */ |
3188 Bytecount slen = XSTRING_LENGTH (sequence); | 3188 Bytecount slen = XSTRING_LENGTH (sequence); |
3189 Intbyte *p = alloca_array (Intbyte, slen); | 3189 Ibyte *p = alloca_array (Ibyte, slen); |
3190 Intbyte *end = p + slen; | 3190 Ibyte *end = p + slen; |
3191 | 3191 |
3192 memcpy (p, XSTRING_DATA (sequence), slen); | 3192 memcpy (p, XSTRING_DATA (sequence), slen); |
3193 | 3193 |
3194 while (p < end) | 3194 while (p < end) |
3195 { | 3195 { |
3196 args[1] = make_char (charptr_emchar (p)); | 3196 args[1] = make_char (itext_ichar (p)); |
3197 INC_CHARPTR (p); | 3197 INC_IBYTEPTR (p); |
3198 result = Ffuncall (2, args); | 3198 result = Ffuncall (2, args); |
3199 if (vals) vals[gcpro1.nvars++] = result; | 3199 if (vals) vals[gcpro1.nvars++] = result; |
3200 } | 3200 } |
3201 } | 3201 } |
3202 else if (BIT_VECTORP (sequence)) | 3202 else if (BIT_VECTORP (sequence)) |
3633 { | 3633 { |
3634 signal_error (Qbase64_conversion_error, reason, frob); | 3634 signal_error (Qbase64_conversion_error, reason, frob); |
3635 } | 3635 } |
3636 | 3636 |
3637 #define ADVANCE_INPUT(c, stream) \ | 3637 #define ADVANCE_INPUT(c, stream) \ |
3638 ((ec = Lstream_get_emchar (stream)) == -1 ? 0 : \ | 3638 ((ec = Lstream_get_ichar (stream)) == -1 ? 0 : \ |
3639 ((ec > 255) ? \ | 3639 ((ec > 255) ? \ |
3640 (base64_conversion_error ("Non-ascii character in base64 input", \ | 3640 (base64_conversion_error ("Non-ascii character in base64 input", \ |
3641 make_char (ec)), 0) \ | 3641 make_char (ec)), 0) \ |
3642 : (c = (Intbyte)ec), 1)) | 3642 : (c = (Ibyte)ec), 1)) |
3643 | 3643 |
3644 static Bytebpos | 3644 static Bytebpos |
3645 base64_encode_1 (Lstream *istream, Intbyte *to, int line_break) | 3645 base64_encode_1 (Lstream *istream, Ibyte *to, int line_break) |
3646 { | 3646 { |
3647 EMACS_INT counter = 0; | 3647 EMACS_INT counter = 0; |
3648 Intbyte *e = to; | 3648 Ibyte *e = to; |
3649 Emchar ec; | 3649 Ichar ec; |
3650 unsigned int value; | 3650 unsigned int value; |
3651 | 3651 |
3652 while (1) | 3652 while (1) |
3653 { | 3653 { |
3654 Intbyte c; | 3654 Ibyte c; |
3655 if (!ADVANCE_INPUT (c, istream)) | 3655 if (!ADVANCE_INPUT (c, istream)) |
3656 break; | 3656 break; |
3657 | 3657 |
3658 /* Wrap line every 76 characters. */ | 3658 /* Wrap line every 76 characters. */ |
3659 if (line_break) | 3659 if (line_break) |
3699 } | 3699 } |
3700 #undef ADVANCE_INPUT | 3700 #undef ADVANCE_INPUT |
3701 | 3701 |
3702 /* Get next character from the stream, except that non-base64 | 3702 /* Get next character from the stream, except that non-base64 |
3703 characters are ignored. This is in accordance with rfc2045. EC | 3703 characters are ignored. This is in accordance with rfc2045. EC |
3704 should be an Emchar, so that it can hold -1 as the value for EOF. */ | 3704 should be an Ichar, so that it can hold -1 as the value for EOF. */ |
3705 #define ADVANCE_INPUT_IGNORE_NONBASE64(ec, stream, streampos) do { \ | 3705 #define ADVANCE_INPUT_IGNORE_NONBASE64(ec, stream, streampos) do { \ |
3706 ec = Lstream_get_emchar (stream); \ | 3706 ec = Lstream_get_ichar (stream); \ |
3707 ++streampos; \ | 3707 ++streampos; \ |
3708 /* IS_BASE64 may not be called with negative arguments so check for \ | 3708 /* IS_BASE64 may not be called with negative arguments so check for \ |
3709 EOF first. */ \ | 3709 EOF first. */ \ |
3710 if (ec < 0 || IS_BASE64 (ec) || ec == '=') \ | 3710 if (ec < 0 || IS_BASE64 (ec) || ec == '=') \ |
3711 break; \ | 3711 break; \ |
3712 } while (1) | 3712 } while (1) |
3713 | 3713 |
3714 #define STORE_BYTE(pos, val, ccnt) do { \ | 3714 #define STORE_BYTE(pos, val, ccnt) do { \ |
3715 pos += set_charptr_emchar (pos, (Emchar)((unsigned char)(val))); \ | 3715 pos += set_itext_ichar (pos, (Ichar)((unsigned char)(val))); \ |
3716 ++ccnt; \ | 3716 ++ccnt; \ |
3717 } while (0) | 3717 } while (0) |
3718 | 3718 |
3719 static Bytebpos | 3719 static Bytebpos |
3720 base64_decode_1 (Lstream *istream, Intbyte *to, Charcount *ccptr) | 3720 base64_decode_1 (Lstream *istream, Ibyte *to, Charcount *ccptr) |
3721 { | 3721 { |
3722 Charcount ccnt = 0; | 3722 Charcount ccnt = 0; |
3723 Intbyte *e = to; | 3723 Ibyte *e = to; |
3724 EMACS_INT streampos = 0; | 3724 EMACS_INT streampos = 0; |
3725 | 3725 |
3726 while (1) | 3726 while (1) |
3727 { | 3727 { |
3728 Emchar ec; | 3728 Ichar ec; |
3729 unsigned long value; | 3729 unsigned long value; |
3730 | 3730 |
3731 /* Process first byte of a quadruplet. */ | 3731 /* Process first byte of a quadruplet. */ |
3732 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); | 3732 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); |
3733 if (ec < 0) | 3733 if (ec < 0) |
3795 Optional third argument NO-LINE-BREAK means do not break long lines | 3795 Optional third argument NO-LINE-BREAK means do not break long lines |
3796 into shorter lines. | 3796 into shorter lines. |
3797 */ | 3797 */ |
3798 (start, end, no_line_break)) | 3798 (start, end, no_line_break)) |
3799 { | 3799 { |
3800 Intbyte *encoded; | 3800 Ibyte *encoded; |
3801 Bytebpos encoded_length; | 3801 Bytebpos encoded_length; |
3802 Charcount allength, length; | 3802 Charcount allength, length; |
3803 struct buffer *buf = current_buffer; | 3803 struct buffer *buf = current_buffer; |
3804 Charbpos begv, zv, old_pt = BUF_PT (buf); | 3804 Charbpos begv, zv, old_pt = BUF_PT (buf); |
3805 Lisp_Object input; | 3805 Lisp_Object input; |
3814 length = zv - begv; | 3814 length = zv - begv; |
3815 allength = length + length/3 + 1; | 3815 allength = length + length/3 + 1; |
3816 allength += allength / MIME_LINE_LENGTH + 1 + 6; | 3816 allength += allength / MIME_LINE_LENGTH + 1 + 6; |
3817 | 3817 |
3818 input = make_lisp_buffer_input_stream (buf, begv, zv, 0); | 3818 input = make_lisp_buffer_input_stream (buf, begv, zv, 0); |
3819 /* We needn't multiply allength with MAX_EMCHAR_LEN because all the | 3819 /* We needn't multiply allength with MAX_ICHAR_LEN because all the |
3820 base64 characters will be single-byte. */ | 3820 base64 characters will be single-byte. */ |
3821 encoded = (Intbyte *) MALLOC_OR_ALLOCA (allength); | 3821 encoded = (Ibyte *) MALLOC_OR_ALLOCA (allength); |
3822 encoded_length = base64_encode_1 (XLSTREAM (input), encoded, | 3822 encoded_length = base64_encode_1 (XLSTREAM (input), encoded, |
3823 NILP (no_line_break)); | 3823 NILP (no_line_break)); |
3824 if (encoded_length > allength) | 3824 if (encoded_length > allength) |
3825 abort (); | 3825 abort (); |
3826 Lstream_delete (XLSTREAM (input)); | 3826 Lstream_delete (XLSTREAM (input)); |
3847 */ | 3847 */ |
3848 (string, no_line_break)) | 3848 (string, no_line_break)) |
3849 { | 3849 { |
3850 Charcount allength, length; | 3850 Charcount allength, length; |
3851 Bytebpos encoded_length; | 3851 Bytebpos encoded_length; |
3852 Intbyte *encoded; | 3852 Ibyte *encoded; |
3853 Lisp_Object input, result; | 3853 Lisp_Object input, result; |
3854 int speccount = specpdl_depth(); | 3854 int speccount = specpdl_depth(); |
3855 | 3855 |
3856 CHECK_STRING (string); | 3856 CHECK_STRING (string); |
3857 | 3857 |
3858 length = string_char_length (string); | 3858 length = string_char_length (string); |
3859 allength = length + length/3 + 1; | 3859 allength = length + length/3 + 1; |
3860 allength += allength / MIME_LINE_LENGTH + 1 + 6; | 3860 allength += allength / MIME_LINE_LENGTH + 1 + 6; |
3861 | 3861 |
3862 input = make_lisp_string_input_stream (string, 0, -1); | 3862 input = make_lisp_string_input_stream (string, 0, -1); |
3863 encoded = (Intbyte *) MALLOC_OR_ALLOCA (allength); | 3863 encoded = (Ibyte *) MALLOC_OR_ALLOCA (allength); |
3864 encoded_length = base64_encode_1 (XLSTREAM (input), encoded, | 3864 encoded_length = base64_encode_1 (XLSTREAM (input), encoded, |
3865 NILP (no_line_break)); | 3865 NILP (no_line_break)); |
3866 if (encoded_length > allength) | 3866 if (encoded_length > allength) |
3867 abort (); | 3867 abort (); |
3868 Lstream_delete (XLSTREAM (input)); | 3868 Lstream_delete (XLSTREAM (input)); |
3879 */ | 3879 */ |
3880 (start, end)) | 3880 (start, end)) |
3881 { | 3881 { |
3882 struct buffer *buf = current_buffer; | 3882 struct buffer *buf = current_buffer; |
3883 Charbpos begv, zv, old_pt = BUF_PT (buf); | 3883 Charbpos begv, zv, old_pt = BUF_PT (buf); |
3884 Intbyte *decoded; | 3884 Ibyte *decoded; |
3885 Bytebpos decoded_length; | 3885 Bytebpos decoded_length; |
3886 Charcount length, cc_decoded_length; | 3886 Charcount length, cc_decoded_length; |
3887 Lisp_Object input; | 3887 Lisp_Object input; |
3888 int speccount = specpdl_depth(); | 3888 int speccount = specpdl_depth(); |
3889 | 3889 |
3892 | 3892 |
3893 length = zv - begv; | 3893 length = zv - begv; |
3894 | 3894 |
3895 input = make_lisp_buffer_input_stream (buf, begv, zv, 0); | 3895 input = make_lisp_buffer_input_stream (buf, begv, zv, 0); |
3896 /* We need to allocate enough room for decoding the text. */ | 3896 /* We need to allocate enough room for decoding the text. */ |
3897 decoded = (Intbyte *) MALLOC_OR_ALLOCA (length * MAX_EMCHAR_LEN); | 3897 decoded = (Ibyte *) MALLOC_OR_ALLOCA (length * MAX_ICHAR_LEN); |
3898 decoded_length = base64_decode_1 (XLSTREAM (input), decoded, &cc_decoded_length); | 3898 decoded_length = base64_decode_1 (XLSTREAM (input), decoded, &cc_decoded_length); |
3899 if (decoded_length > length * MAX_EMCHAR_LEN) | 3899 if (decoded_length > length * MAX_ICHAR_LEN) |
3900 abort (); | 3900 abort (); |
3901 Lstream_delete (XLSTREAM (input)); | 3901 Lstream_delete (XLSTREAM (input)); |
3902 | 3902 |
3903 /* Now we have decoded the region, so we insert the new contents | 3903 /* Now we have decoded the region, so we insert the new contents |
3904 and delete the old. (Insert first in order to preserve markers.) */ | 3904 and delete the old. (Insert first in order to preserve markers.) */ |
3920 Base64-decode STRING and return the result. | 3920 Base64-decode STRING and return the result. |
3921 Characters out of the base64 alphabet are ignored. | 3921 Characters out of the base64 alphabet are ignored. |
3922 */ | 3922 */ |
3923 (string)) | 3923 (string)) |
3924 { | 3924 { |
3925 Intbyte *decoded; | 3925 Ibyte *decoded; |
3926 Bytebpos decoded_length; | 3926 Bytebpos decoded_length; |
3927 Charcount length, cc_decoded_length; | 3927 Charcount length, cc_decoded_length; |
3928 Lisp_Object input, result; | 3928 Lisp_Object input, result; |
3929 int speccount = specpdl_depth(); | 3929 int speccount = specpdl_depth(); |
3930 | 3930 |
3931 CHECK_STRING (string); | 3931 CHECK_STRING (string); |
3932 | 3932 |
3933 length = string_char_length (string); | 3933 length = string_char_length (string); |
3934 /* We need to allocate enough room for decoding the text. */ | 3934 /* We need to allocate enough room for decoding the text. */ |
3935 decoded = (Intbyte *) MALLOC_OR_ALLOCA (length * MAX_EMCHAR_LEN); | 3935 decoded = (Ibyte *) MALLOC_OR_ALLOCA (length * MAX_ICHAR_LEN); |
3936 | 3936 |
3937 input = make_lisp_string_input_stream (string, 0, -1); | 3937 input = make_lisp_string_input_stream (string, 0, -1); |
3938 decoded_length = base64_decode_1 (XLSTREAM (input), decoded, | 3938 decoded_length = base64_decode_1 (XLSTREAM (input), decoded, |
3939 &cc_decoded_length); | 3939 &cc_decoded_length); |
3940 if (decoded_length > length * MAX_EMCHAR_LEN) | 3940 if (decoded_length > length * MAX_ICHAR_LEN) |
3941 abort (); | 3941 abort (); |
3942 Lstream_delete (XLSTREAM (input)); | 3942 Lstream_delete (XLSTREAM (input)); |
3943 | 3943 |
3944 result = make_string (decoded, decoded_length); | 3944 result = make_string (decoded, decoded_length); |
3945 unbind_to (speccount); | 3945 unbind_to (speccount); |
4055 DEFVAR_LISP ("path-separator", &Vpath_separator /* | 4055 DEFVAR_LISP ("path-separator", &Vpath_separator /* |
4056 The directory separator in search paths, as a string. | 4056 The directory separator in search paths, as a string. |
4057 */ ); | 4057 */ ); |
4058 { | 4058 { |
4059 char c = SEPCHAR; | 4059 char c = SEPCHAR; |
4060 Vpath_separator = make_string ((Intbyte *) &c, 1); | 4060 Vpath_separator = make_string ((Ibyte *) &c, 1); |
4061 } | 4061 } |
4062 | 4062 |
4063 DEFVAR_BOOL ("require-prints-loading-message", | 4063 DEFVAR_BOOL ("require-prints-loading-message", |
4064 &require_prints_loading_message /* | 4064 &require_prints_loading_message /* |
4065 If non-nil, every time a file is loaded by `require' a message is printed. | 4065 If non-nil, every time a file is loaded by `require' a message is printed. |