Пример #1
0
static void replaceCommaByDot(const std::string name)
{
  char myCommand[1000], myCommand2[1000];
  sprintf(myCommand, "sed 's/,/./g' %s > temp.txt", name.c_str());
  SystemCall(myCommand, true);
  sprintf(myCommand2, "mv temp.txt %s ", name.c_str());
  SystemCall(myCommand2, true);
}
Пример #2
0
WELS_THREAD_ERROR_CODE    WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* pInfo) {
#ifdef LINUX

#define   CMD_RES_SIZE    2048
  str_t pBuf[CMD_RES_SIZE];

  SystemCall ("cat /proc/cpuinfo | grep \"processor\" | wc -l", pBuf, CMD_RES_SIZE);

  pInfo->ProcessorCount = atoi (pBuf);

  if (pInfo->ProcessorCount == 0) {
    pInfo->ProcessorCount = 1;
  }

  return WELS_THREAD_ERROR_OK;
#undef   CMD_RES_SIZE

#else

  SInt32 cpunumber;
  Gestalt (gestaltCountOfCPUs, &cpunumber);

  pInfo->ProcessorCount	= cpunumber;

  return WELS_THREAD_ERROR_OK;

#endif//LINUX
}
bool MpView::AutoDecompressFile (const string &FileName, 
				 const string &TempDirectory,
				 string &DecompressedTempFileName)
{
  char tmpname[256], buf[256];

  const char *filename  = FileName.c_str();
  const char *extension = GetFileNameExtension(filename);

  // remember if a temporary file has been created
  bool created_tmp = false,
       failure = false;

  // default: file without extension or with unrecognized extension 
  // is assumed to be plain data file
  strcpy(tmpname,filename);

  // yes there is an extension: do corresponding decompression
  if (extension) 
    for (int i = 0; DT[i].extension; i++) 
      if ( ! strcmp( DT[i].extension, extension ) ) {
        // make temporary file name
	sprintf(tmpname,"%s/%s",TempDirectory.c_str(),TempFilePattern);
	mkstemp(tmpname);
	sprintf(buf,DT[i].action,filename,tmpname);
	failure = (SystemCall(string(buf)) != 0);
	created_tmp = true;
	break;
      }

  // return empty string on decompression error
  DecompressedTempFileName = failure ? "" : string(tmpname);
  return created_tmp;
}
Пример #4
0
void Msg::LoadOnelabClient(const std::string &clientName, const std::string &sockName)
{
#if defined(HAVE_ONELAB)
  onelab::remoteNetworkClient *client = 0;
  client = new onelab::remoteNetworkClient(clientName,sockName);
  if(client){
    std::string action, cmd;
    std::vector<onelab::string> ps;
    client->get(ps,clientName+"/Action");
    if(ps.size() && ps[0].getValue().size())
      action.assign(ps[0].getValue());

    //cmd.assign("");
    if(!action.compare("compute")){
      std::vector<onelab::string> ps;
      client->get(ps,clientName+"/FullCmdLine");
      if(ps.size() && ps[0].getValue().size())
	cmd.assign(ps[0].getValue());

      if(cmd.size()){
	Msg::Info("Loader calls <%s>",cmd.c_str());
	//client->sendInfo(strcat("Loader calls",cmd.c_str()));
	std::cout << "Loader calls " << cmd << std::endl;
	SystemCall(cmd.c_str(),true); //true->blocking
      }
      else
	Msg::Info("No full command line found for <%s>",
		    clientName.c_str());
    }
    Msg::Info("Stopping client <%s>", clientName.c_str());
    delete client;
  }
  exit(1);
#endif
}
Пример #5
0
double  sphenoAMSBc(double m0,double m32, double tb, double sgn)
{ 
   int err;
   err=amsbLesH(FIN, m0,m32, tb, (int)sgn);
   if(err) { printf("can not write down LesHouches.in file\n"); exit(10);}

   return SystemCall(1);
}
Пример #6
0
double  isajetSUGRAnuhc(double tb, double gMG1,double gMG2,double gMG3,
             double gAl, double gAt, double gAb, double gMl2,double gMl3,double gMr2,double gMr3,
             double gMq2,double gMq3,double gMu2,double gMu3,double gMd2,double gMd3,double mu,double MA)
{ 
   
   if(sugraHiggsLesH("slha.in",tb, gMG1,gMG2,gMG3, gAl, gAt, gAb, gMl2,gMl3,gMr2,gMr3,
             gMq2,gMq3,gMu2,gMu3,gMd2,gMd3,mu,MA))
   {  printf("can not write down 'slha.in' file\n"); exit(10);}
   return SystemCall(1);
}
Пример #7
0
double  sphenoEwsbMSSMc(double tb, double MG1, double MG2, double MG3, double Al, double At, double Ab,
  double mu, double MH3, double Ml1, double Ml2, double Ml3, double Mr1, double Mr2, double Mr3,
    double Mq1, double Mq2, double Mq3, double Mu1, double Mu2, double Mu3,
                                        double Md1, double Md2, double Md3)
{  int err;
   if(EWSBLesH(FIN,tb,MG1,MG2,MG3,Al,At,Ab,mu,MH3,Ml1,Ml2,Ml3,Mr1,Mr2,Mr3, Mq1,Mq2,Mq3,Mu1,Mu2,Mu3,
                                        Md1,Md2,Md3))
   { printf("can not write down LesHouches.in file\n"); exit(10);}
     err=SystemCall(0);
   return err;
}
Пример #8
0
	void Setup()
	{
		uint32 Response = SystemCall(SYSCALL_GET_FRAMEBUFFER_DATA, (void*) 0);		
		
		//FramebufferData = (FramebufferDescription*) Response;
		//Framebuffer = (uint8*) FramebufferData->Pointer;
		
		//MemorySet(FramebufferData->Pointer, 0, FramebufferData->Size);
		
		//SetColor(255, 255, 255);
		//SetTextColors(0, 0, 0, 255, 255, 255);
		//SetTextFont(1);
	}
