2
require_once("docutil.php");
3
page_head("Back-end utility functions");
5
The following functions can be used in your validator and assimilator code:
9
int get_output_file_path(RESULT const&, std::string&);
11
Returns the path of a result's output file
12
(parses result.xml_doc_out and computes the file's position in the
13
<a href=hier_dir.php>hierarchical directory structure</a>).
16
int get_output_file_paths(RESULT const&, vector<string>&);
19
Same, for multiple output files.
22
int try_fopen(char* path, FILE*& f, char* mode);
24
Open a file, distinguishing between recoverable and nonrecoverable errors.
25
Returns zero on success.
26
Returns ERR_FOPEN if the directory is present but not the file
27
(this is considered a nonrecoverable error).
28
Returns ERR_OPENDIR if the directory is not there
29
(this is generally a recoverable error, like NFS mount failure).
32
double median_mean_credit(vector<RESULT> const& results);
34
Given a vector of N correct results, computes a canonical credit as follows:
36
<li> if N==1, return that result's claimed credit
37
<li> if N==2, return min of claimed credits
38
<li> if N>2, toss out high and low claimed credit,
39
and return the average of the rest.