From a9d828e4b7e39ba8d59d4006b80a5685281ec6be Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 26 May 2019 06:45:16 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B=E3=82=B9=E3=82=AF?= =?UTF-8?q?=E3=83=AA=E3=83=97=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-chm.bat | 6 ++++++ help/remove-comment.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 help/remove-comment.py diff --git a/build-chm.bat b/build-chm.bat index 2b4824ff4a..472a988edc 100644 --- a/build-chm.bat +++ b/build-chm.bat @@ -11,6 +11,12 @@ set HHP_SAKURA=help\sakura\sakura.hhp set CHM_MACRO=help\macro\macro.chm set CHM_PLUGIN=help\plugin\plugin.chm set CHM_SAKURA=help\sakura\sakura.chm +set HH_SCRIPT=%~dp0help\remove-comment.py +set HH_INPUT=sakura_core\sakura.hh +set HH_OUTPUT=help\sakura\sakura.hh + +del /F "%HH_OUTPUT%" +python "%HH_SCRIPT%" "%HH_INPUT%" "%HH_OUTPUT%" || (echo error && exit /b 1) call :BuildChm %HHP_MACRO% %CHM_MACRO% || (echo error && exit /b 1) call :BuildChm %HHP_PLUGIN% %CHM_PLUGIN% || (echo error && exit /b 1) diff --git a/help/remove-comment.py b/help/remove-comment.py new file mode 100644 index 0000000000..b31a0bb3cd --- /dev/null +++ b/help/remove-comment.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +import os +import sys +import re +import codecs + +# 引数で指定した文字列から改行コードを取り除く +def clipEndOfLine(line): + return line.rstrip('\r\n') + +def clipCommet(line): + return re.sub(r'//.*', r'', line) + +# コメントを削除する +def removeComment(inFile, outFile): + with codecs.open(inFile, "r", "utf_8_sig") as fin: + with codecs.open(outFile, "w", "utf_8_sig") as fout: + for line in fin: + text = clipEndOfLine(line) + text = clipCommet(text) + fout.write(text + "\r\n") + +if __name__ == '__main__': + if len(sys.argv) < 3: + print ("usage: " + os.path.basename(sys.argv[0]) + " ") + sys.exit(1) + + if not os.path.exists(sys.argv[1]): + print (sys.argv[1] + " doesn't exist") + sys.exit(1) + + removeComment(sys.argv[1], sys.argv[2]) From fee0e37da3f52cb6f4223a323e7ce6b6b4bff58b Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 26 May 2019 06:47:52 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E3=83=91=E3=82=B9=E3=82=92=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- help/sakura/sakura.hhp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help/sakura/sakura.hhp b/help/sakura/sakura.hhp index f512639015..73df167f54 100644 --- a/help/sakura/sakura.hhp +++ b/help/sakura/sakura.hhp @@ -805,7 +805,7 @@ HLP_UR001=res\HLP_UR001.html HLP_HISTORY=res\HLP_HISTORY.html [MAP] -#include ../../sakura_core/sakura.hh +#include sakura.hh [TEXT POPUPS] Cshelp.txt From 4fbc42c46753787498cd045551e71dc9b08f708c Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 26 May 2019 08:12:53 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E7=84=A1=E8=A6=96=E3=83=AA=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f285108436..d3147e8290 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /.vs /cppcheck-*.xml /cppcheck-install.log +/help/sakura/sakura.hh /tests/build /Win32 /x64 From c5e8f4a0b9fc77b3d3b86305fca6de2b7d507456 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Mon, 27 May 2019 22:12:51 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- help/remove-comment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/help/remove-comment.py b/help/remove-comment.py index b31a0bb3cd..11839fca2c 100644 --- a/help/remove-comment.py +++ b/help/remove-comment.py @@ -8,10 +8,11 @@ def clipEndOfLine(line): return line.rstrip('\r\n') +# 行からコメントを削除する def clipCommet(line): return re.sub(r'//.*', r'', line) -# コメントを削除する +# ファイルからコメントを削除する def removeComment(inFile, outFile): with codecs.open(inFile, "r", "utf_8_sig") as fin: with codecs.open(outFile, "w", "utf_8_sig") as fout: From 9f0e05616d1a35bce5b31421d59636a03d451fe1 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Mon, 27 May 2019 22:18:14 +0900 Subject: [PATCH 5/5] =?UTF-8?q?remove-comment.py=20=E3=81=AB=E9=96=A2?= =?UTF-8?q?=E3=81=99=E3=82=8B=E8=AA=AC=E6=98=8E=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appveyor.md | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.md b/appveyor.md index 401bbf059e..a4a9775332 100644 --- a/appveyor.md +++ b/appveyor.md @@ -92,6 +92,7 @@ APPVEYOR_REPO_TAG_NAME は利用をやめて 代わりに GIT_TAG_NAME を使う - [appveyor_env.py](appveyor_env.py) - [build-gnu.bat](build-gnu.bat) : (Platform="MinGW"のみ) Makefileをビルドしてbuild-all.batの処理を終了する - [build-chm.bat](build-chm.bat) : HTML Help をビルドする + - [remove-comment.py](help/remove-comment.py) : UTF-8 でのコンパイルエラーの回避のために日本語を削除するために [sakura.hh](sakura_core/sakura.hh) から一行コメントを削除する - hhc.exe (Visual Studio 2017 に同梱) - [run-cppcheck.bat](run-cppcheck.bat) : cppcheck を実行する - cppcheck.exe