/*--------------------------------------------------------------------------*/ void C2F(texmacsin)(char buffer[], int *buf_size, int *len_line, int *eof, long int dummy1) { #define STDIN_ID 5 #define TEXMACSLIB "texmacslib" int nr = 0, info = 0; if (first == 1) { if (isNamedVarExist(pvApiCtx, TEXMACSLIB) == 0) { if (getWarningMode()) { fprintf(stdout, _("Please install texmacs ATOMS module: atomsInstall('texmacs')\n\n"), _("Warning")); } } fprintf(stdout, "%cverbatim:", DATA_BEGIN); } next_input (); first = 0; *eof = 0; info = LineRead(STDIN_ID, buffer, *buf_size, len_line, &nr); fprintf(stdout, "%cverbatim:", DATA_BEGIN); *len_line = *len_line - 1; }
/*--------------------------------------------------------------------------*/ void C2F(readnextline)(int *fd, char buf[], int *n, int *count, int *nr, int *ierr) { *ierr = LineRead(*fd, buf, *n, count, nr); }
int Application::run() { std::cout << "***********************************************************" << std::endl << "* ON Server v" << MACRO_STR(DETECTED_ON_VERSION) << " (built on " << MACRO_STR(BUILD_DATE) << ")" << std::endl << "* (c) Copyright 2009 - " << MACRO_STR(BUILD_YEAR) << " IWStudio" << std::endl << "* Released under GNU General Public License, vesion 2" << std::endl << "*" << std::endl << std::endl; _INFO(_logModule, "ON Server Starting Up..."); setApplicationName("ONCoreServer"); setApplicationVersion(MACRO_STR(DETECTED_ON_VERSION)); setOrganizationName("IWStudio"); setOrganizationDomain("iwstudio.hu"); _INFO(_logModule, "Installing signal handlers"); connect(new Common::UnixSignalHandler(SIGHUP, this), SIGNAL(CoughtSignal()), SLOT(quit())); connect(new Common::UnixSignalHandler(SIGINT, this), SIGNAL(CoughtSignal()), SLOT(quit())); connect(new Common::UnixSignalHandler(SIGQUIT, this), SIGNAL(CoughtSignal()), SLOT(quit())); connect(new Common::UnixSignalHandler(SIGTERM, this), SIGNAL(CoughtSignal()), SLOT(quit())); _INFO(_logModule, "Parsing commandline arguments"); _INFO(_logModule, "Loading config file"); _INFO(_logModule, "Setting up logger"); Common::Logger::Instance()->SetLogToStdout(true); Common::Logger::Instance()->SetStdoutLogLevel(Common::Logger::Level::Trace); Common::Logger::Instance()->SetFileLogLevel(Common::Logger::Level::Trace); Common::Logger::Instance()->SetLogFormat(Common::Logger::Format::Csv); Common::Logger::Instance()->SetLogFile(QString(getenv("HOME")).append("/ONServerCore.log")); Common::Logger::Instance()->FlushStartupBuffer(); _INFO(_logModule, "Setting up command interface"); ServerCore::CommandInterface commander; connect(&commander, SIGNAL(Quit()), SLOT(quit())); _INFO(_logModule, "Starting Readline"); ServerCore::Readline readline("on> "); readline.connect(Common::Logger::Instance().data(), SIGNAL(BeforeLogLine()), SLOT(Disable()), Qt::DirectConnection); readline.connect(Common::Logger::Instance().data(), SIGNAL(AfterLogLine()), SLOT(Enable()), Qt::DirectConnection); connect(&readline, SIGNAL(EndSignal()), SLOT(quit())); commander.connect(&readline, SIGNAL(LineRead(QString)), SLOT(ProcessCommand(QString))); _INFO(_logModule, "Start listening"); ServerCore::Listener listener; listener.listen(3214); _INFO(_logModule, "ON Server Startup Complete"); int exitCode = QCoreApplication::exec(); _INFO(_logModule, "ON Server Shutting Down..."); Common::Logger::Instance()->disconnect(&readline); readline.Disable(); return exitCode; }