4 # Copyright 2009 senju@users.sourceforge.jp
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
19 # 標準入力からファイルのリストを読み込み、
24 commentStart = re.compile(r"^\s*/\*")
25 commentEnd = re.compile(r"\*/\s*$")
27 def readToCommentStart():
28 """コメント開始まで読み込む。見つからない場合falseを返す。"""
30 if line.strip() == "":
33 if commentStart.search(line):
36 # 空行でもコメントでもない場合、ファイルの処理を終了
42 def readToCommentEnd():
43 """コメント終了まで読み込む。見つからない場合、falseを返す。"""
45 if commentEnd.search(line):
47 if commentStart.search(line):
54 for path in sys.stdin:
59 if not readToCommentStart():
60 print "%s does not have head comment." % path
64 if not readToCommentEnd():
65 print "%s does not have head comment.(No '*/')" % path
74 if line.strip() == "":
85 file = open(path, "w")