Ejemplo n.º 1
0
 std::wstring generateFileName(const std::wstring &spec,
                               const std::map<uint32_t, std::wstring> &tag)
 {
     std::wstring ofilename = process_template(spec, TagLookup(tag));
     struct ToSafe {
         static wchar_t call(wchar_t ch) {
             return std::wcschr(L":/\\?|<>*\"", ch) ? L'_' : ch;
         }
     };
     return strutil::strtransform(ofilename, ToSafe::call);
 }
Ejemplo n.º 2
0
void
ns_footer(
        FILE *out,
        unsigned char const *templ,
        const unsigned char *copyright,
        int locale_id)
{
  if (!copyright) copyright = get_copyright(locale_id);
  if (!templ) templ = ns_default_footer;
  process_template(out, templ, 0, 0, 0, copyright, 0, 0, 0, NULL, NULL);
}
Ejemplo n.º 3
0
void
ns_separator(
        FILE *out,
        unsigned char const *templ,
        const struct contest_desc *cnts)
{
  const unsigned char *logo_url = 0;

  if (cnts) logo_url = cnts->logo_url;
  if (!logo_url) {
#if defined CONF_STYLE_PREFIX
    logo_url = CONF_STYLE_PREFIX "logo.gif";
#else
    logo_url = "logo.gif";
#endif
  }

  process_template(out, templ, NULL, NULL, NULL, NULL, NULL, NULL, 0, logo_url, NULL);
}
Ejemplo n.º 4
0
void
ns_header(
        FILE *out,
        unsigned char const *templ,
        unsigned char const *content_type,
        unsigned char const *charset,
        const unsigned char *script_part,
        const unsigned char *body_attr,
        int locale_id,
        const struct contest_desc *cnts,
        ej_cookie_t client_key,
        char const *format,
        ...)
{
  va_list args;
  unsigned char title[1024];
  const unsigned char *logo_url = 0;
  const unsigned char *css_url = 0;

  title[0] = 0;
  if (format) {
    va_start(args, format);
    vsnprintf(title, sizeof(title), format, args);
    va_end(args);
  }

  if (!charset) charset = EJUDGE_CHARSET;
  if (!content_type) content_type = "text/html";
  if (!templ) templ = ns_default_header;
  if (!script_part) script_part = "";
  if (!body_attr) body_attr = "";

  if (cnts) {
    logo_url = cnts->logo_url;
    css_url = cnts->css_url;
  }
  if (!logo_url) {
#if defined CONF_STYLE_PREFIX
    logo_url = CONF_STYLE_PREFIX "logo.gif";
#else
    logo_url = "logo.gif";
#endif
  }
  if (!css_url) {
#if defined CONF_STYLE_PREFIX
    css_url = CONF_STYLE_PREFIX "unpriv.css";
#else
    css_url = "unpriv.css";
#endif
  }

  fprintf(out, "Content-Type: %s; charset=%s\n"
          "Cache-Control: no-cache\n"
          "Pragma: no-cache\n", content_type, charset);
  if (client_key) {
    fprintf(out, "Set-Cookie: EJSID=%016llx; Path=/\n", client_key);
  }
  putc('\n', out);

  process_template(out, templ, content_type, charset, title, 0,
                   script_part, body_attr, locale_id, logo_url, css_url);
}
Ejemplo n.º 5
0
int main(int argc, char *argv[])
{
  int len;

  // Signal names.
  // NOTE: For now, these are not used. 
  // In the future, they should be used to help users understand their test results.
  //char **t1_sig_names;
  //char **t2_sig_names;
  //char **t3_sig_names;
  //char **t4_sig_names;

  // Signal locations.
  char** t1_sig_locs = NULL;
  char** t2_sig_locs = NULL;
  char** t3_sig_locs = NULL;
  char** t4_sig_locs = NULL;

  // Force formats.
  char** t1_ffs = NULL;
  char** t2_ffs = NULL;
  char** t3_ffs = NULL;
  char** t4_ffs = NULL;

  // Pin directions.
  char** t1_dirs = NULL;
  char** t2_dirs = NULL;
  char** t3_dirs = NULL;
  char** t4_dirs = NULL;

  // Test cycles (for each pin).
  char** t1_cycles = NULL;
  char** t2_cycles = NULL;
  char** t3_cycles = NULL;
  char** t4_cycles = NULL;

  // Template 1.
  len = atoi(argv[1]);
  process_template(len, 
		   argv[2],
		   argv[3],
		   argv[4],
		   argv[5],
		   argv[6],
		   t1_sig_locs,
		   t1_ffs,
		   t1_dirs,
		   t1_cycles);

  // Template 2.
  len = atoi(argv[7]);
  process_template(len, 
		   argv[8],
		   argv[9],
		   argv[10],
		   argv[11],
		   argv[12],
		   t2_sig_locs,
		   t2_ffs,
		   t2_dirs,
		   t2_cycles);

  // Template 3.
  len = atoi(argv[13]);
  process_template(len, 
		   argv[14],
		   argv[15],
		   argv[16],
		   argv[17],
		   argv[18],
		   t3_sig_locs,
		   t3_ffs,
		   t3_dirs,
		   t3_cycles);

  // Template 4.
  len = atoi(argv[19]);
  process_template(len, 
		   argv[20],
		   argv[21],
		   argv[22],
		   argv[23],
		   argv[24],
		   t4_sig_locs,
		   t4_ffs,
		   t4_dirs,
		   t4_cycles);

  // Convert each bit-vector (ffs, dirs, cycles) into 16 bytes, then use appropriate
  // uart_lib.h command.
  // TODO

  // Then, accumulate input vectors and transfer them to FPGA.
  // TODO

  // Finally, execute tests.
  // TODO

  // Request as many output vectors as input vectors, then make comparisons.

  return 0;
}