/** called when replicated from NSBaseView::Instantiate() */ int gui_init_replicant(int argc, char** argv) { nserror ret; BPath options; struct netsurf_table beos_table = { &beos_misc_table, beos_window_table, beos_download_table, beos_clipboard_table, &beos_fetch_table, NULL, /* use POSIX file */ NULL, /* default utf8 */ NULL, /* default search */ NULL, /* default web search */ NULL, /* default low level cache persistant storage */ beos_bitmap_table, beos_layout_table }; ret = netsurf_register(&beos_table); if (ret != NSERROR_OK) { die("NetSurf operation table failed registration"); } if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); } /* initialise logging. Not fatal if it fails but not much we * can do about it either. */ nslog_init(nslog_stream_configure, &argc, argv); // FIXME: use options as readonly for replicants /* user options setup */ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); if (ret != NSERROR_OK) { // FIXME: must not die when in replicant! die("Options failed to initialise"); } nsoption_read(options.Path(), NULL); nsoption_commandline(&argc, argv, NULL); /* common initialisation */ BPath messages = get_messages_path(); ret = messages_add_from_file(messages.Path()); ret = netsurf_init(NULL); if (ret != NSERROR_OK) { // FIXME: must not die when in replicant! die("NetSurf failed to initialise"); } gui_init(argc, argv); return 0; }
/** Normal entry point from OS */ int main(int argc, char** argv) { nserror ret; BPath options; struct gui_table beos_gui_table = { &beos_browser_table, beos_window_table, beos_download_table, &beos_clipboard_table, &beos_fetch_table }; if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); } if (!replicated) { // create the Application object before trying to use messages // so we can open an alert in case of error. new NSBrowserApplication; } /* initialise logging. Not fatal if it fails but not much we * can do about it either. */ nslog_init(nslog_stream_configure, &argc, argv); /* user options setup */ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); if (ret != NSERROR_OK) { die("Options failed to initialise"); } nsoption_read(options.Path(), NULL); nsoption_commandline(&argc, argv, NULL); /* common initialisation */ BPath messages = get_messages_path(); ret = netsurf_init(messages.Path(), &beos_gui_table); if (ret != NSERROR_OK) { die("NetSurf failed to initialise"); } gui_init(argc, argv); netsurf_main_loop(); netsurf_exit(); return 0; }
/** called when replicated from NSBaseView::Instantiate() */ int gui_init_replicant(int argc, char** argv) { nserror ret; BPath options; struct gui_table beos_gui_table = { &beos_browser_table, beos_window_table, beos_download_table, &beos_clipboard_table, &beos_fetch_table }; if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); } /* initialise logging. Not fatal if it fails but not much we * can do about it either. */ nslog_init(nslog_stream_configure, &argc, argv); // FIXME: use options as readonly for replicants /* user options setup */ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); if (ret != NSERROR_OK) { // FIXME: must not die when in replicant! die("Options failed to initialise"); } nsoption_read(options.Path(), NULL); nsoption_commandline(&argc, argv, NULL); /* common initialisation */ BPath messages = get_messages_path(); ret = netsurf_init(messages.Path(), &beos_gui_table); if (ret != NSERROR_OK) { // FIXME: must not die when in replicant! die("NetSurf failed to initialise"); } gui_init(argc, argv); return 0; }
/** Normal entry point from OS */ int main(int argc, char** argv) { nserror ret; BPath options; struct netsurf_table beos_table = { &beos_misc_table, beos_window_table, beos_download_table, beos_clipboard_table, &beos_fetch_table, NULL, /* use POSIX file */ NULL, /* default utf8 */ NULL, /* default search */ NULL, /* default web search */ NULL, /* default low level cache persistant storage */ beos_bitmap_table, beos_layout_table }; ret = netsurf_register(&beos_table); if (ret != NSERROR_OK) { die("NetSurf operation table failed registration"); } if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) { options.Append("x-vnd.NetSurf"); } if (!replicated) { // create the Application object before trying to use messages // so we can open an alert in case of error. new NSBrowserApplication; } /* initialise logging. Not fatal if it fails but not much we * can do about it either. */ nslog_init(nslog_stream_configure, &argc, argv); /* user options setup */ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); if (ret != NSERROR_OK) { die("Options failed to initialise"); } nsoption_read(options.Path(), NULL); nsoption_commandline(&argc, argv, NULL); /* common initialisation */ BResources resources; resources.SetToImage((const void*)main); size_t size = 0; char path[12]; sprintf(path,"%.2s/Messages", getenv("LC_MESSAGES")); fprintf(stderr, "Loading messages from resource %s\n", path); const uint8_t* res = (const uint8_t*)resources.LoadResource('data', path, &size); if (size > 0 && res != NULL) { ret = messages_add_from_inline(res, size); } else { BPath messages = get_messages_path(); ret = messages_add_from_file(messages.Path()); } ret = netsurf_init(NULL); if (ret != NSERROR_OK) { die("NetSurf failed to initialise"); } gui_init(argc, argv); while (!nsbeos_done) { nsbeos_gui_poll(); } netsurf_exit(); return 0; }