Exemplo n.º 1
0
void RPCExecutor::request(const QString &command)
{
    std::vector<std::string> args;
    if(!parseCommandLine(args, command.toStdString()))
    {
        emit reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \""));
        return;
    }
    if(args.empty())
        return; // Nothing to do
    try
    {
        std::string strPrint;
        // Convert argument list to JSON objects in method-dependent way,
        // and pass it along with the method name to the dispatcher.
        json_spirit::Value result = tableRPC.execute(
            args[0],
            RPCConvertValues(args[0], std::vector<std::string>(args.begin() + 1, args.end())));

        // Format result reply
        if (result.type() == json_spirit::null_type)
            strPrint = "";
        else if (result.type() == json_spirit::str_type)
            strPrint = result.get_str();
        else
            strPrint = write_string(result, true);

        emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
    }
    catch (json_spirit::Object& objError)
    {
        try // Nice formatting for standard-format error
        {
            int code = find_value(objError, "code").get_int();
            std::string message = find_value(objError, "message").get_str();
            emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")");
        }
        catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message
        {   // Show raw JSON object
            emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
        }
    }
    catch (std::exception& e)
    {
        emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
    }
}
Exemplo n.º 2
0
int main (int argc, const char **argv)
{

    gSymbolList = (const char**)calloc (MAX_SUBSCRIPTIONS, sizeof (char*));

    parseCommandLine (argc, argv);

    if (!gNumSymbols)
        gSymbolList[gNumSymbols++] = "MAMA_TOPIC";

    initializeMama ();
    createPublisher ();
    subscribeToSymbols ();
    start();

    return 0;
}
Exemplo n.º 3
0
int main(int argc, char* argv[])
{
    parseCommandLine(argc,argv);
    NarrowBand nb(filename);
    nb.build3Dgrid(prec);
    nb.expandGrid(expand);
    nb.writeGridToFile();
    nb.computeDistanceFunction();
    nb.writeDtoFile();
    nb.computeGradient();
    nb.writeDDtoFile();
    nb.computeInitialSurface();
    nb.writeUtoFile();
    nb.evolve(iter,deltaT);

    return 0;
}
Exemplo n.º 4
0
  static void parseCommandLine(Ref<ParseStream> cin, const FileName& path)
  {
    while (true)
    {
      std::string tag = cin->getString();
      if (tag == "") return;

      /* parse command line parameters from a file */
      if (tag == "-c") {
        FileName file = path + cin->getFileName();
        parseCommandLine(new ParseStream(new LineCommentFilter(file, "#")), file.path());
      }

      /* parse camera parameters */
      else if (tag == "-vp") g_camera.from = cin->getVec3fa();
      else if (tag == "-vi") g_camera.to = cin->getVec3fa();
      else if (tag == "-vd") g_camera.to = g_camera.from + cin->getVec3fa();
      else if (tag == "-vu") g_camera.up = cin->getVec3fa();
      else if (tag == "-fov") g_camera.fov = cin->getFloat();

      /* frame buffer size */
      else if (tag == "-size") {
        g_width = cin->getInt();
        g_height = cin->getInt();
      }

      /* full screen mode */
      else if (tag == "-fullscreen") 
        g_fullscreen = true;
      
      /* rtcore configuration */
      else if (tag == "-rtcore")
        g_rtcore = cin->getString();

      /* number of threads to use */
      else if (tag == "-threads")
        g_numThreads = cin->getInt();

      /* skip unknown command line parameter */
      else {
        std::cerr << "unknown command line parameter: " << tag << " ";
        while (cin->peek() != "" && cin->peek()[0] != '-') std::cerr << cin->getString() << " ";
        std::cerr << std::endl;
      }
    }
  }
