Commit graph

153 commits

Author SHA1 Message Date
Kenichi Handa
3636f7a323 (code_convert_region): Update `dst' correctly. 1999-10-29 00:46:20 +00:00
Paul Eggert
68c45bf065 Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.

* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.

* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.

* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.

* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.

* coding.h (emacs_strerror, Vlocale_coding_system): New decls.

* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.

* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.

* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.

* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back.  Synchronize time
locale before invoking lower level function.  Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.

* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly.  But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.

* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size.  Report IO errors
with emacs_strerror, not strerror.

* fns.c (Fgethash): Declare dflt parameter.

* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.

* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.

* lread.c (file_offset, file_tell): New macros.  All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.

* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.

* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.

* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.

* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.

* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.

* m/delta.h, s/ptx.h, s/template.h: Doc fix.

* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.

* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.

* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.

* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.

* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.

* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open.  Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.

* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.

* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.

* w32proc.c (sys_siglist): Remove decl.

* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.

* xfns.c (Fx_show_tip): Declare timeout param.

* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
Kenichi Handa
b843d1aed4 (code_convert_string): Add record_unwind_protect to
assure setting inhibit_pre_post_conversion back to zero.  Take
care of the multibyteness of the working buffer.

(inhibit_pre_post_conversion): New variable.
(setup_coding_system): If inhibit_pre_post_conversion is nonzero,
ignore post-read-conversion and pre-write-conversion property of
the coding system.
(code_convert_region_unwind): New function.
(code_convert_region): Set inhibit_pre_post_conversion to 1 while
running pre-write-conversion and post-read-conversion.
(code_convert_string): Likewise.
1999-10-18 01:36:35 +00:00
Kenichi Handa
251aeb2451 (DECODE_CHARACTER_ASCII): Decode ASCII invocated to GR
correctly.
1999-10-04 00:12:34 +00:00
Ken Raeburn
03699b140e Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access. 1999-09-13 02:23:04 +00:00
Gerd Moellmann
d9f9a1bc83 (code_convert_region): Compute beg/end_unchanged per
buffer.
1999-08-23 00:11:40 +00:00
Kenichi Handa
ef4ced281f (setup_coding_system): Get compiled CCL code by just
calling setup_coding_system.
1999-07-26 11:56:56 +00:00
Kenichi Handa
5e34de1585 (decode_coding_sjis_big5): Avoid compiler warning. 1999-06-18 06:11:29 +00:00
Kenichi Handa
d6bd663cc1 (ENCODE_SJIS_BIG5_CHARACTER): Encode charset
japanese-jisx0208-1978 correctly.
1999-06-08 00:26:51 +00:00
Kenichi Handa
497ee4fb44 (ENCODE_SJIS_BIG5_CHARACTER): Encode charset
latin-jisx0201 correctly.
1999-06-02 23:44:53 +00:00
Richard M. Stallman
928aedd8b4 (syms_of_coding): Doc fix. 1999-05-24 09:02:41 +00:00
Kenichi Handa
38edf7d458 (code_convert_region): If eol format is inconsistent,
change coding->symbol to the sibling coding system of Unix like
eol format.
1999-05-10 01:04:01 +00:00
Andrew Innes
716e0b0ab9 [andrewi]
(decode_eol): Set produced/consumed values to zero if
src_bytes is <= 0 on entry.

[handa]
(setup_raw_text_coding_system): Call
setup_coding_system to initialize the fields of struct
coding_system correctly.
1999-05-02 10:05:22 +00:00
Kenichi Handa
52d41803be Add comments for decode_coding and encode_coding. 1999-04-06 12:34:12 +00:00
Kenichi Handa
8dbb769e94 (encode_coding_iso2022): Initialize dummy arguments to
ENCODE_ISO_CHARACTER for the previous change on this macro.
1999-03-23 12:28:55 +00:00
Kenichi Handa
6f5510294b (ENCODE_ISO_CHARACTER): Check validity of CHARSET. If
invalid, produce the buffer internal byte sequence without
encoding.
1999-03-20 07:47:54 +00:00
Kenichi Handa
1f5dbf34c7 (setup_coding_system): Check for CODING_SYSTEM = nil. 1999-03-09 11:55:12 +00:00
Kenichi Handa
39787efd63 Comment for ISO 2022 encoding mechanism modified. 1999-03-01 11:52:54 +00:00
Kenichi Handa
9da8350f2e (Fdecode_sjis_char): In case of error, use %x for
formatting error message.
(Fdecode_big5_char): Likewise.
1999-02-18 12:52:07 +00:00
Kenichi Handa
c28a9453f6 (Fdecode_sjis_char, Fencode_sjis_char): Hanlde
ASCII correctly.  Signal error on invalid characters.
(Fdecode_big5_char, Fencode_big5_char): Likewise.
1999-02-16 01:38:01 +00:00
Kenichi Handa
a63063ae57 (decode_coding_iso2022): Don't set coding->composed_chars to 0 here.
(setup_coding_system): Set coding->composed_chars to 0 here.
1999-02-15 10:47:36 +00:00
Kenichi Handa
489427668f (ccl_coding_driver): On encoding, coding->produced_char
should be set to coding->produced.
1999-02-08 11:06:56 +00:00
Kenichi Handa
3efbce959e (encode_coding_iso2022): Before writing out an invalid
code, reset glaphic planes and registers if necessary.
1999-02-05 05:39:58 +00:00
Eli Zaretskii
7722baf9b3 (syms_of_coding): eol-mnemonic-* variables are now
strings, not characters.
1999-01-27 10:08:13 +00:00
Dave Love
94c7a21474 (syms_of_coding): Doc fix for inhibit-eol-conversion. 1999-01-25 19:00:50 +00:00
Kenichi Handa
55ab7be3ac (Fdecode_sjis_char): Decode Japanese Katakana character
correctly.
(Fencode_sjis_char): Encode Japanese Katakana character correctly.
1999-01-14 01:20:35 +00:00
Dave Love
f07f4a2430 (syms_of_coding): Doc fix for inhibit-eol-conversion. 1999-01-11 21:21:03 +00:00
Kenichi Handa
944bd42004 (DECODE_DESIGNATION): Jump to label_invalid_code if
final_char is invalid.
(decode_coding): If coding->type is coding_type_ccl, call
ccl_coding_driver even if SRC_BYTES is zero.
(code_convert_region): Update `inserted' correctly after calling
coding->post_read_conversion.  Even after the code converter
consumed all source text, call it once more if it is
coding_type_ccl to flush out data.
1998-12-15 04:35:38 +00:00
Kenichi Handa
d14d03ac4a (DECODE_CHARACTER_ASCII): Check validity of inserted
code.
(DECODE_CHARACTER_DIMENSION1): Likewise.
(DECODE_CHARACTER_DIMENSION2): Likewise.
(decode_coding_sjis_big5): Check the 2nd byte of SJIS correctly.
1998-10-28 07:52:13 +00:00
Kenichi Handa
0007bdd098 (code_convert_region): Kill the work buffer created by
pre-write-conversion.
1998-10-26 08:00:11 +00:00
Kenichi Handa
6abb9bd967 (code_convert_region): While preserving the orignal
point, pay attention to the byte combining problem.
1998-10-24 01:17:09 +00:00
Kenichi Handa
e133c8fabc (setup_coding_system): Fix setting up
coding->spec.ccl.valid_codes for CCL based coding system.
(code_convert_region): Set point to FROM before inserting the
result of pre-write-funciton.  Preserve original point.
(code_convert_string): If coding->type is coding_type_ccl, do
conversion even if the length of conversion region is zero.
1998-10-21 11:50:56 +00:00
Kenichi Handa
174a4cbee1 (decode_coding_iso2022): Set coding->fake_multibyte to
1 when encountered with a code of the range 0x80..0x9F.
1998-10-17 01:58:01 +00:00
Kenichi Handa
622fece532 (shrink_decoding_region): If a charset other than ascii
is initially designated to G0, don't shrink the region.
(shrink_encoding_region): Likewise.
1998-10-12 12:00:44 +00:00
Kenichi Handa
55d8d76935 (code_convert_region): Set inhibit_modification_hooks
to 1 before calling Fset_text_properties.
1998-10-08 06:48:42 +00:00
Kenichi Handa
88993dfd4e (check_composing_code): Fix previous change. Now it
alwasy returns 0 or -1.
(decode_coding_iso2022): Adjusted for the above change.
(encode_coding_iso2022): When encoding the last block, flush out
tailing garbage bytes.
(setup_coding_system): Delete unnecessary code.
(shrink_decoding_region): Check translation table.  If ASCII
should be translated, give up shrinking.
(shrink_encoding_region): Likewise.
(SHRINK_CONVERSION_REGION_THRESHHOLD): New macro.
(SHRINK_CONVERSION_REGION): New macro.
(code_convert_region): Call SHRINK_CONVERSION_REGION.  Delete text
properties here.
(code_convert_region): In the case of encoding, always calulate
correct character number.
(code_convert_string): Call SHRINK_CONVERSION_REGION.
(code_convert_region1): Don't delete text properties here.
(check_composing_code): Fix previous change.  Now it
alwasy returns 0 or -1.
(decode_coding_iso2022): Adjusted for the above change.
(encode_coding_iso2022): When encoding the last block, flush out
tailing garbage bytes.
(setup_coding_system): Delete unnecessary code.
(shrink_decoding_region): Check translation table.  If ASCII
should be translated, give up shrinking.
(shrink_encoding_region): Likewise.
(SHRINK_CONVERSION_REGION_THRESHHOLD): New macro.
(SHRINK_CONVERSION_REGION): New macro.
(code_convert_region): Call SHRINK_CONVERSION_REGION.  Delete text
properties here.
(code_convert_region): In the case of encoding, always calulate
correct character number.
(code_convert_string): Call SHRINK_CONVERSION_REGION.
(code_convert_region1): Don't delete text properties here.
1998-09-28 11:52:53 +00:00
Kenichi Handa
de79a6a5ed (check_composing_code): If the current composing
sequence doesn't end properly, return -1.
(DECODE_CHARACTER_ASCII): Update coding->composed_chars.
(DECODE_CHARACTER_DIMENSION1): Likewise.
(decode_coding_iso2022): Check validity of a composing sequence.
(code_convert_string): If the length of text to be converted is
shrunk to zero, don't perform code conversion.
(shrink_decoding_region): Fix previous change.
1998-09-26 04:20:48 +00:00
Kenichi Handa
fdfcf19d01 (decode_eol): While decoding DOS-like eol, handle a
single CR code correctly.
(shrink_decoding_region) <CODING_CATEGORY_IDX_ISO_7 or
CODING_CATEGORY_IDX_ISO_7_TIGHT>: Skip also 8-bit codes.
1998-09-25 07:32:05 +00:00
Kenichi Handa
9864ebcee4 (ccl_coding_driver): If ccl_driver is interrupted by a
user or the CCL program executed an invalid command, return
CODING_FINISH_INTERRUPT.
(code_convert_region): Pay attention to the converters return
value CODING_FINISH_NORMAL and CODING_FINISH_INTERRUPT.
1998-09-18 13:10:40 +00:00
Kenichi Handa
f2558efddd (code_convert_region): Update beg_unchanged and
end_unchanged after we delete the source text.
1998-09-16 07:21:31 +00:00
Kenichi Handa
69f7652519 (ccl_coding_driver): Always calculate correct mulibyte
chars in produced byte sequence.
(Ffind_operation_coding_system): Doc-string fixed.
1998-09-07 13:39:15 +00:00
Kenichi Handa
d4e57bcd5b (decode_coding): Even if SRC_BYTES is zero, try
processing if CODING requires flushing.
(encode_coding): Likewise.
(code_convert_region): Likewise.
(code_convert_string): Likewise.
1998-08-31 03:50:17 +00:00
Kenichi Handa
df2ddb2d28 (code_convert_region1): Remove all text properties of the region. 1998-08-28 12:33:52 +00:00
Kenichi Handa
ae9ff118cb (detect_coding_iso2022): Handle ESC N and ESC O
correctly.  They are for SS2 and SS3 respectively.
(ccl_coding_driver): Fix previous change.
1998-08-27 07:47:15 +00:00
Andreas Schwab
a85a871a33 (file-coding-system-alist, select-safe-coding-system-function): Doc fix. 1998-08-24 10:05:10 +00:00
Kenichi Handa
f46869e46f (detect_coding_iso2022): Don't check the byte length of
succeeding codes (0xa0..0xFF) if the codes follows single shit
code.
1998-08-24 06:42:56 +00:00
Kenichi Handa
25b026986f (detect_coding_system): If detect_eol_type returns
CODING_EOL_INCONSISTENT, set eol_type to CODING_EOL_UNDECIDED
correctly.
1998-08-21 06:34:13 +00:00
Kenichi Handa
7b179c2dc2 (ccl_coding_driver): Setup ccl->last_block properly.
(setup_coding_system): Correctly setup `valid_codes' member.
1998-08-18 13:15:18 +00:00
Kenichi Handa
89fa8b3669 (coding_category_name): Fix the order of initial
contents.
(detect_coding_mask): Fix previous change.
1998-08-15 01:28:14 +00:00
Kenichi Handa
6bc51348fd (default_buffer_file_coding): New variable.
(init_coding_once): Initialize default_buffer_file_coding.
1998-08-10 06:29:02 +00:00