--- /dev/null
+/*
+ Copyright 2009 senju@users.sourceforge.jp
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
--- /dev/null
+#! /usr/bin/python
+# coding:utf-8
+
+# Copyright 2009 senju@users.sourceforge.jp
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# 標準入力からファイルのリストを読み込み、
+# ファイルの先頭のコメントを削除する。
+
+import sys,re
+
+commentStart = re.compile(r"^\s*/\*")
+commentEnd = re.compile(r"\*/\s*$")
+
+def readToCommentStart():
+ """コメント開始まで読み込む。見つからない場合falseを返す。"""
+ for line in file:
+ if line.strip() == "":
+ # 空行よみとばし
+ continue
+ if commentStart.search(line):
+ return True
+ else:
+ # 空行でもコメントでもない場合、ファイルの処理を終了
+ return False
+ # すべて空行だった場合
+ return False
+
+
+def readToCommentEnd():
+ """コメント終了まで読み込む。見つからない場合、falseを返す。"""
+ for line in file:
+ if commentEnd.search(line):
+ return True
+ if commentStart.search(line):
+ # コメント開始が見つかった場合、多分異常
+ return False
+
+ # コメントの終了が見つからない場合
+ return False
+
+for path in sys.stdin:
+ path = path.strip()
+ file = open(path)
+
+ # コメント開始まで読み飛ばし
+ if not readToCommentStart():
+ print "%s does not have head comment." % path
+ file.close()
+ continue
+ # コメント終了まで読み飛ばし
+ if not readToCommentEnd():
+ print "%s does not have head comment.(No '*/')" % path
+ file.close()
+ continue
+
+ buf = ""
+ # ソースを読み込む
+ for line in file:
+ buf += line
+ # ソースを書き込む
+ file.close()
+ file = open(path, "w")
+ file.write(buf)
+ file.close()
+
+None
--- /dev/null
+#!/usr/bin/python
+# coding:utf8
+
+# Copyright 2009 senju@users.sourceforge.jp
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# 標準入力からファイルリストの全てのファイルに、
+# 引数に指定されたライセンスファイルの内容を挿入する。
+
+import sys
+
+# ライセンス読み込み
+licenseFile = open(sys.argv[1])
+license = licenseFile.read()
+
+for path in sys.stdin:
+ path = path.strip()
+ file = open(path)
+
+ # ファイル読み込み
+ source = file.read()
+ file.close()
+
+ # 書き込み
+ file = open(path, "w")
+ file.write(license)
+ file.write(source)
+
+None