TEST_F(TestApplication, can_parse_command_line_expected_query) {
    // Arrange
    constexpr int argc = 3;
    constexpr const char* argv[argc] = {
        "somepath_to_binary",
        "-q",
        "Name1,Name2"
    };
    Parameters expected;
    expected.query = "Name1,Name2";

    // Act
    const auto result = parseCommandLine(argc, argv);

    // Assert
    EXPECT_EQ(expected.query, result.query);
}
Exemplo n.º 6
0
 void main(int argc, char **argv) 
 {
   /*! parse command line options */
   parseCommandLine(argc, argv);
   
   /*! bind to a port */
   network::socket_t socket = network::bind(g_port);
   
   /*! handle incoming connections */
   do {
     std::cout << std::endl << "listening for connections on port " << g_port << " ... " << std::flush;
     network::socket_t client = network::listen(socket);
     std::cout << "  [CONNECTED]" << std::endl;
     new NetworkServer(client,Device::rtCreateDevice(g_device_type.c_str(), g_threads),g_encoding,g_verbose);
   } 
   while (g_multiple_connections);
 }
Exemplo n.º 7
0
int main(int argc, const char* argv[])
{
    mamaCaptureConfig mCapture = NULL;
    mamaCaptureList mCaptureList     = NULL;
    mamaCaptureConfig_create (&mCapture);

    if (mCapture == NULL)
    {
        mama_log (MAMA_LOG_LEVEL_NORMAL,
                  "Allocation of memory for capture failed!!!!");
        exit (1);
    }

    gCapture  = &mCapture;
    parseCommandLine (mCapture , &mCaptureList, argc, argv);

    /*Set up a signal handler so that we don't
      just stop without cleaning up*/
    gCaptureList = &mCaptureList;
    initializeMama (mCapture);

    mamaCaptureList_parseCommandInput (mCapture,
                                       mCaptureList, gSource);
    mamaCapture_openFile (&mCapture->myCapture,
                       mCapture->myCaptureFilename);


    buildDataDictionary(mCapture);
    dumpDataDictionary (mCapture);

    if (mCapture->myDumpList)
    {
        dumpList (mCaptureList);
    }
    subscribeToSymbols (mCapture,mCaptureList);

    mama_logStdout (MAMA_LOG_LEVEL_NORMAL, "Type CTRL-C to exit.\n\n");

    mama_start (mCapture->myBridge);

    mamaCapture_closeFile(mCapture->myCapture);
    msshutdown (mCapture,mCaptureList);

    return 0;
}
Exemplo n.º 8
0
int
main(int argc, char **argv) {

    struct cmdlineInfo cmdline;
    struct pam pam;
    int row;
    double normalizer;
    tuplen * tuplerown;
    
    pnm_init(&argc, argv);
   
    parseCommandLine(argc, argv, &cmdline);

    pam.size        = sizeof(pam);
    pam.len         = PAM_STRUCT_SIZE(tuple_type);
    pam.file        = stdout;
    pam.format      = PAM_FORMAT;
    pam.plainformat = 0;
    pam.width       = cmdline.width;
    pam.height      = cmdline.height;
    pam.depth       = 1;
    pam.maxval      = cmdline.maxval;
    strcpy(pam.tuple_type, cmdline.tupletype);

    normalizer = imageNormalizer(&pam, cmdline.sigma);
    
    pnm_writepaminit(&pam);
   
    tuplerown = pnm_allocpamrown(&pam);

    for (row = 0; row < pam.height; ++row) {
        int col;
        for (col = 0; col < pam.width; ++col) {
            double const gauss1 = gauss(distFromCenter(&pam, col, row),
                                        cmdline.sigma);

            tuplerown[col][0] = gauss1 * normalizer;
        }
        pnm_writepamrown(&pam, tuplerown);
    }
    
    pnm_freepamrown(tuplerown);

    return 0;
}
Exemplo n.º 9
0
void
readCommandFile(
    char *name
    )
{
    char *s,                        // buffer
         **vector;                  // local versions of arg vector
    unsigned count = 0;             // count
    size_t n;

    if (!(file = FILEOPEN(name,"rt")))
        makeError(0,CANT_OPEN_FILE,name);
    vector = NULL;                      // no args yet
    while (fgets(buf,MAXBUF,file)) {
        n = _tcslen(buf);

        // if we didn't get the whole line, OR the line ended with a backSlash

        if ((n == MAXBUF-1 && buf[n-1] != '\n') ||
            (buf[n-1] == '\n' && buf[n-2] == '\\')
           ) {
            if (buf[n-2] == '\\' && buf[n-1] == '\n') {
                // Replace \n by \0 and \\ by a space; Also reset length
                buf[n-1] = '\0';
                buf[n-2] = ' ';
                n--;
            }
            s = makeString(buf);
            getRestOfLine(&s,&n);
        } else
            s = buf;

        processLine(s,&count,&vector);  // separate into args
        if (s != buf)
            FREE(s);
    }

    if (fclose(file) == EOF)
        makeError(0, ERROR_CLOSING_FILE, name);

    parseCommandLine(count,vector);     // evaluate the args
    while (count--)                     // free the arg vector
        if(vector[count])
            FREE(vector[count]);        // NULL entries mean that the space the
}                                       //  entry used to pt to is still in use
Exemplo n.º 10
0
int
main(int argc, char **argv)
{
    struct cmdlineInfo cmdline;
    struct pam outpam;
    int * jasperCmpt;  /* malloc'ed */
       /* jaspercmpt[P] is the component number for use with the
          Jasper library that corresponds to Plane P of the PAM.  
       */
    jas_image_t * jasperP;

    pnm_init(&argc, argv);
    
    parseCommandLine(argc, argv, &cmdline);
    
    { 
        int rc;
        
        rc = jas_init();
        if ( rc != 0 )
            pm_error("Failed to initialize Jasper library.  "
                     "jas_init() returns rc %d", rc );
    }
    
    jas_setdbglevel(cmdline.debuglevel);
    
    readJpc(cmdline.inputFilename, &jasperP);

    outpam.file = stdout;
    outpam.size = sizeof(outpam);
    outpam.len  = PAM_STRUCT_SIZE(tuple_type);

    computeOutputParm(jasperP, &outpam, &jasperCmpt);

    pnm_writepaminit(&outpam);
    
    convertToPamPnm(&outpam, jasperP, jasperCmpt);
    
    free(jasperCmpt);
	jas_image_destroy(jasperP);

    pm_close(stdout);
    
    return 0;
}
Exemplo n.º 11
0
AppDelegate::AppDelegate(int argc, char* argv[]) :
    QApplication(argc, argv),
    _qtReady(false),
    _dsReady(false),
    _dsResourcesReady(false),
    _acReady(false),
    _domainServerProcess(NULL),
    _acMonitorProcess(NULL),
    _domainServerName("localhost")
{
    // be a signal handler for SIGTERM so we can stop child processes if we get it
    signal(SIGTERM, signalHandler);

    // look for command-line options
    parseCommandLine();

    setApplicationName("Stack Manager");
    setOrganizationName("High Fidelity");
    setOrganizationDomain("io.highfidelity.StackManager");

    QFile* logFile = new QFile("last_run_log", this);
    if (!logFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) {
        qDebug() << "Failed to open log file. Will not be able to write STDOUT/STDERR to file.";
    } else {
        outStream = new QTextStream(logFile);
    }


    qInstallMessageHandler(myMessageHandler);
    _domainServerProcess = new BackgroundProcess(GlobalData::getInstance().getDomainServerExecutablePath(), this);
    _acMonitorProcess = new BackgroundProcess(GlobalData::getInstance().getAssignmentClientExecutablePath(), this);

    _manager = new QNetworkAccessManager(this);

    _window = new MainWindow();

    createExecutablePath();
    downloadLatestExecutablesAndRequirements();

    _checkVersionTimer.setInterval(0);
    connect(&_checkVersionTimer, SIGNAL(timeout()), this, SLOT(checkVersion()));
    _checkVersionTimer.start();

    connect(this, &QApplication::aboutToQuit, this, &AppDelegate::stopStack);
}
Exemplo n.º 12
0
Arquivo: main.cpp Projeto: tuita/DOMQ
int main( int argc, const char *argv[] )
{
   std::string path;
   Json::Features features;
   bool parseOnly;
   int exitCode = parseCommandLine( argc, argv, features, path, parseOnly );
   if ( exitCode != 0 )
   {
      return exitCode;
   }

   std::string input = readInputTestFile( path.c_str() );
   if ( input.empty() )
   {
      printf( "Failed to read input or empty input: %s\n", path.c_str() );
      return 3;
   }

   std::string basePath = removeSuffix( argv[1], ".json" );
   if ( !parseOnly  &&  basePath.empty() )
   {
      printf( "Bad input path. Path does not end with '.expected':\n%s\n", path.c_str() );
      return 3;
   }

   std::string actualPath = basePath + ".actual";
   std::string rewritePath = basePath + ".rewrite";
   std::string rewriteActualPath = basePath + ".actual-rewrite";

   Json::Value root;
   exitCode = parseAndSaveValueTree( input, actualPath, "input", root, features, parseOnly );
   if ( exitCode == 0  &&  !parseOnly )
   {
      std::string rewrite;
      exitCode = rewriteValueTree( rewritePath, root, rewrite );
      if ( exitCode == 0 )
      {
         Json::Value rewriteRoot;
         exitCode = parseAndSaveValueTree( rewrite, rewriteActualPath, 
            "rewrite", rewriteRoot, features, parseOnly );
      }
   }

   return exitCode;
}
Exemplo n.º 13
0
int main(int argc, char **argv) {
    try {
        std::vector<Common::UString> args;
        Common::Platform::getParameters(argc, argv, args);

        int returnValue = 1;
        Common::UString inFile, outFile;

        if (!parseCommandLine(args, returnValue, inFile, outFile))
            return returnValue;

        desmall(inFile, outFile);
    } catch (...) {
        Common::exceptionDispatcherError();
    }

    return 0;
}
Exemplo n.º 14
0
int
main(int argc, char * argv[]) {

    struct cmdlineInfo cmdline;
    FILE * ifP;
    xelval lmin, lmax;
    gray * lumamap;           /* Luminosity map */
    unsigned int * lumahist;  /* Histogram of luminosity values */
    int rows, cols;           /* Rows, columns of input image */
    xelval maxval;            /* Maxval of input image */
    int format;               /* Format indicator (PBM/PGM/PPM) */
    xel ** xels;              /* Pixel array */
    unsigned int pixelCount;

    pnm_init(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFileName);

    xels = pnm_readpnm(ifP, &cols, &rows, &maxval, &format);

    pm_close(ifP);

    computeLuminosityHistogram(xels, rows, cols, maxval, format,
                               cmdline.gray, &lumahist, &lmin, &lmax,
                               &pixelCount);

    getMapping(cmdline.rmap, lumahist, maxval, pixelCount, &lumamap);

    if (cmdline.verbose)
        reportMap(lumahist, maxval, lumamap);

    remap(xels, cols, rows, maxval, format, !!cmdline.gray, lumamap);

    pnm_writepnm(stdout, xels, cols, rows, maxval, format, 0);

    if (cmdline.wmap)
        writeMap(cmdline.wmap, lumamap, maxval);

    pgm_freerow(lumamap);

    return 0;
}
Exemplo n.º 15
0
int 
main(int argc, char ** argv) {

    struct cmdlineInfo cmdline;

    MS_Ico const MSIconDataP = createIconFile();
    unsigned int iconIndex;
    unsigned int offset;
   
    ppm_init (&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    verbose = cmdline.verbose;

    for (iconIndex = 0; iconIndex < cmdline.iconCount; ++iconIndex) {
        addEntryToIcon(MSIconDataP, cmdline.inputFilespec[iconIndex],
                       cmdline.andpgmFilespec[iconIndex], 
                       cmdline.truetransparent);
    }
    /*
     * Now we have to go through and calculate the offsets.
     * The first infoheader starts at 6 + count*16 bytes.
     */
    offset = (MSIconDataP->count * 16) + 6;
    for (iconIndex = 0; iconIndex < MSIconDataP->count; ++iconIndex) {
        IC_Entry entry = MSIconDataP->entries[iconIndex];
        entry->file_offset = offset;
        /* 
         * Increase the offset by the size of this offset & data.
         * this includes the size of the color data.
         */
        offset += entry->size_in_bytes;
    }
    /*
     * And now, we have to actually SAVE the .ico!
     */
    writeMS_Ico(MSIconDataP, cmdline.output);

    free(cmdline.inputFilespec);
    free(cmdline.andpgmFilespec);

    return 0;
}
Exemplo n.º 16
0
int main( int argc, char **argv ){
	string pathStr;
	gProgramName = argv[0];

	parseCommandLine( argc, argv );
	argc -= optind;
	argv += optind;
	if( gTheScene->hasInputSceneFilePath( ) &&
			gTheScene->hasOutputFilePath( ) &&
			gTheScene->hasDepthFilePath( ) ){
		gTheScene->parse( );	
		cout << *gTheScene << endl;	
	}else{
		usage( "You specify an input scene file, an output file and a depth file." );
	}


	return( 0 );
}
Exemplo n.º 17
0
bool Main::parseOptions(int argc, char** argv) {
  // Reprint command line
  for (int i=0; i<argc; ++i)
    cout << argv[i] << ' ';
  cout << endl;
  // parse command line
  ProgramOptions* opt = parseCommandLine(argc, argv);
  if (!opt) {
    err_txt("Error parsing command line.");
    return false;
  }

  if (opt->seed == NONE)
    opt->seed = time(0);
  rand::seed(opt->seed);

  m_options.reset(opt);
  return true;
}
Exemplo n.º 18
0
  /* main function in embree namespace */
  int main(int argc, char** argv) 
  {
    /* create stream for parsing */
    Ref<ParseStream> stream = new ParseStream(new CommandLineStream(argc, argv));

    /* parse command line */  
    parseCommandLine(stream, FileName());
    if (g_numThreads) 
      g_rtcore += ",threads=" + std::stringOf(g_numThreads);
    if (g_numBenchmarkFrames)
      g_rtcore += ",benchmark=1";

    /* initialize task scheduler */
#if !defined(__EXPORT_ALL_SYMBOLS__)
    TaskScheduler::create(g_numThreads);
#endif

    /* load scene */
    if (filename.str() != "")
      loadOBJ(filename,one,g_obj_scene);

    /* initialize ray tracing core */
    init(g_rtcore.c_str());

    /* send model */
    set_scene(&g_obj_scene);
    
    /* benchmark mode */
    if (g_numBenchmarkFrames)
      renderBenchmark(outFilename);
    
    /* render to disk */
    if (outFilename.str() != "")
      renderToFile(outFilename);
    
    /* interactive mode */
    if (g_interactive) {
      initWindowState(argc,argv,tutorialName, g_width, g_height, g_fullscreen);
      enterWindowRunLoop();
    }

    return 0;
  }
Exemplo n.º 19
0
int
main(int argc, char * argv[] ) {

    struct cmdlineInfo cmdline;
    FILE * ifP;
    int format;
    struct pam colormapPam;
    struct pam outpam;
    tuple ** colormapRaster;
    tupletable2 colormap;

    pnm_init(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFilespec);

    computeColorMapFromInput(ifP,
                             cmdline.allcolors, cmdline.newcolors, 
                             cmdline.methodForLargest, 
                             cmdline.methodForRep,
                             &format, &colormapPam, &colormap);

    pm_close(ifP);

    colormapToImage(format, &colormapPam, colormap,
                    cmdline.sort, cmdline.square, &outpam, &colormapRaster);

    if (cmdline.verbose)
        pm_message("Generating %u x %u image", outpam.width, outpam.height);

    outpam.file = stdout;
    
    pnm_writepam(&outpam, colormapRaster);
    
    pnm_freetupletable2(&colormapPam, colormap);

    pnm_freepamarray(colormapRaster, &outpam);

    pm_close(stdout);

    return 0;
}
Exemplo n.º 20
0
int main(int argc, char **argv) {
    std::vector<Common::UString> args;
    Common::Platform::getParameters(argc, argv, args);

    int returnValue = 1;
    Common::UString nbfsFile, nbfpFile, outFile;
    uint32 width = 0xFFFFFFFF, height = 0xFFFFFFFF;

    try {
        if (!parseCommandLine(args, returnValue, nbfsFile, nbfpFile, outFile, width, height))
            return returnValue;

        convert(nbfsFile, nbfpFile, outFile, width, height);
    } catch (...) {
        Common::exceptionDispatcherError();
    }

    return 0;
}
Exemplo n.º 21
0
int
main(int argc, char **argv ) {

    struct cmdlineInfo cmdline;
    FILE* ifP;
    struct pam pam;
    pfmSample * pfmRowBuffer;
    unsigned int pfmSamplesPerRow;
    unsigned int pfmRow;
    tuplen ** tuplenArray;

    pnm_init(&argc, argv);

    machineEndianness = thisMachineEndianness();

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFilespec);

    tuplenArray = pnm_readpamn(ifP, &pam, PAM_STRUCT_SIZE(tuple_type));

    writePfmHeader(stdout,
                   makePfmHeader(&pam, cmdline.scale, cmdline.endian));

    pfmSamplesPerRow = pam.width * pam.depth;

    MALLOCARRAY_NOFAIL(pfmRowBuffer, pfmSamplesPerRow);

    /* PFMs are upside down like BMPs */
    for (pfmRow = 0; pfmRow < pam.height; ++pfmRow)
        writePfmRow(&pam, stdout, pfmRow, pfmSamplesPerRow,
                    tuplenArray, cmdline.endian, cmdline.scale,
                    pfmRowBuffer);

    pnm_freepamarrayn(tuplenArray, &pam);
    free(pfmRowBuffer);

    pm_close(stdout);
    pm_close(pam.file);

    return 0;
}
Exemplo n.º 22
0
int
main(int argc, const char ** const argv) {

    struct CmdlineInfo cmdline;
    struct pam inpam;
    FILE * ifP;
    struct pam lookuppam;
    tuple ** lookup;

    tuplehash lookupHash;
    
    pm_proginit(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFileName);

    pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));

    getLookup(cmdline.lookupfile, &lookup, &lookuppam);

    if (inpam.depth != lookuppam.depth)
        pm_error("The lookup image has depth %u, but the input image "
                 "has depth %u.  They must be the same",
                 lookuppam.depth, inpam.depth);
    if (!streq(inpam.tuple_type, lookuppam.tuple_type))
        pm_error("The lookup image has tupel type '%s', "
                 "but the input image "
                 "has tuple type '%s'.  They must be the same",
                 lookuppam.tuple_type, inpam.tuple_type);

    makeReverseLookupHash(&lookuppam, lookup, &lookupHash);

    doUnlookup(&inpam, lookupHash, lookuppam.width-1, stdout);

    pm_close(ifP);

    pnm_destroytuplehash(lookupHash);
    pnm_freepamarray(lookup, &lookuppam);
    
    return 0;
}
Exemplo n.º 23
0
	int LibConfigProgram::execute(int argc, char** argv)
	{
		// Parse the command line
		if (not parseCommandLine(argc, argv))
			return pExitStatus;

		// Find the root path
		findRootPath(argv[0]);

		// Display information if asked
		if (not displayInformations())
			return pExitStatus;

		// Expand name for each modules
		expandModuleNames();

		// Display information
		displayInformationAboutYuniVersion();
		return pExitStatus;
	}
