• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン2d40bc03ff78e25dd514c2e4078ea9900ea10b8f (tree)
日時2012-12-26 10:24:23
作者Shinya TAKEBAYASHI <omoikanenomikoto@gmai...>
コミッターShinya TAKEBAYASHI

ログメッセージ

Merged general.py

変更サマリ

差分

--- a/hl.py
+++ b/hl.py
@@ -1,7 +1,9 @@
11 #!/usr/bin/env python
22
33 import sys, os, re, signal
4-from libs import term, config, general
4+from libs import term, config
5+
6+version_number = "$Id$"
57
68 include_path = []
79
@@ -9,14 +11,17 @@ def generate_code():
911 code = '#include <stdio.h> \n int main(int argc, char **argv){return 0;}\n'
1012 open('tmp.c', 'w').write(code)
1113
14+
1215 def ulink():
1316 os.remove('tmp.c')
1417 os.remove('a.out')
1518
19+
1620 def rungcc():
1721 L = ['gcc', '-v', 'tmp.c', '-o', 'a.out']
1822 os.spawnlp(os.P_WAIT, 'gcc', L)
1923
24+
2025 def findheader2(target, rootdir):
2126 path = None
2227 for root, dirs, files in os.walk(rootdir):
@@ -25,6 +30,7 @@ def findheader2(target, rootdir):
2530 break
2631 return path
2732
33+
2834 def findheader(filename):
2935 pattern = re.compile("^#.*include [<\"].*[>\"]")
3036 delimiter = re.compile('[<>"]')
@@ -59,21 +65,22 @@ def findheader(filename):
5965
6066 print('')
6167
68+
6269 def sigint(num, frame):
6370 print('process interrupted.')
6471 sys.exit(2)
6572
66-if __name__ == '__main__':
67- signal.signal(signal.SIGINT, sigint)
6873
69- if len(sys.argv) == 1:
70- general.print_usage()
71- sys.exit(2)
74+def print_usage():
75+ print_version()
76+ print("usage: %s [target]..." % (sys.argv[0]))
7277
73- term.color_mode = True
7478
75- include_path = config.get_include_dir()
79+def print_version():
80+ print("hl version %s" % (version_number[5:-2]))
7681
82+
83+def print_header():
7784 print('-' * 40)
7885 print("*Processing " + term.green("%d " % (len(sys.argv) - 1)) + "file(s).")
7986 print("*header search dirs: ")
@@ -82,5 +89,18 @@ if __name__ == '__main__':
8289 print('-' * 40)
8390 print('')
8491
92+
93+if __name__ == '__main__':
94+ signal.signal(signal.SIGINT, sigint)
95+
96+ if len(sys.argv) == 1:
97+ general.print_usage()
98+ sys.exit(2)
99+
100+ term.color_mode = True
101+
102+ include_path = config.get_include_dir()
103+ print_header()
104+
85105 for target in sys.argv[1:]:
86106 findheader(target)
--- a/libs/general.py
+++ /dev/null
@@ -1,11 +0,0 @@
1-import sys
2-
3-version_number = "$Id$"
4-
5-def print_usage():
6- print_version()
7- print("usage: %s [target]..." % (sys.argv[0]))
8-
9-
10-def print_version():
11- print("hl version %s" % (version_number[5:-2]))