When several filename extensions corresponded to the same programming language,
the compiler and runtime settings had to be duplicated.
It is now possible to define one extension as an alias for another, so that
it is used only for locating the source. The copy of the program in $TDIR
already has the new extension and it is processed according to it.
function compile
{
pstart "Compiling... "
function compile
{
pstart "Compiling... "
+
+ a="ALIAS_EXT_$SRCEXT"
+ if [ -n "${!a}" ] ; then
+ SRCEXT="${!a}"
+ echo "Normalized file extension: $SRCEXT"
+ fi
override-vars "EXT_$SRCEXT"
override-vars "EXT_$SRCEXT"
# Beware, the original SRCN can be a strange user-supplied name
SRC=$PROBLEM.$SRCEXT
cp "$SDIR/$SRCN" $TDIR/$SRC
# Beware, the original SRCN can be a strange user-supplied name
SRC=$PROBLEM.$SRCEXT
cp "$SDIR/$SRCN" $TDIR/$SRC
echo "Extras: $COMP_EXTRAS"
for a in $COMP_EXTRAS ; do cp $PDIR/$a $TDIR/ ; done
fi
echo "Extras: $COMP_EXTRAS"
for a in $COMP_EXTRAS ; do cp $PDIR/$a $TDIR/ ; done
fi
box-clean
for a in $SRC $COMP_EXTRAS ; do cp $TDIR/$a $BOXDIR/ ; done
EXE=$PROBLEM
box-clean
for a in $SRC $COMP_EXTRAS ; do cp $TDIR/$a $BOXDIR/ ; done
EXE=$PROBLEM
# Known source file extensions
EXTENSIONS="c cc C cpp p pas"
# Known source file extensions
EXTENSIONS="c cc C cpp p pas"
+# Some of the extensions can be aliases for other extensions
+ALIAS_EXT_cc=cpp
+ALIAS_EXT_C=cpp
+ALIAS_EXT_p=pas
+
## Variables which control compilation and execution
## (see below for values for individual languages)
## Variables which control compilation and execution
## (see below for values for individual languages)
-EXT_C_COMP='/usr/bin/g++ -O2 -g -o $EXE $EXTRA_CXXFLAGS $SRC -lm'
-EXT_cpp_COMP="$EXT_C_COMP"
-EXT_cc_COMP="$EXT_C_COMP"
+EXT_cpp_COMP='/usr/bin/g++ -O2 -g -o $EXE $EXTRA_CXXFLAGS $SRC -lm'
-EXT_p_COMP='/usr/bin/fpc -Ci -Cr -Ct -g -O2 -Sg -o$EXE $EXTRA_PFLAGS $SRC'
-EXT_pas_COMP="$EXT_p_COMP"
+EXT_pas_COMP='/usr/bin/fpc -Ci -Cr -Ct -g -O2 -Sg -o$EXE $EXTRA_PFLAGS $SRC'
-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)
EXT_pas_EXIT_CODE_HOOK=fpc-exit-code
### Per-task configuration variables (default values, override in per-task config)