示例#1
0
int main(int argc, char* argv[])
{
    // get and set locale language
	string systemLang = "C";
	systemLang = funcexp::utf8::idb_setlocale();

    setupCwd();

    WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC );
#ifdef _MSC_VER
    // In windows, initializing the wrapper (A dll) does not set the static variables
    // in the main program
    idbdatafile::IDBPolicy::configIDBPolicy();
#endif

	ResourceManager rm;
	Dec = DistributedEngineComm::instance(rm);
#ifndef _MSC_VER
	/* set up some signal handlers */
    struct sigaction ign;
    memset(&ign, 0, sizeof(ign));
    ign.sa_handler = added_a_pm;
	sigaction(SIGHUP, &ign, 0);
	ign.sa_handler = SIG_IGN;
	sigaction(SIGPIPE, &ign, 0);
#endif

    ddlprocessor::DDLProcessor ddlprocessor(5, 10);

    {
        Oam oam;
        try
        {
            oam.processInitComplete("DDLProc", ACTIVE);
        }
        catch (...)
        {
        }
    }

    try
    {
        ddlprocessor.process();
    }
    catch (std::exception& ex)
    {
        cerr << ex.what() << endl;
        Message::Args args;
        Message message(8);
        args.add("DDLProc failed on: ");
        args.add(ex.what());
        message.format( args );

    }
    catch (...)
    {
        cerr << "Caught unknown exception!" << endl;
        Message::Args args;
        Message message(8);
        args.add("DDLProc failed on: ");
        args.add("receiving DDLPackage");
        message.format( args );
    }
    return 0;
}