Variable Substitutions

From PC2wiki
Jump to: navigation, search

PC² features variable substitutions in a number of locations to provide flexibility in configuring Language and Problem definitions.


Variable Format

Each variable name is preceded by a open curly brace and colon and ended with a closing curly brace. In the examples that follow each of the variables is shown as it would be placed in the field.

List of Variables

This table's examples assume an input file of hello.c submitted by team 4 at site 5.

Table of Variable Substitution
Name Description Example
{:basename} Name of file without extension hello
{:mainfile} Name of file hello.c
{:teamid} Team Number 4
{:siteid} Site Number 5
{:language} Language Java-7008022922832958176
{:problem} Problem Number A-6037680426662657684
{:timelimit} Problem time limit 120

Version 9.2 variables

Table of new/changed Variable Substitutions
Name Description Example
{:problem} Problem Number 3
{:problemletter} Problem uppercase letter C
{:language} Language Number 3
{:languageletter} Language uppercase letter C
{:pc2home} PC² installation directory /usr/pc2

Version 9.3 variables

Name Description Example
{:languagename} Language Display Name (lowercase and spaces replaced by underscores) java
{:ccsvalrun} CCS validator run command run

Run Submission Interface variables

Name Description Example
{:filelist} List of files submitted for run sumit.c sumit.h sumit2.h
{:options} CCS command line options See below for details

{:options} is a short cut way to specify the following:

-p {:problemshort} -l {:languagename} -u {:teamid} -m {:mainfile} -i {:runid} -t {:elapsedms}

See complete details on the interface at CCS Run Submission Interface. Some more details can be found at the RSI article.

Post Execution Variables

Table of Variable Substitution
Name Description Example
{:exitvalue} Exit/return value of submitted program
{:executetime} Execution time in ms

The exit value is Operating System dependent and should be very well tested before relying on the value (if at all).

Validator Variables

This table's examples assume a data file: sumit.dat, a answer file: sumit.ans, and a validator of gvim.

Table of Variable Substitution
Name Description Example
{:validator} Represents the file name given in the Validator Program box. Note that it is not a required that the 'validator program' actually be an executable program; it could for example be a text file. gvim
{:infile} Represents the problem data input file as configured in the problem. sumit.dat
{:outfile} Represents the output sent to stdout by the team program when it was executed by the judge.
{:ansfile} Represents the judge’s answer file as configured in problem. sumit.ans
{:resfile} Specifies the name of the file into which an active validator must place an XML representation of the judgement.

See Also