Exemplo n.º 1
0
Arquivo: sq.cpp Projeto: apaikan/myCub
int sqrl_main(int argc, char* argv[])
{
    
	HSQUIRRELVM v;
	SQInteger retval = 0;
	const SQChar *filename=NULL;
#if defined(_MSC_VER) && defined(_DEBUG)
	_CrtSetAllocHook(MemAllocHook);
#endif
	
	v=sq_open(1024);
	sq_setprintfunc(v,printfunc,errorfunc);

	sq_pushroottable(v);
    
	sqstd_register_bloblib(v);    
	sqstd_register_iolib(v);
	sqstd_register_mathlib(v);
 	   
    /*
     * TODO: system and string library should be implemented for nuttx 
     *       they need 'longjmp' and 'setjmp'. 
     */   
    //sqstd_register_stringlib(v);    
    //sqstd_register_systemlib(v);

	//aux library
	//sets error handlers
	sqstd_seterrorhandlers(v);

	//gets arguments
	switch(getargs(v,argc,argv,&retval))
	{
	case _INTERACTIVE:
		Interactive(v);
		break;
	case _DONE:
	case _ERROR:
	default: 
		break;
	}

	sq_close(v);
	
#if defined(_MSC_VER) && defined(_DEBUG)
	_getch();
	_CrtMemDumpAllObjectsSince( NULL );
#endif
	return retval;
    
    return 0;
}
Exemplo n.º 2
0
int main(int argc, char* argv[])
{
	HSQUIRRELVM v;
	
	const SQChar *filename=NULL;
#if defined(_MSC_VER) && defined(_DEBUG)
	_CrtSetAllocHook(MemAllocHook);
#endif
	
	//v= sq_open(1024);
	v= sqobject::init();
	sq_setprintfunc(v,printfunc);

	sq_pushroottable(v);

	sqstd_register_bloblib(v);
	sqstd_register_iolib(v);
	sqstd_register_systemlib(v);
//	sqstd_register_mathlib(v);
//	sqstd_register_stringlib(v);

	//aux library
	//sets error handlers
//	sqstd_seterrorhandlers(v);

	sqobject::Object::registerClass();
	
	//gets arguments
	int ret;
	switch((ret = getargs(v,argc,argv)))
	{
	case _INTERACTIVE:
		Interactive(v);
		break;
	case _DONE:
	default: 
		break;
	}

	//sq_close(v);
	sqobject::done();
	
#if defined(_MSC_VER) && defined(_DEBUG)
	_getch();
	_CrtMemDumpAllObjectsSince( NULL );
#endif
	
	return ret == _ERROR ? -1 : 0;
}
Exemplo n.º 3
0
int main(int argc, char** argv) {
    if (!strcmp(argv[1], "--train") && argc == 4) {
        Train(argv[2], argv[3]);
        return EXIT_SUCCESS;
    }

    if (!strcmp(argv[1], "--interactive") && argc == 3) {
        Interactive(argv[2]);
        return EXIT_SUCCESS;
    }

    std::cerr << "Usage: " << argv[0] << " --train <dataset> <model>\n";
    std::cerr << "Usage: " << argv[0] << " --interactive <model>\n";
    return EXIT_FAILURE;
}
Exemplo n.º 4
0
PatcherOptions::PatcherOptions(int argc, char* argv[]) : m_displayHelp(false), m_displayVersion(false),
	m_interactive(true), m_patchToRealLength(false), m_timeInSeconds(105),
	m_lengthConditionType(condition_none), m_lengthCondition(120), m_startingPaths()
{
	po::options_description desc = GetCmdOptions();

	po::positional_options_description positionalOptions;
	positionalOptions.add("patchpaths", -1);

	po::variables_map vm;
	po::store(po::command_line_parser(argc, argv).options(desc).positional(positionalOptions).run(), vm);
	po::notify(vm);

	DisplayHelp(vm.count("help") > 0);
	DisplayVersion(vm.count("version") > 0);
	Interactive(vm.count("not-interactive") == 0);

	bool unpatch = vm.count("unpatch") > 0;
	bool patchall = vm.count("patchall") > 0;

	if(vm.count("patchpaths"))
	{
		SetStartingPaths(vm["patchpaths"].as<vector<string> >());
	}
	else
	{
		StartingPaths().push_back(fs::initial_path().string());
	}

	if(!unpatch)
	{
		TimeInSeconds(105);
		UseLengthGreaterThanCondition(120);
	}
	else
	{
		PatchToRealLength();
		UseLengthEqualCondition(105);
	}

	if(patchall)
	{
		DontUseLengthCondition();
	}
}
Exemplo n.º 5
0
int main(int argc, char* argv[])
{
    HPSCRIPTVM v;
    PSInteger retval = 0;
#if defined(_MSC_VER) && defined(_DEBUG)
    _CrtSetAllocHook(MemAllocHook);
#endif

    v=ps_open(1024);
    ps_setprintfunc(v,printfunc,errorfunc);

    ps_pushroottable(v);

    psstd_register_bloblib(v);
    psstd_register_iolib(v);
    psstd_register_systemlib(v);
    psstd_register_mathlib(v);
    psstd_register_stringlib(v);
    psstd_register_exutillib(v);

    //aux library
    //sets error handlers
    psstd_seterrorhandlers(v);

    //gets arguments
    switch(getargs(v,argc,argv,&retval))
    {
    case _INTERACTIVE:
        Interactive(v);
        break;
    case _DONE:
    case _ERROR:
    default:
        break;
    }

    ps_close(v);

#if defined(_MSC_VER) && defined(_DEBUG)
    _getch();
    _CrtMemDumpAllObjectsSince( NULL );
#endif
    return retval;
}
Exemplo n.º 6
0
int Cpptraj::RunCpptraj(int argc, char** argv) {
  int err = 0;
  Timer total_time;
  total_time.Start();
  Mode cmode = ProcessCmdLineArgs(argc, argv);
  if ( cmode == BATCH ) {
    // If State is not empty, run now. 
    if (!State_.EmptyState())
      err = State_.Run();
  } else if ( cmode == INTERACTIVE ) {
    err = Interactive();
  } else if ( cmode == ERROR ) {
    err = 1;
  }
  total_time.Stop();
  if (cmode != INTERACTIVE)
    mprintf("TIME: Total execution time: %.4f seconds.\n", total_time.Total());
  if (err == 0) Cpptraj::Finalize();
  mprintf("\n");
  return err;
}