diff options
-rw-r--r-- | Build/source/texk/ptexenc/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc.c | 26 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc/ptexenc.h | 10 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/openclose.c | 7 |
5 files changed, 42 insertions, 9 deletions
diff --git a/Build/source/texk/ptexenc/ChangeLog b/Build/source/texk/ptexenc/ChangeLog index 292921c2fc7..07de39fb089 100644 --- a/Build/source/texk/ptexenc/ChangeLog +++ b/Build/source/texk/ptexenc/ChangeLog @@ -1,8 +1,10 @@ 2011-08-22 Peter Breitenlohner <peb@mppmu.mpg.de> - More support for upTeX and e-upTeX. + More support for upTeX and e-upTeX. Updates from W32TeX. * ptexenc.c, ptexenc/ptexenc.h: Add is_internalEUC(), - is_internalUPTEX(), ismultichr(), and ismultichr(). + is_internalUPTEX(), ismultichr(), ismultichr(), toDVI(), and + fromDVI(). + No nkf_disable(), nkf_open(), and nkf_close() for WIN32. * ptexenc/unicode.h, unicode.c: Add UCStoUPTEX(), UPTEXtoUCS(). diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c index 386c36cb477..e4663cedb42 100644 --- a/Build/source/texk/ptexenc/ptexenc.c +++ b/Build/source/texk/ptexenc/ptexenc.c @@ -179,7 +179,7 @@ boolean set_enc_string(const_string file_str, const_string internal_str) if (file != ENC_UNKNOWN) { set_file_enc(file); #if !defined(WIN32) - infile_enc_auto =0; + infile_enc_auto = 0; nkf_disable(); #endif } @@ -295,6 +295,21 @@ long toBUFF(long kcode) return kcode; } +/* DVI (JIS/UCS) to internal (EUC/SJIS/UPTEX) code conversion */ +long fromDVI (long kcode) +{ + if (is_internalUPTEX()) return UCStoUPTEX(kcode); + if (is_internalSJIS()) return JIStoSJIS(kcode); + /* EUC */ return JIStoEUC(kcode); +} + +/* internal (EUC/SJIS/UPTEX) to DVI (JIS/UCS) code conversion */ +long toDVI (long kcode) +{ + if (is_internalUPTEX()) return UPTEXtoUCS(kcode); + if (is_internalSJIS()) return SJIStoJIS(kcode); + /* EUC */ return EUCtoJIS(kcode); +} /* JIS to internal (EUC/SJIS/UPTEX) code conversion */ long fromJIS(long kcode) @@ -681,7 +696,12 @@ long input_line2(FILE *fp, unsigned char *buff, long pos, return last; } - +#ifdef WIN32 +void clear_infile_enc(FILE *fp) +{ + infile_enc[fileno(fp)] = ENC_UNKNOWN; +} +#else /* !WIN32 */ static const_string in_filter = NULL; static FILE *piped_fp[NOFILE]; static int piped_num = 0; @@ -692,7 +712,6 @@ void nkf_disable(void) } #ifdef NKF_TEST -#include <stdlib.h> static void nkf_check(void) { if (piped_num > 0) { @@ -747,3 +766,4 @@ int nkf_close(FILE *fp) { } return fclose(fp); } +#endif /* !WIN32 */ diff --git a/Build/source/texk/ptexenc/ptexenc/ptexenc.h b/Build/source/texk/ptexenc/ptexenc/ptexenc.h index 2863f6e0574..5c0ddfc9def 100644 --- a/Build/source/texk/ptexenc/ptexenc/ptexenc.h +++ b/Build/source/texk/ptexenc/ptexenc/ptexenc.h @@ -57,9 +57,9 @@ extern PTENCDLL int multibytelen (int first_byte); extern PTENCDLL long fromBUFF(unsigned char *s, int len, int pos); extern PTENCDLL long toBUFF(long inter); -/* internal (EUC/SJIS/UPTEX) from/to DVI (JIS) code conversion */ -#define fromDVI fromJIS -#define toDVI toJIS +/* internal (EUC/SJIS/UPTEX) from/to DVI (JIS/UCS) code conversion */ +extern PTENCDLL long toDVI (long kcode); +extern PTENCDLL long fromDVI (long kcode); /* JIS/EUC/SJIS/KUTN/UCS to internal (EUC/SJIS/UPTEX) code conversion */ /* (only for \euc primitive, etc.) */ @@ -79,9 +79,13 @@ extern PTENCDLL int fputs2(const char *s, FILE *fp); extern PTENCDLL long input_line2(FILE *fp, unsigned char *buff, long pos, const long buffsize, int *lastchar); +#ifdef WIN32 +extern PTENCDLL void clear_infile_enc(FILE *fp); +#else /* open/close through nkf */ extern PTENCDLL void nkf_disable(void); extern PTENCDLL FILE *nkf_open(const char *path, const char *mode); extern PTENCDLL int nkf_close(FILE *fp); +#endif #endif /* PTEXENC_PTEXENC_H */ diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index c308834f68d..c013acd471c 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -2,6 +2,8 @@ * texmfmp.c: Remove some (e-)pTeX cruft. + * openclose.c [PTEX]: No nkf_open() and nkf_close() for WIN32. + 2011-08-18 Peter Breitenlohner <peb@mppmu.mpg.de> * texmfmp.c: Options for (e-)pTeX and (e-)upTeX. diff --git a/Build/source/texk/web2c/lib/openclose.c b/Build/source/texk/web2c/lib/openclose.c index a42c14c1036..b71df46e235 100644 --- a/Build/source/texk/web2c/lib/openclose.c +++ b/Build/source/texk/web2c/lib/openclose.c @@ -224,7 +224,7 @@ open_input (FILE **f_ptr, int filefmt, const_string fopen_mode) free (fname); /* This fopen is not allowed to fail. */ -#ifdef PTEX +#if defined(PTEX) && !defined(WIN32) if (filefmt == kpse_tex_format || filefmt == kpse_bib_format) { *f_ptr = nkf_open (nameoffile + 1, fopen_mode); @@ -317,7 +317,12 @@ close_file (FILE *f) return; #ifdef PTEX +#ifdef WIN32 + clear_infile_enc (f); + if (fclose (f) == EOF) { +#else if (nkf_close (f) == EOF) { +#endif #else if (fclose (f) == EOF) { #endif |