]> mj.ucw.cz Git - eval.git/commitdiff
Replaced FREE_PASCAL_RTE by a generic EXIT_CODE_HOOK.
authorMartin Mares <mj@ucw.cz>
Wed, 19 Mar 2008 12:39:40 +0000 (13:39 +0100)
committerMartin Mares <mj@ucw.cz>
Wed, 19 Mar 2008 12:39:40 +0000 (13:39 +0100)
bin/lib
config

diff --git a/bin/lib b/bin/lib
index f0476f2ec699acbdf8f77cc47feb4211a7822a89..16afaebe428b02feec61afb9f0c831d989e57bdb 100644 (file)
--- a/bin/lib
+++ b/bin/lib
@@ -244,20 +244,13 @@ function test-result
                [ -z "$SG" ] || M="$M (SIG$SG)"
        fi
 
-       # Translate Free Pascal runtime errors to readable strings
+       # Translate runtime errors to readable strings
        RE=${M#Exited with error status }
-       if [ "$FREE_PASCAL_RTE" == 1 -a "$RE" != "$M" ] ; then
-               N="Runtime error $RE"
-               case "$RE" in
-                       200)    M="$N: Division by zero" ;;
-                       201)    M="$N: Range check error" ;;
-                       202)    M="$N: Stack overflow" ;;
-                       203)    M="$N: Heap overflow" ;;
-                       205)    M="$N: Floating point overflow" ;;
-                       215)    M="$N: Arithmetic overflow" ;;
-                       216)    M="$N: Segmentation fault" ;;
-                       ???)    M="$N" ;;
-               esac
+       if [ -n "$EXIT_CODE_HOOK" -a "$RE" != "$M" ] ; then
+               NEWMSG=`$EXIT_CODE_HOOK $RE`
+               if [ -n "$NEWMSG" ] ; then
+                       M="Runtime error $RE: $NEWMSG"
+               fi
        fi
 
        echo "Verdict: $M"
@@ -473,3 +466,18 @@ function open-locate
        fi
        [ -f "$SDIR/$SRCN" ] || fatal "Output file $SRCN not found"
 }
+
+# Translation of runtime error codes for various compilers
+
+function fpc-exit-code
+{
+       case "$1" in
+               200)    echo -n "Division by zero" ;;
+               201)    echo -n "Range check error" ;;
+               202)    echo -n "Stack overflow" ;;
+               203)    echo -n "Heap overflow" ;;
+               205)    echo -n "Floating point overflow" ;;
+               215)    echo -n "Arithmetic overflow" ;;
+               216)    echo -n "Segmentation fault" ;;
+       esac
+}
diff --git a/config b/config
index 0297a06a5dd734f38743faa8cd39e9d46f1aacb9..052e9991b16c46cb1cd78c1409e6a9a34d06e28c 100644 (file)
--- a/config
+++ b/config
@@ -50,6 +50,10 @@ COMP_SANDBOX_OPTS='-m262144 -w60 -e -i/dev/null'
 # Sandbox initialization commands for compilation
 COMP_SANDBOX_INIT=
 
+# Translation of runtime errors: a function, which receives the exit code as an argument and
+# if it is recognized as a runtime error code, it prints its name to the standard output.
+EXIT_CODE_HOOK=
+
 ## Settings for individual languages
 
 # C
@@ -66,9 +70,8 @@ EXTRA_CXXFLAGS=
 EXT_p_COMP='/usr/bin/fpc -Ci -Cr -Ct -g -O2 -Sg -o$EXE $EXTRA_PFLAGS $SRC'
 EXT_pas_COMP="$EXT_p_COMP"
 EXTRA_PFLAGS=
-
-# Translate FreePascal exit codes to names of well-known runtime errors
-FREE_PASCAL_RTE=1
+EXT_p_EXIT_CODE_HOOK=fpc-exit-code
+EXT_pas_EXIT_CODE_HOOK=fpc-exit-code
 
 ### Per-task configuration variables (default values, override in per-task config)