void compile(void) { LEXEME *lex = NULL ; SetGlobalFlag(TRUE); helpinit(); errorinit(); constoptinit(); declare_init(); init_init(); inlineinit(); lambda_init(); rtti_init(); expr_init(); libcxx_init(); statement_ini(); syminit(); preprocini(infile, inputFile); lexini(); setglbdefs(); templateInit(); #ifndef PARSER_ONLY SSAInit(); outcodeini(); conflictini(); iexpr_init(); iinlineInit(); flow_init(); genstmtini(); #endif ParseBuiltins(); if (chosenAssembler->intrinsicInit) chosenAssembler->intrinsicInit(); if (chosenAssembler->inlineAsmInit) chosenAssembler->inlineAsmInit(); if (chosenAssembler->outcode_init) chosenAssembler->outcode_init(); if (chosenAssembler->enter_filename) chosenAssembler->enter_filename(clist->data); if (cparams.prm_debug && chosenDebugger && chosenDebugger->init) chosenDebugger->init(); if (cparams.prm_browse && chosenDebugger && chosenDebugger->init_browsedata) chosenDebugger->init_browsedata(clist->data); browse_init(); browse_startfile(infile, 0); if (cparams.prm_assemble) { lex = getsym(); if (lex) { BLOCKDATA block; memset(&block, 0, sizeof(block)); block.type = begin; while ((lex = statement_asm(lex, NULL, &block)) != NULL) ; #ifndef PARSER_ONLY genASM(block.head); #endif } } else { #ifndef PARSER_ONLY asm_header(clist->data, version); #endif lex = getsym(); if (lex) { while ((lex = declare(lex, NULL, NULL, sc_global, lk_none, NULL, TRUE, FALSE, FALSE, FALSE, ac_public)) != NULL) ; } } #ifdef PARSER_ONLY ccDumpSymbols(); #endif if (!total_errors) { dumpInlines(); dumpInitializers(); dumpInlines(); dumpStartups(); #ifndef PARSER_ONLY dumpLits(); #endif /* rewrite_icode(); */ if (chosenAssembler->gen->finalGen) chosenAssembler->gen->finalGen(); if (!cparams.prm_assemble && cparams.prm_debug) if (chosenDebugger && chosenDebugger->outputtypedef) debug_dumptypedefs(globalNameSpace); #ifndef PARSER_ONLY putexterns(); #endif if (!cparams.prm_asmfile) if (chosenAssembler->output_obj_file) chosenAssembler->output_obj_file(); } findUnusedStatics(globalNameSpace); dumperrs(stdout); if (cparams.prm_debug && chosenDebugger && chosenDebugger->rundown) chosenDebugger->rundown(); if (cparams.prm_browse && chosenDebugger && chosenDebugger->rundown_browsedata) chosenDebugger->rundown_browsedata(); #ifndef PARSER_ONLY if (!cparams.prm_assemble) asm_trailer(); #endif }
/* Method to initialize all global classes and use the objects that we need. * rgerhards, 2008-01-04 * rgerhards, 2008-04-16: the actual initialization is now carried out by the runtime */ rsRetVal rsyslogd_InitGlobalClasses(void) { DEFiRet; char *pErrObj; /* tells us which object failed if that happens (useful for troubleshooting!) */ /* Intialize the runtime system */ pErrObj = "rsyslog runtime"; /* set in case the runtime errors before setting an object */ CHKiRet(rsrtInit(&pErrObj, &obj)); rsrtSetErrLogger(rsyslogd_submitErrMsg); /* Now tell the system which classes we need ourselfs */ pErrObj = "glbl"; CHKiRet(objUse(glbl, CORE_COMPONENT)); pErrObj = "errmsg"; CHKiRet(objUse(errmsg, CORE_COMPONENT)); pErrObj = "module"; CHKiRet(objUse(module, CORE_COMPONENT)); pErrObj = "datetime"; CHKiRet(objUse(datetime, CORE_COMPONENT)); pErrObj = "ruleset"; CHKiRet(objUse(ruleset, CORE_COMPONENT)); /*pErrObj = "conf"; CHKiRet(objUse(conf, CORE_COMPONENT));*/ pErrObj = "prop"; CHKiRet(objUse(prop, CORE_COMPONENT)); pErrObj = "parser"; CHKiRet(objUse(parser, CORE_COMPONENT)); pErrObj = "rsconf"; CHKiRet(objUse(rsconf, CORE_COMPONENT)); /* intialize some dummy classes that are not part of the runtime */ pErrObj = "action"; CHKiRet(actionClassInit()); pErrObj = "template"; CHKiRet(templateInit()); /* TODO: the dependency on net shall go away! -- rgerhards, 2008-03-07 */ pErrObj = "net"; CHKiRet(objUse(net, LM_NET_FILENAME)); dnscacheInit(); initRainerscript(); ratelimitModInit(); /* we need to create the inputName property (only once during our lifetime) */ CHKiRet(prop.Construct(&pInternalInputName)); CHKiRet(prop.SetString(pInternalInputName, UCHAR_CONSTANT("rsyslogd"), sizeof("rsyslogd") - 1)); CHKiRet(prop.ConstructFinalize(pInternalInputName)); finalize_it: if(iRet != RS_RET_OK) { /* we know we are inside the init sequence, so we can safely emit * messages to stderr. -- rgerhards, 2008-04-02 */ fprintf(stderr, "Error during class init for object '%s' - failing...\n", pErrObj); fprintf(stderr, "rsyslogd initializiation failed - global classes could not be initialized.\n" "Did you do a \"make install\"?\n" "Suggested action: run rsyslogd with -d -n options to see what exactly " "fails.\n"); } RETiRet; }