]> mj.ucw.cz Git - moe.git/commitdiff
Moved `public' to MO-P stuff, too. I will decide later where to put it.
authorMartin Mares <mj@ucw.cz>
Thu, 15 May 2008 10:56:38 +0000 (12:56 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 15 May 2008 10:56:38 +0000 (12:56 +0200)
mop/public/COPY [new file with mode: 0644]
mop/public/check [new file with mode: 0755]
mop/public/compile [new file with mode: 0755]
mop/public/status [new file with mode: 0755]
mop/public/submit [new file with mode: 0755]
public/COPY [deleted file]
public/check [deleted file]
public/compile [deleted file]
public/status [deleted file]
public/submit [deleted file]

diff --git a/mop/public/COPY b/mop/public/COPY
new file mode 100644 (file)
index 0000000..82d9bb8
--- /dev/null
@@ -0,0 +1,3 @@
+bin/lib
+bin/box
+bin/iwrapper
diff --git a/mop/public/check b/mop/public/check
new file mode 100755 (executable)
index 0000000..6a8012f
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+# The Evaluator -- Public Checking Script
+# (c) 2001--2008 Martin Mares <mj@ucw.cz>
+
+set -e
+[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
+. $MO_ROOT/bin/lib
+. $MO_ROOT/config
+
+function usage
+{
+       die "Usage: check [-s <source-file>] <problem> [<test-number>]"
+}
+
+SRCFILE=
+while getopts "s:" opt ; do
+       case $opt in
+               s)      SRCFILE="$OPTARG"
+                       ;;
+               *)      usage
+                       ;;
+       esac
+done
+shift $(($OPTIND-1))
+[ -n "$1" ] || usage
+PROBLEM=$1
+TEST=
+shift
+if [ -n "$1" ] ; then
+       TEST="$1"
+       shift
+fi
+[ -z "$1" ] || usage
+
+public-setup
+. $PDIR/config
+
+function test-verdict
+{
+       pend "$2"
+       if [ $1 == 0 ] ; then
+               exit 1
+       else
+               exit 0
+       fi
+}
+
+if [ $TASK_TYPE == open-data ] ; then
+       [ -n "$TEST" ] || die "You need to specify test number for open data problems."
+       pstart "Checking $TEST: "
+       test-config
+       open-locate "$SRCFILE"
+       try-ln "$SDIR/$SRCN" $TDIR/$TEST.out
+       syntax-check
+       test-result $POINTS_PER_TEST OK
+else
+       [ -z "$TEST" ] || die "Test number should be given only for open data problems."
+       locate-source "$SRCFILE"
+       compile
+       RC=0
+       for TEST in $SAMPLE_TESTS ; do
+               (
+               pstart "Checking on sample input $TEST: "
+               test-config
+               test-run
+               syntax-check
+               output-check
+               ) || RC=1
+       done
+       exit $RC
+fi
diff --git a/mop/public/compile b/mop/public/compile
new file mode 100755 (executable)
index 0000000..f96528f
--- /dev/null
@@ -0,0 +1,34 @@
+# The Evaluator -- Public Compilation Script
+# (c) 2001 Martin Mares <mj@ucw.cz>
+
+set -e
+[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
+. $MO_ROOT/bin/lib
+. $MO_ROOT/config
+
+[ -n "$1" ] || die "Usage: compile (<problem> | <file> [<options>])"
+if [ "${1%%.*}" == "$1" ] ; then
+       # Compiling problem
+       PROBLEM=$1
+       public-setup
+       . $PDIR/config
+       locate-source
+       if compile ; then
+               mv $TDIR/$PROBLEM .
+       else
+               echo >&2
+               sed <check-log >&2 '1,/^Compiler output:/d;/^Compiler output files:/,$d;/^Exited /d'
+       fi
+else
+       SRC=$1
+       [ -f $SRC ] || die "$SRC doesn't exist"
+       EXE=${1%%.*}
+       SRCEXT=${1/*./}
+       shift
+       EXTRA_CFLAGS="$@"
+       CCMD=COMP_$SRCEXT
+       [ -n "${!CCMD}" ] || die "Don't know how to compile $SRC"
+       CCMD="`eval echo ${!CCMD}`"
+       echo "$CCMD"
+       $CCMD
+fi
diff --git a/mop/public/status b/mop/public/status
new file mode 100755 (executable)
index 0000000..9e795dc
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+# The Evaluator -- Public Status Script
+# (c) 2004 Martin Mares <mj@ucw.cz>
+
+set -e
+[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
+. $MO_ROOT/bin/lib
+. $MO_ROOT/config
+
+[ -z "$1" ] || die "Usage: status"
+
+echo -e "Submitted tasks:\n"
+
+if [ -n "$REMOTE_SUBMIT" ] ; then
+       exec $MO_ROOT/bin/remote-status
+fi
+
+for PROBLEM in `cd $MO_ROOT/problems/ ; echo *` ; do
+       (
+       PDIR=$MO_ROOT/problems/$PROBLEM
+       SUBDIR=~/.submit/$PROBLEM
+       [ -f $PDIR/config ] || exit 0
+       echo -n "$PROBLEM: "
+       . $PDIR/config
+       if [ -d $SUBDIR ] ; then
+               if [ $TASK_TYPE == open-data ] ; then
+                       for X in $TESTS ; do
+                               [ -f $SUBDIR/$X.out ] && echo -n "$X " || echo -n "- "
+                       done
+                       echo
+               else
+                       C=0
+                       for X in $EXTENSIONS ; do
+                               if [ -f $SUBDIR/$PROBLEM.$X ] ; then
+                                       echo -n `basename $SUBDIR/$PROBLEM.$X`
+                                       C=$(($C+1))
+                               fi
+                       done
+                       if [ $C == 0 ] ; then
+                               echo ---
+                       elif [ $C == 1 ] ; then
+                               echo
+                       else
+                               echo "INCONSISTENT (you probably modified $SUBDIR manually)"
+                       fi
+               fi
+       else
+               echo ---
+       fi
+       )
+done
diff --git a/mop/public/submit b/mop/public/submit
new file mode 100755 (executable)
index 0000000..f597ee4
--- /dev/null
@@ -0,0 +1,105 @@
+#!/bin/bash
+# The Evaluator -- Public Submit Script
+# (c) 2001--2007 Martin Mares <mj@ucw.cz>
+
+set -e
+[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
+. $MO_ROOT/bin/lib
+. $MO_ROOT/config
+
+function usage
+{
+       die "Usage: submit [--force] [-s <source-file>] <problem> [<test-number>]"
+}
+
+FORCE=0
+if [ "$1" = --force ] ; then
+       FORCE=1
+       shift
+fi
+[ -n "$1" -a "$1" != "--help" ] || usage
+SRCFILE=
+while getopts "s:" opt ; do
+       case $opt in
+               s)      SRCFILE="$OPTARG"
+                       ;;
+               *)      usage
+                       ;;
+       esac
+done
+shift $(($OPTIND-1))
+[ -n "$1" ] || usage
+PROBLEM=$1
+PART=
+shift
+if [ -n "$1" ] ; then
+       PART="$1"
+       shift
+fi
+[ -z "$1" ] || usage
+public-setup
+. $PDIR/config
+
+function test-verdict
+{
+       pend "$2"
+       [ $1 == 0 ] && exit 1 || exit 0
+}
+
+FAILED=0
+if [ $TASK_TYPE == open-data ] ; then
+       [ -n "$PART" ] || die "You need to specify test number for open data problems."
+       TEST=$PART
+       pstart "Test case $TEST: "
+       open-locate "$SRCFILE"
+       (
+               [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
+               try-ln "$SDIR/$SRCN" $TDIR/$TEST.out
+               syntax-check
+               test-result $POINTS_PER_TEST OK
+       ) || FAILED=1
+else
+       [ -z "$PART" ] || die "Test number should be given only for open data problems."
+       locate-source "$SRCFILE"
+       compile
+       for TEST in $SAMPLE_TESTS ; do
+               (
+               pstart "Checking on sample input $TEST: "
+               [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
+               test-run
+               syntax-check
+               output-check
+               die "How could I get there? It's a buuuuug!"
+               ) || FAILED=$(($FAILED+1))
+       done
+fi
+
+if [ $FAILED != 0 ] ; then
+       if [ $FORCE != 0 ] ; then
+               echo "Submit forced."
+               pend "TESTS FAILED, but --force given, so submitting anyway."
+       else
+               pend "TESTS FAILED. Nothing has been submitted!"
+               pend "Use submit --force if you really want to submit an obviously WRONG solution."
+               exit 1
+       fi
+fi
+
+if [ -n "$REMOTE_SUBMIT" ] ; then
+       pstart "Submitting to the server... "
+       $MO_ROOT/bin/remote-submit $PROBLEM $PART "$SDIR/$SRCN"
+       pend "OK"
+       exit 0
+fi
+
+pstart "Submitting... "
+mkdir -p ~/.submit
+if [ $TASK_TYPE == open-data ] ; then
+       mkdir -p ~/.submit/$PROBLEM
+       cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/$PART.out
+else
+       rm -rf ~/.submit/$PROBLEM
+       mkdir -p ~/.submit/$PROBLEM
+       cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/
+fi
+pend "OK"
diff --git a/public/COPY b/public/COPY
deleted file mode 100644 (file)
index 82d9bb8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/lib
-bin/box
-bin/iwrapper
diff --git a/public/check b/public/check
deleted file mode 100755 (executable)
index 6a8012f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-# The Evaluator -- Public Checking Script
-# (c) 2001--2008 Martin Mares <mj@ucw.cz>
-
-set -e
-[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
-. $MO_ROOT/bin/lib
-. $MO_ROOT/config
-
-function usage
-{
-       die "Usage: check [-s <source-file>] <problem> [<test-number>]"
-}
-
-SRCFILE=
-while getopts "s:" opt ; do
-       case $opt in
-               s)      SRCFILE="$OPTARG"
-                       ;;
-               *)      usage
-                       ;;
-       esac
-done
-shift $(($OPTIND-1))
-[ -n "$1" ] || usage
-PROBLEM=$1
-TEST=
-shift
-if [ -n "$1" ] ; then
-       TEST="$1"
-       shift
-fi
-[ -z "$1" ] || usage
-
-public-setup
-. $PDIR/config
-
-function test-verdict
-{
-       pend "$2"
-       if [ $1 == 0 ] ; then
-               exit 1
-       else
-               exit 0
-       fi
-}
-
-if [ $TASK_TYPE == open-data ] ; then
-       [ -n "$TEST" ] || die "You need to specify test number for open data problems."
-       pstart "Checking $TEST: "
-       test-config
-       open-locate "$SRCFILE"
-       try-ln "$SDIR/$SRCN" $TDIR/$TEST.out
-       syntax-check
-       test-result $POINTS_PER_TEST OK
-else
-       [ -z "$TEST" ] || die "Test number should be given only for open data problems."
-       locate-source "$SRCFILE"
-       compile
-       RC=0
-       for TEST in $SAMPLE_TESTS ; do
-               (
-               pstart "Checking on sample input $TEST: "
-               test-config
-               test-run
-               syntax-check
-               output-check
-               ) || RC=1
-       done
-       exit $RC
-fi
diff --git a/public/compile b/public/compile
deleted file mode 100755 (executable)
index f96528f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# The Evaluator -- Public Compilation Script
-# (c) 2001 Martin Mares <mj@ucw.cz>
-
-set -e
-[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
-. $MO_ROOT/bin/lib
-. $MO_ROOT/config
-
-[ -n "$1" ] || die "Usage: compile (<problem> | <file> [<options>])"
-if [ "${1%%.*}" == "$1" ] ; then
-       # Compiling problem
-       PROBLEM=$1
-       public-setup
-       . $PDIR/config
-       locate-source
-       if compile ; then
-               mv $TDIR/$PROBLEM .
-       else
-               echo >&2
-               sed <check-log >&2 '1,/^Compiler output:/d;/^Compiler output files:/,$d;/^Exited /d'
-       fi
-else
-       SRC=$1
-       [ -f $SRC ] || die "$SRC doesn't exist"
-       EXE=${1%%.*}
-       SRCEXT=${1/*./}
-       shift
-       EXTRA_CFLAGS="$@"
-       CCMD=COMP_$SRCEXT
-       [ -n "${!CCMD}" ] || die "Don't know how to compile $SRC"
-       CCMD="`eval echo ${!CCMD}`"
-       echo "$CCMD"
-       $CCMD
-fi
diff --git a/public/status b/public/status
deleted file mode 100755 (executable)
index 9e795dc..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-# The Evaluator -- Public Status Script
-# (c) 2004 Martin Mares <mj@ucw.cz>
-
-set -e
-[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
-. $MO_ROOT/bin/lib
-. $MO_ROOT/config
-
-[ -z "$1" ] || die "Usage: status"
-
-echo -e "Submitted tasks:\n"
-
-if [ -n "$REMOTE_SUBMIT" ] ; then
-       exec $MO_ROOT/bin/remote-status
-fi
-
-for PROBLEM in `cd $MO_ROOT/problems/ ; echo *` ; do
-       (
-       PDIR=$MO_ROOT/problems/$PROBLEM
-       SUBDIR=~/.submit/$PROBLEM
-       [ -f $PDIR/config ] || exit 0
-       echo -n "$PROBLEM: "
-       . $PDIR/config
-       if [ -d $SUBDIR ] ; then
-               if [ $TASK_TYPE == open-data ] ; then
-                       for X in $TESTS ; do
-                               [ -f $SUBDIR/$X.out ] && echo -n "$X " || echo -n "- "
-                       done
-                       echo
-               else
-                       C=0
-                       for X in $EXTENSIONS ; do
-                               if [ -f $SUBDIR/$PROBLEM.$X ] ; then
-                                       echo -n `basename $SUBDIR/$PROBLEM.$X`
-                                       C=$(($C+1))
-                               fi
-                       done
-                       if [ $C == 0 ] ; then
-                               echo ---
-                       elif [ $C == 1 ] ; then
-                               echo
-                       else
-                               echo "INCONSISTENT (you probably modified $SUBDIR manually)"
-                       fi
-               fi
-       else
-               echo ---
-       fi
-       )
-done
diff --git a/public/submit b/public/submit
deleted file mode 100755 (executable)
index f597ee4..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/bash
-# The Evaluator -- Public Submit Script
-# (c) 2001--2007 Martin Mares <mj@ucw.cz>
-
-set -e
-[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
-. $MO_ROOT/bin/lib
-. $MO_ROOT/config
-
-function usage
-{
-       die "Usage: submit [--force] [-s <source-file>] <problem> [<test-number>]"
-}
-
-FORCE=0
-if [ "$1" = --force ] ; then
-       FORCE=1
-       shift
-fi
-[ -n "$1" -a "$1" != "--help" ] || usage
-SRCFILE=
-while getopts "s:" opt ; do
-       case $opt in
-               s)      SRCFILE="$OPTARG"
-                       ;;
-               *)      usage
-                       ;;
-       esac
-done
-shift $(($OPTIND-1))
-[ -n "$1" ] || usage
-PROBLEM=$1
-PART=
-shift
-if [ -n "$1" ] ; then
-       PART="$1"
-       shift
-fi
-[ -z "$1" ] || usage
-public-setup
-. $PDIR/config
-
-function test-verdict
-{
-       pend "$2"
-       [ $1 == 0 ] && exit 1 || exit 0
-}
-
-FAILED=0
-if [ $TASK_TYPE == open-data ] ; then
-       [ -n "$PART" ] || die "You need to specify test number for open data problems."
-       TEST=$PART
-       pstart "Test case $TEST: "
-       open-locate "$SRCFILE"
-       (
-               [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
-               try-ln "$SDIR/$SRCN" $TDIR/$TEST.out
-               syntax-check
-               test-result $POINTS_PER_TEST OK
-       ) || FAILED=1
-else
-       [ -z "$PART" ] || die "Test number should be given only for open data problems."
-       locate-source "$SRCFILE"
-       compile
-       for TEST in $SAMPLE_TESTS ; do
-               (
-               pstart "Checking on sample input $TEST: "
-               [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
-               test-run
-               syntax-check
-               output-check
-               die "How could I get there? It's a buuuuug!"
-               ) || FAILED=$(($FAILED+1))
-       done
-fi
-
-if [ $FAILED != 0 ] ; then
-       if [ $FORCE != 0 ] ; then
-               echo "Submit forced."
-               pend "TESTS FAILED, but --force given, so submitting anyway."
-       else
-               pend "TESTS FAILED. Nothing has been submitted!"
-               pend "Use submit --force if you really want to submit an obviously WRONG solution."
-               exit 1
-       fi
-fi
-
-if [ -n "$REMOTE_SUBMIT" ] ; then
-       pstart "Submitting to the server... "
-       $MO_ROOT/bin/remote-submit $PROBLEM $PART "$SDIR/$SRCN"
-       pend "OK"
-       exit 0
-fi
-
-pstart "Submitting... "
-mkdir -p ~/.submit
-if [ $TASK_TYPE == open-data ] ; then
-       mkdir -p ~/.submit/$PROBLEM
-       cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/$PART.out
-else
-       rm -rf ~/.submit/$PROBLEM
-       mkdir -p ~/.submit/$PROBLEM
-       cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/
-fi
-pend "OK"