diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-23 10:17:01 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-23 10:17:01 +0000 |
commit | 82e002633513b0b73099d293aba30fb14360fa9a (patch) | |
tree | 06d3e4ce4cde2988646b6967ca11598d22278cbe /Build/source/texk/web2c/uptexdir | |
parent | 16c57cd409df0f406fc2710bcadadbd790cab70b (diff) |
more upTeX and e-upTeX
git-svn-id: svn://tug.org/texlive/trunk@23652 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/uptexdir')
-rw-r--r-- | Build/source/texk/web2c/uptexdir/am/uptex.am | 56 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/kanji.c | 32 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/kanji.h | 16 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/upbibtex.ch | 366 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/updvitype.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/uppltotf.ch | 98 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/uptex.defines | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/uptftopl.ch | 85 |
8 files changed, 640 insertions, 19 deletions
diff --git a/Build/source/texk/web2c/uptexdir/am/uptex.am b/Build/source/texk/web2c/uptexdir/am/uptex.am index 58c2f479b05..541f69547e6 100644 --- a/Build/source/texk/web2c/uptexdir/am/uptex.am +++ b/Build/source/texk/web2c/uptexdir/am/uptex.am @@ -5,9 +5,10 @@ uptex_cppflags = $(PTEXENC_INCLUDES) $(AM_CPPFLAGS) uptex_ldadd = libukanji.a $(pproglib) $(PTEXENC_LIBS) $(LDADD) +uptex_dependencies = libukanji.a $(pproglib) $(PTEXENC_DEPEND) $(default_dependencies) up_tangle = WEBINPUTS=.:$(srcdir)/uptexdir:$(srcdir) $(buildenv) $(TANGLE) -upweb_programs = updvitype +upweb_programs = upbibtex updvitype uppltotf uptftopl ## libukanji.a for upTeX and e-upTeX ## @@ -29,6 +30,7 @@ uptex_CPPFLAGS = $(uptex_cppflags) # With --enable-ipc, upTeX may need to link with -lsocket. uptex_LDADD = $(uptex_ldadd) $(ipc_socketlibs) +uptex_DEPENDENCIES = $(uptex_dependencies) # upTeX C sources uptex_c_h = uptexini.c uptex0.c uptexcoerce.h uptexd.h @@ -86,12 +88,30 @@ EXTRA_DIST += $(uptex_web_srcs) $(uptex_ch_srcs) uptexdir/uptex.defines DISTCLEANFILES += $(nodist_uptex_SOURCES) uptex.web uptex.ch uptex-web2c \ uptex.p uptex.pool uptex-tangle +## upBibTeX +## +nodist_upbibtex_SOURCES = upbibtex.c upbibtex.h +upbibtex_SOURCES = uptexdir/kanji.h +upbibtex_CPPFLAGS = $(uptex_cppflags) -DDHEX_CHAR_CODE +upbibtex_LDADD = $(uptex_ldadd) +upbibtex_DEPENDENCIES = $(uptex_dependencies) +upbibtex.c upbibtex.h: upbibtex-web2c + $(web2c) upbibtex +upbibtex-web2c: upbibtex.p $(web2c_depend) uptexdir/uptex.defines + $(web2c) upbibtex +upbibtex.p: tangle$(EXEEXT) upbibtex.web uptexdir/upbibtex.ch + $(up_tangle) upbibtex upbibtex +upbibtex.web: tie$(EXEEXT) bibtex.web bibtex.ch ptexdir/pbibtex.ch + $(tie) -m upbibtex.web bibtex.web bibtex.ch ptexdir/pbibtex.ch +EXTRA_DIST += ptexdir/pbibtex.ch uptexdir/upbibtex.ch + ## upDVItype ## nodist_updvitype_SOURCES = updvitype.c updvitype.h updvitype_SOURCES = uptexdir/kanji.h updvitype_CPPFLAGS = $(uptex_cppflags) -DDHEX_CHAR_CODE updvitype_LDADD = $(uptex_ldadd) +updvitype_DEPENDENCIES = $(uptex_dependencies) updvitype.c updvitype.h: updvitype-web2c $(web2c) updvitype updvitype-web2c: updvitype.p $(web2c_depend) uptexdir/uptex.defines @@ -102,3 +122,37 @@ updvitype.web: tie$(EXEEXT) dvitype.web dvitype.ch ptexdir/pdvitype.ch $(tie) -m updvitype.web dvitype.web dvitype.ch ptexdir/pdvitype.ch EXTRA_DIST += ptexdir/pdvitype.ch uptexdir/updvitype.ch +## upPLtoTF +## +nodist_uppltotf_SOURCES = uppltotf.c uppltotf.h +uppltotf_SOURCES = uptexdir/kanji.h +uppltotf_CPPFLAGS = $(uptex_cppflags) -DDHEX_CHAR_CODE +uppltotf_LDADD = $(uptex_ldadd) +uppltotf_DEPENDENCIES = $(uptex_dependencies) +uppltotf.c uppltotf.h: uppltotf-web2c + $(web2c) uppltotf +uppltotf-web2c: uppltotf.p $(web2c_depend) uptexdir/uptex.defines + $(web2c) uppltotf +uppltotf.p: tangle$(EXEEXT) uppltotf.web uptexdir/uppltotf.ch + $(up_tangle) uppltotf uppltotf +uppltotf.web: tie$(EXEEXT) pltotf.web pltotf.ch ptexdir/ppltotf.ch + $(tie) -m uppltotf.web pltotf.web pltotf.ch ptexdir/ppltotf.ch +EXTRA_DIST += ptexdir/ppltotf.ch uptexdir/uppltotf.ch + +## upTFtoPL +## +nodist_uptftopl_SOURCES = uptftopl.c uptftopl.h +uptftopl_SOURCES = uptexdir/kanji.h +uptftopl_CPPFLAGS = $(uptex_cppflags) -DDHEX_CHAR_CODE +uptftopl_LDADD = $(uptex_ldadd) +uptftopl_DEPENDENCIES = $(uptex_dependencies) +uptftopl.c uptftopl.h: uptftopl-web2c + $(web2c) uptftopl +uptftopl-web2c: uptftopl.p $(web2c_depend) uptexdir/uptex.defines + $(web2c) uptftopl +uptftopl.p: tangle$(EXEEXT) uptftopl.web uptexdir/uptftopl.ch + $(up_tangle) uptftopl uptftopl +uptftopl.web: tie$(EXEEXT) tftopl.web tftopl.ch ptexdir/ptftopl.ch + $(tie) -m uptftopl.web tftopl.web tftopl.ch ptexdir/ptftopl.ch +EXTRA_DIST += ptexdir/ptftopl.ch uptexdir/uptftopl.ch + diff --git a/Build/source/texk/web2c/uptexdir/kanji.c b/Build/source/texk/web2c/uptexdir/kanji.c index b6dd47edd55..533785ccaeb 100644 --- a/Build/source/texk/web2c/uptexdir/kanji.c +++ b/Build/source/texk/web2c/uptexdir/kanji.c @@ -361,13 +361,31 @@ integer multilenbuffchar(integer c) return 0; } -/* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME */ -/* Temporary fix for functions still missing in the ptexenc library. */ -boolean is_internalUPTEX(void) { return false; } -boolean ismultichr (int length, int nth, int c) { return false; } -/* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME */ - -void initdefaultkanji (void) +void init_default_kanji (const_string file_str, const_string internal_str) { + char *p; + enable_UPTEX (true); /* enable */ + + p = getenv ("PTEX_KANJI_ENC"); + if (p) { + if (!set_enc_string (p, NULL)) + fprintf (stderr, "Ignoring bad kanji encoding \"%s\".\n", p); + } + +#ifdef WIN32 + p = kpse_var_value ("guess_input_kanji_encoding"); + if (p) { + if (*p == '1' || *p == 'y' || *p == 't') + infile_enc_auto = 1; + free(p); + } +#endif + + if (!set_enc_string (file_str, internal_str)) { + fprintf (stderr, "Bad kanji encoding \"%s\" or \"%s\".\n", + file_str ? file_str : "NULL", + internal_str ? internal_str : "NULL"); + uexit(1); + } } diff --git a/Build/source/texk/web2c/uptexdir/kanji.h b/Build/source/texk/web2c/uptexdir/kanji.h index 630fb5ccdde..71faa43f3e0 100644 --- a/Build/source/texk/web2c/uptexdir/kanji.h +++ b/Build/source/texk/web2c/uptexdir/kanji.h @@ -36,7 +36,12 @@ extern integer calc_pos (integer c); #define calcpos calc_pos extern integer kcatcodekey (integer c); extern integer multilenbuffchar (integer c); -extern void initdefaultkanji (void); + +extern void init_default_kanji (const_string file_str, const_string internal_str); +/* for upTeX and e-upTeX */ +#define initdefaultkanji() init_default_kanji("utf8", "uptex") +/* for upBibTeX, upDVItype, upPLtoTF, and upTFtoPL */ +#define initkanji() init_default_kanji("utf8", "uptex") #define setptexencuptex() set_enc_string("utf8", "uptex"); @@ -48,17 +53,10 @@ extern void initdefaultkanji (void); #define putc(c,fp) putc2(c,fp) #endif /* !PRESERVE_PUTC */ -#if defined(UPBIBTEX) || defined(BIBTEX) +#ifdef UPBIBTEX #define inputline2(fp,buff,pos,size,ptr) input_line2(fp,buff,pos,size,ptr) #else #define inputline2(fp,buff,pos,size) input_line2(fp,buff,pos,size,NULL) #endif -/* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME */ -/* Temporary fix for functions still missing in the ptexenc library. */ -extern boolean is_internalUPTEX(void); -#define isinternalUPTEX is_internalUPTEX -extern boolean ismultichr (int length, int nth, int c); -/* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME */ - #endif /* not KANJI_H */ diff --git a/Build/source/texk/web2c/uptexdir/upbibtex.ch b/Build/source/texk/web2c/uptexdir/upbibtex.ch new file mode 100644 index 00000000000..efa8a9b389b --- /dev/null +++ b/Build/source/texk/web2c/uptexdir/upbibtex.ch @@ -0,0 +1,366 @@ +@x +@d banner=='This is pBibTeX, Version 0.99d-j0.33' +@y +@d banner=='This is upBibTeX, Version 0.99d-j0.33-u0.30' +@z + +@x +for i:=@'200 to @'237 do xchr[i]:=chr(i-@'200); +for i:=@'240 to 255 do xchr[i]:=chr(i); +@y +for i:=@'200 to 255 do xchr[i]:=chr(i); +@z + +@x +for i:=@'200 to @'237 do xord[i]:= i-@'200; +for i:=@'240 to 255 do xord[i]:=i; +@y +for i:=@'200 to 255 do xord[i]:=i; +@z + +@x +@d zen_pun_first = 161 {Zenkaku punctuation first byte; in EUC} +@d zen_space = 161 {Zenkaku space first, second byte; in EUC} +@d zen_kuten = 162 {Zenkaku kuten second byte; in EUC} +@d zen_ten = 163 {Zenkaku ten second byte; in EUC} +@d zen_comma = 164 {Zenkaku comman second byte; in EUC} +@d zen_period = 165 {Zenkaku period second byte; in EUC} +@d zen_question = 169 {Zenkaku question mark second byte; in EUC} +@d zen_exclamation = 170 {Zenkaku exclamation mark second byte; in EUC} +@y +@d e_ss3 = @"8F {single shift three in EUC} +@d e_pun_first = @"A1 {Zenkaku punctuation first byte; in EUC} +@d e_space = @"A1A1 {Zenkaku space; in EUC} +@d e_toten = @"A1A2 {Zenkaku kuten; in EUC} +@d e_kuten = @"A1A3 {Zenkaku toten; in EUC} +@d e_comma = @"A1A4 {Zenkaku comman; in EUC} +@d e_period = @"A1A5 {Zenkaku period; in EUC} +@d e_question = @"A1A9 {Zenkaku question mark; in EUC} +@d e_exclamation =@"A1AA {Zenkaku exclamation mark; in EUC} +@d u_pun_first1 = @"E3 {Zenkaku punctuation first byte(1); in UTF-8} +@d u_pun_first2 = @"EF {Zenkaku punctuation first byte(2); in UTF-8} +@d u_space = @"3000 {Zenkaku space; in UCS} +@d u_toten = @"3001 {Zenkaku toten; in UCS} +@d u_kuten = @"3002 {Zenkaku kuten; in UCS} +@d u_comma = @"FF0C {Zenkaku comman; in UCS} +@d u_period = @"FF0E {Zenkaku period; in UCS} +@d u_question = @"FF1F {Zenkaku question mark; in UCS} +@d u_exclamation = @"FF01 {Zenkaku exclamation mark; in UCS} +@d u_double_question = @"2047 {Zenkaku double question mark; in UCS} +@d u_double_exclam = @"203C {Zenkaku double exclamation mark; in UCS} +@d u_question_exclam = @"2048 {Zenkaku question exclamation mark; in UCS} +@d u_exclam_question = @"2049 {Zenkaku exclamation question mark; in UCS} +@z + +@x +for i:=@'200 to @'237 do lex_class[i] := illegal; +for i:=@'240 to 255 do lex_class[i] := alpha; +lex_class[@'33]:=alpha; +@y +@z + +@x +for i:=@'200 to @'237 do id_class[i] := illegal_id_char; +@y +@z + +@x +for i:=@'240 to 254 do char_width[i]:=514; +@y +@z + +@x procedure get_the_top_level_aux_file_name +label aux_found,@!aux_not_found; +@y +label aux_found,@!aux_not_found; +var i:0..last_text_char; {this is the first one declared} +@z +@x + @<Process a possible command line@> +@y + @<Process a possible command line@> + @<Initialize variables depending on Kanji code@> +@z + +@x + zen_ten, + zen_period, + zen_question, + zen_exclamation: + if( str_pool[sp_ptr-1] = zen_pun_first ) then + repush_string + else + @<Add the |period| (it's necessary) and push@>; + othercases + @<Add the |period| (it's necessary) and push@> +@y + othercases + begin + if (is_internalEUC) then + begin + case (fromBUFF(str_pool, sp_ptr+1, sp_ptr-1)) of + e_kuten, + e_period, + e_question, + e_exclamation: + if (str_pool[sp_ptr-2]<>e_ss3) then + repush_string + else + @<Add the |period| (it's necessary) and push@>; + othercases + @<Add the |period| (it's necessary) and push@>; + endcases; + end; + if (is_internalUPTEX) then + begin + case (fromBUFF(str_pool, sp_ptr+1, sp_ptr-2)) of + u_kuten, + u_period, + u_question, + u_exclamation, + u_double_question, + u_double_exclam, + u_question_exclam, + u_exclam_question: + repush_string; + othercases + @<Add the |period| (it's necessary) and push@>; + endcases; + end; + end; +@z + +@x + if(str_pool[str_start[pop_lit1]]>127) then { a KANJI char is 2byte long } +@y + if(str_pool[str_start[pop_lit1]]>127) then { a KANJI char is |2..4|byte long } +@z + +@x + if( (ex_buf[ex_buf_ptr-1]=zen_comma) or (ex_buf[ex_buf_ptr-1]=zen_kuten) ) + then ex_buf_ptr := ex_buf_ptr - 2 + else ex_buf_ptr := ex_buf_ptr - 4; +@y + if (is_internalEUC) then + if((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-2) = e_comma) or + (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-2) = e_toten)) + then ex_buf_ptr := ex_buf_ptr - 2 + else ex_buf_ptr := ex_buf_ptr - 4; + if (is_internalUPTEX) then + if((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-3) = u_comma) or + (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-3) = u_toten)) + then ex_buf_ptr := ex_buf_ptr - 3 + else ex_buf_ptr := ex_buf_ptr - 4; +@z + +@x + zen_pun_first: + begin + if((ex_buf[ex_buf_ptr+1]=zen_comma) or + (ex_buf[ex_buf_ptr+1]=zen_kuten) ) then +@y + e_pun_first: + if (is_internalEUC) then + begin + if ((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = e_comma) or + (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = e_toten)) then +@z +@x + else if(ex_buf[ex_buf_ptr+1]=zen_space) then +@y + else if (fromBUFF(ex_buf,ex_buf_length,ex_buf_ptr) = e_space) then +@z +@x + end; +@y + end else begin + ex_buf_ptr := ex_buf_ptr + multibytelen(ex_buf[ex_buf_ptr]); + preceding_white := false; + end; + u_pun_first1, + u_pun_first2: + if (is_internalUPTEX) then + begin + if ((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = u_comma) or + (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = u_toten)) then + begin + preceding_white := false; + and_found := true + end + else if (fromBUFF(ex_buf,ex_buf_length,ex_buf_ptr) = u_space) then + begin + ex_buf[ex_buf_ptr] := space; + ex_buf[ex_buf_ptr+1] := space; + ex_buf[ex_buf_ptr+2] := space; + preceding_white := true; + end; + ex_buf_ptr := ex_buf_ptr + 3; + end else begin + ex_buf_ptr := ex_buf_ptr + multibytelen(ex_buf[ex_buf_ptr]); + preceding_white := false; + end; +@z + +@x + if( ex_buf[ex_buf_ptr] > 127 ) then + ex_buf_ptr := ex_buf_ptr +2 + else + incr(ex_buf_ptr); +@y + ex_buf_ptr := ex_buf_ptr + multibytelen(ex_buf[ex_buf_ptr]); +@z + +@x + if name_buf[name_bf_ptr]>127 then begin + append_ex_buf_char_and_check (name_buf[name_bf_ptr]); + incr(name_bf_ptr); + append_ex_buf_char_and_check (name_buf[name_bf_ptr]); + end + else + append_ex_buf_char_and_check (name_buf[name_bf_ptr]); +@y + append_ex_buf_char_and_check (name_buf[name_bf_ptr]); + if multibytelen(name_buf[name_bf_ptr]) > 1 then + append_ex_buf_char_and_check (name_buf[name_bf_ptr+1]); + if multibytelen(name_buf[name_bf_ptr]) > 2 then + append_ex_buf_char_and_check (name_buf[name_bf_ptr+2]); + if multibytelen(name_buf[name_bf_ptr]) > 3 then + append_ex_buf_char_and_check (name_buf[name_bf_ptr+3]); + name_bf_ptr := name_bf_ptr + multibytelen(name_buf[name_bf_ptr])-1; +@z + +@x +{ 2 bytes Kanji code break check } +@y +{ |2..4| bytes Kanji code break check } +@z +@x + if str_pool[tps] > 127 + then tps := tps + 2 + else incr(tps); +@y + tps := tps + multibytelen(str_pool[tps]); +@z +@x + if str_pool[tpe] > 127 + then tpe := tpe+2 + else incr(tpe); +@y + tpe := tpe + multibytelen(str_pool[tpe]); +@z + +@x + if str_pool[sp_ptr] >127 then begin + append_char (str_pool[sp_ptr]); incr(sp_ptr); + append_char (str_pool[sp_ptr]); incr(sp_ptr); + end + else begin + append_char (str_pool[sp_ptr]); incr(sp_ptr); + end; +@y + append_char (str_pool[sp_ptr]); + if multibytelen(str_pool[sp_ptr]) > 1 then + append_char (str_pool[sp_ptr+1]); + if multibytelen(str_pool[sp_ptr]) > 2 then + append_char (str_pool[sp_ptr+2]); + if multibytelen(str_pool[sp_ptr]) > 3 then + append_char (str_pool[sp_ptr+3]); + if multibytelen(str_pool[sp_ptr]) > 0 then + sp_ptr := sp_ptr + multibytelen(str_pool[sp_ptr]) + else + incr(sp_ptr); +@z + +@x + incr(sp_xptr1); num_text_chars:=num_text_chars+2; +@y + num_text_chars := num_text_chars + multibytelen(str_pool[sp_xptr1-1]); + sp_xptr1 := sp_xptr1-1 + multibytelen(str_pool[sp_xptr1-1]); +@z + +@x +const n_options = 6; {Pascal won't count array lengths for us.} +@y +const n_options = 7; {Pascal won't count array lengths for us.} +@z + +@x + usage ('pbibtex'); +@y + usage ('upbibtex'); +@z + +@x + usage_help (PBIBTEX_HELP, nil); +@y + usage_help (UPBIBTEX_HELP, nil); +@z + +@x + end; {Else it was a flag; |getopt| has already done the assignment.} +@y + end else if argument_is ('kanji-internal') then begin + if (not (set_enc_string(0,optarg) and + (is_internalEUC or is_internalUPTEX))) then + write_ln('Bad internal kanji encoding "', stringcast(optarg), '".'); + + end; {Else it was a flag; |getopt| has already done the assignment.} +@z + +@x + write_ln (stderr, 'pbibtex: Need exactly one file argument.'); + usage ('pbibtex'); +@y + write_ln (stderr, 'upbibtex: Need exactly one file argument.'); + usage ('upbibtex'); +@z + +@x +@ An element with all zeros always ends the list. +@y +@ Kanji-internal option. +@.-kanji-internal@> + +@<Define the option...@> = +long_options[current_option].name := 'kanji-internal'; +long_options[current_option].has_arg := 1; +long_options[current_option].flag := 0; +long_options[current_option].val := 0; +incr(current_option); + +@ An element with all zeros always ends the list. +@z + +@x +exit:end; +@y +exit:end; + +@ @<Initialize variables depending on Kanji code@>= +if (is_internalUPTEX) then + begin + for i:=@"80 to @"BF do lex_class[i] := alpha; { trail bytes } + for i:=@"C0 to @"C1 do lex_class[i] := illegal; + for i:=@"C2 to @"F4 do lex_class[i] := alpha; { lead bytes } + for i:=@"F5 to @"FF do lex_class[i] := illegal; + for i:=@"C0 to @"C1 do id_class[i] := illegal_id_char; + for i:=@"F5 to @"FF do id_class[i] := illegal_id_char; + for i:=@"80 to @"BF do char_width[i]:=257; { trail bytes } + for i:=@"C2 to @"DF do char_width[i]:=771; { lead bytes (2bytes) } + for i:=@"E0 to @"EF do char_width[i]:=514; { lead bytes (3bytes) } + for i:=@"F0 to @"F4 do char_width[i]:=257; { lead bytes (4bytes) } + end +else + begin { is_internalEUC } + for i:=@'200 to @'240 do lex_class[i] := illegal; + for i:=@'241 to 254 do lex_class[i] := alpha; + lex_class[255]:=illegal; + for i:=@'200 to @'240 do id_class[i] := illegal_id_char; + id_class[255]:=illegal_id_char; + lex_class[@'33]:=alpha; + lex_class[e_ss3]:=alpha; + for i:=@'241 to 254 do char_width[i]:=514; + char_width[e_ss3]:=0; + end; +@z + diff --git a/Build/source/texk/web2c/uptexdir/updvitype.ch b/Build/source/texk/web2c/uptexdir/updvitype.ch index 84f56f1d2d9..47297de8a29 100644 --- a/Build/source/texk/web2c/uptexdir/updvitype.ch +++ b/Build/source/texk/web2c/uptexdir/updvitype.ch @@ -1,5 +1,5 @@ @x -@d banner=='This is PDVItype, Version 3.6-p0.4' +@d banner=='This is pDVItype, Version 3.6-p0.4' @y @d banner=='This is upDVItype, Version 3.6-p0.4-u0.28' @z diff --git a/Build/source/texk/web2c/uptexdir/uppltotf.ch b/Build/source/texk/web2c/uptexdir/uppltotf.ch new file mode 100644 index 00000000000..61326987d0a --- /dev/null +++ b/Build/source/texk/web2c/uptexdir/uppltotf.ch @@ -0,0 +1,98 @@ +@x +@d banner=='This is pPLtoTF, Version 3.5-p1.8' +@y +@d banner=='This is upPLtoTF, Version 3.5-p1.8-u0.30' +@z + +@x + usage ('ppltotf'); +@y + usage ('uppltotf'); +@z + +@x + usage_help (PPLTOTF_HELP, nil); +@y + usage_help (UPPLTOTF_HELP, nil); +@z + +@x + write_ln (stderr, 'ppltotf: Need one or two file arguments.'); + usage ('ppltotf'); +@y + write_ln (stderr, 'uppltotf: Need one or two file arguments.'); + usage ('uppltotf'); +@z + +@x +max_kanji=7237; { maximam number of 2byte characters } +@y +max_kanji=65535; { maximam number of 2byte characters } +@z + +@x function get_next_raw +if multistrlen(stringcast(buffer),loc+2,loc)=2 then cur_char:=" " +@y +if multistrlen(stringcast(buffer),loc+3,loc)>1 then cur_char:=" " +@z + +@x function valid_jis_code +var @!first_byte,@!second_byte:integer; { jis code bytes } +begin valid_jis_code:=true; +first_byte:=cx div @'400; second_byte:=cx mod @'400; +if (first_byte<@"21) + or((first_byte>@"28)and(first_byte<@"30)) + or(first_byte>@"74) then valid_jis_code:=false; +if (second_byte<@"21)or(second_byte>@"7E) then valid_jis_code:=false; +@y +begin valid_jis_code:=true; +if (cx>@"FFFF)or(check_kanji(fromDVI(cx),0)<>1) + or(toDVI(fromDVI(cx))<>cx) then valid_jis_code:=false; +@z + +@x function jis_to_index +var @!first_byte,@!second_byte:integer; { jis code bytes } +begin +first_byte:=jis div @'400 -@"21; +second_byte:=jis mod @'400 -@"21; +if first_byte<8 then + jis_to_index:=first_byte*94+second_byte +else { next |first_byte| start 16 } + jis_to_index:=(first_byte-7)*94+second_byte; +@y +begin +jis_to_index:=jis; +@z + +@x function index_to_jis +begin if ix<=8*94-1 then + index_to_jis:=(ix div 94 +@"21)*@'400+(ix mod 94 +@"21) +else + index_to_jis:=((ix+7*94) div 94 +@"21)*@'400+((ix+7*94) mod 94 +@"21); +@y +begin +index_to_jis:=ix; +@z + +@x function get_kanji +else if multistrlen(stringcast(buffer), loc+2, loc)=2 then + begin jis_code:=toDVI(fromBUFF(stringcast(buffer), loc+2, loc)); + incr(loc); cur_char:=" "; +@y +else if (ch='U')or(ch='u') then + begin repeat ch:=get_next_raw; until ch<>' '; + cx:=todig(xord[ch])*@"1000; + incr(loc); ch:=xord[buffer[loc]]; cx:=cx+todig(ch)*@"100; + incr(loc); ch:=xord[buffer[loc]]; cx:=cx+todig(ch)*@"10; + incr(loc); ch:=xord[buffer[loc]]; cx:=cx+todig(ch); + jis_code:=toDVI(fromUCS(cx)); + cur_char:=ch; + if not valid_jis_code(jis_code) then + err_print('jis code ', jis_code:1, ' is invalid'); + end +else if multistrlen(stringcast(buffer), loc+4, loc)>1 then + begin cur_char:=" "; + jis_code:=toDVI(fromBUFF(stringcast(buffer), loc+4, loc)); + loc:=loc+multistrlen(stringcast(buffer), loc+4, loc)-1; +@z + diff --git a/Build/source/texk/web2c/uptexdir/uptex.defines b/Build/source/texk/web2c/uptexdir/uptex.defines index d32c67bca64..635039307ea 100644 --- a/Build/source/texk/web2c/uptexdir/uptex.defines +++ b/Build/source/texk/web2c/uptexdir/uptex.defines @@ -10,6 +10,7 @@ @define function setencstring (); @define procedure setpriorfileenc; @define function isinternalUPTEX; +@define function isinternalEUC; @define procedure setptexencuptex; @define function iskanji1 (); @@ -17,6 +18,7 @@ @define function ismultichr (); @define function multistrlen (); +@define function multibytelen (); @define function fromBUFF (); @define function toBUFF (); @@ -41,6 +43,6 @@ @define function multilenbuffchar (); @define function nrestmultichr (); -@define procedure initdefaultkanji; +@define procedure initkanji; @define var sjisterminal; diff --git a/Build/source/texk/web2c/uptexdir/uptftopl.ch b/Build/source/texk/web2c/uptexdir/uptftopl.ch new file mode 100644 index 00000000000..a3b6b23ba6e --- /dev/null +++ b/Build/source/texk/web2c/uptexdir/uptftopl.ch @@ -0,0 +1,85 @@ +@x +@d banner=='This is pTFtoPL, Version 3.2-p1.7' +@y +@d banner=='This is upTFtoPL, Version 3.2-p1.7-u0.30' +@z + +@x + usage ('ptftopl'); +@y + usage ('uptftopl'); +@z + +@x + usage_help (PTFTOPL_HELP, nil); +@y + usage_help (UPTFTOPL_HELP, nil); +@z + +@x + print_ln ('ptftopl: Need one or two file arguments.'); + usage ('ptftopl'); +@y + print_ln ('uptftopl: Need one or two file arguments.'); + usage ('uptftopl'); +@z + +@x +@d max_kanji=7237 {number of the kanji characters - 1} +@y +@d max_kanji=65535 {number of the kanji characters - 1} +@z + +@x procedure out_kanji + begin cx:=jis_code; out('J '); {specify jiscode format} +@y + begin cx:=jis_code; + if (isinternalUPTEX) then out(' U ') + else out(' J '); {specify jiscode format} +@z +@x + out(xchr[Hi(cx)]); out(xchr[Lo(cx)]); +@y + if BYTE1(cx)<>0 then out(xchr[BYTE1(cx)]); + if BYTE2(cx)<>0 then out(xchr[BYTE2(cx)]); + if BYTE3(cx)<>0 then out(xchr[BYTE3(cx)]); + out(xchr[BYTE4(cx)]); +@z + +@x function valid_jis_code +var first_byte, second_byte:integer; { jis code bytes } +begin valid_jis_code:=true; +first_byte:=cx div @'400; second_byte:=cx mod @'400; +if (first_byte<@"21) + or((first_byte>@"28)and(first_byte<@"30)) + or(first_byte>@"74) then valid_jis_code:=false; +if (second_byte<@"21)or(second_byte>@"7E) then valid_jis_code:=false; +@y +begin valid_jis_code:=true; +if (cx>@"FFFF)or(check_kanji(fromDVI(cx),0)<>1) + or(toDVI(fromDVI(cx))<>cx) then valid_jis_code:=false; +@z + +@x function index_to_jis +if ix<=8*94-1 then + index_to_jis:=(ix div 94 + @"21) * @'400 + (ix mod 94 + @"21) +else + index_to_jis:=((ix+7 * 94) div 94 + @"21) * @'400 + ((ix+7*94) mod 94 + @"21); +@y +index_to_jis:=ix; +@z + +@x function jis_to_index +var first_byte,second_byte:integer; { jis code bytes } +begin +first_byte:=cx div @'400 - @"21; +second_byte:=cx mod @'400 - @"21; +if first_byte<8 then + jis_to_index:=first_byte*94+second_byte +else + jis_to_index:=(first_byte-7)*94+second_byte; +@y +begin +jis_to_index:=cx; +@z + |