Skip to content

Commit f04df89

Browse files
committed
Added support for Pascal (What is Pascal? I don't know.)
1 parent f275413 commit f04df89

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

pyjudge/compiler.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,18 @@ def __init__(self, source_path):
251251
@wrap_compiler
252252
class CLikeCompiler(Compiler):
253253
""" C / C++ / C-Style compiler, invokes GCC or G++, used this as an
254-
abbreviation for fewer code lines. """
254+
abbreviation for fewer code lines.
255+
This can also be used for languages that are compiled to machine code which
256+
can be executed directly. """
255257

256258
def __init__(self, source_path, language_type):
257259
Compiler.__init__(self, source_path)
258260
if language_type == 'C':
259261
self.__c_args = config.get_config('gcc_args')
260262
elif language_type == 'C++':
261263
self.__c_args = config.get_config('g++_args')
264+
elif language_type == 'Pascal':
265+
self.__c_args = config.get_config('fpc_args')
262266
else:
263267
raise AttributeError('Unknown C/Style language type')
264268
return
@@ -350,7 +354,10 @@ def close(self):
350354
pass
351355

352356
@wrap_compiler
353-
class PascalCompiler(Compiler):
357+
class PascalCompiler(CLikeCompiler):
358+
""" Pascal Compiler, wraps CLikeCompiler. """
359+
def __init__(self, source_path):
360+
return CLikeCompiler.__init__(self, source_path, 'Pascal')
354361
pass
355362

356363
@wrap_compiler
@@ -377,6 +384,7 @@ def __init__(self, source_path, source_type=None):
377384
r'.py$': 'Python3',
378385
r'.py3$': 'Python3', # Non-standard
379386
r'.py2$': 'Python2', # Non-standard
387+
r'.pas$': 'Pascal',
380388
r'.java$': 'Java',
381389
r'.exe$': 'Executable', # Windows executable
382390
r'^[~.]$': 'Executable', # We treat them as executable

pyjudge/config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
'max_output': 64*1024*1024, # 64 MB Maximum allowed output
2121
'table_max_lines': 20,
2222
'table_max_linewidth': 256,
23-
'gcc_args': ['C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/gcc.exe', '-O0', '-g0', '-Wall', '-o', '{output_file}', '{source_file}'],
24-
'g++_args': ['C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/g++.exe', '-O0', '-g0', '-Wall', '-o', '{output_file}', '{source_file}'],
25-
'fpc_args': None,
26-
'python2_args': ['C:/Programs/Python2/python2.exe', '{source_file}'],
27-
'python3_args': ['C:/Programs/Python3/python3.exe', '{source_file}'],
28-
'javac_args': None,
23+
'gcc_args': ['gcc', '-O0', '-g0', '-Wall', '-o', '{output_file}', '{source_file}'],
24+
'g++_args': ['g++', '-O0', '-g0', '-Wall', '-o', '{output_file}', '{source_file}'],
25+
'fpc_args': ['fpc', '{source_file}', '-o{output_file}'],
26+
'python2_args': ['python2', '{source_file}'],
27+
'python3_args': ['python3', '{source_file}'],
28+
'javac_args': ['javac'],
2929
}
3030

3131
def get_config(idx):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def readme():
77

88
setup(
99
name = 'pyjudge',
10-
version = '0.1.78',
10+
version = '0.1.79',
1111
description = 'OI programs Judger in Python',
1212
long_description = 'Judge OI programs easily with pyJudge.',
1313
classifiers = [

0 commit comments

Comments
 (0)