Description:
[grader] fixed to work with free pascal git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@221 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r53:45abc6ae27d1 - - 3 files changed: 10 inserted, 7 deleted

@@ -236,48 +236,51
236 236 case __NR_ftruncate:
237 237 case __NR_fstat:
238 238 case __NR_personality:
239 239 case __NR__llseek:
240 240 case __NR_readv:
241 241 case __NR_writev:
242 242 case __NR_getresuid:
243 243 #ifdef __NR_pread64
244 244 case __NR_pread64:
245 245 case __NR_pwrite64:
246 246 #else
247 247 case __NR_pread:
248 248 case __NR_pwrite:
249 249 #endif
250 250 case __NR_ftruncate64:
251 251 case __NR_fstat64:
252 252 case __NR_fcntl:
253 253 case __NR_fcntl64:
254 254 case __NR_mmap:
255 255 case __NR_munmap:
256 256 case __NR_ioctl:
257 257 case __NR_uname:
258 258 case 252:
259 259 case 243:
260 + // added for free pascal
261 + case __NR_ugetrlimit:
262 + case __NR_readlink:
260 263 return 1;
261 264 // case __NR_time:
262 265 case __NR_alarm:
263 266 // case __NR_pause:
264 267 case __NR_signal:
265 268 case __NR_fchmod:
266 269 case __NR_sigaction:
267 270 case __NR_sgetmask:
268 271 case __NR_ssetmask:
269 272 case __NR_sigsuspend:
270 273 case __NR_sigpending:
271 274 case __NR_getrlimit:
272 275 case __NR_getrusage:
273 276 case __NR_gettimeofday:
274 277 case __NR_select:
275 278 case __NR_readdir:
276 279 case __NR_setitimer:
277 280 case __NR_getitimer:
278 281 case __NR_sigreturn:
279 282 case __NR_mprotect:
280 283 case __NR_sigprocmask:
281 284 case __NR_getdents:
282 285 case __NR_getdents64:
283 286 case __NR__newselect:
@@ -1,49 +1,49
1 1 #!/bin/sh
2 2
3 3 ##############################
4 4 #
5 5 # Standard Compile Script
6 6 #
7 7 # Supported compilers:
8 - # gcc, g++, and gpc.
8 + # gcc, g++, and fpc.
9 9 #
10 10 ##############################
11 11
12 12 talk ()
13 13 {
14 14 if [ "$TALKATIVE" != "" ]; then
15 15 echo "$1"
16 16 fi
17 17 }
18 18
19 19 export C_COMPILER=/usr/bin/gcc
20 20 export CPLUSPLUS_COMPILER=/usr/bin/g++
21 - export PASCAL_COMPILER=/usr/bin/gpc
21 + export PASCAL_COMPILER=/usr/bin/fpc
22 22
23 23 export C_OPTIONS="-O2 -s -static -lm -Wall"
24 24 export CPLUSPLUS_OPTIONS="-O2 -s -static -lm -Wall"
25 - export PASCAL_OPTIONS="-O2 -XS -lm -Wall"
25 + export PASCAL_OPTIONS="-O1 -XS"
26 26
27 27 # Check for the correct number of arguments. Otherwise, print usage.
28 28 if [ $# -eq 0 -o $# -gt 4 ]
29 29 then
30 30 echo "Usage: $0 <language> [<source-file>] [<output-file>] [<message-file>]"
31 31 echo
32 32 echo "<source-file> is defaulted to \"source\"."
33 33 echo "<output-file> is defaulted to \"a.out\"."
34 34 echo "<message-file> is defaulted to \"compiler_message\"."
35 35 echo
36 36 exit 127
37 37 fi
38 38
39 39 # Retrieve the arguments.
40 40 if [ $# -ge 1 ]
41 41 then
42 42 export PROG_LANG=$1
43 43 talk "programming language: ${PROG_LANG}"
44 44 fi
45 45
46 46 if [ $# -ge 2 ]
47 47 then
48 48 export SOURCE_FILE=$2
49 49 else
@@ -65,42 +65,42
65 65 else
66 66 export MESSAGE_FILE=compiler_message
67 67 fi
68 68 talk " message file: $MESSAGE_FILE"
69 69
70 70 # Remove any remaining output files or message files.
71 71 rm -Rf $OUTPUT_FILE
72 72 rm -Rf $MESSAGE_FILE
73 73
74 74 # Check if the source file exists before attempt compiling.
75 75 if [ ! -f $SOURCE_FILE ]
76 76 then
77 77 talk "ERROR: The source file does not exist!"
78 78 echo "ERROR: The source file did not exist." > $MESSAGE_FILE
79 79 exit 127
80 80 fi
81 81
82 82 # Compile.
83 83 if [ $PROG_LANG = "c" ]
84 84 then
85 85 $C_COMPILER $SOURCE_FILE -o $OUTPUT_FILE $C_OPTIONS 2>$MESSAGE_FILE
86 86 elif [ $PROG_LANG = "c++" ]
87 87 then
88 88 $CPLUSPLUS_COMPILER $SOURCE_FILE -o $OUTPUT_FILE $CPLUSPLUS_OPTIONS 2>$MESSAGE_FILE
89 - elif [ $PROG_LANG = "pascal" ]
89 + elif [ $PROG_LANG = "pas" ]
90 90 then
91 - $PASCAL_COMPILER $SOURCE_FILE -o $OUTPUT_FILE $PASCAL_OPTIONS 2>$MESSAGE_FILE
91 + $PASCAL_COMPILER $SOURCE_FILE -o$OUTPUT_FILE $PASCAL_OPTIONS >$MESSAGE_FILE
92 92 else
93 93 talk "ERROR: Invalid language specified!"
94 94 echo "ERROR: Invalid language specified!" > $MESSAGE_FILE
95 95 exit 127
96 96 fi
97 97
98 98 # Report success or failure.
99 99 if [ -f $OUTPUT_FILE ]
100 100 then
101 101 talk "Compilation was successful!"
102 102 else
103 103 talk "ERROR: Something was wrong during the compilation!"
104 104 talk "Dumping compiler message:"
105 105 #cat $MESSAGE_FILE
106 106 fi
@@ -15,50 +15,50
15 15 problem_home = ENV['PROBLEM_HOME']
16 16
17 17 def execute(command, error_message="")
18 18 if not system(command)
19 19 msg = "ERROR: #{error_message}"
20 20 log msg
21 21 raise msg
22 22 end
23 23 end
24 24
25 25 # ARGV[0] --- language
26 26 # ARGV[1] --- program source file
27 27 # ARGV[2] --- test result directory
28 28 # ARGV[3] --- sandbox directory
29 29
30 30 if ARGV.length < 2 || ARGV.length > 4
31 31 puts "Usage: judge <language> <program-source> [<test-result-directory>] [<sandbox-directory>]"
32 32 puts " <sandbox-directory> is defaulted to ./sandbox"
33 33 puts " <test-result-directory> is defaulted to ./test-result"
34 34 puts "WARNING: The judge script will forcefully create the (implicitly and explicitly) specified directories and remove anything inside it."
35 35 exit(127)
36 36 end
37 37
38 38 language = ARGV[0]
39 - if language != "c" && language != "c++" && language != "pascal"
40 - log "You specified a language that is not supported."
39 + if language != "c" && language != "c++" && language != "pas"
40 + log "You specified a language that is not supported: #{language}."
41 41 exit(127)
42 42 end
43 43
44 44 source_file = ARGV[1]
45 45 if File.exist?(source_file) == false
46 46 log "The source file does not exist."
47 47 exit(127)
48 48 end
49 49
50 50 log "Making test result and sandbox directories..."
51 51
52 52 current_dir = `pwd`
53 53 current_dir.strip!
54 54
55 55 if ARGV.length >= 3
56 56 test_result_dir = ARGV[2]
57 57 else
58 58 test_result_dir = "#{current_dir}/test-result"
59 59 end
60 60 log "Test result directory: #{test_result_dir}"
61 61 system("rm -Rf #{test_result_dir}")
62 62 execute("mkdir #{test_result_dir}", "Cannot make directory #{test_result_dir}.")
63 63
64 64 if ARGV.length >= 4
You need to be logged in to leave comments. Login now