Skip to content

Commit

Permalink
unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
aminophen committed Jan 29, 2022
1 parent 3b7dcf4 commit fb1d536
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions source/texk/web2c/ptexdir/ptex-base.ch
Original file line number Diff line number Diff line change
Expand Up @@ -2866,19 +2866,14 @@ if #<>0 then
@d append_to_name_hex(#)==if (#)<10 then append_to_name_char((#)+"0") else append_to_name_char((#)-10+"a")
@d append_to_name(#)==begin
if (#)>=@"100 then begin
c:=(#)-@"100;
c:=#;
if (c>=@"80) and (not isinternalUPTEX) and isterminalUTF8 then begin
append_to_name_char("^");
append_to_name_char("^");
append_to_name_hex(c div 16);
append_to_name_hex(c mod 16);
end else if not (c="""") then
append_to_name_char(c);
end else begin
c:=#;
if (c>=@"80) and (not isinternalUPTEX) and isterminalUTF8 then begin
append_to_name_char("^");
append_to_name_char("^");
append_to_name_hex(c div 16);
append_to_name_hex(c mod 16);
end else if not (c="""") then
append_to_name_char(c);
end
end
@z
Expand Down

5 comments on commit fb1d536

@h20y6m
Copy link
Collaborator

@h20y6m h20y6m commented on fb1d536 Jan 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これだと和文文字まで ^^ 形式になって日本語ファイル名が開けなくなります…

@aminophen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

うちの macOS ではコンパイラ警告 #81 (comment) が3回出て always false だと言われるのですが,必要なのですね。元々の型宣言がよくない?

@h20y6m
Copy link
Collaborator

@h20y6m h20y6m commented on fb1d536 Jan 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pack_buffered_nameappend_to_name が使われるときの引数が unsigned char のようですね。
(ここには和文文字が入ることはない?)

@h-kitagawa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あらら,たしかに私の環境でも同様のコンパイラ警告がでたのでいらないなと思ったのですが,やっぱり日本語ファイル名が開けないですね.revert しておきます.

@aminophen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

append_to_name 関数は全部で6回呼ばれて

  • pack_file_name から呼ばれる3回: packed_ASCII_codeunsigned short
  • pack_buffered_name から呼ばれる3回: ASCII_codeunsigned char

ということなのですね。前者は引数が str_pool だから和文文字も入りますが,後者のうち1回は引数が buffer で 0--255 しかないはず(もう一つの buffer2 に和文文字フラグを示す 0 か 1 が格納される)ですし,残り2回は TeX のフォーマット名だから和文文字を使うことはないでしょう。

Please sign in to comment.