Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tasks.h"
Toshihiro Shimizu 890ddd
#include "tconvert.h"
Toshihiro Shimizu 890ddd
#include "casmfileinfo.h"
Toshihiro Shimizu 890ddd
#include "util.h"
Toshihiro Shimizu 890ddd
#include "texception.h"
Toshihiro Shimizu 890ddd
#include "tsystem.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define DDR_OUTPUTSCRIPT_FILENAME "D@D@R"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
string SubmitPageTask::getFilePath() { return m_filePath; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void SubmitPageTask::setFilePath(const string &filePath) {
Shinya Kitaoka 120a6e
  m_filePath = filePath;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
string SubmitPageTask::getName() { return m_name; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void SubmitPageTask::setName(const string &name) { m_name = name; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
map<string, string=""> SubmitPageTask::getDependencies() { return m_depTasks; }</string,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void SubmitPageTask::setDependencies(const map<string, string=""> &tasks) {</string,>
Shinya Kitaoka 120a6e
  m_depTasks = tasks;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void SubmitPageTask::checkNameUnc() {
Shinya Kitaoka 120a6e
  if (m_filePath == "") return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TFilePath fp(m_filePath);
Shinya Kitaoka 120a6e
  string uncString = "";
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    uncString = convertToUncString(fp);
Shinya Kitaoka 120a6e
  } catch (TException &) {
Shinya Kitaoka 120a6e
    if (!TFileStatus(fp).doesExist()) {
Shinya Kitaoka 120a6e
      string msg = toString(fp.getWideString()) + "\n";
Shinya Kitaoka 120a6e
      msg += "File not found\n";
Shinya Kitaoka 120a6e
      msg += "Please verify that the path is correct";
Shinya Kitaoka 120a6e
      throw TException(msg);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
CasmTask2::CasmTask2() { setDefaultValue(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
CasmTask2::CasmTask2(const string &s, const string &setupFilePath)
Shinya Kitaoka 120a6e
    : m_setupFile(setupFilePath) {
Shinya Kitaoka 120a6e
  setCommandLine(s);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CasmTask2::setDefaultValue() {
Shinya Kitaoka 120a6e
  m_taskChunksize        = 1;
Shinya Kitaoka 120a6e
  m_start                = 0;
Shinya Kitaoka 120a6e
  m_end                  = 9999;
Shinya Kitaoka 120a6e
  m_step                 = 1;
Shinya Kitaoka 120a6e
  m_filePath             = "";
Shinya Kitaoka 120a6e
  m_name                 = "";
Shinya Kitaoka 120a6e
  m_outname              = "";
Shinya Kitaoka 120a6e
  m_firstFrame           = 0;
Shinya Kitaoka 120a6e
  m_lastFrame            = 0;
Shinya Kitaoka 120a6e
  m_reduction            = 1;
Shinya Kitaoka 120a6e
  m_moveType             = M_BG_FRACMOVE;
Shinya Kitaoka 120a6e
  m_prec                 = 32;
Shinya Kitaoka 120a6e
  m_renderTile           = 1.;
Shinya Kitaoka 120a6e
  m_memChunk             = 4.;
Shinya Kitaoka 120a6e
  m_multimedia           = false;
Shinya Kitaoka 120a6e
  m_logfile              = false;
Shinya Kitaoka 120a6e
  m_cf                   = false;
Shinya Kitaoka 120a6e
  m_restype              = RES_TYPE_STANDARD;
Shinya Kitaoka 120a6e
  m_noOverwrite          = false;
Shinya Kitaoka 120a6e
  m_clap                 = false;
Shinya Kitaoka 120a6e
  m_mprocess             = false;
Shinya Kitaoka 120a6e
  m_numColumn            = -1;
Shinya Kitaoka 120a6e
  m_lineart              = -1;
Shinya Kitaoka 120a6e
  m_edgeAliasing         = -1;
Shinya Kitaoka 120a6e
  m_gamma                = -1.;
Shinya Kitaoka 120a6e
  m_bcScript             = "";
Shinya Kitaoka 120a6e
  m_acScript             = "";
Shinya Kitaoka 120a6e
  m_outputScript         = "";
Shinya Kitaoka 120a6e
  m_outputScriptArgument = "";
Shinya Kitaoka 120a6e
  m_setupFile            = "";
Shinya Kitaoka 120a6e
  xsize                  = 0;
Shinya Kitaoka 120a6e
  ysize                  = 0;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CasmTask2::setFileArg(const string &fp) {
Shinya Kitaoka 120a6e
  TFilePath filePath = TFilePath(fp);
Shinya Kitaoka 120a6e
  CasmFileInfo casmFileInfo(filePath);
Shinya Kitaoka 120a6e
  int start, end;
Shinya Kitaoka 120a6e
  bool interlaced;
Shinya Kitaoka 120a6e
  casmFileInfo.getFrameRange(start, end, interlaced);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  m_filePath = fp;
Shinya Kitaoka 120a6e
  m_start    = start;
Shinya Kitaoka 120a6e
  m_end      = end;
Shinya Kitaoka 120a6e
  m_step     = 1;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  setName(TFilePath(fp).getName());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
string CasmTask2::getCommandLine() const {
Shinya Kitaoka 120a6e
  string qualifiers, prgname, dirname, biname;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_reduction != 1) qualifiers += " -shrink " + toString(m_reduction) + " ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_moveType != moveType::M_BG_FRACMOVE)
Shinya Kitaoka 120a6e
    qualifiers +=
Shinya Kitaoka 120a6e
        (m_moveType == moveType::M_FRACMOVE) ? " -fracmove " : " -intmove ";
Shinya Kitaoka 120a6e
  if (m_prec == 64)
Shinya Kitaoka 120a6e
    qualifiers += " -64bit";
Shinya Kitaoka 120a6e
  else
Shinya Kitaoka 120a6e
    qualifiers += " -32bit";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  qualifiers += " -tile " + toString(m_renderTile) + " ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  qualifiers += " -mem " + toString(m_memChunk) + " ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_multimedia) {
Shinya Kitaoka 120a6e
    if (m_numColumn < 0)
Shinya Kitaoka 120a6e
      qualifiers += " -mm ";
Shinya Kitaoka 120a6e
    else
Shinya Kitaoka 120a6e
      qualifiers += " -mmsingle " + toString(m_numColumn) + " ";
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_logfile) qualifiers += " -logfile +output/casm_batches.log ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_lineart > -1) qualifiers += " -lineart " + toString(m_lineart) + " ";
Shinya Kitaoka 120a6e
  if (m_edgeAliasing > -1)
Shinya Kitaoka 120a6e
    qualifiers += " -edgealiasing " + toString(m_edgeAliasing) + " ";
Shinya Kitaoka 120a6e
  if (m_gamma > -1.0) qualifiers += " -gamma " + toString(m_gamma) + " ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  switch (m_restype) {
Shinya Kitaoka 120a6e
    CASE RES_TYPE_STANDARD : qualifiers += " -sq ";
Shinya Kitaoka 120a6e
    CASE RES_TYPE_IMPROVED : qualifiers += " -iq ";
Shinya Kitaoka 120a6e
    CASE RES_TYPE_HIGH : qualifiers += " -hq ";
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_cf) qualifiers += " -cf ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_noOverwrite) qualifiers += " -no_overwrite ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_clap) qualifiers += " -clap ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_bcScript != "") qualifiers += " -bc " + m_bcScript + " ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_acScript != "" && m_outputScript == "")
Shinya Kitaoka 120a6e
    qualifiers += " -ac " + m_acScript + " ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_outputScript != "") {
Shinya Kitaoka 120a6e
    bool outputToDdr = (m_outputScript == DDR_OUTPUTSCRIPT_FILENAME);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    if (!outputToDdr) qualifiers += " -ac " + m_outputScript + " ";
Shinya Kitaoka 120a6e
    if (m_outputScriptArgument != "") {
Shinya Kitaoka 120a6e
      string entry_point = m_outputScriptArgument;
Shinya Kitaoka 120a6e
      string parity      = "odd";
Shinya Kitaoka 120a6e
      int i;
Shinya Kitaoka 120a6e
      i = entry_point.size();
Shinya Kitaoka 120a6e
      if (i > 0 && entry_point[i - 1] == '+') {
Shinya Kitaoka 120a6e
        parity             = "even";
Shinya Kitaoka 120a6e
        entry_point[i - 1] = '\0';
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
      // convert_timecode_to_frame (entry_point);//??????
Shinya Kitaoka 120a6e
      if (outputToDdr)
Shinya Kitaoka 120a6e
        qualifiers += " -ddr " + entry_point + " ";
Shinya Kitaoka 120a6e
      else {
Shinya Kitaoka 120a6e
        string app;
Toshihiro Shimizu 890ddd
#ifdef WIN32
Shinya Kitaoka 120a6e
        app = " -ac_args \"$filename $count " + entry_point;
Shinya Kitaoka 120a6e
        app += " " + parity;
Shinya Kitaoka 120a6e
        app += " $total\" ";
Shinya Kitaoka 120a6e
        qualifiers += app;
Toshihiro Shimizu 890ddd
#else
Shinya Kitaoka 120a6e
        app = " -ac_args '$filename $count " + entry_point;
Shinya Kitaoka 120a6e
        app += " " + parity;
Shinya Kitaoka 120a6e
        app += " $total' ";
Shinya Kitaoka 120a6e
        qualifiers += " app;
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      if (outputToDdr)
Shinya Kitaoka 120a6e
        qualifiers += " -ddr " + toString(0) + " ";
Shinya Kitaoka 120a6e
      else
Toshihiro Shimizu 890ddd
#ifdef WIN32
Shinya Kitaoka 120a6e
        qualifiers += " -ac_args \"$filename $count $total\" ";
Toshihiro Shimizu 890ddd
#else
Shinya Kitaoka 120a6e
        qualifiers += " -ac_args '$filename $count $total' ";
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  qualifiers += "  -step " + toString(m_step);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (m_start > m_firstFrame || m_end < m_lastFrame)
Shinya Kitaoka 120a6e
    qualifiers += " -range " + toString(m_start) + " " + toString(m_end) + " ";
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // qualifiers += " -chunk "+toString(m_taskChunksize)+" ";
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return qualifiers;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
static bool is_num(string word) {
Shinya Kitaoka 120a6e
  string::iterator it = word.begin();
Shinya Kitaoka 120a6e
  while (it != word.end()) {
Shinya Kitaoka 120a6e
    if ((*it < '0' || *it > '9') && *it != '.') return false;
Shinya Kitaoka 120a6e
    it++;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
static string cpy_word(string &word, string s) {
Shinya Kitaoka 120a6e
  /* salto gli spazi bianchi iniziali */
Shinya Kitaoka 120a6e
  string::iterator it  = s.begin();
Shinya Kitaoka 120a6e
  word                 = "";
Shinya Kitaoka 120a6e
  string::iterator it2 = word.begin();
Shinya Kitaoka 120a6e
  while (s[0] == ' ' || s[0] == '\t') it++;
Shinya Kitaoka 120a6e
  if (s[0] == '\'' || s[0] == '\"') {
Shinya Kitaoka 120a6e
    /* argomento fra virgolette */
Shinya Kitaoka 120a6e
    char quote = *it++;
Shinya Kitaoka 120a6e
    while (*it && *it != '\n') {
Shinya Kitaoka 120a6e
      if (*it == '\\') {
Shinya Kitaoka 120a6e
        it++;
Shinya Kitaoka 120a6e
        if (*it == '\0' || *it == '\n') break;
Shinya Kitaoka 120a6e
        switch (*it) {
Shinya Kitaoka 120a6e
          CASE '\\' : *it2++ = '\\';
Shinya Kitaoka 120a6e
        DEFAULT:
Shinya Kitaoka 120a6e
          *it2++ = *it;
Shinya Kitaoka 120a6e
        }
Shinya Kitaoka 120a6e
        it++;
Shinya Kitaoka 120a6e
      } else if (*it == quote) {
Shinya Kitaoka 120a6e
        it++;
Shinya Kitaoka 120a6e
        break;
Shinya Kitaoka 120a6e
      } else
Shinya Kitaoka 120a6e
        *it2++ = *it++;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  } else {
Shinya Kitaoka 120a6e
    /* argomento senza virgolette */
Shinya Kitaoka 120a6e
    while (*it && *it != ' ' && *it != '\t' && *it != '\n') *it2++ = *it++;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  //*word = '\0';
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /* salto gli spazi bianchi finali */
Shinya Kitaoka 120a6e
  while (*it == ' ' || *it == '\t') it++;
Shinya Kitaoka 120a6e
  return s.erase(s.begin(), it);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CasmTask2::setCommandLine(const string &cmdLine) {
Shinya Kitaoka 120a6e
  if (cmdLine.empty()) return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  setDefaultValue();
Shinya Kitaoka 120a6e
  string s            = cmdLine;
Shinya Kitaoka 120a6e
  string::iterator it = s.begin();
Shinya Kitaoka 120a6e
  string word;
Shinya Kitaoka 120a6e
  while (it != s.end()) {
Shinya Kitaoka 120a6e
    s = cpy_word(word, s);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    if (word == "-64bit")
Shinya Kitaoka 120a6e
      m_prec = 64;
Shinya Kitaoka 120a6e
    else if (word == "-32bit")
Shinya Kitaoka 120a6e
      m_prec = 32;
Shinya Kitaoka 120a6e
    else if (word == "-sq")
Shinya Kitaoka 120a6e
      m_restype = RES_TYPE_STANDARD;
Shinya Kitaoka 120a6e
    else if (word == "-iq")
Shinya Kitaoka 120a6e
      m_restype = RES_TYPE_IMPROVED;
Shinya Kitaoka 120a6e
    else if (word == "-hq")
Shinya Kitaoka 120a6e
      m_restype = RES_TYPE_HIGH;
Shinya Kitaoka 120a6e
    else if (word == "-step") {
Shinya Kitaoka 120a6e
      s                        = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_step = atoi(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-range") {
Shinya Kitaoka 120a6e
      s                         = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_start = atoi(word.c_str());
Shinya Kitaoka 120a6e
      s                         = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_end   = atoi(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-shrink") {
Shinya Kitaoka 120a6e
      s                             = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_reduction = atoi(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-fracmove") {
Shinya Kitaoka 120a6e
      m_moveType = M_FRACMOVE;
Shinya Kitaoka 120a6e
    } else if (word == "-intmove") {
Shinya Kitaoka 120a6e
      m_moveType = M_INTMOVE;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    /*     else
Shinya Kitaoka 120a6e
if (STR_EQ(word, "-64bit"))
Shinya Kitaoka 120a6e
task->prec = 64;
Shinya Kitaoka 120a6e
else
Shinya Kitaoka 120a6e
if (STR_EQ(word, "-32bit"))
Shinya Kitaoka 120a6e
task->prec = 32;*/
Shinya Kitaoka 120a6e
    else if (word == "-tile") {
Shinya Kitaoka 120a6e
      s                              = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_renderTile = atof(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-mem") {
Shinya Kitaoka 120a6e
      s                                 = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_taskChunksize = atoi(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-chunk") {
Shinya Kitaoka 120a6e
      s                            = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_memChunk = atof(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-mm") {
Shinya Kitaoka 120a6e
      m_multimedia = true;
Shinya Kitaoka 120a6e
      m_numColumn  = -1;
Shinya Kitaoka 120a6e
    } else if (word == "-mmsingle") {
Shinya Kitaoka 120a6e
      m_multimedia                  = true;
Shinya Kitaoka 120a6e
      s                             = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_numColumn = atoi(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-lineart") {
Shinya Kitaoka 120a6e
      s                           = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_lineart = atoi(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-edgealiasing") {
Shinya Kitaoka 120a6e
      s                                = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_edgeAliasing = atoi(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-gamma") {
Shinya Kitaoka 120a6e
      s                         = cpy_word(word, s);
Shinya Kitaoka 120a6e
      if (is_num(word)) m_gamma = atof(word.c_str());
Shinya Kitaoka 120a6e
    } else if (word == "-cf") {
Shinya Kitaoka 120a6e
      m_cf = true;
Shinya Kitaoka 120a6e
    } else if (word == "-no_overwrite") {
Shinya Kitaoka 120a6e
      m_noOverwrite = true;
Shinya Kitaoka 120a6e
    } else if (word == "-clap") {
Shinya Kitaoka 120a6e
      m_clap = true;
Shinya Kitaoka 120a6e
    } else if (word == "-bc") {
Shinya Kitaoka 120a6e
      s          = cpy_word(word, s);
Shinya Kitaoka 120a6e
      m_bcScript = word;
Shinya Kitaoka 120a6e
    } else if (word == "-ac") {
Shinya Kitaoka 120a6e
      s              = cpy_word(word, s);
Shinya Kitaoka 120a6e
      m_outputScript = word;
Shinya Kitaoka 120a6e
    } else if (word == "-ac_args") { /*
Shinya Kitaoka 120a6e
char output_script_argument[1024];
Shinya Kitaoka 120a6e
s = cpy_word(word, s);
Shinya Kitaoka 120a6e
if(parse_ac_args(output_script_argument, word))
Shinya Kitaoka 120a6e
task->output_script_argument = strsave(output_script_argument);*/
Shinya Kitaoka 120a6e
    } else if (word == "-logfile") {
Shinya Kitaoka 120a6e
      s         = cpy_word(word, s);
Shinya Kitaoka 120a6e
      m_logfile = true;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    /*     else
Shinya Kitaoka 120a6e
if (!word.compare("-range"))
Toshihiro Shimizu 890ddd
{
Shinya Kitaoka 120a6e
s = cpy_word(word, s);
Shinya Kitaoka 120a6e
if (is_num(word))
Shinya Kitaoka 120a6e
task->start = atoi(word);
Shinya Kitaoka 120a6e
else
Shinya Kitaoka 120a6e
{
Shinya Kitaoka 120a6e
delete_job((TASK *)task);
Shinya Kitaoka 120a6e
return NULL;
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
s = cpy_word(word, s);
Shinya Kitaoka 120a6e
if (is_num(word))
Shinya Kitaoka 120a6e
task->end = atoi(word);
Shinya Kitaoka 120a6e
else
Shinya Kitaoka 120a6e
{
Shinya Kitaoka 120a6e
delete_job((TASK *)task);
Shinya Kitaoka 120a6e
return NULL;
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
}*/
Shinya Kitaoka 120a6e
    /*     else
Shinya Kitaoka 120a6e
if (*word!='\n' && *word!='\0')
Shinya Kitaoka 120a6e
{
Shinya Kitaoka 120a6e
t = tim_get_type(word);
Shinya Kitaoka 120a6e
if (*t == '.') t++;
Shinya Kitaoka 120a6e
if (FILESTR_NE(t, "casm"))
Shinya Kitaoka 120a6e
{
Shinya Kitaoka 120a6e
delete_job((TASK *)task);
Toshihiro Shimizu 890ddd
//           return NULL;
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
else
Shinya Kitaoka 120a6e
{
Shinya Kitaoka 120a6e
TCALLOC(task->casm_file, strlen(word)+1);
Shinya Kitaoka 120a6e
strcpy(task->casm_file, word);
Shinya Kitaoka 120a6e
compute_casm_range(task->casm_file, &(task->first_frame), &(task->last_frame),
Shinya Kitaoka 120a6e
&dummy);
Shinya Kitaoka 120a6e
if (task->start<task->first_frame)</task->
Shinya Kitaoka 120a6e
  task->start=task->first_frame;
Shinya Kitaoka 120a6e
if (task->end>task->last_frame)
Shinya Kitaoka 120a6e
  task->end=task->last_frame;
Shinya Kitaoka 120a6e
task->xsize = task->ysize = 0;
Shinya Kitaoka 120a6e
casm_camera_size(task->casm_file, &task->xsize, &task->ysize);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
}*/
Shinya Kitaoka 120a6e
    it = s.begin();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CasmTask2::checkNameUnc() {
Shinya Kitaoka 120a6e
  SubmitPageTask::checkNameUnc();
Shinya Kitaoka 120a6e
  if (m_setupFile == "") return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TFilePath fp(m_setupFile);
Shinya Kitaoka 120a6e
  string uncString = "";
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    uncString = convertToUncString(fp);
Shinya Kitaoka 120a6e
  } catch (TException &) {
Shinya Kitaoka 120a6e
    if (!TFileStatus(fp).doesExist()) {
Shinya Kitaoka 120a6e
      string msg = toString(fp.getWideString()) + "\n";
Shinya Kitaoka 120a6e
      msg += "File not found\n";
Shinya Kitaoka 120a6e
      msg += "Please verify that the path is correct";
Shinya Kitaoka 120a6e
      throw TException(msg);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
ScriptTask::ScriptTask() { setDefaultValue(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
ScriptTask::ScriptTask(const string &s, const string &setupFilePath)
Shinya Kitaoka 120a6e
    : m_setupFile(setupFilePath) {
Shinya Kitaoka 120a6e
  setCommandLine(s);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void ScriptTask::setFileArg(const string &fp) {
Shinya Kitaoka 120a6e
  m_filePath = fp;
Shinya Kitaoka 120a6e
  m_name     = TFilePath(fp).getName();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
string ScriptTask::getCommandLine() const {
Shinya Kitaoka 120a6e
  string cmdLine;
Shinya Kitaoka 120a6e
  if (m_filePath == "") {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
    return "";
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
#ifdef WIN32
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
if (is_fg)
Shinya Kitaoka 120a6e
cmdLine = m_filePath;
Shinya Kitaoka 120a6e
else
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  // viene sempre fatto girare in background
Shinya Kitaoka 120a6e
  cmdLine = "CALL " + m_filePath + " ";
Toshihiro Shimizu 890ddd
#else
Shinya Kitaoka 120a6e
  cmdLine = m_filePath;
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
  cmdLine += "   ";
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_arg1 != "") cmdLine += m_arg1 + "   ";
Shinya Kitaoka 120a6e
  if (m_arg2 != "") cmdLine += m_arg2 + "   ";
Shinya Kitaoka 120a6e
  if (m_arg3 != "") cmdLine += m_arg3 + "   ";
Shinya Kitaoka 120a6e
  if (m_arg4 != "") cmdLine += m_arg4 + "   ";
Shinya Kitaoka 120a6e
  if (m_arg5 != "") cmdLine += m_arg5 + "   ";
Shinya Kitaoka 120a6e
  return cmdLine;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void ScriptTask::setCommandLine(const string &cmdLine) {
Shinya Kitaoka 120a6e
  setDefaultValue();
Shinya Kitaoka 120a6e
  string s = cmdLine;
Shinya Kitaoka 120a6e
  string word;
Shinya Kitaoka 120a6e
  if (s == "") {
Shinya Kitaoka 120a6e
    s = cpy_word(word, s);
Shinya Kitaoka 120a6e
    // if (word == "")
Shinya Kitaoka 120a6e
    m_arg1 = word;
Shinya Kitaoka 120a6e
    // else
Shinya Kitaoka 120a6e
    // m_arg1 = "";
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (s == "") {
Shinya Kitaoka 120a6e
    s = cpy_word(word, s);
Shinya Kitaoka 120a6e
    // if (word == "")
Shinya Kitaoka 120a6e
    m_arg2 = word;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (s == "") {
Shinya Kitaoka 120a6e
    s = cpy_word(word, s);
Shinya Kitaoka 120a6e
    // if (word == "")
Shinya Kitaoka 120a6e
    m_arg3 = word;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (s == "") {
Shinya Kitaoka 120a6e
    s = cpy_word(word, s);
Shinya Kitaoka 120a6e
    // if (word == "")
Shinya Kitaoka 120a6e
    m_arg4 = word;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (s == "") {
Shinya Kitaoka 120a6e
    s = cpy_word(word, s);
Shinya Kitaoka 120a6e
    // if (word == "")
Shinya Kitaoka 120a6e
    m_arg5 = word;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void ScriptTask::setDefaultValue() {
Shinya Kitaoka 120a6e
  m_name      = "";
Shinya Kitaoka 120a6e
  m_filePath  = "";
Shinya Kitaoka 120a6e
  m_setupFile = "";
Shinya Kitaoka 120a6e
  m_arg1      = "";
Shinya Kitaoka 120a6e
  m_arg2      = "";
Shinya Kitaoka 120a6e
  m_arg3      = "";
Shinya Kitaoka 120a6e
  m_arg4      = "";
Shinya Kitaoka 120a6e
  m_arg5      = "";
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void ScriptTask::checkNameUnc() {
Shinya Kitaoka 120a6e
  SubmitPageTask::checkNameUnc();
Shinya Kitaoka 120a6e
  if (m_arg1 == "") return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TFilePath fp(m_arg1);
Shinya Kitaoka 120a6e
  string uncString = "";
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    uncString = convertToUncString(fp);
Shinya Kitaoka 120a6e
  } catch (TException &) {
Shinya Kitaoka 120a6e
    if (!TFileStatus(fp).doesExist()) {
Shinya Kitaoka 120a6e
      string msg = toString(fp.getWideString()) + "\n";
Shinya Kitaoka 120a6e
      msg += "File not found\n";
Shinya Kitaoka 120a6e
      msg += "Please verify that the path is correct";
Shinya Kitaoka 120a6e
      throw TException(msg);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}