示例#1
0
/**
 * Writes the data transfer file of this process. This method is called
 * immediately before starting the operating system process.
 */
INT16 CGEN_PUBLIC CProcess::SendData()
{
  DLP_FILE* pfScr;                                                              // Slave script file pointer
  INT32     i;                                                                  // Loop counter
  char      sScrFn[L_PATH];                                                     // Slave script file name
  char      sDtoFn[L_PATH];                                                     // Data transfer file name

  if (m_nState & PRC_DATASENT) return NOT_EXEC;                                 // Data have already been sent
  if (m_iDto)                                                                   // This process is a function call
  {                                                                             // >>
    sprintf(sScrFn,"%s.xtp",m_psTmpFile);                                       //   Get slave script file name
    sprintf(sDtoFn,"%s.xml",m_psTmpFile);                                       //   Get data transfer fine name
    pfScr = dlp_fopen(sScrFn,"w");                                              //   Open temporary script file
    for (i=0; dlp_strcmp(__sSlaveScript[i],"\0")!=0; i++)                       //   Loop over slave script lines
    {                                                                           //   >>
      dlp_fwrite(__sSlaveScript[i],1,dlp_strlen(__sSlaveScript[i]),pfScr);      //     Write a line
      dlp_fwrite("\n",1,1,pfScr);                                               //     Write a line break
    }                                                                           //   <<
    dlp_fclose(pfScr);                                                          //   Close temporary script file
    CDlpObject_Save(m_iDto,sDtoFn,SV_XML|SV_ZIP);                               //   Save data transfer object
    sprintf(m_psCmdLine,"%s %s %s",dlp_get_binary_path(),sScrFn,sDtoFn);        //   Change the command line
    // -- ???? -->
    IDESTROY(m_iDto); IFIELD_RESET(CDlpObject,"dto");                           //   Save memory!
    // <----------
  }                                                                             // <<
  m_nState |= PRC_DATASENT;                                                     // Remember data have been sent
  return O_K;
}
示例#2
0
/*
 * Write a formated string to a zipped or normal file.
 */
INT32 dlp_fprintf(DLP_FILE *lpZF,const char *format, ...)
{
  va_list va;
  size_t len;
  char buf[DLP_PRINTF_BUFSIZE];
  if(!lpZF) return -1;
  va_start(va,format);
#ifdef HAS_vsnprintf
   (void)vsnprintf(buf, sizeof(buf), format, va);
#else
   (void)vsprintf(buf, format, va);
#endif
   va_end(va);
   len=strlen(buf);
   if(len<=0) return 0;
  return dlp_fwrite(buf,len,1,lpZF);
}