Пример #9
0
double  sphenoSUGRAnuhc(double tb, double gMG1,double gMG2,double gMG3,
             double gAl, double gAt, double gAb,double gMl2,double gMl3,double gMr2,double gMr3,
             double gMq2,double gMq3,double gMu2,double gMu3,double gMd2,double gMd3,double mu,double MA)
{ 
   int err=sugraHiggsLesH(FIN, tb, gMG1,gMG2,gMG3, gAl, gAt, gAb, gMl2,gMl3,gMr2,gMr3,gMq2,gMq3,gMu2,gMu3,gMd2,gMd3,mu,MA);
   FILE*f=fopen(FIN,"a");
   
   fprintf(f," 0  -1  # EWSB\n");
   fclose(f);  
  
              
   if(err) {printf("can not write down LesHouches.in file\n"); exit(10);}

   return SystemCall(1);
}
Пример #10
0
double  sphenoSUGRAc(double tb, double gMG1,double gMG2,double gMG3,
             double gAl, double gAt, double gAb, double sgn, double gMHu, double gMHd,
             double gMl2,double gMl3,double gMr2,double gMr3,
             double gMq2,double gMq3,double gMu2,double gMu3,double gMd2,double gMd3)
{ 
   int err;

   err=sugraLesH(FIN, tb, gMG1,gMG2,gMG3,
             gAl, gAt, gAb, sgn, gMHu, gMHd,
             gMl2,gMl3,gMr2,gMr3,
             gMq2,gMq3,gMu2,gMu3,gMd2,gMd3);
              
   if(err) {printf("can not write down LesHouches.in file\n"); exit(10);}

   return SystemCall(1);
}
Пример #11
0
/* We will run the unit test of serial driver in main() */
int main(int argc, char *argv[])
{
	unsigned long tm;
	int i = 0;

	printf("Enter main() ...\n");

    ARM_INT_UNLOCK(0x1F);            /* unlock IRQ/FIQ at the ARM core level */
	goldfish_unmask_irq(IRQ_TIMER);
	goldfish_unmask_irq(IRQ_TTY2);

	EnterUserMode();

	/* We do nothing in main() */
	for(;;) {
		if(ch != 0) {
			printf("1. Command is %c. time=(%lu).\n", ch, tm);

			if(ch == 'd') {
				/* disable timer interrupt. */
				goldfish_mask_irq(IRQ_TIMER);
				printf("  - Disabled timer.\n");
			}

			if(ch == 'e') {
				/* disable timer interrupt. */
				goldfish_unmask_irq(IRQ_TIMER);
				printf("  - Enabled timer.\n");
			}

			if(ch == 's') {
				/* Unit test 2: Fire a system call. */
				SystemCall();
				printf("  - Make system call.\n");
			}

		    ch = 0;
		    tm = goldfish_timer_read();
		    printf("2. ----- End loop (%lu) -----\n", tm);
		}
		else {
			tm = goldfish_timer_read();
		}
	}
	return 1;
}
Пример #12
0
int nb_xcopy(char *Source, char *Destination)
{
    intptr_t   rc;
    char    FileName[128];
    char    temp[512];
    char    command[256];
    char    NewSource[256];
    char    NewDestination[256];

    sprintf(FileName, "Thread_%05d.log", ProcessNumber);
    if ((strlen(Source) == 0) || (strlen(Destination) == 0))
    {
        return(LeaveThread(1, "nb_xcopy failed to xcopy: either source or destination is missing\n", CMD_XCOPY));
    }
    strcpy(NewSource, Source);
    strcpy(NewDestination, Destination);
    memset(command, '\0', sizeof(command));
    sprintf(command, "xcopy /E /I /V /Y /Q %s %s > .\\test\\%s%d", NewSource, NewDestination, HostName, ProcessNumber);

    StartFirstTimer();
    rc = SystemCall(command);

    if (rc)
    {
        EndFirstTimer(CMD_XCOPY, 0);
        sprintf(temp, "xcopy failed on %s\n", command);
        LeaveThread((int)rc, temp, CMD_XCOPY);
        sprintf(temp, "FAIURE: Thread %d - xcopy failed on \"%s\"\n", ProcessNumber, command);
        if (verbose)
            printf("%s", temp);
        LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
        return(-1);
    }
    EndFirstTimer(CMD_XCOPY, 1);
    return(0);
}
Пример #13
0
//---------------------------------------------------------------------------------
void CpuFastSet( const void *source,  void *dest, u32 mode)
//---------------------------------------------------------------------------------
{
	SystemCall(12);
}
Пример #14
0
int Edit(DirEntry * dir_entry, char *file_path)
{
  char *command_line;
  int  result = -1;
  char *file_p_aux=NULL;
  char cwd[PATH_LENGTH + 1];
  char path[PATH_LENGTH + 1];


  if( mode != DISK_MODE && mode != USER_MODE )
  {
    beep();
    return( -1 );
  }

  if( access( file_path, R_OK ) )
  {
    (void) sprintf( message, 
		    "Edit not possible!*\"%s\"*%s", 
		    file_path, 
		    strerror(errno) 
		  );
    MESSAGE( message );
    ESCAPE;
  }

  if( ( file_p_aux = (char *)malloc( COMMAND_LINE_LENGTH ) ) == NULL )
  {
    ERROR_MSG( "Malloc failed*ABORT" );
    exit( 1 );
  }
  StrCp(file_p_aux, file_path);

  if( ( command_line = (char *)malloc( COMMAND_LINE_LENGTH ) ) == NULL )
  {
    ERROR_MSG( "Malloc failed*ABORT" );
    exit( 1 );
  }
  (void) strcpy( command_line, EDITOR );
  (void) strcat( command_line, " \"" );
  (void) strcat( command_line, file_p_aux );
  (void) strcat( command_line, "\"" );
  free( file_p_aux);

  /*  result = SystemCall(command_line);
    --crb3 29apr02: perhaps finally eliminate the problem with jstar writing new
    files to the ytree starting cwd. new code grabbed from execute.c.
    --crb3 01oct02: move Getcwd operation within the IF DISKMODE stuff.
  */                                                                              

  if (mode == DISK_MODE)
  {
    if (Getcwd(cwd, PATH_LENGTH) == NULL)
    {
            WARNING("Getcwd failed*\".\"assumed");
            (void) strcpy(cwd, ".");
    }

    if (chdir(GetPath(dir_entry, path)))
    {
            (void) sprintf(message, "Can't change directory to*\"%s\"", path);
            MESSAGE(message);
    }else{
            result = SystemCall(command_line);
    }
    if(chdir(cwd))
    {
            (void) sprintf(message, "Can't change directory to*\"%s\"", cwd);
            MESSAGE(message);
    }
  }else{
    result = SystemCall(command_line);
  }                                                                         
  free( command_line );
 
FNC_XIT:

  return( result );
}
Пример #15
0
//---------------------------------------------------------------------------------
void ObjAffineSet(ObjAffineSource *source, void *dest, s32 num, s32 offset)
//---------------------------------------------------------------------------------
{
	SystemCall (15);
}
Пример #16
0
//---------------------------------------------------------------------------------
void BgAffineSet(BGAffineSource *source, BGAffineDest *dest, s32 num)
//---------------------------------------------------------------------------------
{
	SystemCall (14);
}
Пример #17
0
void Int80hSyscall(registers_t *regs)
{
	SystemCall(regs->eax, (void*)regs->esi, (void*)regs->edi);
}
Пример #18
0
void ProgramSetMessageHandler(void* Handler)
{
	SystemCall(SYSCALL_SET_MESSAGE_HANDLER, Handler);
}
Пример #19
0
int main()
{
	SystemCall(0, "Hello!\n", NULL);
}