Exemplo n.º 24
0
int main(int argc, char **argv) {
	try {
		std::vector<Common::UString> args;
		Common::Platform::getParameters(argc, argv, args);

		int returnValue = 1;
		uint32 width, height;
		std::vector<Common::UString> ncgrFiles;
		Common::UString nclrFile, outFile;

		if (!parseCommandLine(args, returnValue, width, height, ncgrFiles, nclrFile, outFile))
			return returnValue;

		convert(ncgrFiles, nclrFile, outFile, width, height);
	} catch (...) {
		Common::exceptionDispatcherError();
	}

	return 0;
}
Exemplo n.º 25
0
int main(int argc, char* argv[])
{
#ifdef _DEBUG
    //initLeakCheck(false);
#endif

    parseCommandLine(argc, argv);
    
    char* sourcefile = gArgv[1];
    char* outdir = (gArgc>=3)?(char*)gArgv[2]:(char*)"";
    
    HIDLcompiler hc(sourcefile, outdir);
    hc.Process();

    delete[] gArgv;
    if (esp_def_export_tag)
        free(esp_def_export_tag);

    return 0;
}
Exemplo n.º 26
0
int main(int argc, char **argv) {
	std::vector<Common::UString> args;
	Common::Platform::getParameters(argc, argv, args);

	int returnValue = 1;
	Common::UString inFile, outFile;
	Aurora::FileType type = Aurora::kFileTypeNone;
	bool flip = false;

	try {
		if (!parseCommandLine(args, returnValue, inFile, outFile, type, flip))
			return returnValue;

		convert(inFile, outFile, type, flip);
	} catch (...) {
		Common::exceptionDispatcherError();
	}

	return 0;
}
Exemplo n.º 27
0
int main(int argc, char **argv) {
	std::vector<Common::UString> args;
	Common::Platform::getParameters(argc, argv, args);

	int returnValue = 1;
	Common::UString cdpthFile, twoDAFile, outFile;

	try {
		if (!parseCommandLine(args, returnValue, cdpthFile, twoDAFile, outFile))
			return returnValue;

		convert(cdpthFile, twoDAFile, outFile);
	} catch (Common::Exception &e) {
		Common::printException(e);
		return -1;
	} catch (std::exception &e) {
		error("%s", e.what());
	}

	return 0;
}
Exemplo n.º 28
0
int main(int argc, char **argv) {
	try {
		std::vector<Common::UString> args;
		Common::Platform::getParameters(argc, argv, args);

		Common::Encoding encoding = Common::kEncodingUTF16LE;
		bool nwnPremium = false;

		int returnValue = 1;
		Common::UString inFile, outFile;

		if (!parseCommandLine(args, returnValue, inFile, outFile, encoding, nwnPremium))
			return returnValue;

		dumpGFF(inFile, outFile, encoding, nwnPremium);
	} catch (...) {
		Common::exceptionDispatcherError();
	}

	return 0;
}
Exemplo n.º 29
0
void LibSVMRunner::processRequest(SVMConfiguration& config) {

//	Training
	if (!config.isPrediction()) {
		svm_node** node = 0;
		if(config.isSparse()) {
            node = ArmaSpMatToSvmNode(config.sparse_data);
		} else {
			node = armatlib(config.data);
		}
		svm_parameter* param = configuration_to_problem(config);
        parseCommandLine(config, *param);
		prob.l = config.target.n_rows;
		prob.y = vectlib(config.target);
		prob.x = node;
		save_model_to_config(config, param, prob);
		config.w = (config.support_vectors * config.alpha_y);

	} else {
		arma_prediction(config);
	}
}
Exemplo n.º 30
0
int main(int argc, char *argv[])
{
    parseCommandLine(argc, argv);
    logInit("certserv", arg.useSyslog, arg.verbose, arg.logMask);
    //logNorm("arg.verbose = %d, arg.log_mask = %d\n", arg.verbose, arg.logMask);
    //logNorm("arg.chunks = %s\n", arg.chunks);

    if (init() < 0)
        dieError("init()\n");

	// Skip the slash
	if (arg.url[0] == '/')
		arg.url++;
    logVerb("host = '%s', url = '%s', port = %d\n", arg.host, arg.url, arg.port);

    if (arg.isServer)
        serverLoop();
    else
        client();

    return 0;
}