本文整理汇总了C++中Shell::run方法的典型用法代码示例。如果您正苦于以下问题:C++ Shell::run方法的具体用法?C++ Shell::run怎么用?C++ Shell::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shell
的用法示例。
在下文中一共展示了Shell::run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
TEvent init;
init.what = evCommand;
init.message.command = cmAbout; // make a cmAbout command event
Shell shell;
shell.putEvent(init); // put it in the queue to pop up
shell.run(); // About box when program starts
return 0;
}
示例2: main
int main() {
Shell s;
s->run();
return 0;
}
示例3: run
int App::run()
{
// Initialize GUI interface
if (isGui()) {
PRINTF("GUI mode\n");
// Setup the GUI screen
jmouse_set_cursor(kArrowCursor);
ui::Manager::getDefault()->invalidate();
// Create the main window and show it.
m_mainWindow.reset(new MainWindow);
// Default status of the main window.
app_rebuild_documents_tabs();
app_default_statusbar_message();
m_mainWindow->openWindow();
// Redraw the whole screen.
ui::Manager::getDefault()->invalidate();
}
// Set background mode for non-GUI modes
set_display_switch_mode(SWITCH_BACKGROUND);
// Procress options
PRINTF("Processing options...\n");
{
Console console;
for (FileList::iterator
it = m_files.begin(),
end = m_files.end();
it != end; ++it) {
// Load the sprite
Document* document = load_document(it->c_str());
if (!document) {
if (!isGui())
console.printf("Error loading file \"%s\"\n", it->c_str());
}
else {
// Mount and select the sprite
UIContext* context = UIContext::instance();
context->addDocument(document);
if (isGui()) {
// Recent file
getRecentFiles()->addRecentFile(it->c_str());
}
}
}
}
// Run the GUI
if (isGui()) {
// Support to drop files from Windows explorer
install_drop_files();
#ifdef ENABLE_UPDATER
// Launch the thread to check for updates.
app::CheckUpdateThreadLauncher checkUpdate;
checkUpdate.launch();
#endif
#ifdef ENABLE_WEBSERVER
// Launch the webserver.
app::WebServer webServer;
webServer.start();
#endif
// Run the GUI main message loop
gui_run();
// Uninstall support to drop files
uninstall_drop_files();
// Destroy all documents in the UIContext.
const Documents& docs = m_modules->m_ui_context.getDocuments();
while (!docs.empty())
m_modules->m_ui_context.removeDocument(docs.back());
// Destroy the window.
m_mainWindow.reset(NULL);
}
// Start shell to execute scripts.
else if (m_isShell) {
m_systemConsole.prepareShell();
if (m_modules->m_scriptingEngine.supportEval()) {
Shell shell;
shell.run(m_modules->m_scriptingEngine);
}
else {
std::cerr << "Your version of " PACKAGE " wasn't compiled with shell support.\n";
}
}
return 0;
}
示例4: run
int App::run()
{
UIContext* context = UIContext::instance();
// Initialize GUI interface
if (isGui()) {
PRINTF("GUI mode\n");
// Setup the GUI cursor and redraw screen
ui::set_use_native_cursors(
context->settings()->experimental()->useNativeCursor());
jmouse_set_cursor(kArrowCursor);
ui::Manager::getDefault()->invalidate();
// Create the main window and show it.
m_mainWindow.reset(new MainWindow);
// Default status of the main window.
app_rebuild_documents_tabs();
app_default_statusbar_message();
// Default window title bar.
updateDisplayTitleBar();
m_mainWindow->openWindow();
// Redraw the whole screen.
ui::Manager::getDefault()->invalidate();
}
// Procress options
PRINTF("Processing options...\n");
{
Console console;
for (const std::string& filename : m_files) {
// Load the sprite
Document* document = load_document(context, filename.c_str());
if (!document) {
if (!isGui())
console.printf("Error loading file \"%s\"\n", filename.c_str());
}
else {
// Add the given file in the argument as a "recent file" only
// if we are running in GUI mode. If the program is executed
// in batch mode this is not desirable.
if (isGui())
getRecentFiles()->addRecentFile(filename.c_str());
// Add the document to the exporter.
if (m_exporter != NULL)
m_exporter->addDocument(document);
}
}
}
// Export
if (m_exporter != NULL) {
PRINTF("Exporting sheet...\n");
m_exporter->exportSheet();
m_exporter.reset(NULL);
}
// Run the GUI
if (isGui()) {
#ifdef ENABLE_UPDATER
// Launch the thread to check for updates.
app::CheckUpdateThreadLauncher checkUpdate;
checkUpdate.launch();
#endif
#ifdef ENABLE_WEBSERVER
// Launch the webserver.
app::WebServer webServer;
webServer.start();
#endif
app::SendCrash sendCrash;
sendCrash.search();
// Run the GUI main message loop
gui_run();
// Destroy all documents in the UIContext.
const doc::Documents& docs = m_modules->m_ui_context.documents();
while (!docs.empty()) {
doc::Document* doc = docs.back();
// First we close the document. In this way we receive recent
// notifications related to the document as an app::Document. If
// we delete the document directly, we destroy the app::Document
// too early, and then doc::~Document() call
// DocumentsObserver::onRemoveDocument(). In this way, observers
// could think that they have a fully created app::Document when
// in reality it's a doc::Document (in the middle of a
// destruction process).
//.........这里部分代码省略.........
示例5: main
int main(int argc, char **argv)
{
Shell sh;
FILE *fp;
struct stat st;
char *contents;
/* Verify command-line arguments. */
if (argc >= 2)
{
/* Execute commands in each file. */
for (int i = 0; i < argc - 1; i++)
{
/* Query the file size. */
if (stat(argv[i + 1], &st) != 0)
{
printf("%s: failed to stat() `%s': %s\r\n",
argv[0], argv[i + 1], strerror(errno));
continue;
}
/* Open file. */
if ((fp = fopen(argv[i + 1], "r")) == NULL)
{
printf("%s: failed to fopen() `%s': %s\r\n",
argv[0], argv[i + 1], strerror(errno));
continue;
}
/* Allocate buffer storage. */
contents = new char[st.st_size];
/* Read the entire file into memory. */
if (fread(contents, st.st_size, 1, fp) != (size_t) st.st_size)
{
printf("%s: failed to fread() `%s': %s\r\n",
argv[0], argv[i + 1], strerror(errno));
fclose(fp);
continue;
}
/* Parse it into lines. */
List<String> lines = String(contents).split('\n');
/* Execute each command. */
for (ListIterator<String> i(lines); i.hasCurrent(); i++)
{
sh.executeInput((char *) *i.current());
}
/* Cleanup. */
delete contents;
fclose(fp);
}
}
/* Run an interactive Shell. */
else
{
/* Show the user where to get help. */
printf( "\r\n"
"Entering interactive Shell. Type 'help' for the command list.\r\n"
"\r\n");
/* Begin loop. */
return sh.run();
}
/* Success. */
return EXIT_SUCCESS;
}
示例6: run
int App::run()
{
// Initialize GUI interface
if (isGui()) {
PRINTF("GUI mode\n");
// Setup the GUI screen
jmouse_set_cursor(kArrowCursor);
ui::Manager::getDefault()->invalidate();
// Create the main window and show it.
m_mainWindow.reset(new MainWindow);
// Default status of the main window.
app_rebuild_documents_tabs();
app_default_statusbar_message();
m_mainWindow->openWindow();
// Redraw the whole screen.
ui::Manager::getDefault()->invalidate();
// 2013-11-19 - JRM - Force setting active view to NULL, workaround for setting
// window title to proper devault value. (Issue #285)
UIContext::instance()->setActiveView(NULL);
}
// Set background mode for non-GUI modes
set_display_switch_mode(SWITCH_BACKGROUND);
// Procress options
PRINTF("Processing options...\n");
{
UIContext* context = UIContext::instance();
Console console;
for (FileList::iterator
it = m_files.begin(),
end = m_files.end();
it != end; ++it) {
// Load the sprite
Document* document = load_document(it->c_str());
if (!document) {
if (!isGui())
console.printf("Error loading file \"%s\"\n", it->c_str());
}
else {
// Mount and select the sprite
context->addDocument(document);
// Add the given file in the argument as a "recent file" only
// if we are running in GUI mode. If the program is executed
// in batch mode this is not desirable.
if (isGui())
getRecentFiles()->addRecentFile(it->c_str());
// Add the document to the exporter.
if (m_exporter != NULL)
m_exporter->addDocument(document);
}
}
}
// Export
if (m_exporter != NULL) {
PRINTF("Exporting sheet...\n");
m_exporter->exportSheet();
m_exporter.reset(NULL);
}
// Run the GUI
if (isGui()) {
#ifdef ENABLE_UPDATER
// Launch the thread to check for updates.
app::CheckUpdateThreadLauncher checkUpdate;
checkUpdate.launch();
#endif
#ifdef ENABLE_WEBSERVER
// Launch the webserver.
app::WebServer webServer;
webServer.start();
#endif
// Run the GUI main message loop
gui_run();
// Destroy all documents in the UIContext.
const Documents& docs = m_modules->m_ui_context.getDocuments();
while (!docs.empty())
m_modules->m_ui_context.removeDocument(docs.back());
// Destroy the window.
m_mainWindow.reset(NULL);
}
// Start shell to execute scripts.
else if (m_isShell) {
m_systemConsole.prepareShell();
//.........这里部分代码省略.........