Skip to content

Commit

Permalink
update r824
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Apr 20, 2015
1 parent 43d5325 commit f5fe911
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tools/wandbox/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ help: $(TOOLS)
python iuwandbox.py -h

sample: sample.cpp $(TOOLS) Makefile
python iuwandbox.py sample.cpp -x "warning,gnu++11" -f"-Dx=hogefuga\n-O3"
python iuwandbox.py sample.cpp -x "warning,gnu++11" -f"-Dx=hogefuga\n-O3" --check_config

save: sample.cpp $(TOOLS) Makefile
python iuwandbox.py sample.cpp -s -x "warning,gnu++11" -f"-Dx=hogefuga\n-O3" -r"--iutest_color=no"
Expand Down
27 changes: 26 additions & 1 deletion tools/wandbox/iuwandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def parse_command_line():
'-v'
, '--version'
, action='version'
, version=u'%(prog)s version 1.0'
, version=u'%(prog)s version 2.0'
)
parser.add_argument(
'--list_compiler'
Expand Down Expand Up @@ -88,6 +88,11 @@ def parse_command_line():
, action='store_true'
, help = 'expand include file.'
)
parser.add_argument(
'--check_config'
, action='store_true'
, help = 'check config.'
)
parser.add_argument(
'code'
, metavar='CODE'
Expand Down Expand Up @@ -134,6 +139,14 @@ def make_code(path, encoding, expand):
file.close()
return code

#
# check config
def check_config(options):
if not find_compiler(options.compiler):
print 'Wandbox is not supported compiler [' + options.compiler + ']'
listup_compiler()
sys.exit(1)

#
# run wandbox
def run_wandbox(code, options):
Expand Down Expand Up @@ -217,6 +230,16 @@ def listup_compiler():
if d['language'] == 'C++':
print d['name'] + ' (' + d['version'] + ')'

#
# find compiler
def find_compiler(c):
w = Wandbox()
r = w.get_compiler_list()
for d in r:
if d['language'] == 'C++' and d['name'] == c:
return True
return False

#
# listup options
def listup_options(compiler):
Expand Down Expand Up @@ -263,6 +286,8 @@ def main():
elif options.permlink:
get_permlink(options.permlink, options.output)
else:
if options.check_config:
check_config(options)
run(options)

if __name__ == '__main__':
Expand Down

0 comments on commit f5fe911

Please sign in to comment.