diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-06-14 03:29:59 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-06-14 03:29:59 +0000 |
commit | 06e6a8794777448532e6b4ef0136747ff20ee6bc (patch) | |
tree | ce08013234f92e08f4e47afc88271bf51bbc4c8d /Build/source/texk/ptexenc | |
parent | a83124cac963f5d52c6890bf280460d750507703 (diff) |
remove sjisterminal (w32 only)
git-svn-id: svn://tug.org/texlive/trunk@48012 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ptexenc')
-rw-r--r-- | Build/source/texk/ptexenc/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc.c | 74 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc/ptexenc.h | 1 |
3 files changed, 35 insertions, 44 deletions
diff --git a/Build/source/texk/ptexenc/ChangeLog b/Build/source/texk/ptexenc/ChangeLog index cefcc2db516..6d6b10f3c71 100644 --- a/Build/source/texk/ptexenc/ChangeLog +++ b/Build/source/texk/ptexenc/ChangeLog @@ -1,3 +1,7 @@ +2018-06-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * ptexenc.c, ptexenc/ptexenc.h: remove sjisterminal (w32 only). + 2018-06-09 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * ptexenc.c, ptexenc/ptexenc.h: Add new functions diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c index aa5b9bbc867..43696693227 100644 --- a/Build/source/texk/ptexenc/ptexenc.c +++ b/Build/source/texk/ptexenc/ptexenc.c @@ -39,7 +39,6 @@ static boolean prior_file_enc = false; const char *ptexenc_version_string = PTEXENCVERSION; #if defined(WIN32) -int sjisterminal; FILE *Poptr; int infile_enc_auto; #else @@ -419,44 +418,38 @@ static long toENC(long kcode, int enc) static int put_multibyte(long c, FILE *fp) { #ifdef WIN32 - if (sjisterminal) { - const int fd = fileno(fp); + const int fd = fileno(fp); + + if ((fd == fileno(stdout) || fd == fileno(stderr)) && _isatty(fd)) { + HANDLE hStdout; + DWORD ret, wclen; + UINT cp; + wchar_t buff[2]; + char str[4]; + int mblen; + + if (fd == fileno(stdout)) + hStdout = GetStdHandle(STD_OUTPUT_HANDLE); + else + hStdout = GetStdHandle(STD_ERROR_HANDLE); + + mblen=0; + if (BYTE1(c) != 0) str[mblen++]=BYTE1(c); + if (BYTE2(c) != 0) str[mblen++]=BYTE2(c); + if (BYTE3(c) != 0) str[mblen++]=BYTE3(c); + /* always */ str[mblen++]=BYTE4(c); - if ((fd == fileno(stdout) || fd == fileno(stderr)) && _isatty(fd)) { - HANDLE hStdout; - DWORD ret, wclen; - UINT cp; - wchar_t buff[2]; - char str[4]; - int mblen; - - if (fd == fileno(stdout)) - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - else - hStdout = GetStdHandle(STD_ERROR_HANDLE); - - mblen=0; - if (BYTE1(c) != 0) str[mblen++]=BYTE1(c); - if (BYTE2(c) != 0) str[mblen++]=BYTE2(c); - if (BYTE3(c) != 0) str[mblen++]=BYTE3(c); - /* always */ str[mblen++]=BYTE4(c); - -#define CP_932 932 #define CP_UTF8 65001 - if (is_internalUPTEX()) - cp = CP_UTF8; - else - cp = CP_932; - if (MultiByteToWideChar(cp, 0, str, mblen, buff, 2) == 0) - return EOF; + cp = CP_UTF8; + if (MultiByteToWideChar(cp, 0, str, mblen, buff, 2) == 0) + return EOF; - wclen = mblen > 3 ? 2 : 1; - if (WriteConsoleW(hStdout, buff, wclen, &ret, NULL) == 0) - return EOF; + wclen = mblen > 3 ? 2 : 1; + if (WriteConsoleW(hStdout, buff, wclen, &ret, NULL) == 0) + return EOF; - return BYTE4(c); - } + return BYTE4(c); } #endif @@ -491,20 +484,15 @@ int putc2(int c, FILE *fp) #ifdef WIN32 if ((fp == stdout || fp == stderr) && (_isatty(fd) || !prior_file_enc)) { - if (sjisterminal) { - if (is_internalUPTEX()) - output_enc = ENC_UTF8; - else - output_enc = ENC_SJIS; - } else + output_enc = ENC_UTF8; + } else + output_enc = get_file_enc(); #else if ((fp == stdout || fp == stderr) && !prior_file_enc) { -#endif - output_enc = get_terminal_enc(); } else output_enc = get_file_enc(); - +#endif if (num[fd] > 0) { /* multi-byte char */ if (is_internalUPTEX() && iskanji1(c)) { /* error */ ret = flush(store[fd], num[fd], fp); diff --git a/Build/source/texk/ptexenc/ptexenc/ptexenc.h b/Build/source/texk/ptexenc/ptexenc/ptexenc.h index 175fdd4297b..2417c5e6150 100644 --- a/Build/source/texk/ptexenc/ptexenc/ptexenc.h +++ b/Build/source/texk/ptexenc/ptexenc/ptexenc.h @@ -23,7 +23,6 @@ extern PTENCDLL const char *ptexenc_version_string; #if defined(WIN32) -extern PTENCDLL int sjisterminal; extern PTENCDLL FILE *Poptr; extern PTENCDLL int infile_enc_auto; #endif |