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/ptexdir | |
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/ptexdir')
-rw-r--r-- | Build/source/texk/web2c/ptexdir/ChangeLog | 36 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/am/ptex.am | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/kanji.c | 26 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/kanji.h | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/pbibtex.ch | 61 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/pdvitype.ch | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/ppltotf.ch | 57 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/ptex.defines | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/ptftopl.ch | 56 |
9 files changed, 125 insertions, 132 deletions
diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog index d9e3e3ced05..fca40b0347e 100644 --- a/Build/source/texk/web2c/ptexdir/ChangeLog +++ b/Build/source/texk/web2c/ptexdir/ChangeLog @@ -1,3 +1,39 @@ +2011-08-23 Peter Breitenlohner <peb@mppmu.mpg.de> + + * pbibtex.ch, pdvitype.ch, ppltotf.ch, ptftopl.ch, ptex.defines: + Change init_default_kanji => init_kanji. + * kanji.[ch]: Map initdefaultkanji (for pTeX and e-pTeX) and + initkanji (for pBibTeX, pDVItype, pPLtoTF, and pTFtoPL) to + init_default_kanji() with two encoding string arguments. + +2011-08-22 Peter Breitenlohner <peb@mppmu.mpg.de> + + * pbibtex.ch, pdvitype.ch, ppltotf.ch, ptftopl.ch: Change error + message text 'kanjicode encoding' => 'kanji encoding'. + * am/ptex.am (*_DEPENDENCIES): Define proper dependencies. + +2011-08-20 Peter Breitenlohner <peb@mppmu.mpg.de> + + * pbibtex.ch, ppltotf.ch, ptftopl.ch: Stop parsing arguments at + "-version" and immediately call print_version_and_exit(). + +2011-08-19 Peter Breitenlohner <peb@mppmu.mpg.de> + + * pbibtex.ch, pdvitype.ch, ppltotf.ch, ptftopl.ch: Add WIN32 + option "sjis-terminal" and init_default_kanji(). + * ptex.defines: Add sjisterminal and initdefaultkanji. + * kanji.[ch]: Add support for WIN32 option "sjis-terminal". + (check_kanji): Change return type boolean => int (for -1, 0, +1). + (initdefaultkanji): New function from W32TeX kanjiextra.c. + * am/ptex.am (*_LDADD): Use libkanji.a for all binaries. + + * pdvitype.ch: Change banner 'PDVItype' => 'pDVItype'. + * ppltotf.ch: Change banner 'Nihongo PLtoTF' => 'pPLtoTF'. + More fix usage ('progname'). Simplify kanji encoding output. + * ptftopl.ch: Change banner 'Nihongo TFtoPL' => 'pTFtoPL'. + More fix usage ('progname'). Simplify kanji encoding output. + * pbibtex.ch: Simplify kanji encoding output. + 2011-08-19 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * ppltotf.ch, ptftopl.ch: fix usage ('progname'). diff --git a/Build/source/texk/web2c/ptexdir/am/ptex.am b/Build/source/texk/web2c/ptexdir/am/ptex.am index e9f3c835936..2b1523bbbc4 100644 --- a/Build/source/texk/web2c/ptexdir/am/ptex.am +++ b/Build/source/texk/web2c/ptexdir/am/ptex.am @@ -5,6 +5,7 @@ ptex_cppflags = $(PTEXENC_INCLUDES) $(AM_CPPFLAGS) ptex_ldadd = libkanji.a $(pproglib) $(PTEXENC_LIBS) $(LDADD) +ptex_dependencies = libkanji.a $(pproglib) $(PTEXENC_DEPEND) $(default_dependencies) p_tangle = WEBINPUTS=.:$(srcdir)/ptexdir:$(srcdir) $(buildenv) $(TANGLE) pweb_programs = pbibtex pdvitype ppltotf ptftopl @@ -51,6 +52,7 @@ ptex_CPPFLAGS = $(ptex_cppflags) # With --enable-ipc, pTeX may need to link with -lsocket. ptex_LDADD = $(ptex_ldadd) $(ipc_socketlibs) +ptex_DEPENDENCIES = $(ptex_dependencies) # pTeX C sources ptex_c_h = ptexini.c ptex0.c ptexcoerce.h ptexd.h @@ -107,6 +109,7 @@ nodist_pbibtex_SOURCES = pbibtex.c pbibtex.h pbibtex_SOURCES = ptexdir/kanji.h pbibtex_CPPFLAGS = $(ptex_cppflags) pbibtex_LDADD = $(ptex_ldadd) +pbibtex_DEPENDENCIES = $(ptex_dependencies) pbibtex.c pbibtex.h: pbibtex-web2c $(web2c) pbibtex pbibtex-web2c: pbibtex.p $(web2c_depend) ptexdir/ptex.defines web2c/cvtbib.sed @@ -126,6 +129,7 @@ nodist_pdvitype_SOURCES = pdvitype.c pdvitype.h pdvitype_SOURCES = ptexdir/kanji.h pdvitype_CPPFLAGS = $(ptex_cppflags) -DDHEX_CHAR_CODE pdvitype_LDADD = $(ptex_ldadd) +pdvitype_DEPENDENCIES = $(ptex_dependencies) pdvitype.c pdvitype.h: pdvitype-web2c $(web2c) pdvitype pdvitype-web2c: pdvitype.p $(web2c_depend) ptexdir/ptex.defines @@ -144,6 +148,7 @@ nodist_ppltotf_SOURCES = ppltotf.c ppltotf.h ppltotf_SOURCES = ptexdir/kanji.h ppltotf_CPPFLAGS = $(ptex_cppflags) -DPRESERVE_PUTC ppltotf_LDADD = $(ptex_ldadd) +ppltotf_DEPENDENCIES = $(ptex_dependencies) ppltotf.c ppltotf.h: ppltotf-web2c $(web2c) ppltotf ppltotf-web2c: ppltotf.p $(web2c_depend) ptexdir/ptex.defines @@ -160,6 +165,7 @@ nodist_ptftopl_SOURCES = ptftopl.c ptftopl.h ptftopl_SOURCES = ptexdir/kanji.h ptftopl_CPPFLAGS = $(ptex_cppflags) ptftopl_LDADD = $(ptex_ldadd) +ptftopl_DEPENDENCIES = $(ptex_dependencies) ptftopl.c ptftopl.h: ptftopl-web2c $(web2c) ptftopl ptftopl-web2c: ptftopl.p $(web2c_depend) ptexdir/ptex.defines diff --git a/Build/source/texk/web2c/ptexdir/kanji.c b/Build/source/texk/web2c/ptexdir/kanji.c index 5852be396e1..d0a3766c25f 100644 --- a/Build/source/texk/web2c/ptexdir/kanji.c +++ b/Build/source/texk/web2c/ptexdir/kanji.c @@ -81,7 +81,31 @@ integer kcatcodekey(integer c) return Hi(toDVI(c)); } -void initdefaultkanji (void) +void init_default_kanji (const_string file_str, const_string internal_str) { + char *p; + enable_UPTEX (false); /* disable */ + + 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/ptexdir/kanji.h b/Build/source/texk/web2c/ptexdir/kanji.h index 67a3d18f05b..5d33b97d9fa 100644 --- a/Build/source/texk/web2c/ptexdir/kanji.h +++ b/Build/source/texk/web2c/ptexdir/kanji.h @@ -33,7 +33,12 @@ extern boolean ismultiprn (integer c); extern integer calc_pos (integer c); #define calcpos calc_pos extern integer kcatcodekey (integer c); -extern void initdefaultkanji (void); + +extern void init_default_kanji (const_string file_str, const_string internal_str); +/* for pTeX and e-pTeX */ +#define initdefaultkanji() init_default_kanji(NULL, "euc") +/* for pBibTeX, pDVItype, pPLtoTF, and pTFtoPL */ +#define initkanji() init_default_kanji(NULL, "euc") #ifndef PRESERVE_PUTC #undef putc diff --git a/Build/source/texk/web2c/ptexdir/pbibtex.ch b/Build/source/texk/web2c/ptexdir/pbibtex.ch index fd55579304b..95ec3d47b91 100644 --- a/Build/source/texk/web2c/ptexdir/pbibtex.ch +++ b/Build/source/texk/web2c/ptexdir/pbibtex.ch @@ -52,9 +52,7 @@ print (banner); @y print (banner); - print (' ('); - print (conststringcast(get_enc_string)); - print (')'); + print (' (', conststringcast(get_enc_string), ')'); @z @x Changes for JBibTeX by Shouichi Matsui [27] @@ -229,7 +227,7 @@ begin @x parse_arguments; @y -init_default_kanji; +init_kanji; parse_arguments; @z @@ -335,11 +333,11 @@ if (ex_buf_ptr < ex_buf_length) then {remove the ``and''} ex_buf_ptr := ex_buf_ptr - 4; @y if (ex_buf_ptr < ex_buf_length) then {remove the ``and'', or Zenkau comma} - begin + begin 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; - end; + end; @z @x Changes for JBibTeX by Shouichi Matsui for Zenkaku comma @@ -456,12 +454,13 @@ while (sp_ptr < sp_end) do {shift the substring} @y { 2 bytes Kanji code break check } tps:=str_start[pop_lit3]; -while (tps < sp_ptr ) do +while (tps < sp_ptr) do begin if str_pool[tps] > 127 then tps := tps + 2 else incr(tps); +end; tpe:=tps; -while (tpe < sp_end ) do begin +while (tpe < sp_end) do begin if str_pool[tpe] > 127 then tpe := tpe+2 else incr(tpe); @@ -485,7 +484,8 @@ while (sp_ptr < sp_end) do {shift the substring} append_char (str_pool[sp_ptr]); incr(sp_ptr); end else begin - append_char (str_pool[sp_ptr]); incr(sp_ptr); end; + append_char (str_pool[sp_ptr]); incr(sp_ptr); + end; end; @z @@ -504,9 +504,10 @@ while (sp_ptr < sp_end) do {shift the substring} if (sp_brace_level > 0) then decr(sp_brace_level); end - else if (str_pool[sp_xptr1-1]>127) then begin {kanji char} + else if (str_pool[sp_xptr1-1]>127) then + begin {kanji char} incr(sp_xptr1); num_text_chars:=num_text_chars+2; - end + end else incr(num_text_chars); end; @@ -514,22 +515,8 @@ while (sp_ptr < sp_end) do {shift the substring} @x const n_options = 4; {Pascal won't count array lengths for us.} -var @!long_options: array[0..n_options] of getopt_struct; - @!getopt_return_val: integer; - @!option_index: c_int_type; - @!current_option: 0..n_options; -begin - @<Initialize the option variables@>; @y const n_options = 6; {Pascal won't count array lengths for us.} -var @!long_options: array[0..n_options] of getopt_struct; - @!getopt_return_val: integer; - @!option_index: c_int_type; - @!current_option: 0..n_options; - @!version_switch: boolean; -begin - @<Initialize the option variables@>; - version_switch := false; @z @x @@ -545,28 +532,19 @@ begin @z @x - print_version_and_exit (banner, 'Oren Patashnik', nil, nil); + end; {Else it was a flag; |getopt| has already done the assignment.} @y - version_switch := true; - end else if argument_is ('kanji') then begin - @<Set process kanji code@>; -@z + if (not set_enc_string(optarg, 0)) then + write_ln('Bad kanji encoding "', stringcast(optarg), '".'); -@x - until getopt_return_val = -1; -@y - until getopt_return_val = -1; - if (version_switch) then - print_version_and_exit (banner, 'Oren Patashnik', nil, nil); + end; {Else it was a flag; |getopt| has already done the assignment.} @z @x - if (optind + 1 <> argc) then begin write_ln (stderr, 'bibtex: Need exactly one file argument.'); usage ('bibtex'); @y - if (optind + 1 <> argc) then begin write_ln (stderr, 'pbibtex: Need exactly one file argument.'); usage ('pbibtex'); @z @@ -577,7 +555,6 @@ long_options[current_option].has_arg := 0; long_options[current_option].flag := 0; long_options[current_option].val := 0; incr (current_option); - @y long_options[current_option].name := 'version'; long_options[current_option].has_arg := 0; @@ -612,7 +589,6 @@ begin kpse_set_program_name (argv[0], 'bibtex'); begin kpse_set_program_name (argv[0], 'pbibtex'); @z - @x until j_prime; incr (k); @@ -653,9 +629,4 @@ begin push_lit_stk(0,stk_int); end; exit:end; - -@ @<Set process kanji code@>= - if (not set_enc_string(optarg, 0)) then begin - write_ln('Bad kanjicode encoding "', stringcast(optarg), '".'); - end; @z diff --git a/Build/source/texk/web2c/ptexdir/pdvitype.ch b/Build/source/texk/web2c/ptexdir/pdvitype.ch index 143377709a6..7a30e85d560 100644 --- a/Build/source/texk/web2c/ptexdir/pdvitype.ch +++ b/Build/source/texk/web2c/ptexdir/pdvitype.ch @@ -5,14 +5,14 @@ @x @d banner=='This is DVItype, Version 3.6' {printed when the program starts} @y -@d banner=='This is PDVItype, Version 3.6-p0.4' +@d banner=='This is pDVItype, Version 3.6-p0.4' {printed when the program starts} @z @x parse_arguments; @y - init_default_kanji; + init_kanji; parse_arguments; @z @@ -505,7 +505,7 @@ const n_options = 10; {Pascal won't count array lengths for us.} @y end else if argument_is ('kanji') then begin if (not set_enc_string(optarg,optarg)) then begin - write_ln('Bad kanjicode encoding "', stringcast(optarg), '".'); + write_ln('Bad kanji encoding "', stringcast(optarg), '".'); end; end; {Else it was a flag; |getopt| has already done the assignment.} diff --git a/Build/source/texk/web2c/ptexdir/ppltotf.ch b/Build/source/texk/web2c/ptexdir/ppltotf.ch index c6480da3387..da930c7ad22 100644 --- a/Build/source/texk/web2c/ptexdir/ppltotf.ch +++ b/Build/source/texk/web2c/ptexdir/ppltotf.ch @@ -13,14 +13,14 @@ @x [2] l.69 - pTeX: @d banner=='This is PLtoTF, Version 3.5' {printed when the program starts} @y -@d banner=='This is Nihongo PLtoTF, Version 3.5-p1.8' +@d banner=='This is pPLtoTF, Version 3.5-p1.8' {printed when the program starts} @z @x parse_arguments; @y - init_default_kanji; + init_kanji; parse_arguments; @z @@ -28,9 +28,7 @@ print_ln (version_string); @y print_ln (version_string); - print ('process kanji code is '); - fputs(get_enc_string, stdout); - print_ln ('.'); + print_ln ('process kanji code is ', conststringcast(get_enc_string), '.'); @z @x [18] l.495 - pTeX: @@ -355,23 +353,6 @@ const n_options = 3; {Pascal won't count array lengths for us.} @y const n_options = 5; {Pascal won't count array lengths for us.} @z -@x -var @!long_options: array[0..n_options] of getopt_struct; - @!getopt_return_val: integer; - @!option_index: c_int_type; - @!current_option: 0..n_options; -begin - @<Initialize the option variables@>; -@y -var @!long_options: array[0..n_options] of getopt_struct; - @!getopt_return_val: integer; - @!option_index: c_int_type; - @!current_option: 0..n_options; - @!version_switch: boolean; -begin - @<Initialize the option variables@>; - version_switch := false; -@z @x usage ('pltotf'); @@ -384,23 +365,23 @@ begin @y usage_help (PPLTOTF_HELP, nil); @z -@x - end else if argument_is ('version') then begin - print_version_and_exit (banner, nil, 'D.E. Knuth', nil); +@x end; {Else it was a flag; |getopt| has already done the assignment.} - until getopt_return_val = -1; @y - end else if argument_is ('version') then begin - version_switch := true; - end else if argument_is ('kanji') then begin - @<Set process kanji code@>; + if (not set_enc_string(optarg,optarg)) then + print_ln('Bad kanji encoding "', stringcast(optarg), '".'); end; {Else it was a flag; |getopt| has already done the assignment.} - until getopt_return_val = -1; - if (version_switch) then - print_version_and_exit (banner, nil, 'D.E. Knuth', nil); +@z + +@x + write_ln (stderr, 'pltotf: Need one or two file arguments.'); + usage ('pltotf'); +@y + write_ln (stderr, 'ppltotf: Need one or two file arguments.'); + usage ('ppltotf'); @z @x @@ -697,10 +678,10 @@ for i:=0 to 3 do end; end; @# -function valid_jis_code(jis:integer):boolean; +function valid_jis_code(cx:integer):boolean; var @!first_byte,@!second_byte:integer; { jis code bytes } begin valid_jis_code:=true; -first_byte:=jis div @'400; second_byte:=jis mod @'400; +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; @@ -722,7 +703,7 @@ function index_to_jis(ix:integer):integer; 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) + index_to_jis:=((ix+7*94) div 94 +@"21)*@'400+((ix+7*94) mod 94 +@"21); end; @# function get_kanji:integer; {get kanji character code} @@ -753,9 +734,5 @@ else jis_code:=-1; get_kanji:=jis_code; end; -@ @<Set process kanji code@>= - if (not set_enc_string(optarg,optarg)) then - print_ln('Bad kanjicode encoding "', stringcast(optarg), '".'); - @* Index. @z diff --git a/Build/source/texk/web2c/ptexdir/ptex.defines b/Build/source/texk/web2c/ptexdir/ptex.defines index a591012d1c2..b7680c84c7c 100644 --- a/Build/source/texk/web2c/ptexdir/ptex.defines +++ b/Build/source/texk/web2c/ptexdir/ptex.defines @@ -28,6 +28,6 @@ @define function calcpos (); @define function kcatcodekey (); -@define procedure initdefaultkanji; +@define procedure initkanji; @define var sjisterminal; diff --git a/Build/source/texk/web2c/ptexdir/ptftopl.ch b/Build/source/texk/web2c/ptexdir/ptftopl.ch index f5bd13a1a54..a4e0937c723 100644 --- a/Build/source/texk/web2c/ptexdir/ptftopl.ch +++ b/Build/source/texk/web2c/ptexdir/ptftopl.ch @@ -12,7 +12,7 @@ @x [2] l.64 - pTeX: @d banner=='This is TFtoPL, Version 3.2' {printed when the program starts} @y -@d banner=='This is Nihongo TFtoPL, Version 3.2-p1.7' +@d banner=='This is pTFtoPL, Version 3.2-p1.7' {printed when the program starts} @z @@ -32,7 +32,7 @@ var @!k:integer; {all-purpose initiallization index} @x parse_arguments; @y - init_default_kanji; + init_kanji; parse_arguments; @z @@ -40,9 +40,7 @@ var @!k:integer; {all-purpose initiallization index} print_ln (version_string); @y print_ln (version_string); - print ('process kanji code is '); - print (conststringcast(get_enc_string)); - print_ln('.'); + print_ln ('process kanji code is ', conststringcast(get_enc_string), '.'); @z @x [18.20] l.438 - pTeX: @@ -352,23 +350,6 @@ const n_options = 4; {Pascal won't count array lengths for us.} @y const n_options = 6; {Pascal won't count array lengths for us.} @z -@x -var @!long_options: array[0..n_options] of getopt_struct; - @!getopt_return_val: integer; - @!option_index: c_int_type; - @!current_option: 0..n_options; -begin - @<Initialize the option variables@>; -@y -var @!long_options: array[0..n_options] of getopt_struct; - @!getopt_return_val: integer; - @!option_index: c_int_type; - @!current_option: 0..n_options; - @!version_switch: boolean; -begin - @<Initialize the option variables@>; - version_switch := false; -@z @x usage ('tftopl'); @@ -381,24 +362,23 @@ begin @y usage_help (PTFTOPL_HELP, nil); @z + @x - end else if argument_is ('version') then begin - print_version_and_exit (banner, nil, 'D.E. Knuth', nil); + end; {Else it was a flag; |getopt| has already done the assignment.} @y - end else if argument_is ('version') then begin - version_switch := true; - end else if argument_is ('kanji') then begin - @<Set process kanji code@>; + if (not set_enc_string(optarg,optarg)) then + print_ln('Bad kanji encoding "', stringcast(optarg), '".'); + + end; {Else it was a flag; |getopt| has already done the assignment.} @z + @x - end; {Else it was a flag; |getopt| has already done the assignment.} - until getopt_return_val = -1; + print_ln ('tftopl: Need one or two file arguments.'); + usage ('tftopl'); @y - end; {Else it was a flag; |getopt| has already done the assignment.} - until getopt_return_val = -1; - if (version_switch) then - print_version_and_exit (banner, nil, 'D.E. Knuth', nil); + print_ln ('ptftopl: Need one or two file arguments.'); + usage ('ptftopl'); @z @x @@ -553,7 +533,7 @@ 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) + index_to_jis:=((ix+7 * 94) div 94 + @"21) * @'400 + ((ix+7*94) mod 94 + @"21); end; @ @<declare kanji conversion functions@>= @@ -568,11 +548,5 @@ else jis_to_index:=(first_byte-7)*94+second_byte; end -@ output kanji code. - -@ @<Set process kanji code@>= - if (not set_enc_string(optarg,optarg)) then - print_ln('Bad kanjicode encoding "', stringcast(optarg), '".'); - @* Index. @z |